00001 #ifndef _IT_REFLECT_REFLECTION_IMPL_T_H_ 00002 #define _IT_REFLECT_REFLECTION_IMPL_T_H_ 00003 00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved. 00005 // 00006 00007 #include <it_bus/reflect/reflection_impl.h> 00008 #include <it_bus/reflect/traits.h> 00009 00010 namespace IT_Reflect 00011 { 00015 template <class T> 00016 class ReflectionImplT : public virtual ReflectionImpl 00017 { 00018 public: 00022 ReflectionImplT( 00023 const T* data 00024 ) IT_THROW_DECL(()); 00025 00026 virtual const IT_Bus::QName& 00027 get_type_name() const IT_THROW_DECL(()); 00028 00029 virtual IT_Bus::AnyType::Kind 00030 get_type_kind() const IT_THROW_DECL(()); 00031 00032 virtual IT_Bus::AnyType* 00033 clone() const IT_THROW_DECL((ReflectException)); 00034 00039 virtual void 00040 reset( 00041 const T* new_value 00042 ) const IT_THROW_DECL(()); 00043 00044 protected: 00045 typedef ReflectionImplT<T> ThisType; 00046 00047 virtual IT_Bus::AnyType& 00048 get_data() const IT_THROW_DECL(()); 00049 00050 T* m_data; 00051 }; 00052 00053 00054 template <class T> 00055 const IT_Bus::QName& 00056 ReflectionImplT<T>::get_type_name( 00057 ) const IT_THROW_DECL(()) 00058 { 00059 return this->m_data->T::get_type(); 00060 } 00061 00062 template <class T> 00063 IT_Bus::AnyType::Kind 00064 ReflectionImplT<T>::get_type_kind( 00065 ) const IT_THROW_DECL(()) 00066 { 00067 return this->m_data->T::get_kind(); 00068 } 00069 00070 template <class T> 00071 ReflectionImplT<T>::ReflectionImplT( 00072 const T* data 00073 ) IT_THROW_DECL(()) 00074 : 00075 m_data(IT_CONST_CAST(T*, data)) 00076 { 00077 // Complete. 00078 } 00079 00080 template <class T> 00081 IT_Bus::AnyType* 00082 ReflectionImplT<T>::clone( 00083 ) const IT_THROW_DECL((ReflectException)) 00084 { 00085 return Traits<T>::clone(*this->m_data); 00086 } 00087 00088 template <class T> 00089 void 00090 ReflectionImplT<T>::reset( 00091 const T* new_value 00092 ) const IT_THROW_DECL(()) 00093 { 00094 IT_CONST_CAST(ThisType*, this)->m_data = 00095 IT_CONST_CAST(T*, new_value); 00096 } 00097 00098 template <class T> 00099 IT_Bus::AnyType& 00100 ReflectionImplT<T>::get_data() const IT_THROW_DECL(()) 00101 { 00102 return *m_data; 00103 } 00104 } 00105 00106 00107 #endif