it_bus/reflect/reflection.h

00001 #ifndef _IT_REFLECT_REFLECTION_H_
00002 #define _IT_REFLECT_REFLECTION_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 #include <it_bus/reflect/reflect_exception.h>
00007 #include <it_bus/any_type.h>
00008 #include <it_bus/var.h>
00009 #include <it_bus/ref_counted_base.h>
00010 
00011 namespace IT_Bus
00012 {
00013     class QName;
00014 }
00015 
00016 namespace IT_XMLSCHEMA_Typenodes
00017 {
00018     class SchemaType;
00019 }
00020 
00021 namespace IT_Reflect
00022 {
00023     class SimpleType;
00024     class DerivedSimpleType;
00025     class BuiltInType;
00026     class Array;
00027     class ComplexContent;
00028     class ComplexType;
00029     class ElementList;
00030     class Nillable;
00031     class SimpleContent;
00032 
00036     class IT_AFC_API Reflection : public virtual IT_Bus::RefCountedBase     
00037     {
00038       public:
00042         Reflection() throw(());
00043         
00047         virtual
00048         ~Reflection() throw(());
00049 
00054         virtual const IT_Bus::QName&
00055         get_type_name() const throw((ReflectException)) = 0;
00056 
00061         virtual IT_Bus::AnyType::Kind
00062         get_type_kind() const throw((ReflectException)) = 0;
00063 
00068         virtual const IT_Bus::AnyType&
00069         get_reflected() const throw((ReflectException)) = 0;
00070 
00075         virtual IT_Bus::AnyType&
00076         get_reflected() throw((ReflectException)) = 0;
00077         
00084         virtual IT_Bus::AnyType*
00085         clone() const throw((ReflectException)) = 0;
00086 
00087       private:
00088         virtual const IT_XMLSCHEMA_Typenodes::SchemaType&
00089         get_schema_type() const throw((ReflectException));
00090         
00091         // private and unimplemented to prevent copying other than by copy()
00092         Reflection(const Reflection&);
00093         void operator=(const Reflection&);
00094     };
00095 
00096 
00103     IT_AFC_API void
00104     copy(
00105         IT_Reflect::Reflection& destination,
00106         const IT_Reflect::Reflection& source
00107     ) throw((ReflectException));
00108 
00115     IT_AFC_API void
00116     copy(
00117         IT_Bus::AnyType& destination,
00118         const IT_Bus::AnyType& source
00119         ) throw((ReflectException));
00120     
00124     IT_AFC_API IT_Bus::AnyType*
00125     clone(
00126         const IT_Bus::AnyType& value
00127         ) throw((ReflectException));
00128 
00135     template <typename T>
00136     struct Copier
00137     {
00143         static void
00144         copy(
00145             T& destination,
00146             const IT_Bus::AnyType& source
00147         )
00148         {
00149             const T* tmp = dynamic_cast<const T*>(&source);
00150             if (tmp != 0)
00151             {
00152                 destination = *tmp;
00153             }
00154             else
00155             {
00156                 IT_Reflect::copy(destination, source);
00157             }
00158         }
00159     };
00160 }
00161 
00162 #endif  

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