7 #ifndef __FWCAMP_CAMP_DETAIL_MAPPROPERTYIMPL_HXX__ 8 #define __FWCAMP_CAMP_DETAIL_MAPPROPERTYIMPL_HXX__ 10 #include "fwCamp/camp/customtype.hpp" 11 #include <fwCamp/Mapper/ValueMapper.hpp> 13 #include <camp/class.hpp> 14 #include <camp/classbuilder.hpp> 15 #include <camp/userobject.hpp> 24 MapPropertyImpl<A>::MapPropertyImpl(
const std::string& name,
const A& accessor) :
25 camp::MapProperty(name,
camp::mapType<ValueType>())
34 std::size_t MapPropertyImpl<A>::getSize(
const UserObject&
object)
const 36 return Mapper::size(map(
object));
41 void MapPropertyImpl<A>::set(
const UserObject&
object,
const Value& key,
const Value& value)
const 43 const typename Mapper::KeyType& typedKey = key.to<
typename Mapper::KeyType >();
44 const typename Mapper::MappedType& typedValue = value.to<
typename Mapper::MappedType >();
46 Mapper::set(map(
object), typedKey, typedValue );
52 MapProperty::ValuePair MapPropertyImpl<A>::getElement(
const UserObject&
object, std::size_t index )
const 55 ValueType p(Mapper::get(map(
object), index));
56 return ValuePair(p.first, p.second);
60 typename MapPropertyImpl<A>::MapType&
61 MapPropertyImpl<A>::map(
const UserObject &
object)
const 63 return m_accessor.get(
object.get<typename A::ClassType>());
70 struct PropertyMapper<A,
camp::mappingType>
72 typedef MapPropertyImpl<A> Type;