00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
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 "fimex/Data.h"
00031 #include "fimex/CDMDataType.h"
00032 #include "fimex/CDMNamedEntity.h"
00033
00034 namespace MetNoFimex
00035 {
00036
00037 class CDMAttribute : public CDMNamedEntity
00038 {
00039
00040 public:
00041 CDMAttribute();
00043 explicit CDMAttribute(std::string name, std::string value);
00045 explicit CDMAttribute(std::string name, char value);
00047 explicit CDMAttribute(std::string name, int value);
00049 explicit CDMAttribute(std::string name, short value);
00051 explicit CDMAttribute(std::string name, float value);
00053 explicit CDMAttribute(std::string name, double value);
00055 explicit CDMAttribute(std::string name, CDMDataType datatype, boost::shared_ptr<Data> data);
00057 explicit CDMAttribute(const std::string& name, const std::string& datatype, const std::string& value) throw(CDMException);
00058 virtual ~CDMAttribute();
00060 const std::string& getName() const {return name;}
00062 const std::string getStringValue() const {return data->asString();}
00064 const boost::shared_ptr<Data> getData() const {return data;}
00066 void setData(boost::shared_ptr<Data> data) {this->data = data;}
00068 const CDMDataType getDataType() const {return datatype;}
00069 void toXMLStream(std::ostream& out) const;
00070 private:
00071 std::string name;
00072 CDMDataType datatype;
00073 boost::shared_ptr<Data> data;
00074 };
00075
00081 std::vector<CDMAttribute> projStringToAttributes(std::string projStr);
00088 std::string attributesToProjString(const std::vector<CDMAttribute>& attrs);
00089
00090
00091 }
00092
00093 #endif