fw4spl
StructuralPatchDB.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_STRUCTURALPATCHDB_HPP__
8 #define __FWATOMSPATCH_STRUCTURALPATCHDB_HPP__
9 
10 #include <string>
11 #include <vector>
12 #include <map>
13 #include <utility>
14 
15 #include <fwCore/macros.hpp>
16 #include <fwCore/mt/types.hpp>
17 
18 #include "fwAtomsPatch/config.hpp"
19 
20 #include "fwAtomsPatch/IStructuralPatch.hpp"
21 
22 namespace fwAtomsPatch
23 {
24 
25 class IStructuralPatch;
26 
31 class FWATOMSPATCH_CLASS_API StructuralPatchDB
32 {
33 
34 public:
35  typedef SPTR (StructuralPatchDB) sptr;
37  typedef std::pair< std::string, std::string > VersionIDType;
39  typedef std::pair< VersionIDType, VersionIDType > PatchKeyType;
41  typedef std::map< PatchKeyType, SPTR(::fwAtomsPatch::IStructuralPatch) > PatchesType;
42 
48  FWATOMSPATCH_API void registerPatch(SPTR(::fwAtomsPatch::IStructuralPatch) patch);
49 
60  FWATOMSPATCH_API SPTR(::fwAtomsPatch::IStructuralPatch) getPatch(const std::string& originClassname,
61  const std::string& originVersion,
62  const std::string& targetClassname,
63  const std::string& targetVersion) const;
64 
66  FWATOMSPATCH_API size_t size() const;
67 
69  static ::fwAtomsPatch::StructuralPatchDB::sptr getDefault()
70  {
71  return s_default;
72  }
73 
76  {
77  }
78 
81  {
82  }
83 
84 private:
85 
86 
89  {
90  }
91 
93  mutable ::fwCore::mt::ReadWriteMutex m_mutex;
94 
96  PatchesType m_patches;
97 
99  FWATOMSPATCH_API static ::fwAtomsPatch::StructuralPatchDB::sptr s_default;
100 };
101 
102 } // fwAtomsPatch
103 
104 #endif /* __FWATOMSPATCH_STRUCTURALPATCHDB_HPP__ */
#define SPTR(_cls_)
std::pair< VersionIDType, VersionIDType > PatchKeyType
Typedef used to store link to data structure.
Structural patch database. All structural patches are stored in this database.
STL namespace.
This file defines fwCore base macros.
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
std::pair< std::string, std::string > VersionIDType
Typedef used to store the pair classname/version of a data structure.
std::map< PatchKeyType, std::shared_ptr< ::fwAtomsPatch::IStructuralPatch > > PatchesType
Typedef used to store all the structural patches.
Base class of all structural patches.