fw4spl
fwData/Reconstruction/V1ToV2.cpp
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 #include <fwAtoms/Numeric.hpp>
8 #include <fwAtoms/Numeric.hxx>
9 #include <fwAtoms/String.hpp>
10 
11 #include "fwStructuralPatch/fwData/Reconstruction/V1ToV2.hpp"
12 
13 namespace fwStructuralPatch
14 {
15 
16 namespace fwData
17 {
18 
19 namespace Reconstruction
20 {
21 
22 V1ToV2::V1ToV2() : ::fwAtomsPatch::IStructuralPatch()
23 {
24  m_originClassname = "::fwData::Reconstruction";
25  m_targetClassname = "::fwData::Reconstruction";
26  m_originVersion = "1";
27  m_targetVersion = "2";
28 
29 }
30 
31 // ----------------------------------------------------------------------------
32 
34 {
35 }
36 
37 // ----------------------------------------------------------------------------
38 
40 {
41 }
42 
43 // ----------------------------------------------------------------------------
44 
46  const ::fwAtoms::Object::sptr& previous,
47  const ::fwAtoms::Object::sptr& current,
48  ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
49 {
50  IStructuralPatch::apply(previous, current, newVersions);
51 
52  // Update object version
53  this->updateVersion(current);
54 
55  // Create helper
56  ::fwAtomsPatch::helper::Object helper(current);
57 
58  helper.removeAttribute("reconstruction_format");
59  helper.removeAttribute("is_closed");
60  helper.removeAttribute("is_automatic");
61  helper.removeAttribute("avg_volume");
62  helper.removeAttribute("vol_deviation");
63  helper.removeAttribute("vol_pct_confidence");
64  helper.removeAttribute("reconstruction_time");
65  helper.removeAttribute("mask_generated");
66  helper.removeAttribute("level");
67  helper.removeAttribute("label");
68  helper.removeAttribute("generated_3D");
69  helper.removeAttribute("type_3D");
70  helper.removeAttribute("db_id");
71 }
72 
73 } // namespace Reconstruction
74 
75 } // namespace fwData
76 
77 } // namespace fwStructuralPatch
78 
Structural patch to convert a fwData::Reconstruction from version &#39;1&#39; to version &#39;2&#39;.
virtual FWSTRUCTURALPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
FWATOMSPATCH_API void updateVersion(std::shared_ptr< ::fwAtoms::Object > current)
Updates the version of the patched object.
FWATOMSPATCH_API void removeAttribute(const std::string &name, conditions::Abstract::sptr condition=conditions::Abstract::New())
Removes an attribute.
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
std::string m_targetClassname
Target type.
FWATOMSPATCH_API IStructuralPatch()
Constructor.
std::string m_originClassname
Origin classname of the object.
Definition: IPatch.hpp:64
Contains creators and structural patches.
Definition: Landmarks1.hpp:13
std::string m_originVersion
Origin version of the object.
Definition: IPatch.hpp:67
std::string m_targetVersion
Target version.
Contains the representation of the data objects used in the framework.