00001 /* 00002 * Fimex, SliceBuilder.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 16, 2010 00024 * Author: Heiko Klein 00025 */ 00026 00027 #ifndef SLICEBUILDER_H_ 00028 #define SLICEBUILDER_H_ 00029 00030 #include <string> 00031 #include <vector> 00032 #include <map> 00033 #include <boost/shared_ptr.hpp> 00034 00035 namespace MetNoFimex 00036 { 00037 // forward decl 00038 class CDM; 00039 class CoordinateAxis; 00045 class SliceBuilder 00046 { 00047 public: 00055 SliceBuilder(const CDM& cdm, const std::string& varName); 00056 ~SliceBuilder(); 00065 void setStartAndSize(const std::string& dimName, size_t start, size_t size); 00074 void setStartAndSize(const boost::shared_ptr<const CoordinateAxis>& axis, size_t start, size_t size); 00078 const std::vector<size_t>& getDimensionStartPositions() const {return start_;} 00083 const std::vector<size_t>& getDimensionSizes() const {return size_;} 00087 std::vector<std::string> getDimensionNames() const; 00092 const std::vector<size_t>& getMaxDimensionSizes() const {return maxSize_;} 00093 00094 private: 00095 size_t getDimPos(const std::string& dimName) const; 00096 // position of the dimension 00097 std::map<std::string, size_t> dimPos_; 00098 std::vector<size_t> maxSize_; 00099 std::vector<size_t> start_; 00100 std::vector<size_t> size_; 00101 00102 }; 00103 00104 } 00105 00106 #endif /* SLICEBUILDER_H_ */