00001 #ifndef _IT_REFLECT_SIMPLE_TYPE_LIST_IMPL_T_H_
00002 #define _IT_REFLECT_SIMPLE_TYPE_LIST_IMPL_T_H_
00003
00004
00005
00006
00007 #include <it_bus/reflect/reflection_impl.h>
00008 #include <it_bus/reflect/simple_type_list_impl_base.h>
00009 #include <it_bus/reflect/traits.h>
00010 #include <it_bus/reflect/simple_type.h>
00011
00012 namespace IT_Reflect
00013 {
00015 template <class ListT, class T>
00016 class SimpleTypeListImplT :
00017 public virtual ReflectionImpl,
00018 public virtual SimpleTypeListImplBase
00019 {
00020 public:
00024 SimpleTypeListImplT(
00025 const ListT& data
00026 ) IT_THROW_DECL(());
00027
00031 SimpleTypeListImplT(
00032 const ListT* data
00033 ) IT_THROW_DECL(());
00034
00035 virtual IT_Bus::AnyType*
00036 clone() const IT_THROW_DECL((ReflectException));
00037
00042 void
00043 reset(
00044 const ListT* new_value
00045 ) const IT_THROW_DECL(());
00046
00047 protected:
00048 typedef SimpleTypeListImplT<ListT, T> ThisType;
00049
00050 virtual IT_Bus::SimpleTypeList&
00051 get_list() const IT_THROW_DECL(());
00052
00053 virtual Reflection*
00054 get_reflection(
00055 size_t index
00056 ) const IT_THROW_DECL((ReflectException));
00057
00058 virtual IT_Bus::AnyType&
00059 get_data() const IT_THROW_DECL(());
00060
00061 private:
00062 ListT* m_data;
00063 };
00064
00065
00066 template <class ListT, class T>
00067 SimpleTypeListImplT<ListT, T>::SimpleTypeListImplT(
00068 const ListT& data
00069 ) IT_THROW_DECL(())
00070 :
00071 m_data(IT_CONST_CAST(ListT*, &data))
00072 {
00073
00074 }
00075
00076 template <class ListT, class T>
00077 SimpleTypeListImplT<ListT, T>::SimpleTypeListImplT(
00078 const ListT* data
00079 ) IT_THROW_DECL(())
00080 :
00081 m_data(IT_CONST_CAST(ListT*, data))
00082 {
00083
00084 }
00085
00086 template <class ListT, class T>
00087 IT_Bus::SimpleTypeList&
00088 SimpleTypeListImplT<ListT, T>::get_list(
00089 ) const IT_THROW_DECL(())
00090 {
00091 return *m_data;
00092 }
00093
00094 template <class ListT, class T>
00095 Reflection*
00096 SimpleTypeListImplT<ListT, T>::get_reflection(
00097 size_t index
00098 ) const IT_THROW_DECL((ReflectException))
00099 {
00100 return Traits<T>::get_reflection((*m_data)[index]);
00101 }
00102
00103 template <class ListT, class T>
00104 IT_Bus::AnyType&
00105 SimpleTypeListImplT<ListT, T>::get_data() const IT_THROW_DECL(())
00106 {
00107 return *m_data;
00108 }
00109
00110 template <class ListT, class T>
00111 IT_Bus::AnyType*
00112 SimpleTypeListImplT<ListT, T>::clone(
00113 ) const IT_THROW_DECL((ReflectException))
00114 {
00115 return new ListT(*m_data);
00116 }
00117
00118 template <class ListT, class T>
00119 void
00120 SimpleTypeListImplT<ListT, T>::reset(
00121 const ListT* new_value
00122 ) const IT_THROW_DECL(())
00123 {
00124 IT_CONST_CAST(ThisType*, this)->m_data =
00125 IT_CONST_CAST(ListT*, new_value);
00126 }
00127
00128 }
00129
00130 #endif