Repository navigation
Expand file tree
/
Copy pathbag_valuetable.h
More file actions
76 lines (55 loc) · 2.12 KB
/
Copy pathbag_valuetable.h
File metadata and controls
76 lines (55 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#ifndef BAG_VALUE_TABLE_H
#define BAG_VALUE_TABLE_H
#include "bag_config.h"
#include "bag_fordec.h"
#include "bag_compounddatatype.h"
#include <memory>
namespace BAG {
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable: 4251) // std classes do not have DLL-interface when exporting
#endif
//! The interface for the values of the spatial metadata in the georeferenced metadata layer.
class BAG_API ValueTable final
{
public:
ValueTable(const ValueTable&) = delete;
ValueTable(ValueTable&&) = delete;
ValueTable& operator=(const ValueTable&) = delete;
ValueTable& operator=(ValueTable&&) = delete;
// Don't overload == because there is a circular reference between GeorefMetadataLayer
// ValueTable and implementing == on ValueTable causes compilers problems.
const Records& getRecords() const & noexcept;
const RecordDefinition& getDefinition() const & noexcept;
const CompoundDataType& getValue(size_t key,
const std::string& name) const &;
const CompoundDataType& getValue(size_t key,
size_t fieldIndex) const &;
size_t getFieldIndex(const std::string& name) const;
const char* getFieldName(size_t index) const &;
size_t addRecord(const Record& record);
void addRecords(const Records& records);
void setValue(size_t key, const std::string& name,
const CompoundDataType& value);
void setValue(size_t key, size_t fieldIndex,
const CompoundDataType& value);
protected:
explicit ValueTable(const GeorefMetadataLayer& layer);
private:
std::vector<uint8_t> convertRecordToRaw(const Record& record) const;
std::vector<uint8_t> convertRecordsToRaw(
const std::vector<Record>& records) const;
bool validateRecord(const Record& record) const;
void writeRecord(size_t key, const Record& record);
void writeRecords(const std::vector<Record>& records);
//! The layer these records pertain to.
const GeorefMetadataLayer& m_layer;
//! The stored values.
Records m_records;
friend GeorefMetadataLayer;
};
#ifdef _MSC_VER
#pragma warning(pop)
#endif
} // namespace BAG
#endif // BAG_VALUE_TABLE_H