it_bus/part.h

00001 #ifndef _IT_BUS_PART_H_
00002 #define _IT_BUS_PART_H_
00003 
00004 // @Copyright 2004 IONA Technologies, Plc. All Rights Reserved.
00005 //
00006 #include <it_bus/qname.h>
00007 #include <it_bus/any_simple_type_t.h>
00008 #include <it_bus/reflect/reflect_exception.h>
00009 
00010 namespace IT_Bus
00011 {
00012     class AnyType;
00013 
00014     class IT_AFC_API NotModifiable :
00015         public Exception
00016     {
00017       public:
00018         NotModifiable();
00019 
00023         virtual Exception*
00024         clone() const;
00025     
00029         virtual void
00030         rethrow() const;
00031     };
00032     
00036     class IT_AFC_API Part
00037     {
00038       public:
00039 
00053         enum AutoDelete { AUTO_DELETE, NO_DELETE };
00054 
00059         Part() IT_THROW_DECL(());
00060 
00072         Part(
00073             const QName& name,
00074             AnyType*     value,
00075             AutoDelete   auto_delete = NO_DELETE
00076         ) IT_THROW_DECL(());
00077 
00089         Part(
00090             const QName&   name,
00091             const AnyType* value,
00092             AutoDelete   auto_delete = NO_DELETE
00093         ) IT_THROW_DECL(());
00094 
00102         Part(
00103             const Part& other
00104         );
00105         
00117         Part(
00118             Part& other,
00119             Boolean take_ownership
00120         );
00121 
00129         void operator=(const Part&);
00130 
00134         void
00135         refer(
00136             const Part& other
00137         );
00138 
00145         void
00146         take(
00147             Part& other
00148         );
00149         
00150         ~Part() IT_THROW_DECL(());
00151 
00157         void
00158         set_name(
00159             const QName& name
00160         ) IT_THROW_DECL(());
00161         
00167         QName
00168         get_name() const IT_THROW_DECL(());
00169 
00173         void
00174         set_const_value(
00175             const AnyType* value,
00176             AutoDelete   auto_delete = NO_DELETE
00177         ) IT_THROW_DECL(());
00178                 
00182         void
00183         set_modifiable_value(
00184             AnyType* value,
00185             AutoDelete   auto_delete = NO_DELETE
00186         ) IT_THROW_DECL(());
00187                 
00194         Boolean
00195         is_const() const IT_THROW_DECL(());
00196 
00201         const AnyType&
00202         get_const_value() const IT_THROW_DECL(());
00203 
00210         AnyType&
00211         get_modifiable_value() IT_THROW_DECL((NotModifiable));
00212 
00217         AnyType&
00218         replace_if_const() IT_THROW_DECL((IT_Reflect::ReflectException));
00219 
00226         Boolean get_skip() const;
00227         
00234         void set_skip(
00235             Boolean
00236         );
00237         
00238       private:
00239         void
00240         clear() IT_THROW_DECL(());
00241 
00242         QName          m_name;
00243         AnyType*       m_modifiable;
00244         const AnyType* m_const;
00245         Boolean        m_skip;
00246         AutoDelete     m_auto_delete;
00247 
00248 
00249     };
00250 
00251 
00256     template <class T>
00257     void set_modifiable_value(
00258         Part&        part,
00259         T&           value
00260     )
00261     {
00262         part.set_modifiable_value(
00263             new AnySimpleTypeRefT<T>(value), Part::AUTO_DELETE);
00264     }
00265 
00270     template <class T>
00271     void set_const_value(
00272         Part&        part,
00273         T&           value
00274     )
00275     {
00276         part.set_const_value(
00277             new AnySimpleTypeT<T>(value), Part::AUTO_DELETE);
00278     }
00279 }
00280 
00281 
00282 #endif  

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