nidas v1.2.3
Datasets.h
Go to the documentation of this file.
1// -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2// vim: set shiftwidth=4 softtabstop=4 expandtab:
3/*
4 ********************************************************************
5 ** NIDAS: NCAR In-situ Data Acquistion Software
6 **
7 ** 2014, Copyright University Corporation for Atmospheric Research
8 **
9 ** This program is free software; you can redistribute it and/or modify
10 ** it under the terms of the GNU General Public License as published by
11 ** the Free Software Foundation; either version 2 of the License, or
12 ** (at your option) any later version.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ** GNU General Public License for more details.
18 **
19 ** The LICENSE.txt file accompanying this software contains
20 ** a copy of the GNU General Public License. If it is not found,
21 ** write to the Free Software Foundation, Inc.,
22 ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23 **
24 ********************************************************************
25*/
26
27#ifndef NIDAS_CORE_DATASETS_H
28#define NIDAS_CORE_DATASETS_H
29
31#include "XMLException.h"
32#include "XMLParser.h"
33
34#include <xercesc/dom/DOMElement.hpp>
35#include <xercesc/dom/DOMException.hpp>
36
37#include <list>
38
39namespace nidas { namespace core {
40
47class Dataset
48{
49public:
50
51 Dataset();
52
53 const std::string& getName() const { return _name; }
54
55 void setName(const std::string& val) { _name = val; }
56
57 const std::string& getDescription() const { return _desc; }
58
59 void setDescription(const std::string& val) { _desc = val; }
60
61 float getResolutionSecs() const { return _resSecs; }
62
63 void setResolutionSecs(float val) { _resSecs = val; }
64
72 void addEnvironmentVariable(const std::string& name, const std::string& value);
73
74 std::map<std::string,std::string> getEnvironmentVariables() const
75 {
76 return _envVars;
77 }
78
83 void putenv() const;
84
88 void fromDOMElement(const xercesc::DOMElement*);
89
93 xercesc::DOMElement*
94 toDOMParent(xercesc::DOMElement* parent) const;
95
99 xercesc::DOMElement*
100 toDOMElement(xercesc::DOMElement* node) const;
101
102private:
103
104 std::string _name;
105
106 std::string _desc;
107
108 float _resSecs;
109
110 std::map<std::string,std::string> _envVars;
111
112};
113
119class Datasets {
120public:
121 Datasets();
122
126 const Dataset& getDataset(const std::string& name) const;
127
128 std::list<Dataset> getDatasets() const;
129
133 void addDataset(const Dataset& val);
134
135 void removeDataset(const Dataset& val);
136
141 void parseXML(const std::string& xmlFileName, bool verbose=true);
142
147 void writeXML(const std::string& xmlFileName);
148
152 void fromDOMElement(const xercesc::DOMElement*);
153
157 xercesc::DOMElement*
158 toDOMParent(xercesc::DOMElement* parent) const;
159
163 xercesc::DOMElement*
164 toDOMElement(xercesc::DOMElement* node) const;
165
166private:
167
168 std::string _xmlName;
169
170 std::map<std::string, Dataset> _datasetsByName;
171
172};
173
174}} // namespace nidas namespace core
175
176#endif
A Dataset is a named collection of parameters, that are used in data processing.
Definition Datasets.h:48
std::map< std::string, std::string > getEnvironmentVariables() const
Definition Datasets.h:74
float getResolutionSecs() const
Definition Datasets.h:61
Dataset()
Definition Datasets.cc:48
xercesc::DOMElement * toDOMElement(xercesc::DOMElement *node) const
Definition Datasets.cc:293
void fromDOMElement(const xercesc::DOMElement *)
Definition Datasets.cc:217
xercesc::DOMElement * toDOMParent(xercesc::DOMElement *parent) const
Definition Datasets.cc:282
std::map< std::string, std::string > _envVars
Definition Datasets.h:110
float _resSecs
Definition Datasets.h:108
void putenv() const
Update the process environment with the current list of environment variables in the Dataset.
Definition Datasets.cc:206
std::string _name
Definition Datasets.h:104
void addEnvironmentVariable(const std::string &name, const std::string &value)
Add an environment variable to this Dataset.
Definition Datasets.cc:201
void setResolutionSecs(float val)
Definition Datasets.h:63
const std::string & getName() const
Definition Datasets.h:53
void setName(const std::string &val)
Definition Datasets.h:55
std::string _desc
Definition Datasets.h:106
const std::string & getDescription() const
Definition Datasets.h:57
void setDescription(const std::string &val)
Definition Datasets.h:59
A collection of Datasets.
Definition Datasets.h:119
void parseXML(const std::string &xmlFileName, bool verbose=true)
Definition Datasets.cc:86
xercesc::DOMElement * toDOMElement(xercesc::DOMElement *node) const
Definition Datasets.cc:189
std::list< Dataset > getDatasets() const
Definition Datasets.cc:77
std::string _xmlName
Definition Datasets.h:168
const Dataset & getDataset(const std::string &name) const
Definition Datasets.cc:68
void writeXML(const std::string &xmlFileName)
Definition Datasets.cc:124
void removeDataset(const Dataset &val)
Definition Datasets.cc:61
std::map< std::string, Dataset > _datasetsByName
Definition Datasets.h:170
Datasets()
Definition Datasets.cc:52
void addDataset(const Dataset &val)
Definition Datasets.cc:56
void fromDOMElement(const xercesc::DOMElement *)
Definition Datasets.cc:106
xercesc::DOMElement * toDOMParent(xercesc::DOMElement *parent) const
Definition Datasets.cc:176
static int verbose
Definition lidar_vel.cc:45
Sample * getSample(sampleType type, unsigned int len)
A convienence method for getting a sample of an enumerated type from a pool.
Definition Sample.cc:70
Root namespace for the NCAR In-Situ Data Acquisition Software.
Definition A2DConverter.h:31