BdsApi 3.1.4
This is the Blacknest BDS API.
Loading...
Searching...
No Matches
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
13typedef struct MSRecord_s MSRecord; // Forward-declaration for libmseed type.
14
15namespace Bds {
16
18class DataFileSeed : public DataFile{
19public:
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
47private:
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 int getChannel(BString name);
66 void sortChannels();
67 DataError getBlockReorderInfo();
68
69 BUInt addCode(BString str);
70 BUInt addUnitCode(BString name, BString desc);
71 Response* getResponse(BUInt stage);
72
73 DataFileOptions oreadOptions;
74 DataInfo odataInfo;
75 BString onetwork;
76 ChannelInfos ochannelInfos;
77 BArray<ChannelInfo> ochannelInfoSegments;
78 ChannelInfo ochannelInfo;
79 double osampleRate;
80 BArray<BArray<DataBlockPos> > oblockPositions;
81
82 BUInt32 oblockSize;
83 char* oblock;
84 BUInt64 oblockPosition;
85 BUInt opos;
86 BUInt oblockNumberRead;
87 BUInt oblockNumberWrite;
88 BUInt oblocketteNumber;
89 BUInt ologNumber;
90
91 // SEED information
92 BDictString ocodes;
93 BDict<NameDesc> ounitCodes;
94
95 // SEED import information
96 BdsSeedType10 otype10;
97 BdsSeedType11 otype11;
98 BdsSeedType30 otype30;
99 BdsSeedType52 otype52;
100 BArray<BdsSeedType30> oseedDataFormats;
101 BArray<BdsSeedStation> oseedStations;
102 BArray<BdsSeedType52> oseedChannels;
103
104 BArray<BString> odataChannels;
105 BArray<int> odataChannelFormats;
106
107 // SEED export information
108 BArray<BInt32> odataInt32;
109 BArray<BFloat32> odataFloat32;
110
111 BUInt odataChannel;
112 BUInt odataSegment;
113 BUInt odataTimeSpanBlock;
114 BDict<int> ostationBlockNumbers;
115 BArray<BArray<BUInt32> > odataStartBlocks;
116 BArray<BArray<BUInt32> > odataEndBlocks;
117
118 static BMutex olock;
119 MSRecord* omsr;
120
121 BUInt oabbrevCode;
122 BUInt oabbrevUnitsCode;
123};
124
125}
126#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 full Metadata information on a channel.
Definition: BdsD.h:542
This class provides Metadata information on a set of channels.
Definition: BdsD.h:564
This class provides the actual Sensor data values contained within a single data block.
Definition: BdsD.h:707
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:1245
void msrFileWrite(void *data, int len)
Definition: BdsDataFileSeed.cpp:1143
BError end()
End write segment.
Definition: BdsDataFileSeed.cpp:1218
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:557
BError start(BUInt channel, BUInt segment)
Start writing next segment of data.
Definition: BdsDataFileSeed.cpp:1159
BError readData(BUInt32 channel, BUInt segment, BUInt32 blockNumber, DataBlock &data)
Read a block.
Definition: BdsDataFileSeed.cpp:445
BError getMetaData(ChannelInfos &channelInfos, BUInt32 options, BList< DataError > &errors)
Return all known MetaData in the file.
Definition: BdsDataFileSeed.cpp:532
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:640
This class defines a seismic Response characteristic.
Definition: BdsD.h:311
Definition: BdsC.cc:8