7 #include <fwAtoms/Object.hpp> 9 #include <fwData/Object.hpp> 11 #include "fwAtomConversion/convert.hpp" 12 #include "fwAtomConversion/DataVisitor.hpp" 13 #include "fwAtomConversion/AtomVisitor.hpp" 14 #include "fwAtomConversion/mapper/Base.hpp" 19 ::fwAtoms::Object::sptr
convert(const ::fwData::Object::sptr &data )
21 DataVisitor::AtomCacheType cache;
27 ::fwAtoms::Object::sptr
convert(const ::fwData::Object::sptr &dataObj, DataVisitor::AtomCacheType & cache )
29 ::fwAtoms::Object::sptr atom;
31 DataVisitor::AtomCacheType::iterator elem = cache.find( ::
fwTools::UUID::get( dataObj ) );
33 if ( elem == cache.end() )
35 SPTR(mapper::Base) mapper = mapper::
factory::New( dataObj->getClassname() );
38 atom = mapper->convert( dataObj, cache );
42 const camp::Class& metaclass = ::camp::classByName( dataObj->getClassname() );
44 metaclass.visit(visitor);
45 atom = visitor.getAtomObject();
58 ::fwData::Object::sptr
convert( const ::fwAtoms::Object::sptr &atom,
59 const AtomVisitor::IReadPolicy &uuidPolicy
62 AtomVisitor::DataCacheType cache;
63 return convert( atom, cache, uuidPolicy );
68 ::fwData::Object::sptr
convert( const ::fwAtoms::Object::sptr &atomObj, AtomVisitor::DataCacheType & cache,
69 const AtomVisitor::IReadPolicy &uuidPolicy
72 ::fwData::Object::sptr data;
76 if ( elem == cache.end() )
78 SPTR(mapper::Base) mapper = mapper::
factory::New( atomObj->getMetaInfo( DataVisitor::CLASSNAME_METAINFO ) );
81 data = mapper->convert( atomObj, cache, uuidPolicy );
87 data = visitor.getDataObject();
This namespace contains the necessary class for fwData <-> fwAtoms conversion.
Contains fwAtomsFilter::factory utilities.
FWATOMCONVERSION_API std::shared_ptr< ::fwAtoms::Object > convert(const std::shared_ptr< ::fwData::Object > &data)
Helper to convert a fwData::Object to a fwAtoms::Object.
static FWATOMCONVERSION_API const std::string 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 ...
This class is used to convert a fwAtoms to a fwData.