BdsApi  2.2.6
This is the Blacknest BDS API.
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros
BdsDataFileSeed.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * BdsDataFileSeed.h BDRS 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);
37  BError writeData(const DataBlock& data);
38  BError end();
39 
40  void msrFileWrite(void* data, int len);
41 
42  static DataFormat 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(BUInt blockNumber, 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 
61  int addCode(BString str);
62  int addUnitCode(BString str);
63  Response* getResponse(BUInt stage);
64 
65  DataFileOptions oreadOptions;
66  DataInfo odataInfo;
67  BString onetwork;
68  ChannelInfos ochannelInfos;
69  BArray<ChannelInfo> ochannelInfoSegments;
70  ChannelInfo ochannelInfo;
71  double osampleRate;
72  BArray<BArray<DataBlockPos> > oblockPositions;
73 
74  BUInt32 oblockSize;
75  char* oblock;
76  BUInt oblockNumber;
77  BUInt opos;
78  BUInt oblocketteNumber;
79  BUInt ologNumber;
80 
81  // SEED information
82  BDictString ocodes;
83  BDictString ounitCodes;
84 
85  // SEED import information
86  BdsSeedType10 otype10;
87  BdsSeedType11 otype11;
88  BdsSeedType30 otype30;
89  BdsSeedType52 otype52;
90  BArray<BdsSeedType30> oseedDataFormats;
91  BArray<BdsSeedStation> oseedStations;
92  BArray<BdsSeedType52> oseedChannels;
93 
94  BArray<BString> odataChannels;
95  BArray<int> odataChannelFormats;
96 
97  // SEED export information
98  BArray<BInt32> odataInt32;
99  BArray<BFloat32> odataFloat32;
100 
101  BUInt odataChannel;
102  BUInt odataSegment;
103  BUInt odataTimeSpanBlock;
104  BDict<int> ostationBlockNumbers;
105  BArray<BArray<BUInt32> > odataStartBlocks;
106  BArray<BArray<BUInt32> > odataEndBlocks;
107 
108  static BMutex olock;
109  MSRecord* omsr;
110 };
111 
112 }
113 #endif
WriteOptionsList
Definition: BdsDataFile.h:45
static DataFormat getFormats()
Definition: BdsDataFileSeed.cpp:29
static BError omsrErr
MSR processing error.
Definition: BdsDataFileSeed.h:43
DataOrder
Definition: BdsDataFile.h:43
int getFeatures()
Get bitmask of supported features.
Definition: BdsDataFileSeed.cpp:178
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1001
~DataFileSeed()
Definition: BdsDataFileSeed.cpp:147
BError setFormat(BString format)
Set the sub-format.
Definition: BdsDataFileSeed.cpp:186
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1060
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:419
This class defines a seismic Response characteristic.
Definition: BdsD.h:269
This class defines information on a set of data.
Definition: BdsD.h:573
This holds information on a seismic data format.
Definition: BdsD.h:829
This class provides the acual seismic data values contained within a single data block.
Definition: BdsD.h:640
BUInt32 format
Data file convertor for SEED file formats.
Definition: BdsDataFileSeed.h:18
BError close()
Close the file.
Definition: BdsDataFileSeed.cpp:159
This class provides metadata information on a set of channels.
Definition: BdsD.h:499
This class defines the interface for generic data file access that all of the BDS data conterors shar...
Definition: BdsDataFile.h:41
DataFileSeed()
Definition: BdsDataFileSeed.cpp:127
Definition: BdsDataFile.h:45
BUInt32 BUInt
uint32_t BUInt32
DataOrder getDataOrder()
Get the expected order of writing data, by sample or by channel.
Definition: BdsDataFileSeed.cpp:182
char data[8]
This class provides information on a channel.
Definition: BdsD.h:477
BError setInfo(const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
Set information on data for write.
Definition: BdsDataFileSeed.cpp:443
BError getInfo(DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
Get info on data.
Definition: BdsDataFileSeed.cpp:194
BError writeData(const DataBlock &data)
Write a block of data.
Definition: BdsDataFileSeed.cpp:1087
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:985
This defines a list of BDS data convtor options.
Definition: BdsDataFile.h:30
static int onoLock
Disable libmseed locking.
Definition: BdsDataFileSeed.h:44
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:332