fw4spl
ModelSeries/V2ToV1.cpp
1 /* ***** BEGIN LICENSE BLOCK *****
2  * FW4SPL - Copyright (C) IRCAD, 2018.
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 "fwStructuralPatch/fwMedData/ModelSeries/V2ToV1.hpp"
8 
9 #include <fwAtoms/Object.hpp>
10 #include <fwAtoms/Object.hxx>
11 
12 namespace fwStructuralPatch
13 {
14 namespace fwMedData
15 {
16 namespace ModelSeries
17 {
18 
20  ::fwAtomsPatch::IStructuralPatch()
21 {
22  m_originClassname = "::fwMedData::ModelSeries";
23  m_targetClassname = "::fwMedData::ModelSeries";
24  m_originVersion = "2";
25  m_targetVersion = "1";
26 }
27 
28 // ----------------------------------------------------------------------------
29 
31 {
32 }
33 
34 // ----------------------------------------------------------------------------
35 
36 V2ToV1::V2ToV1( const V2ToV1& cpy ) :
38 {
39 }
40 
41 // ----------------------------------------------------------------------------
42 
43 void V2ToV1::apply( const ::fwAtoms::Object::sptr& previous,
44  const ::fwAtoms::Object::sptr& current,
45  ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
46 {
47  IStructuralPatch::apply(previous, current, newVersions);
48 
49  // Update object version
50  this->updateVersion(current);
51 
52  ::fwAtomsPatch::helper::Object helper(current);
53  helper.removeAttribute("dicom_reference");
54 }
55 
56 } // namespace ModelSeries
57 } // namespace fwMedData
58 } // namespace fwStructuralPatch
Namespace containing medical data.
Structural patch to convert a fwMedData::ModelSeries from version &#39;2&#39; to version &#39;1&#39;.
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.
FWSTRUCTURALPATCH_API V2ToV1()
Constructor.
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.
virtual FWSTRUCTURALPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.