7 #include "fwAtoms/Object.hpp" 9 #include "fwAtoms/registry/macros.hpp" 11 #include <fwCamp/UserObject.hpp> 22 m_attributes[key] = value;
29 AttributesType::const_iterator iterAttr = m_attributes.find(key);
30 if (iterAttr != m_attributes.end())
32 return iterAttr->second;
48 Object::sptr obj = Object::New();
49 obj->m_metaInfos = m_metaInfos;
51 for(
const AttributesType::value_type& elem : m_attributes)
55 obj->m_attributes.insert( AttributesType::value_type(elem.first, elem.second->clone() ) );
60 obj->m_attributes.insert( AttributesType::value_type(elem.first, nullData) );
71 m_metaInfos[key] = value;
78 MetaInfosType::const_iterator iterMetaInfos = m_metaInfos.find(key);
79 if(iterMetaInfos != m_metaInfos.end())
81 return iterMetaInfos->second;
90 m_metaInfos = metaInfos;
97 return m_attributes.erase(key);
104 m_attributes.clear();
111 return m_metaInfos.erase(key);
FWATOMS_API void setAttribute(const std::string &key, const Base::sptr &)
add a atrtribut, old value is erased
fwAtoms contains basic objects to represent any other kind of object
FWATOMS_API void setMetaInfo(const std::string &key, const std::string &value)
Add a metainfo in the object MetaInfo coud be anything limited to string type.
FWATOMS_API Base::sptr getAttribute(const std::string &key) const
Returns requested attribute if exists, empty sptr else.
FWATOMS_API void clearAttribute()
clear attributes
virtual FWATOMS_API Base::sptr clone() const override
Returns a clone object.
FWATOMS_API AttributesType::size_type eraseAttribute(const std::string &key)
Removes an attributes.
Class represented a fwData::Object.
FWATOMS_API void setAttributes(const AttributesType &attrs)
Sets the attributes map.
FWATOMS_API std::string getMetaInfo(const std::string &key) const
Returns one meta information.
FWATOMS_API MetaInfosType::size_type eraseMetaInfo(const std::string &key)
Removes a MetaInfo.
FWATOMS_API void clearMetaInfo()
clear MetaInfos
FWATOMS_API void setMetaInfos(const MetaInfosType &metaInfos)
Replace metaInfos.