BdsApi  3.0.8
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 
13 typedef struct MSRecord_s MSRecord; // Forward-declaration for libmseed type.
14 
15 namespace Bds {
16 
18 class DataFileSeed : public DataFile{
19 public:
20  DataFileSeed();
21  ~DataFileSeed();
22 
23  BError close();
24 
26  int getFeatures();
29 
30  // Read routines
31  BError getInfo(DataInfo& dataInfo, DataFileOptions options, BList<DataError>& errors);
32  BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock& data);
33  BError getMetaData(ChannelInfos& channelInfos, BUInt32 options, BList<DataError>& errors);
34 
35  // Write routines
36  BError setInfo(const DataInfo& dataInfo, const ChannelInfos& channelInfos, WriteOptionsList options = WriteOptionSensorData);
37  BError start(BUInt channel, BUInt segment);
39  BError end();
40 
41  void msrFileWrite(void* data, int len);
42 
43  static DataFormats getFormats();
44  static BError omsrErr;
45  static int onoLock;
46 
47 private:
48  class NameDesc {
49  public:
50  NameDesc(BString name = "", BString desc = "") : name(name), desc(desc){}
51  BString name;
52  BString desc;
53  };
54 
55  BError processControl();
56  BError processBlockette();
57  BError processData(DataBlock& data, int addInfo);
58  BError setBlockSize(BUInt blockSize);
59  BError readBlockData(char* buf, BUInt numBytes);
60  BError readBlock(BUInt64 blockPosition, char& type, char& cont, BUInt& seq);
61  BError writeVolumeHeader(int rl);
62  BError writeTimeSpans();
63  BError writeBlockData(char type, const char* buf, BUInt numBytes);
64  BError writeFlush();
65  BString unitsConvert(BString units);
66  int getChannel(BString name);
67  void sortChannels();
68  DataError getBlockReorderInfo();
69 
70  BUInt addCode(BString str);
71  BUInt addUnitCode(BString name, BString desc);
72  Response* getResponse(BUInt stage);
73 
74  DataFileOptions oreadOptions;
75  DataInfo odataInfo;
76  BString onetwork;
77  ChannelInfos ochannelInfos;
78  BArray<ChannelInfo> ochannelInfoSegments;
79  ChannelInfo ochannelInfo;
80  double osampleRate;
81  BArray<BArray<DataBlockPos> > oblockPositions;
82 
83  BUInt32 oblockSize;
84  char* oblock;
85  BUInt64 oblockPosition;
86  BUInt opos;
87  BUInt oblockNumberRead;
88  BUInt oblockNumberWrite;
89  BUInt oblocketteNumber;
90  BUInt ologNumber;
91 
92  // SEED information
93  BDictString ocodes;
94  BDict<NameDesc> ounitCodes;
95 
96  // SEED import information
97  BdsSeedType10 otype10;
98  BdsSeedType11 otype11;
99  BdsSeedType30 otype30;
100  BdsSeedType52 otype52;
101  BArray<BdsSeedType30> oseedDataFormats;
102  BArray<BdsSeedStation> oseedStations;
103  BArray<BdsSeedType52> oseedChannels;
104 
105  BArray<BString> odataChannels;
106  BArray<int> odataChannelFormats;
107 
108  // SEED export information
109  BArray<BInt32> odataInt32;
110  BArray<BFloat32> odataFloat32;
111 
112  BUInt odataChannel;
113  BUInt odataSegment;
114  BUInt odataTimeSpanBlock;
115  BDict<int> ostationBlockNumbers;
116  BArray<BArray<BUInt32> > odataStartBlocks;
117  BArray<BArray<BUInt32> > odataEndBlocks;
118 
119  static BMutex olock;
120  MSRecord* omsr;
121 
122  BUInt oabbrevCode;
123  BUInt oabbrevUnitsCode;
124 };
125 
126 }
127 #endif
BUInt32 format
BUInt32 BUInt
uint32_t BUInt32
uint64_t BUInt64
struct MSRecord_s MSRecord
Definition: BdsDataFileSeed.h:13
char data[8]
This class provides information on a channel.
Definition: BdsD.h:532
This class provides metadata information on a set of channels.
Definition: BdsD.h:554
This class provides the actual seismic data values contained within a single data block.
Definition: BdsD.h:697
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:170
static BError omsrErr
MSR processing error.
Definition: BdsDataFileSeed.h:44
BError writeData(const DataBlock &data)
Write a block of data.
Definition: BdsDataFileSeed.cpp:1260
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:1158
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1233
BError getInfo(DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
Get info on data.
Definition: BdsDataFileSeed.cpp:281
BError setFormat(BString format)
Set the sub-format.
Definition: BdsDataFileSeed.cpp:209
BError setInfo(const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
Set information on data for write.
Definition: BdsDataFileSeed.cpp:552
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1174
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:443
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:530
DataFileSeed()
Definition: BdsDataFileSeed.cpp:134
static DataFormats getFormats()
Definition: BdsDataFileSeed.cpp:43
BString getFixesInfo()
Get readable list of fixes that can be applied to faulty data files.
Definition: BdsDataFileSeed.cpp:197
~DataFileSeed()
Definition: BdsDataFileSeed.cpp:158
int getFeatures()
Get bitmask of supported features.
Definition: BdsDataFileSeed.cpp:189
static int onoLock
Disable libmseed locking.
Definition: BdsDataFileSeed.h:45
DataOrder getDataOrder()
Get the expected order of writing data, by sample or by channel.
Definition: BdsDataFileSeed.cpp:193
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:630
This class defines a seismic Response characteristic.
Definition: BdsD.h:307
Definition: BdsC.cc:8