BdsApi  3.0.5
This is the Blacknest BDS API.
BdsDataFileSeed.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BdsDataFileSeed.h SEED Data File Access
3  * T.Barnaby, BEAM Ltd, 2009-12-18
4  *******************************************************************************
5  */
6 #ifndef BdsDataFileSeed_H
7 #define BdsDataFileSeed_H
8 
9 #include <BdsDataFile.h>
10 #include <BdsSeedTypes.h>
11 #include <BMutex.h>
12 #include <libmseed-beam/libmseed.h>
13 #include <libmseed-beam/unpackdata.h>
14 
15 namespace Bds {
16 
18 class DataFileSeed : public DataFile{
19 public:
20  DataFileSeed();
21  ~DataFileSeed();
22 
23  BError close();
24 
26  int getFeatures();
28 
29  // Read routines
30  BError getInfo(DataInfo& dataInfo, DataFileOptions options, BList<DataError>& errors);
31  BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock& data);
32  BError getMetaData(ChannelInfos& channelInfos, BUInt32 options, BList<DataError>& errors);
33 
34  // Write routines
35  BError setInfo(const DataInfo& dataInfo, const ChannelInfos& channelInfos, WriteOptionsList options = WriteOptionSensorData);
36  BError start(BUInt channel, BUInt segment);
38  BError end();
39 
40  void msrFileWrite(void* data, int len);
41 
42  static DataFormats getFormats();
43  static BError omsrErr;
44  static int onoLock;
45 
46 private:
47  BError processControl();
48  BError processBlockette();
49  BError processData(DataBlock& data, int addInfo);
50  BError setBlockSize(BUInt blockSize);
51  BError readBlockData(char* buf, BUInt numBytes);
52  BError readBlock(BUInt64 blockPosition, char& type, char& cont, BUInt& seq);
53  BError writeVolumeHeader(int rl);
54  BError writeTimeSpans();
55  BError writeBlockData(char type, const char* buf, BUInt numBytes);
56  BError writeFlush();
57  BString unitsConvert(BString units);
58  int getChannel(BString name);
59  void sortChannels();
60  DataError getBlockReorderInfo();
61 
62  int addCode(BString str);
63  int addUnitCode(BString str);
64  Response* getResponse(BUInt stage);
65 
66  DataFileOptions oreadOptions;
67  DataInfo odataInfo;
68  BString onetwork;
69  ChannelInfos ochannelInfos;
70  BArray<ChannelInfo> ochannelInfoSegments;
71  ChannelInfo ochannelInfo;
72  double osampleRate;
73  BArray<BArray<DataBlockPos> > oblockPositions;
74 
75  BUInt32 oblockSize;
76  char* oblock;
77  BUInt64 oblockPosition;
78  BUInt opos;
79  BUInt oblockNumberRead;
80  BUInt oblockNumberWrite;
81  BUInt oblocketteNumber;
82  BUInt ologNumber;
83 
84  // SEED information
85  BDictString ocodes;
86  BDictString ounitCodes;
87 
88  // SEED import information
89  BdsSeedType10 otype10;
90  BdsSeedType11 otype11;
91  BdsSeedType30 otype30;
92  BdsSeedType52 otype52;
93  BArray<BdsSeedType30> oseedDataFormats;
94  BArray<BdsSeedStation> oseedStations;
95  BArray<BdsSeedType52> oseedChannels;
96 
97  BArray<BString> odataChannels;
98  BArray<int> odataChannelFormats;
99 
100  // SEED export information
101  BArray<BInt32> odataInt32;
102  BArray<BFloat32> odataFloat32;
103 
104  BUInt odataChannel;
105  BUInt odataSegment;
106  BUInt odataTimeSpanBlock;
107  BDict<int> ostationBlockNumbers;
108  BArray<BArray<BUInt32> > odataStartBlocks;
109  BArray<BArray<BUInt32> > odataEndBlocks;
110 
111  static BMutex olock;
112  MSRecord* omsr;
113 };
114 
115 }
116 #endif
BUInt32 format
BUInt32 BUInt
uint32_t BUInt32
uint64_t BUInt64
char data[8]
This class provides information on a channel.
Definition: BdsD.h:494
This class provides metadata information on a set of channels.
Definition: BdsD.h:516
This class provides the actual seismic data values contained within a single data block.
Definition: BdsD.h:659
This stores a data error. It includes and error number and a string as well as information on what se...
Definition: BdsLib.h:35
This defines a list of BDS data converter options.
Definition: BdsDataFile.h:30
Data file convertor for SEED file formats.
Definition: BdsDataFileSeed.h:18
BError close()
Close the file.
Definition: BdsDataFileSeed.cpp:167
static BError omsrErr
MSR processing error.
Definition: BdsDataFileSeed.h:43
BError writeData(const DataBlock &data)
Write a block of data.
Definition: BdsDataFileSeed.cpp:1208
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:1106
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1181
BError getInfo(DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
Get info on data.
Definition: BdsDataFileSeed.cpp:266
BError setFormat(BString format)
Set the sub-format.
Definition: BdsDataFileSeed.cpp:194
BError setInfo(const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
Set information on data for write.
Definition: BdsDataFileSeed.cpp:539
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1122
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:428
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:515
DataFileSeed()
Definition: BdsDataFileSeed.cpp:133
static DataFormats getFormats()
Definition: BdsDataFileSeed.cpp:42
~DataFileSeed()
Definition: BdsDataFileSeed.cpp:155
int getFeatures()
Get bitmask of supported features.
Definition: BdsDataFileSeed.cpp:186
static int onoLock
Disable libmseed locking.
Definition: BdsDataFileSeed.h:44
DataOrder getDataOrder()
Get the expected order of writing data, by sample or by channel.
Definition: BdsDataFileSeed.cpp:190
This class defines the interface for generic data file access that all of the BDS data converters sha...
Definition: BdsDataFile.h:41
DataOrder
Definition: BdsDataFile.h:43
WriteOptionsList
Definition: BdsDataFile.h:45
@ WriteOptionSensorData
Definition: BdsDataFile.h:45
This class defines information on a set of data.
Definition: BdsD.h:592
This class defines a seismic Response characteristic.
Definition: BdsD.h:274
Definition: BdsC.cc:8