it_bus/param.h

00001 #ifndef _PARAM_H_
00002 #define _PARAM_H_
00003 
00004 //
00005 //  Copyright (c) 2002 IONA Technologies PLC. All Rights Reserved.
00006 //
00007 
00008 #error "This file is obsolete."
00009 
00010 #include <it_bus/message_writer.h>
00011 #include <it_bus/message_reader.h>
00012 #include <it_bus/serialization_exception.h>
00013 #include <it_bus/deserialization_exception.h>
00014 
00015 namespace IT_Bus
00016 {
00017     class IT_BUS_API InParam
00018     {
00019       public:
00020         InParam() {}
00021         virtual ~InParam();
00022 
00023         virtual void
00024         write(
00025             MessageWriter &
00026         ) const IT_THROW_DECL((SerializationException)) = 0;
00027 
00028         virtual const String &
00029         get_name() const = 0;
00030 
00031       protected:
00032         InParam(const InParam &);
00033         InParam & operator=(const InParam &);
00034     };
00035 
00036     class IT_BUS_API OutParam
00037     {
00038       public:
00039         OutParam() {}
00040         virtual ~OutParam();
00041 
00042         virtual void
00043         read(
00044             MessageReader &
00045         ) IT_THROW_DECL((SerializationException)) = 0;
00046 
00047         virtual const String &
00048         get_name() const = 0;
00049 
00050       protected:
00051         OutParam(const OutParam &);
00052         OutParam & operator=(const OutParam &);
00053     };
00054 
00055     class IT_BUS_API InOutParam : public InParam, public OutParam
00056     {
00057       public:
00058         InOutParam() {}
00059         virtual ~InOutParam();
00060 
00061         virtual void
00062         write(
00063             MessageWriter &
00064         ) const IT_THROW_DECL((SerializationException)) = 0;
00065 
00066         virtual void
00067         read(
00068             MessageReader &
00069         ) IT_THROW_DECL((SerializationException)) = 0;
00070 
00071         virtual const String &
00072         get_name() const = 0;
00073 
00074       protected:
00075         InOutParam(const InOutParam &);
00076         InOutParam & operator=(const InOutParam &);
00077     };
00078 
00079     template <class T>
00080     class InParamImpl : public InParam
00081     {
00082       public:
00083         InParamImpl(
00084             const String& param_name,
00085             const T&      value
00086         ) :
00087             m_value(value), m_name(param_name) {}
00088 
00089         virtual void
00090         write(
00091             MessageWriter & writer
00092         ) const IT_THROW_DECL((SerializationException))
00093         {
00094             writer.write(QName(m_name), m_value);
00095         }
00096 
00097         virtual const String &
00098         get_name() const
00099         {
00100             return m_name;
00101         }
00102 
00103       protected:
00104         InParamImpl(const InParamImpl<T> &);
00105         InParamImpl<T> & operator=(const InParamImpl<T> &);
00106 
00107         String m_name;
00108         const T & m_value;
00109     };
00110 
00111     template <class T>
00112     class OutParamImpl : public OutParam
00113     {
00114       public:
00115         OutParamImpl(
00116             const String& param_name,
00117             T&            value
00118         ) :
00119             m_value(value), m_name(param_name) {}
00120 
00121         virtual void
00122         read(
00123             MessageReader & reader
00124         ) IT_THROW_DECL((SerializationException))
00125         {
00126             reader.read(m_value);
00127         }
00128 
00129         virtual const String &
00130         get_name() const
00131         {
00132             return m_name;
00133         }
00134 
00135       protected:
00136         OutParamImpl(const OutParamImpl<T> &);
00137         OutParamImpl<T> & operator=(const OutParamImpl<T> &);
00138 
00139         String m_name;
00140         T & m_value;
00141     };
00142 
00143     template <class T>
00144     class InOutParamImpl : public InOutParam
00145     {
00146       public:
00147         InOutParamImpl(
00148             const String& param_name,
00149             T&            value
00150         ) :
00151             m_value(value), m_name(param_name) {}
00152 
00153         virtual void
00154         write(
00155             MessageWriter & writer
00156         ) const IT_THROW_DECL((SerializationException))
00157         {
00158             writer.write(QName(m_name), m_value);
00159         }
00160 
00161         virtual void
00162         read(
00163             MessageReader & reader
00164         ) IT_THROW_DECL((SerializationException))
00165         {
00166             reader.read(m_value);
00167         }
00168 
00169         virtual const String &
00170         get_name() const
00171         {
00172             return m_name;
00173         }
00174 
00175       protected:
00176         InOutParamImpl(const InOutParamImpl<T> &);
00177         InOutParamImpl<T> & operator=(const InOutParamImpl<T> &);
00178 
00179         String m_name;
00180         T & m_value;
00181     };
00182 };
00183 
00184 #endif  

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