fw4spl
patch/fwMDSemanticPatch/src/fwMDSemanticPatch/V1/V2/fwData/Patient.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 <fwTools/UUID.hpp>
8 
9 #include <fwAtoms/Object.hpp>
10 #include <fwAtoms/Object.hxx>
11 #include <fwAtoms/String.hpp>
12 
13 #include <fwAtomsPatch/helper/Object.hpp>
14 #include <fwAtomsPatch/helper/functions.hpp>
15 
16 #include "fwMDSemanticPatch/V1/V2/fwData/Patient.hpp"
17 
18 namespace fwMDSemanticPatch
19 {
20 namespace V1
21 {
22 namespace V2
23 {
24 namespace fwData
25 {
26 
27 Patient::Patient() : ::fwAtomsPatch::ISemanticPatch()
28 {
29  m_originClassname = "::fwData::Patient";
30  m_originVersion = "1";
31  this->addContext("MedicalData", "V1", "V2");
32 }
33 
34 // ----------------------------------------------------------------------------
35 
37 {
38 }
39 
40 // ----------------------------------------------------------------------------
41 
43 {
44 }
45 
46 // ----------------------------------------------------------------------------
47 
49  const ::fwAtoms::Object::sptr& previous,
50  const ::fwAtoms::Object::sptr& current,
51  ::fwAtomsPatch::IPatch::NewVersionsType& newVersions)
52 {
53  ISemanticPatch::apply(previous, current, newVersions);
54  ::fwAtomsPatch::helper::cleanFields( current );
55  ::fwAtomsPatch::helper::Object helper( current );
56 
57  ::fwAtoms::String::sptr uid = current->getAttribute< ::fwAtoms::String >("patient_id");
58  if( uid->getValue().empty() )
59  {
61  }
62 }
63 
64 // ----------------------------------------------------------------------------
65 
66 } // namespace fwData
67 } // namespace V2
68 } // namespace V1
69 } // namespace fwMDSemanticPatch
70 
virtual FWMDSEMANTICPATCH_API void apply(const ::fwAtoms::Object::sptr &previous, const ::fwAtoms::Object::sptr &current,::fwAtomsPatch::IPatch::NewVersionsType &newVersions) override
Applies patch.
Contains the semantic patches within the context "MedicalData".
static FWATOMS_API String::sptr New(std::string value)
Construct a new Object represented a string.
Contains base functionalities used to transform objects from a version to another.
Definition: Abstract.hpp:16
std::string m_originClassname
Origin classname of the object.
Definition: IPatch.hpp:64
virtual FWATOMSPATCH_API void addContext(const std::string &context, const std::string &originVersion, const std::string &targetVersion)
Add a context where the patch can be applied.
FWATOMSPATCH_API void replaceAttribute(const std::string &name,::fwAtoms::Base::sptr newValue, conditions::Abstract::sptr condition=conditions::Abstract::New())
Replaces an attribute.
std::string m_originVersion
Origin version of the object.
Definition: IPatch.hpp:67
FWATOMSPATCH_API ISemanticPatch()
Constructor.
Patch a patient from version &#39;V1&#39; to &#39;V2&#39; within &#39;MedicalData&#39; context.
Contains the representation of the data objects used in the framework.
Class represented a String.
static FWTOOLS_API UUIDType generateUUID()
Return a new extended UUID;.
Definition: UUID.cpp:114