BdsApi  3.0.6
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  int addCode(BString str);
71  int 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 
123 }
124 #endif
BError
Bds::DataFileSeed::writeData
BError writeData(const DataBlock &data)
Write a block of data.
Definition: BdsDataFileSeed.cpp:1258
Bds::DataFileOptions
This defines a list of BDS data converter options.
Definition: BdsDataFile.h:30
Bds::DataFileSeed::omsrErr
static BError omsrErr
MSR processing error.
Definition: BdsDataFileSeed.h:44
Bds::DataFileSeed::close
BError close()
Close the file.
Definition: BdsDataFileSeed.cpp:168
Bds::DataFile::WriteOptionsList
WriteOptionsList
Definition: BdsDataFile.h:45
Bds::DataFileSeed::start
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1172
BdsDataFile.h
Bds::DataFileSeed::onoLock
static int onoLock
Disable libmseed locking.
Definition: BdsDataFileSeed.h:45
BUInt
BUInt32 BUInt
Bds::DataFileSeed::setFormat
BError setFormat(BString format)
Set the sub-format.
Definition: BdsDataFileSeed.cpp:207
Bds::DataFileSeed::readData
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:441
BArray
BUInt64
uint64_t BUInt64
Bds::DataFileSeed::getDataOrder
DataOrder getDataOrder()
Get the expected order of writing data, by sample or by channel.
Definition: BdsDataFileSeed.cpp:191
Bds::DataBlock
This class provides the actual seismic data values contained within a single data block.
Definition: BdsD.h:697
Bds::DataFileSeed::end
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1231
BUInt32
uint32_t BUInt32
Bds::DataFile::WriteOptionSensorData
@ WriteOptionSensorData
Definition: BdsDataFile.h:45
Bds::DataFileSeed::~DataFileSeed
~DataFileSeed()
Definition: BdsDataFileSeed.cpp:156
Bds::Response
This class defines a seismic Response characteristic.
Definition: BdsD.h:307
Bds::DataFile::DataOrder
DataOrder
Definition: BdsDataFile.h:43
Bds
Definition: BdsC.cc:8
Bds::DataError
This stores a data error. It includes and error number and a string as well as information on what se...
Definition: BdsLib.h:35
BString
BMutex.h
Bds::DataFileSeed::DataFileSeed
DataFileSeed()
Definition: BdsDataFileSeed.cpp:134
BDict
Bds::DataFileSeed::setInfo
BError setInfo(const DataInfo &dataInfo, const ChannelInfos &channelInfos, WriteOptionsList options=WriteOptionSensorData)
Set information on data for write.
Definition: BdsDataFileSeed.cpp:550
Bds::DataInfo
This class defines information on a set of data.
Definition: BdsD.h:630
MSRecord
struct MSRecord_s MSRecord
Definition: BdsDataFileSeed.h:13
Bds::DataFile
This class defines the interface for generic data file access that all of the BDS data converters sha...
Definition: BdsDataFile.h:41
format
BUInt32 format
Bds::DataFileSeed::getMetaData
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:528
data
char data[8]
Bds::ChannelInfo
This class provides information on a channel.
Definition: BdsD.h:532
Bds::DataFileSeed::msrFileWrite
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:1156
Bds::DataFileSeed::getFormats
static DataFormats getFormats()
Definition: BdsDataFileSeed.cpp:43
BList
BMutex
Bds::DataFileSeed
Data file convertor for SEED file formats.
Definition: BdsDataFileSeed.h:18
Bds::DataFileSeed::getFeatures
int getFeatures()
Get bitmask of supported features.
Definition: BdsDataFileSeed.cpp:187
Bds::DataFileSeed::getInfo
BError getInfo(DataInfo &dataInfo, DataFileOptions options, BList< DataError > &errors)
Get info on data.
Definition: BdsDataFileSeed.cpp:279
Bds::DataFileSeed::getFixesInfo
BString getFixesInfo()
Get readable list of fixes that can be applied to faulty data files.
Definition: BdsDataFileSeed.cpp:195
Bds::ChannelInfos
This class provides metadata information on a set of channels.
Definition: BdsD.h:554