BALL  1.4.79
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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
10 #endif
11 
12 #ifndef BALL_DATATYPE_STRINGHASHMAP_H
14 #endif
15 
16 namespace BALL
17 {
29  : public LineBasedFile
30  {
31  public:
32 
36  // The value types supported by JCAMP
38  {
44  ARRAY
45  };
46 
49  {
50  public:
54  std::vector<double> numeric_value;
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 
70 
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 
160 
163  };
164 }
165 
166 #endif // BALL_FORMAT_JCAMPFILE_H
EntryMap entries_
Entries from the key-value section.
Definition: JCAMPFile.h:162
HeaderMap & getHeader()
Definition: JCAMPFile.h:108
const EntryMap & getEntries() const
Definition: JCAMPFile.h:117
std::vector< double > numeric_value
Definition: JCAMPFile.h:54
EntryMap & getEntries()
Definition: JCAMPFile.h:114
bool hasEntry(const String &name) const
Definition: JCAMPFile.h:133
bool hasHeader(const String &name) const
Definition: JCAMPFile.h:136
StringHashMap< String > HeaderMap
A hash map containing the header entries.
Definition: JCAMPFile.h:72
BALL_EXPORT bool operator!=(const String &s1, const String &s2)
STRING
Definition: paramFile.h:28
BALL_EXPORT bool operator==(const String &s1, const String &s2)
StringHashMap< JCAMPValue > EntryMap
A hash map containing the JCAMP entries.
Definition: JCAMPFile.h:69
const HeaderMap & getHeader() const
Definition: JCAMPFile.h:111
std::pair< String, JCAMPValue > KeyValuePair
a key-value pair
Definition: JCAMPFile.h:66
HeaderMap header_
Entries from the header section.
Definition: JCAMPFile.h:159
#define BALL_EXPORT
Definition: COMMON/global.h:50
virtual ~JCAMPFile()
Definition: JCAMPFile.h:90