00001
00002
00003 #ifndef TAO_Notify_PROPERTY_T_CPP
00004 #define TAO_Notify_PROPERTY_T_CPP
00005
00006 #include "orbsvcs/Notify/Property_T.h"
00007
00008 #if ! defined (__ACE_INLINE__)
00009 #include "orbsvcs/Notify/Property_T.inl"
00010 #endif
00011
00012 ACE_RCSID (Notify,
00013 TAO_Notify_Property_T,
00014 "Property_T.cpp,v 1.9 2006/03/14 06:14:34 jtc Exp")
00015
00016 #include "orbsvcs/Notify/PropertySeq.h"
00017
00018 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
00019
00020
00021
00022 template <class TYPE>
00023 TAO_Notify_PropertyBase_T<TYPE>::TAO_Notify_PropertyBase_T (const char* name)
00024 : name_ (name), valid_(0)
00025 {
00026 }
00027
00028 template <class TYPE>
00029 TAO_Notify_PropertyBase_T<TYPE>::TAO_Notify_PropertyBase_T (const char* name, const TYPE& initial)
00030 : name_ (name), value_ (initial), valid_ (1)
00031 {
00032 }
00033
00034 template <class TYPE>
00035 TAO_Notify_PropertyBase_T<TYPE>::TAO_Notify_PropertyBase_T (
00036 const TAO_Notify_PropertyBase_T &rhs)
00037 : name_ (rhs.name_),
00038 value_ (rhs.value_),
00039 valid_ (rhs.valid_)
00040 {
00041
00042 }
00043
00044 template <class TYPE>
00045 TAO_Notify_PropertyBase_T<TYPE>::~TAO_Notify_PropertyBase_T ()
00046 {
00047 }
00048
00049 template <class TYPE> void
00050 TAO_Notify_PropertyBase_T<TYPE>::get (CosNotification::PropertySeq& prop_seq)
00051 {
00052
00053 prop_seq.length (prop_seq.length () + 1);
00054
00055 prop_seq[prop_seq.length () - 1].value <<= this->value_;
00056 }
00057
00058
00059
00060 template <class TYPE>
00061 TAO_Notify_Property_T<TYPE>::TAO_Notify_Property_T (const char* name)
00062 :TAO_Notify_PropertyBase_T <TYPE> (name)
00063 {
00064 }
00065
00066 template <class TYPE>
00067 TAO_Notify_Property_T<TYPE>::TAO_Notify_Property_T (const char* name, const TYPE& initial)
00068 :TAO_Notify_PropertyBase_T <TYPE> (name, initial)
00069 {
00070 }
00071
00072 template <class TYPE> int
00073 TAO_Notify_Property_T<TYPE>::set (const TAO_Notify_PropertySeq& property_seq)
00074 {
00075 CosNotification::PropertyValue value;
00076
00077 if (property_seq.find (this->name_, value) == 0 && (value >>= this->value_))
00078 {
00079 this->valid_ = 1;
00080 return 0;
00081 }
00082
00083 this->valid_ = 0;
00084 return -1;
00085 }
00086
00087 template <class TYPE> int
00088 TAO_Notify_Property_T<TYPE>::set(const CosNotification::PropertyValue &value)
00089 {
00090 if (value >>= this->value_)
00091 {
00092 this->valid_ = 1;
00093 return 0;
00094 }
00095
00096 return -1;
00097 }
00098
00099
00100
00101 template <class TYPE>
00102 TAO_Notify_StructProperty_T<TYPE>::TAO_Notify_StructProperty_T (const char* name)
00103 :name_ (name), valid_(0)
00104 {
00105 }
00106
00107 template <class TYPE>
00108 TAO_Notify_StructProperty_T<TYPE>::TAO_Notify_StructProperty_T (const char* name, const TYPE& initial)
00109 :name_ (name), value_ (initial), valid_ (1)
00110 {
00111 }
00112
00113 template <class TYPE> int
00114 TAO_Notify_StructProperty_T<TYPE>::set (
00115 const TAO_Notify_PropertySeq& property_seq)
00116 {
00117 CosNotification::PropertyValue value;
00118
00119 if (property_seq.find (this->name_, value) == 0)
00120 {
00121 TYPE* extract_type = 0;
00122
00123 if ((value >>= extract_type) && extract_type != 0)
00124 {
00125 this->value_ = *extract_type;
00126 this->valid_ = 1;
00127 return 0;
00128 }
00129 }
00130
00131 this->valid_ = 0;
00132 return -1;
00133 }
00134
00135 TAO_END_VERSIONED_NAMESPACE_DECL
00136
00137 #endif