00001 #ifndef _IT_REFLECT_REFLECTION_H_
00002 #define _IT_REFLECT_REFLECTION_H_
00003
00004
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() IT_THROW_DECL(());
00043
00047 virtual
00048 ~Reflection() IT_THROW_DECL(());
00049
00054 virtual const IT_Bus::QName&
00055 get_type_name() const IT_THROW_DECL((ReflectException)) = 0;
00056
00061 virtual IT_Bus::AnyType::Kind
00062 get_type_kind() const IT_THROW_DECL((ReflectException)) = 0;
00063
00068 virtual const IT_Bus::AnyType&
00069 get_reflected() const IT_THROW_DECL((ReflectException)) = 0;
00070
00075 virtual IT_Bus::AnyType&
00076 get_reflected() IT_THROW_DECL((ReflectException)) = 0;
00077
00084 virtual IT_Bus::AnyType*
00085 clone() const IT_THROW_DECL((ReflectException)) = 0;
00086
00087 private:
00088 virtual const IT_XMLSCHEMA_Typenodes::SchemaType&
00089 get_schema_type() const IT_THROW_DECL((ReflectException));
00090
00091
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 ) IT_THROW_DECL((ReflectException));
00108
00115 IT_AFC_API void
00116 copy(
00117 IT_Bus::AnyType& destination,
00118 const IT_Bus::AnyType& source
00119 ) IT_THROW_DECL((ReflectException));
00120
00124 IT_AFC_API IT_Bus::AnyType*
00125 clone(
00126 const IT_Bus::AnyType& value
00127 ) IT_THROW_DECL((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