MI - Fimex
SpatialAxisSpec.h
Go to the documentation of this file.
1 /*
2  * Fimex, SpatialAxisSpec.h
3  *
4  * (C) Copyright 2009, met.no
5  *
6  * Project Info: https://wiki.met.no/fimex/start
7  *
8  * This library is free software; you can redistribute it and/or modify it
9  * under the terms of the GNU Lesser General Public License as published by
10  * the Free Software Foundation; either version 2.1 of the License, or
11  * (at your option) any later version.
12  *
13  * This library is distributed in the hope that it will be useful, but
14  * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
15  * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
16  * License for more details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with this library; if not, write to the Free Software
20  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
21  * USA.
22  *
23  * Created on: Mar 18, 2009
24  * Author: Heiko Klein
25  */
26 
27 #ifndef TIMESPEC_H_
28 #define TIMESPEC_H_
29 
30 #include "fimex/TimeUnit.h"
31 #include "fimex/CDMException.h"
32 #include <vector>
33 #include <string>
34 
35 namespace MetNoFimex
36 {
37 
75 {
76 private:
77  void init();
78 public:
83  SpatialAxisSpec(const std::string& axisSpec) throw(CDMException) :
84  axisSpec(axisSpec), startEndInitialized(false), axisInitialized(false) {}
91  SpatialAxisSpec(const std::string& axisSpec, double start, double end) throw(CDMException) :
92  axisSpec(axisSpec), start(start), end(end), startEndInitialized(true), axisInitialized(false) {}
93  virtual ~SpatialAxisSpec() {};
99  bool requireStartEnd();
100  void setStartEnd(double start, double end) {this->start = start; this->end = end; this->startEndInitialized = true;}
104  const std::vector<double>& getAxisSteps() {if (!axisInitialized) init(); return axisSteps;}
105 
106 private:
107  std::string axisSpec;
108  double start;
109  double end;
110  bool startEndInitialized;
111  bool axisInitialized;
112  std::vector<double> axisSteps;
113 };
114 
115 } /* MetNoFimex */
116 
117 #endif /* TIMESPEC_H_ */
SpatialAxisSpec(const std::string &axisSpec)
Definition: SpatialAxisSpec.h:83
basic_string< char > string
void setStartEnd(double start, double end)
Definition: SpatialAxisSpec.h:100
const std::vector< double > & getAxisSteps()
Definition: SpatialAxisSpec.h:104
Definition: CDMException.h:36
Definition: C_CDMReader.h:35
SpatialAxisSpec(const std::string &axisSpec, double start, double end)
Definition: SpatialAxisSpec.h:91
virtual ~SpatialAxisSpec()
Definition: SpatialAxisSpec.h:93
Definition: SpatialAxisSpec.h:74