it_bus/any.h

00001 #ifndef _IT_BUS_ANY_H_
00002 #define _IT_BUS_ANY_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 
00007 #include <it_bus/api_defines.h>
00008 #include <it_bus/any_type.h>
00009 #include <it_bus/any_holder.h>
00010 #include <it_bus/qname.h>
00011 #include <it_dsa/var.h>
00012 #include <it_bus/type_list_t.h>
00013 
00014 namespace IT_Reflect
00015 {
00016     template <class T>
00017     class ComplexValueRef;
00018 }
00019 
00020 namespace IT_Bus
00021 {
00022     typedef IT_Vector<String> NamespaceConstraints;
00023         
00024     class AnyStreamable;
00025 
00038     class IT_AFC_API Any : public AnyType
00039     {
00040       public :
00041         typedef IT_Reflect::ComplexValueRef<Any> IT_ReflectionType;
00042 
00043         static const QName&
00044         get_static_type();
00045 
00049         Any();
00050 
00061         Any(
00062             const char*                  process_contents,
00063             const NamespaceConstraints&  namespace_constraints,
00064             const char*                  any_namespace
00065         );
00066 
00070         virtual ~Any();
00071 
00075         Any(
00076             const Any& rhs
00077         );
00078 
00082         Any& 
00083         operator=(
00084             const Any&  other
00085         );
00086 
00094         AnyType&
00095         copy(
00096             const AnyType&  other
00097         );
00098 
00105         const QName&
00106         get_type() const;
00107 
00115         Kind
00116         get_kind() const;
00117 
00125         void
00126         read(
00127             const QName&        name,
00128             ComplexTypeReader&  reader
00129         ) IT_THROW_DECL((DeserializationException));
00130 
00138         void
00139         write(
00140             const QName&         name,
00141             ComplexTypeWriter&   writer
00142         ) const IT_THROW_DECL((SerializationException));
00143 
00144         virtual void
00145         read_any(
00146             const QName&         element_name,
00147             ComplexTypeReader&   reader
00148         ) IT_THROW_DECL((DeserializationException));
00149 
00150         virtual void
00151         write_any(
00152             const QName&        element_name,
00153             ComplexTypeWriter&  writer
00154         ) const IT_THROW_DECL((SerializationException));
00155 
00161         void 
00162         set_process_contents(
00163             const String& pc
00164         );
00165 
00172         void
00173         set_namespace_constraints(
00174             const NamespaceConstraints& ns
00175         );
00176 
00182         void
00183         set_any_namespace(
00184             const String& ns
00185         );
00186 
00194         void
00195         set_string_data(
00196             const String&  value,
00197             const QName&   element_name = QName::EMPTY_QNAME
00198         );
00199 
00205         void
00206         set_boolean(
00207             const Boolean& value,
00208             const QName&   element_name
00209         );
00210 
00216         void
00217         set_byte(
00218             const Byte&    value,
00219             const QName&   element_name
00220         );
00221 
00227         void
00228         set_short(
00229             const Short&   value,
00230             const QName&   element_name
00231         );
00232 
00238         void
00239         set_int(
00240             const Int&     value,
00241             const QName&   element_name
00242         );
00243 
00249         void
00250         set_long(
00251             const Long&    value,
00252             const QName&   element_name
00253         );
00254 
00260         void
00261         set_string(
00262             const String&   value,
00263             const QName&    element_name
00264         );
00265 
00271         void
00272         set_QName(
00273             const QName&    value,
00274             const QName&    element_name
00275         );
00276 
00282         void
00283         set_float(
00284             const Float&   value,
00285             const QName&   element_name
00286         );
00287 
00293         void
00294         set_double(
00295             const Double&  value,
00296             const QName&   element_name
00297         );
00298 
00304         void
00305         set_ubyte(
00306             const UByte&   value,
00307             const QName&   element_name
00308         ) ;
00309 
00315         void
00316         set_ushort(
00317             const UShort&  value,
00318             const QName&   element_name
00319         );
00320 
00326         void
00327         set_uint(
00328             const UInt&    value,
00329             const QName&   element_name
00330         );
00331 
00337         void
00338         set_ulong(
00339             const ULong&   value,
00340             const QName&   element_name
00341         );
00342 
00348         void
00349         set_decimal(
00350             const Decimal&  value,
00351             const QName&    element_name
00352         );
00353 
00359         void
00360         set_any_type(
00361             const AnyType&  value,
00362             const QName&    element_name
00363         );
00364 
00370         QName
00371         get_element_name() const;
00372 
00379         String
00380         get_process_contents() const;
00381 
00387         const NamespaceConstraints&
00388         get_namespace_constraints() const;
00389 
00395         String
00396         get_any_namespace() const;
00397 
00403         String
00404         get_string_data() const;
00405 
00412         const AnyType*
00413         get_any_type() const;
00414 
00422         Boolean
00423         get_boolean() const;
00424 
00432         Byte
00433         get_byte() const;
00434 
00442         Short
00443         get_short() const;
00444 
00452         Int
00453         get_int() const;
00454 
00462         Long
00463         get_long() const;
00464 
00472         String
00473         get_string() const;
00474 
00482         QName
00483         get_QName() const;
00484 
00492         Float
00493         get_float() const;
00494 
00502         Double
00503         get_double() const;
00504 
00512         UByte
00513         get_ubyte() const;
00514 
00522         UShort
00523         get_ushort() const;
00524 
00532         UInt
00533         get_uint() const;
00534 
00542         ULong
00543         get_ulong() const;
00544 
00552         Decimal
00553         get_decimal() const;
00554 
00561         virtual bool
00562         validate_contents() const;
00563 
00570         virtual bool
00571         validate_namespace() const;
00572 
00579         virtual IT_Reflect::Reflection*
00580         get_reflection()
00581             IT_THROW_DECL((IT_Reflect::ReflectException));
00582 
00589         virtual const IT_Reflect::Reflection*
00590         get_reflection() const
00591             IT_THROW_DECL((IT_Reflect::ReflectException));
00592 
00593         friend class AnyStreamable;
00594 
00595     private:
00596         AnyType*
00597         create_type_for_element(
00598             const QName&                               element_name,
00599             ImplementationDetails::ImplementationType  impl_type
00600         ) const;
00601 
00602         AnyType*
00603         create_type(
00604             const QName&                               type_name,
00605             ImplementationDetails::ImplementationType  impl_type
00606         ) const;
00607 
00608         void
00609         populate_from_string_data() const;
00610 
00611         void
00612         populate_element_name() const;
00613 
00614         void
00615         clear_data();
00616 
00617         // attributes of Any.
00618         //
00619         String                   m_process_contents;       // default is strict
00620         NamespaceConstraints     m_namespace_constraints;  // default is ##any
00621         String                   m_any_namespace;          // xsd:any's target namespace. 
00622 
00623         // other members.
00624         //
00625         mutable String            m_string_data;     // string form
00626         mutable QName             m_element_name;
00627         mutable AnyType*          m_any_data;
00628     };
00629 
00630     class IT_AFC_API AnyList :
00631         public TypeListT<Any>
00632     {
00633       public:
00634 
00635         typedef IT_Reflect::ComplexValueRef<Any> IT_ReflectionType;
00636 
00637         AnyList(
00638             const size_t min_occurs,
00639             const size_t max_occurs,
00640             const size_t list_size = 0
00641         );
00642 
00643         AnyList(
00644             const Any&    elem,
00645             const size_t  min_occurs,
00646             const size_t  max_occurs,
00647             const size_t  list_size = 0
00648         );
00649 
00650         AnyList(
00651             const size_t                 min_occurs,
00652             const size_t                 max_occurs,
00653             const char*                  process_contents,
00654             const NamespaceConstraints&  namespace_constraints,
00655             const char*                  any_tns
00656         );
00657 
00658         AnyList(
00659             const size_t                 min_occurs,
00660             const size_t                 max_occurs,
00661             const size_t                 list_size,
00662             const char*                  process_contents,
00663             const NamespaceConstraints&  namespace_constraints,
00664             const char*                  any_tns
00665         );
00666 
00667         AnyList(
00668             const Any&                   elem,
00669             const size_t                 min_occurs,
00670             const size_t                 max_occurs,
00671             const char*                  process_contents,
00672             const NamespaceConstraints&  namespace_constraints,
00673             const char*                  any_tns
00674         );
00675 
00676         AnyList(
00677             const Any & elem,
00678             const size_t min_occurs,
00679             const size_t max_occurs,
00680             const size_t list_size,
00681             const char*                  process_contents,
00682             const NamespaceConstraints&  namespace_constraints,
00683             const char*                  any_tns
00684         );
00685 
00686         virtual 
00687         ~AnyList();
00688 
00689         const String&
00690         get_process_contents() const;
00691 
00692         const NamespaceConstraints&
00693         get_namespace_constraints() const;
00694 
00695         const String&
00696         get_any_namespace() const;
00697 
00698         void 
00699         set_process_contents(
00700             const String& pc
00701         );
00702 
00703         void
00704         set_namespace_constraints(
00705             const NamespaceConstraints& ns
00706         );
00707 
00708         void
00709         set_any_namespace(
00710             const String& ns
00711         );
00712 
00713         Kind
00714         get_kind() const;
00715         
00716         const QName&
00717         get_type() const;
00718 
00719         void
00720         read(
00721             const QName& name,
00722             ComplexTypeReader& reader
00723         ) IT_THROW_DECL((IT_Bus::DeserializationException));
00724 
00725         void
00726         write(
00727             const QName& name,
00728             ComplexTypeWriter& writer
00729         ) const IT_THROW_DECL((IT_Bus::SerializationException));
00730     
00731         AnyList&
00732         operator= (
00733             const IT_Vector<Any>& rhs
00734         );
00735 
00736         AnyList&
00737         operator=(
00738             const AnyList& rhs
00739         );
00740       
00741         AnyType&
00742         copy(
00743             const AnyType& rhs
00744         ); 
00745 
00749         virtual void
00750         set_size(
00751             size_t new_size
00752         );
00753 
00754     private:
00755         // attributes of Any.
00756         //
00757         String                   m_process_contents;       // default is strict
00758         NamespaceConstraints     m_namespace_constraints;  // default is ##any
00759         String                   m_any_namespace;          // xsd:any's target namespace. 
00760 
00761     };
00762 
00763 }
00764 
00765 #endif /* !_IT_BUS_ANY_H_ */
00766 
00767 
00768         

Generated on Thu Sep 7 11:38:50 2006 for Artix by  doxygen 1.4.7