fw4spl
|
Visitor used to convert a fwData to a fwAtoms. fwData camp property names are used like key to store attributes in fwAtoms::Object. More...
#include <DataVisitor.hpp>
Public Types | |
typedef std::map< ::fwTools::UUID::UUIDType, std::shared_ptr< ::fwAtoms::Object > > | AtomCacheType |
typedef std::string | ClassnameType |
Public Member Functions | |
FWATOMCONVERSION_API | DataVisitor (std::shared_ptr< ::fwData::Object >dataObj, AtomCacheType &cache) |
Constructor. Initializes atom object and store it in the cache. More... | |
virtual FWATOMCONVERSION_API | ~DataVisitor () |
Destructor. Does nothing. | |
FWATOMCONVERSION_API void | visit (const camp::SimpleProperty &property) |
Visit simple property. More... | |
FWATOMCONVERSION_API void | visit (const camp::EnumProperty &property) |
Visit enum property. Uses fwAtoms::String to store enum name (and not enum value) | |
FWATOMCONVERSION_API void | visit (const camp::UserProperty &property) |
Visit user property. Null fwData::Object::sptr attribute is converted to null fwAtoms::Base::sptr attributes. | |
FWATOMCONVERSION_API void | visit (const camp::ArrayProperty &property) |
Visit array property. Null fwData::Object::sptr attribute is converted to null fwAtoms::Base::sptr attributes. | |
FWATOMCONVERSION_API void | visit (const camp::MapProperty &property) |
Visit map property. Null fwData::Object::sptr attribute is converted to null fwAtoms::Base::sptr attributes. More... | |
FWATOMCONVERSION_API std::shared_ptr< ::fwAtoms::Object > | getAtomObject () const |
Returns the atom object (representation of dataObj in fwAtoms) . Calls this methods after the visit. | |
Public Member Functions inherited from camp::ExtendedClassVisitor | |
virtual void | visit (const Property &property) |
virtual void | visit (const SimpleProperty &property) |
virtual void | visit (const ArrayProperty &property) |
virtual void | visit (const EnumProperty &property) |
virtual void | visit (const UserProperty &property) |
virtual void | visit (const Function &function) |
Static Public Attributes | |
static FWATOMCONVERSION_API const std::string | CLASSNAME_METAINFO = "CLASSNAME_METAINFO" |
Key of the meta info to store data object classname. | |
static FWATOMCONVERSION_API const std::string | ID_METAINFO = "ID_METAINFO" |
Key of the meta info to store data object ID. | |
Visitor used to convert a fwData to a fwAtoms. fwData camp property names are used like key to store attributes in fwAtoms::Object.
::camp::ClassNotFound | if data class is not found in camp world during visit |
Definition at line 38 of file DataVisitor.hpp.
fwAtomConversion::DataVisitor::DataVisitor | ( | std::shared_ptr< ::fwData::Object > | dataObj, |
AtomCacheType & | cache | ||
) |
Constructor. Initializes atom object and store it in the cache.
Creates a new fwAtoms::Object. Sets : ID from dataObj UUID, meta info CLASSNAME_METAINFO from dataObj classname() and add tag information from camp data
Definition at line 124 of file DataVisitor.cpp.
References fwTools::UUID::get().
void fwAtomConversion::DataVisitor::visit | ( | const camp::SimpleProperty & | property | ) |
Visit simple property.
ACH Hack !
Definition at line 156 of file DataVisitor.cpp.
References fwAtoms::Numeric::New().
|
virtual |
Visit map property. Null fwData::Object::sptr attribute is converted to null fwAtoms::Base::sptr attributes.
Only map with key of type enum, string, real or int are managed ( real and int are converted in string ). In other cases, an assertion is raised.
Reimplemented from camp::ExtendedClassVisitor.
Definition at line 189 of file DataVisitor.cpp.