fw4spl
DataVisitor.hpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2009-2015.
3  * Distributed under the terms of the GNU Lesser General Public License (LGPL) as
4  * published by the Free Software Foundation.
5  * ****** END LICENSE BLOCK ****** */
6 
7 #ifndef __FWATOMCONVERSION_DATAVISITOR_HPP__
8 #define __FWATOMCONVERSION_DATAVISITOR_HPP__
9 
10 #include <map>
11 
12 #include <fwCamp/camp/ExtendedClassVisitor.hpp>
13 
14 #include <fwTools/UUID.hpp>
15 
16 #include "fwAtomConversion/config.hpp"
17 
18 namespace fwAtoms
19 {
20 class Object;
21 }
22 
23 namespace fwData
24 {
25 class Object;
26 }
27 
28 namespace fwAtomConversion
29 {
30 
38 class FWATOMCONVERSION_CLASS_API DataVisitor : public ::camp::ExtendedClassVisitor
39 {
40 
41 public:
42 
43  typedef std::map< ::fwTools::UUID::UUIDType, SPTR(::fwAtoms::Object) > AtomCacheType;
44 
45  typedef std::string ClassnameType;
46 
48  FWATOMCONVERSION_API static const std::string CLASSNAME_METAINFO;
50  FWATOMCONVERSION_API static const std::string ID_METAINFO;
51 
58  FWATOMCONVERSION_API DataVisitor( SPTR(::fwData::Object)dataObj, AtomCacheType & cache );
59 
61  FWATOMCONVERSION_API virtual ~DataVisitor();
62 
67  FWATOMCONVERSION_API void visit(const camp::SimpleProperty& property);
68 
70  FWATOMCONVERSION_API void visit(const camp::EnumProperty& property);
71 
73  FWATOMCONVERSION_API void visit(const camp::UserProperty& property);
74 
76  FWATOMCONVERSION_API void visit(const camp::ArrayProperty& property);
77 
85  FWATOMCONVERSION_API void visit(const camp::MapProperty& property);
86 
88  FWATOMCONVERSION_API SPTR(::fwAtoms::Object) getAtomObject() const;
89 
90 private:
91 
93  ::camp::UserObject m_campDataObj;
94 
96  SPTR(::fwAtoms::Object) m_atomObj;
97 
99  AtomCacheType & m_cache;
100 };
101 
102 } // end namespace fwAtomConversion
103 
104 #endif // __FWATOMCONVERSION_DATAVISITOR_HPP__
#define SPTR(_cls_)
fwAtoms contains basic objects to represent any other kind of object
This namespace contains the necessary class for fwData <-> fwAtoms conversion.
Class represented a fwData::Object.
static FWATOMCONVERSION_API const std::string CLASSNAME_METAINFO
Key of the meta info to store data object classname.
Definition: DataVisitor.hpp:48
static FWATOMCONVERSION_API const std::string ID_METAINFO
Key of the meta info to store data object ID.
Definition: DataVisitor.hpp:50
Visitor used to convert a fwData to a fwAtoms. fwData camp property names are used like key to store ...
Definition: DataVisitor.hpp:38
Base class for each data object.
Contains the representation of the data objects used in the framework.