fw4spl
IPatcher.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 __FWATOMSPATCH_PATCHER_IPATCHER_HPP__
8 #define __FWATOMSPATCH_PATCHER_IPATCHER_HPP__
9 
10 #include <string>
11 
12 #include <fwTools/Object.hpp>
13 #include <fwAtoms/Object.hpp>
14 
15 #include "fwAtomsPatch/patcher/factory/new.hpp"
16 #include "fwAtomsPatch/patcher/registry/detail.hpp"
17 
18 #include "fwAtomsPatch/helper/Object.hpp"
19 #include "fwAtomsPatch/VersionDescriptor.hpp"
20 #include "fwAtomsPatch/VersionsGraph.hpp"
21 
22 #include "fwAtomsPatch/patcher/registry/detail.hpp"
23 #include "fwAtomsPatch/patcher/factory/new.hpp"
24 
25 
26 
27 #include "fwAtomsPatch/config.hpp"
28 
29 
30 namespace fwAtomsPatch
31 {
32 
33 namespace patcher
34 {
35 
40 class FWATOMSPATCH_CLASS_API IPatcher : public ::fwTools::Object
41 {
42 
43 public:
44 
46  typedef ::fwAtomsPatch::patcher::factory::Key Key;
47 
54  template <typename T>
55  class Registrar
56  {
57  public:
58  Registrar(std::string functorKey)
59  {
60  ::fwAtomsPatch::patcher::registry::get()->addFactory(functorKey, &::fwAtomsPatch::patcher::factory::New<T>);
61  }
62  };
63 
64 
65 public:
66 
69 
71  FWATOMSPATCH_API IPatcher();
72 
74  FWATOMSPATCH_API virtual ~IPatcher();
75 
77  FWATOMSPATCH_API virtual ::fwAtoms::Object::sptr transformObject(::fwAtoms::Object::sptr object,
78  const std::string &context,
79  const std::string &currentVersion,
80  const std::string &targetVersion) = 0;
81 
82 };
83 
84 } // namespace patcher
85 
86 } // namespace fwAtomsPatch
87 
88 #endif /* __FWATOMSPATCH_PATCHER_IPATCHER_HPP__ */
#define fwCoreNonInstanciableClassDefinitionsMacro(_classinfo_)
Generate common code for Non Instanciable classes (Interfaces, Abstract classes, ...)
Define Base class for FW4SPL objects and services.
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
::fwAtomsPatch::patcher::factory::Key Key
Factory key used by IPatcher implementations.
Definition: IPatcher.hpp:46
Class used to register a class factory in factory registry. This class defines also the object factor...
Definition: IPatcher.hpp:55
Base class of all patchers.
Definition: IPatcher.hpp:40
#define fwCoreAllowSharedFromThis()
Generate getSptr and getConstSptr methods.