27 #ifndef G2O_PROPERTY_H_ 28 #define G2O_PROPERTY_H_ 43 virtual std::string
toString()
const = 0;
56 const T&
value()
const {
return _value;}
59 std::stringstream sstr;
75 class PropertyMap :
protected std::map<std::string, BaseProperty*>
78 typedef std::map<std::string, BaseProperty*>
BaseClass;
92 bool eraseProperty(
const std::string& name_);
100 PropertyMapIterator it=find(name_);
103 return dynamic_cast<P*
>(it->second);
105 template <
typename P>
108 PropertyMapConstIterator it=find(name_);
111 return dynamic_cast<P*
>(it->second);
117 template <
typename P>
118 P*
makeProperty(
const std::string& name_,
const typename P::ValueType& v)
120 PropertyMapIterator it=find(name_);
122 P* p=
new P(name_, v);
126 return dynamic_cast<P*
>(it->second);
133 bool updatePropertyFromString(
const std::string&
name,
const std::string& value);
139 bool updateMapFromString(
const std::string&
values);
141 void writeToCSV(std::ostream& os)
const;
143 using BaseClass::size;
144 using BaseClass::begin;
145 using BaseClass::end;
146 using BaseClass::iterator;
147 using BaseClass::const_iterator;
BaseClass::iterator PropertyMapIterator
BaseClass::const_iterator PropertyMapConstIterator
virtual std::string toString() const
std::vector< double > values
Property(const std::string &name_, const T &v)
Property< double > DoubleProperty
Property(const std::string &name_)
P * makeProperty(const std::string &name_, const typename P::ValueType &v)
virtual bool fromString(const std::string &s)=0
void setValue(const T &v)
std::map< std::string, BaseProperty * > BaseClass
Property< std::string > StringProperty
bool convertString(const std::string &s, T &x, bool failIfLeftoverChars=true)
Property< int > IntProperty
virtual std::string toString() const =0
virtual bool fromString(const std::string &s)
BaseProperty(const std::string name_)
const P * getProperty(const std::string &name_) const
Property< float > FloatProperty
a collection of properties mapping from name to the property itself
const std::string & name()
Property< bool > BoolProperty
P * getProperty(const std::string &name_)