00001 #ifndef _IT_BUS_NILLABLE_H_
00002 #define _IT_BUS_NILLABLE_H_
00003
00004
00005
00006
00007 #include <it_bus/any_type.h>
00008 #include <it_bus/serialization_exception.h>
00009 #include <it_bus/deserialization_exception.h>
00010
00011 namespace IT_Bus
00012 {
00013 class ComplexTypeWriter;
00014 class ComplexTypeReader;
00015
00019 class IT_AFC_API Nillable : public virtual AnyType
00020 {
00021 public:
00025 Nillable();
00026
00030 virtual ~Nillable();
00031
00035 virtual Boolean
00036 is_nil() const = 0;
00037
00041 virtual void
00042 set_nil() = 0;
00043
00044 virtual void
00045 read(
00046 const QName& name,
00047 ComplexTypeReader& reader
00048 ) IT_THROW_DECL((IT_Bus::DeserializationException));
00049
00050 virtual void
00051 write(
00052 const QName& name,
00053 ComplexTypeWriter& writer
00054 ) const IT_THROW_DECL((IT_Bus::SerializationException));
00055
00062 virtual AnyType::Kind
00063 get_kind() const;
00064
00068 virtual void
00069 write_value(
00070 const QName& name,
00071 ComplexTypeWriter& writer
00072 ) const IT_THROW_DECL((SerializationException)) = 0;
00073
00077 virtual void
00078 read_value(
00079 const QName& name,
00080 ComplexTypeReader& reader
00081 ) IT_THROW_DECL((DeserializationException)) = 0;
00082 };
00083
00084
00092 template <class T>
00093 Boolean
00094 equal_or_nil(
00095 const T* a,
00096 const T* b
00097 )
00098 {
00099 return (a == 0 && b == 0) || (a != 0 && b != 0 && *a == *b);
00100 }
00101 }
00102
00103 #endif