it_bus/part_list.h

00001 #ifndef _IT_BUS_PART_LIST_H_
00002 #define _IT_BUS_PART_LIST_H_
00003 
00004 
00005 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00006 //
00007 
00008 #include <it_bus/any_simple_type_t.h>
00009 #include <it_bus/binary_any_simple_type.h>
00010 #include <it_bus/part.h>
00011 #include <it_dsa/vector.h>
00012 
00013 namespace IT_Bus
00014 {
00015     class BinaryInParam;
00016     class BinaryOutParam;
00017 
00021     class IT_AFC_API PartList
00022     {
00023       public:
00027         PartList(
00028             size_t list_size = 0
00029         );
00030         
00034         ~PartList();
00035 
00041         const Part&
00042         operator[](
00043             size_t i
00044         ) const;
00045 
00051         Part&
00052         operator[](
00053             size_t i
00054         );
00055 
00061         size_t
00062         size() const;
00063 
00069         void
00070         set_size(
00071             const size_t len
00072         ) ;
00073 
00085         void
00086         add_const_part(
00087             const QName&     name,
00088             const AnyType*   part,
00089             Part::AutoDelete auto_delete = Part::NO_DELETE
00090         );
00091 
00103         void
00104         add_modifiable_part(
00105             const QName&     name,
00106             AnyType*         part,
00107             Part::AutoDelete auto_delete = Part::NO_DELETE
00108         );
00109 
00113         void
00114         clear();
00115 
00120         void
00121         refer(
00122             const PartList& other
00123         );
00124 
00129         void
00130         take(
00131             PartList& other
00132         );
00133         
00134       private:
00135         // private and unimplemented to prevent copying
00136         PartList(const PartList&);
00137         void operator=(const PartList&);
00138         
00139         typedef IT_Vector<Part> Parts;
00140         Parts m_parts;
00141         size_t m_count;
00142     };
00143 
00151     template <class T>
00152     void add_const_part(
00153         PartList&    parts,
00154         const QName& name,
00155         const T&     value
00156     )
00157     {
00158         parts.add_const_part(
00159             name, new AnySimpleTypeConstRefT<T>(value), Part::AUTO_DELETE);
00160     }
00161 
00165     template <>
00166     IT_AFC_API void add_const_part<BinaryInParam>(
00167         PartList&            parts,
00168         const QName&         name,
00169         const BinaryInParam& value
00170     );
00171     
00175     template <>
00176     IT_AFC_API void add_const_part<AnyType>(
00177         PartList&      parts,
00178         const QName&   name,
00179         const AnyType& value
00180     );
00181 
00189     template <class T>
00190     void add_modifiable_part(
00191         PartList&    parts,
00192         const QName& name,
00193         T&           value
00194     )
00195     {
00196         parts.add_modifiable_part(
00197             name, new AnySimpleTypeRefT<T>(value), Part::AUTO_DELETE);
00198     }
00199 
00203     template <>
00204     IT_AFC_API void add_modifiable_part<BinaryOutParam>(
00205         PartList&       parts,
00206         const QName&    name,
00207         BinaryOutParam& value
00208     );
00209     
00213     template <>
00214     IT_AFC_API void add_modifiable_part<AnyType>(
00215         PartList&    parts,
00216         const QName& name,
00217         AnyType&     value
00218     );
00219 }
00220 
00221 #endif  

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