it_bus/reflect/reflection_impl_t.h

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         ) throw(());
00025 
00026         virtual const IT_Bus::QName&
00027         get_type_name() const throw(());
00028 
00029         virtual IT_Bus::AnyType::Kind
00030         get_type_kind() const throw(());
00031 
00032         virtual IT_Bus::AnyType*
00033         clone() const throw((ReflectException));
00034 
00039         virtual void
00040         reset(
00041             const T* new_value
00042         ) const throw(());
00043 
00044       protected:
00045         typedef ReflectionImplT<T> ThisType;
00046 
00047         virtual IT_Bus::AnyType&
00048         get_data() const throw(());
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 throw(())
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 throw(())
00066     {
00067         return this->m_data->T::get_kind();
00068     }
00069 
00070     template <class T>
00071     ReflectionImplT<T>::ReflectionImplT(
00072         const T* data
00073     ) throw(())
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 throw((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 throw(())
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 throw(())
00101     {
00102         return *m_data;
00103     }
00104 }
00105 
00106 
00107 #endif  

Generated on Tue Mar 20 15:27:43 2007 for Artix by  doxygen 1.5.1-p1