00001 #ifndef _IT_BUS_ANY_H_
00002 #define _IT_BUS_ANY_H_
00003
00004
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 ) throw((DeserializationException));
00130
00138 void
00139 write(
00140 const QName& name,
00141 ComplexTypeWriter& writer
00142 ) const throw((SerializationException));
00143
00144 virtual void
00145 read_any(
00146 const QName& element_name,
00147 ComplexTypeReader& reader
00148 ) throw((DeserializationException));
00149
00150 virtual void
00151 write_any(
00152 const QName& element_name,
00153 ComplexTypeWriter& writer
00154 ) const throw((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
00365 void
00366 adopt_any_type(
00367 AnyType* value,
00368 const QName& element_name
00369 );
00370
00376 QName
00377 get_element_name() const;
00378
00385 String
00386 get_process_contents() const;
00387
00393 const NamespaceConstraints&
00394 get_namespace_constraints() const;
00395
00401 String
00402 get_any_namespace() const;
00403
00409 String
00410 get_string_data() const;
00411
00418 const AnyType*
00419 get_any_type() const;
00420
00428 Boolean
00429 get_boolean() const;
00430
00438 Byte
00439 get_byte() const;
00440
00448 Short
00449 get_short() const;
00450
00458 Int
00459 get_int() const;
00460
00468 Long
00469 get_long() const;
00470
00478 String
00479 get_string() const;
00480
00488 QName
00489 get_QName() const;
00490
00498 Float
00499 get_float() const;
00500
00508 Double
00509 get_double() const;
00510
00518 UByte
00519 get_ubyte() const;
00520
00528 UShort
00529 get_ushort() const;
00530
00538 UInt
00539 get_uint() const;
00540
00548 ULong
00549 get_ulong() const;
00550
00558 Decimal
00559 get_decimal() const;
00560
00567 virtual bool
00568 validate_contents() const;
00569
00576 virtual bool
00577 validate_namespace() const;
00578
00585 virtual IT_Reflect::Reflection*
00586 get_reflection()
00587 throw((IT_Reflect::ReflectException));
00588
00595 virtual const IT_Reflect::Reflection*
00596 get_reflection() const
00597 throw((IT_Reflect::ReflectException));
00598
00599 friend class AnyStreamable;
00600
00601 private:
00602 AnyType*
00603 create_type_for_element(
00604 const QName& element_name,
00605 ImplementationDetails::ImplementationType impl_type
00606 ) const;
00607
00608 AnyType*
00609 create_type(
00610 const QName& type_name,
00611 ImplementationDetails::ImplementationType impl_type
00612 ) const;
00613
00614 void
00615 populate_from_string_data() const;
00616
00617 void
00618 populate_element_name() const;
00619
00620 void
00621 clear_data();
00622
00623
00624
00625 String m_process_contents;
00626 NamespaceConstraints m_namespace_constraints;
00627 String m_any_namespace;
00628
00629
00630
00631 mutable String m_string_data;
00632 mutable QName m_element_name;
00633 mutable AnyType* m_any_data;
00634 };
00635
00636 class IT_AFC_API AnyList :
00637 public TypeListT<Any>
00638 {
00639 public:
00640
00641 typedef IT_Reflect::ComplexValueRef<Any> IT_ReflectionType;
00642
00643 AnyList(
00644 const size_t min_occurs,
00645 const size_t max_occurs,
00646 const size_t list_size = 0
00647 );
00648
00649 AnyList(
00650 const Any& elem,
00651 const size_t min_occurs,
00652 const size_t max_occurs,
00653 const size_t list_size = 0
00654 );
00655
00656 AnyList(
00657 const size_t min_occurs,
00658 const size_t max_occurs,
00659 const char* process_contents,
00660 const NamespaceConstraints& namespace_constraints,
00661 const char* any_tns
00662 );
00663
00664 AnyList(
00665 const size_t min_occurs,
00666 const size_t max_occurs,
00667 const size_t list_size,
00668 const char* process_contents,
00669 const NamespaceConstraints& namespace_constraints,
00670 const char* any_tns
00671 );
00672
00673 AnyList(
00674 const Any& elem,
00675 const size_t min_occurs,
00676 const size_t max_occurs,
00677 const char* process_contents,
00678 const NamespaceConstraints& namespace_constraints,
00679 const char* any_tns
00680 );
00681
00682 AnyList(
00683 const Any & elem,
00684 const size_t min_occurs,
00685 const size_t max_occurs,
00686 const size_t list_size,
00687 const char* process_contents,
00688 const NamespaceConstraints& namespace_constraints,
00689 const char* any_tns
00690 );
00691
00692 virtual
00693 ~AnyList();
00694
00695 const String&
00696 get_process_contents() const;
00697
00698 const NamespaceConstraints&
00699 get_namespace_constraints() const;
00700
00701 const String&
00702 get_any_namespace() const;
00703
00704 void
00705 set_process_contents(
00706 const String& pc
00707 );
00708
00709 void
00710 set_namespace_constraints(
00711 const NamespaceConstraints& ns
00712 );
00713
00714 void
00715 set_any_namespace(
00716 const String& ns
00717 );
00718
00719 Kind
00720 get_kind() const;
00721
00722 const QName&
00723 get_type() const;
00724
00725 void
00726 read(
00727 const QName& name,
00728 ComplexTypeReader& reader
00729 ) throw((IT_Bus::DeserializationException));
00730
00731 void
00732 write(
00733 const QName& name,
00734 ComplexTypeWriter& writer
00735 ) const throw((IT_Bus::SerializationException));
00736
00737 AnyList&
00738 operator= (
00739 const IT_Vector<Any>& rhs
00740 );
00741
00742 AnyList&
00743 operator=(
00744 const AnyList& rhs
00745 );
00746
00747 AnyType&
00748 copy(
00749 const AnyType& rhs
00750 );
00751
00755 virtual void
00756 set_size(
00757 size_t new_size
00758 );
00759
00760 private:
00761
00762
00763 String m_process_contents;
00764 NamespaceConstraints m_namespace_constraints;
00765 String m_any_namespace;
00766
00767 };
00768
00769 }
00770
00771 #endif
00772
00773
00774