fw4spl
fwAtomConversion::DataVisitor Class Reference

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>

+ Inheritance diagram for fwAtomConversion::DataVisitor:
+ Collaboration diagram for fwAtomConversion::DataVisitor:

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::ObjectgetAtomObject () 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.
 

Detailed Description

Visitor used to convert a fwData to a fwAtoms. fwData camp property names are used like key to store attributes in fwAtoms::Object.

Date
2013
Exceptions
::camp::ClassNotFoundif data class is not found in camp world during visit

Definition at line 38 of file DataVisitor.hpp.

Constructor & Destructor Documentation

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().

+ Here is the call graph for this function:

Member Function Documentation

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().

+ Here is the call graph for this function:

void fwAtomConversion::DataVisitor::visit ( const camp::MapProperty property)
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.


The documentation for this class was generated from the following files: