BALL
1.4.2
Main Page
Related Pages
Modules
Namespaces
Classes
Files
File List
File Members
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
include
BALL
FORMAT
JCAMPFile.h
Go to the documentation of this file.
1
// -*- Mode: C++; tab-width: 2; -*-
2
// vi: set ts=2:
3
//
4
5
#ifndef BALL_FORMAT_JCAMPFILE_H
6
#define BALL_FORMAT_JCAMPFILE_H
7
8
#ifndef BALL_FORMAT_LINEBASEDFILE_H
9
# include <
BALL/FORMAT/lineBasedFile.h
>
10
#endif
11
12
#ifndef BALL_DATATYPE_STRINGHASHMAP_H
13
# include <
BALL/DATATYPE/stringHashMap.h
>
14
#endif
15
16
namespace
BALL
17
{
28
class
BALL_EXPORT
JCAMPFile
29
:
public
LineBasedFile
30
{
31
public
:
32
36
// The value types supported by JCAMP
37
enum
ContentType
38
{
40
STRING
,
42
NUMERIC
,
44
ARRAY
45
};
46
48
class
BALL_EXPORT
JCAMPValue
49
{
50
public
:
52
String
string_value
;
54
std::vector<double>
numeric_value
;
56
ContentType
type
;
57
58
JCAMPValue
() : string_value(
""
), numeric_value(), type(STRING) {}
59
60
bool
operator == (
const
JCAMPValue
& value)
const
;
61
62
bool
operator != (
const
JCAMPValue
& value)
const
;
63
};
64
66
typedef
std::pair<String, JCAMPValue>
KeyValuePair
;
67
69
typedef
StringHashMap<JCAMPValue>
EntryMap
;
70
72
typedef
StringHashMap<String>
HeaderMap
;
73
75
78
81
JCAMPFile
() {}
82
86
JCAMPFile
(
const
String
& name, OpenMode open_mode = std::ios::in);
87
90
virtual
~JCAMPFile
() {}
91
93
96
100
void
read();
101
105
bool
write();
106
108
HeaderMap
&
getHeader
() {
return
header_; }
109
111
const
HeaderMap
&
getHeader
()
const
{
return
header_; }
112
114
EntryMap
&
getEntries
() {
return
entries_; }
115
117
const
EntryMap
&
getEntries
()
const
{
return
entries_; }
118
120
const
JCAMPValue
& operator [] (
const
String
& name)
const
{
return
entries_[name]; }
121
125
double
getDoubleValue(
const
String
& name)
const
;
126
130
Index
getIntValue(
const
String
& name)
const
;
131
133
bool
hasEntry
(
const
String
& name)
const
{
return
entries_.has(name); }
134
136
bool
hasHeader
(
const
String
& name)
const
{
return
header_.has(name); }
137
139
const
JCAMPFile
& operator = (
const
JCAMPFile
& file) ;
140
142
145
148
bool
operator == (
const
JCAMPFile
&
f
)
const
;
149
152
bool
operator != (
const
JCAMPFile
&
f
)
const
;
154
155
156
protected
:
157
159
HeaderMap
header_
;
160
162
EntryMap
entries_
;
163
};
164
}
165
166
#endif // BALL_FORMAT_JCAMPFILE_H
Generated by
1.8.3.1