fw4spl
MapProperty.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 "fwCamp/camp/customtype.hpp"
8 #include "fwCamp/camp/MapProperty.hpp"
9 #include "fwCamp/camp/ExtendedClassVisitor.hpp"
10 
11 namespace camp
12 {
13 
14 MapProperty::MapProperty(const std::string& name, Type elementType) :
15  Property(name, (::camp::Type) mappingType),
16  m_elementType(elementType)
17 {
18 }
19 
20 //-----------------------------------------------------------------------------
21 
22 MapProperty::~MapProperty()
23 {
24 }
25 
26 //-----------------------------------------------------------------------------
27 
28 void MapProperty::accept(ClassVisitor& visitor) const
29 {
30  ExtendedClassVisitor* mapVisitor = dynamic_cast< ExtendedClassVisitor*>(&visitor);
31  if (mapVisitor)
32  {
33  mapVisitor->visit(*this);
34  }
35  else
36  {
37  visitor.visit(*this);
38  }
39 }
40 
41 //-----------------------------------------------------------------------------
42 
43 Value MapProperty::getValue(const UserObject& object) const
44 {
45  return getElement(object, 0);
46 }
47 
48 //-----------------------------------------------------------------------------
49 
50 void MapProperty::setValue(const UserObject& object, const Value& value) const
51 {
52  //FIXME XXX TODO DO something
53 }
54 
55 //-----------------------------------------------------------------------------
56 
57 Type MapProperty::elementType() const
58 {
59  return m_elementType;
60 }
61 
62 } // namespace camp