src/CDMAttribute.h

Go to the documentation of this file.
00001 /*
00002  * Fimex
00003  * 
00004  * (C) Copyright 2008, 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 
00024 #ifndef CDMATTRIBUTE_H_
00025 #define CDMATTRIBUTE_H_
00026 
00027 #include<string>
00028 #include<ostream>
00029 #include<boost/shared_ptr.hpp>
00030 #include "Data.h"
00031 #include "CDMDataType.h"
00032 
00033 namespace MetNoFimex
00034 {
00035 
00036 class CDMAttribute
00037 {
00038         
00039 public:
00040         CDMAttribute();
00042         explicit CDMAttribute(std::string name, std::string value);
00044         explicit CDMAttribute(std::string name, char value);
00046         explicit CDMAttribute(std::string name, int value);
00048         explicit CDMAttribute(std::string name, short value);
00050         explicit CDMAttribute(std::string name, float value);
00052         explicit CDMAttribute(std::string name, double value);
00054         explicit CDMAttribute(std::string name, CDMDataType datatype, boost::shared_ptr<Data> data);
00056         explicit CDMAttribute(const std::string& name, const std::string& datatype, const std::string& value) throw(CDMException);
00057         virtual ~CDMAttribute();
00059         const std::string& getName() const {return name;}
00061         const std::string getStringValue() const {return data->asString();}
00063         const boost::shared_ptr<Data> getData() const {return data;}
00065         void setData(boost::shared_ptr<Data> data) {this->data = data;}
00067         const CDMDataType getDataType() const {return datatype;}
00068         void toXMLStream(std::ostream& out) const;
00069 private:
00070         std::string name;
00071         CDMDataType datatype;
00072         boost::shared_ptr<Data> data;
00073 };
00074 
00080 std::vector<CDMAttribute> projStringToAttributes(std::string projStr);
00087 std::string attributesToProjString(const std::vector<CDMAttribute>& attrs);
00088 
00089 
00090 }
00091 
00092 #endif /*CDMATTRIBUTE_H_*/

Generated on Thu Jun 5 14:58:22 2008 for MI - Fimex by  doxygen 1.4.6