fw4spl
core/fwAtomConversion/include/fwAtomConversion/mapper/Base.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_MAPPER_BASE_HPP__
8 #define __FWATOMCONVERSION_MAPPER_BASE_HPP__
9 
10 #include <string>
11 
12 #include "fwAtomConversion/config.hpp"
13 #include "fwAtomConversion/mapper/factory/new.hpp"
14 #include "fwAtomConversion/DataVisitor.hpp"
15 #include "fwAtomConversion/AtomVisitor.hpp"
16 
17 namespace fwAtoms
18 {
19 class Object;
20 }
21 namespace fwData
22 {
23 class Object;
24 }
25 
26 namespace fwAtomConversion
27 {
28 namespace mapper
29 {
30 
32 class FWATOMCONVERSION_CLASS_API Base
33 {
34 public:
35 
41  template <typename T>
42  class Registrar
43  {
44  public:
45  Registrar(std::string functorKey)
46  {
47  ::fwAtomConversion::mapper::registry::get()->addFactory(
48  functorKey,
49  &::fwAtomConversion::mapper::factory::New<T>
50  );
51  }
52  };
53 
54  virtual ~Base()
55  {
56  }
57 
63  FWATOMCONVERSION_API virtual SPTR(::fwAtoms::Object) convert(SPTR(::fwData::Object) object,
64  DataVisitor::AtomCacheType & cache) = 0;
65 
72  FWATOMCONVERSION_API virtual SPTR(::fwData::Object) convert(SPTR(::fwAtoms::Object) atom,
73  AtomVisitor::DataCacheType & cache,
74  const AtomVisitor::IReadPolicy &uuidPolicy
75  ) = 0;
76 
77 };
78 
79 }
80 }
81 
82 #endif /* __FWATOMCONVERSION_MAPPER_BASE_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.
Visitor UUID Management policies.
Definition: AtomVisitor.hpp:40
Class represented a fwData::Object.
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.
Base class for each data object.
Contains the representation of the data objects used in the framework.
Class used to register a class factory in factory registry.
Base class of custom mapper between fwData and fwAtoms.