-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathNameValueMetaData.h
More file actions
49 lines (39 loc) · 1.56 KB
/
NameValueMetaData.h
File metadata and controls
49 lines (39 loc) · 1.56 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
/*
* File: NameValueMetaData.h
* Author: Marc
*
* A generic metadata class that lets you set (string) name, (double) values
*
* (C) Marc Gershow; licensed under the Creative Commons Attribution Share Alike 3.0 United States License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-sa/3.0/us/ or send a letter to
* Creative Commons, 171 Second Street, Suite 300, San Francisco, California, 94105, USA.
*
*/
#ifndef NAMEVALUEMETADATA_H
#define NAMEVALUEMETADATA_H
#include "ImageMetaData.h"
class NameValueMetaData : public ImageMetaData{
public:
static const uint32_t IdCode = 0xc15ac674; //CRC32 hash of "NameValueMetaData" from http://www.fileformat.info/tool/hash.htm?text=NameValueMetaData
NameValueMetaData();
virtual ~NameValueMetaData();
virtual void toDisk (std::ofstream &os) const;
virtual std::string saveDescription ()const;
virtual int32_t sizeOnDisk ()const;
virtual uint32_t idCode()const {
return IdCode;
}
virtual std::map<std::string, double> getFieldNamesAndValues(void)const;
virtual void addData (std::string name, double value);
virtual bool hasField (std::string fieldName)const;
virtual void replaceData (std::string name, double value);
virtual void clear();
virtual NameValueMetaData *copy() const;
static NameValueMetaData *fromFile (std::ifstream &is);
virtual ImageMetaData *clone() const;
protected:
std::map<std::string, double> data;
private:
NameValueMetaData(const NameValueMetaData& orig);
};
#endif /* NAMEVALUEMETADATA_H */