00001 /* 00002 * Fimex, SpatialAxisSpec.h 00003 * 00004 * (C) Copyright 2009, met.no 00005 * 00006 * Project Info: https://wiki.met.no/fimex/start 00007 * 00008 * This library is free software; you can redistribute it and/or modify it 00009 * under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation; either version 2.1 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, but 00014 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 00015 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public 00016 * License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 00021 * USA. 00022 * 00023 * Created on: Mar 18, 2009 00024 * Author: Heiko Klein 00025 */ 00026 00027 #ifndef TIMESPEC_H_ 00028 #define TIMESPEC_H_ 00029 00030 #include "fimex/TimeUnit.h" 00031 #include "fimex/CDMException.h" 00032 #include <vector> 00033 #include <string> 00034 00035 namespace MetNoFimex 00036 { 00037 00071 class SpatialAxisSpec 00072 { 00073 private: 00074 void init(); 00075 public: 00080 SpatialAxisSpec(const std::string& axisSpec) throw(CDMException) : 00081 axisSpec(axisSpec), startEndInitialized(false), axisInitialized(false) {} 00088 SpatialAxisSpec(const std::string& axisSpec, double start, double end) throw(CDMException) : 00089 axisSpec(axisSpec), start(start), end(end), startEndInitialized(true), axisInitialized(false) {} 00090 virtual ~SpatialAxisSpec() {}; 00096 bool requireStartEnd(); 00097 void setStartEnd(double start, double end) {this->start = start; this->end = end; this->startEndInitialized = true;} 00101 const std::vector<double>& getAxisSteps() {if (!axisInitialized) init(); return axisSteps;} 00102 00103 private: 00104 std::string axisSpec; 00105 double start; 00106 double end; 00107 bool startEndInitialized; 00108 bool axisInitialized; 00109 std::vector<double> axisSteps; 00110 }; 00111 00112 } /* MetNoFimex */ 00113 00114 #endif /* TIMESPEC_H_ */