00001 // -*- C++ -*- 00002 00003 /** 00004 * @file Property_T.h 00005 * 00006 * Property_T.h,v 1.15 2006/03/14 06:14:34 jtc Exp 00007 * 00008 * @author Pradeep Gore <pradeep@oomworks.com> 00009 */ 00010 00011 #ifndef TAO_Notify_PROPERTY_T_H 00012 #define TAO_Notify_PROPERTY_T_H 00013 00014 #include /**/ "ace/pre.h" 00015 00016 #include "orbsvcs/Notify/notify_serv_export.h" 00017 00018 #if !defined (ACE_LACKS_PRAGMA_ONCE) 00019 # pragma once 00020 #endif /* ACE_LACKS_PRAGMA_ONCE */ 00021 00022 #include "ace/SString.h" 00023 00024 #include "orbsvcs/CosNotificationC.h" 00025 00026 TAO_BEGIN_VERSIONED_NAMESPACE_DECL 00027 00028 class TAO_Notify_PropertySeq; 00029 00030 /** 00031 * @class TAO_Notify_PropertyBase_T 00032 * 00033 * @brief 00034 * 00035 */ 00036 template <class TYPE> 00037 class TAO_Notify_PropertyBase_T 00038 { 00039 public: 00040 /// Constuctor 00041 TAO_Notify_PropertyBase_T (const char* name, const TYPE& initial); 00042 00043 /// Constuctor 00044 TAO_Notify_PropertyBase_T (const char* name); 00045 00046 /// Copy Constuctor 00047 TAO_Notify_PropertyBase_T (const TAO_Notify_PropertyBase_T &rhs); 00048 00049 /// Destructor 00050 ~TAO_Notify_PropertyBase_T (); 00051 00052 /// Equality comparison operator. 00053 bool operator== (const TYPE &rhs) const; 00054 00055 /// Inequality comparison operator. 00056 bool operator!= (const TYPE &rhs) const; 00057 00058 /// Populate the Property Sequence with this valid value. 00059 void get (CosNotification::PropertySeq& prop_seq); 00060 00061 // assign a new value 00062 void assign (const TYPE& value); 00063 00064 /// Return the value. 00065 const TYPE& value (void) const; 00066 00067 /// Return the name 00068 const char * name (void) const; 00069 00070 /// Is the current value valid 00071 CORBA::Boolean is_valid (void) const; 00072 00073 /// Invalidate this property's value. 00074 void invalidate (void); 00075 00076 protected: 00077 /// The Property name. 00078 const char* name_; 00079 00080 /// The value 00081 TYPE value_; 00082 00083 /// Is the value valid 00084 CORBA::Boolean valid_; 00085 }; 00086 00087 00088 /*******************************************************************************/ 00089 /** 00090 * @class TAO_Notify_Property_T 00091 * 00092 * @brief 00093 * 00094 */ 00095 template <class TYPE> 00096 class TAO_Notify_Property_T : public TAO_Notify_PropertyBase_T<TYPE> 00097 { 00098 public: 00099 /// Constuctor 00100 TAO_Notify_Property_T (const char* name, const TYPE& initial); 00101 00102 /// Constuctor 00103 TAO_Notify_Property_T (const char* name); 00104 00105 /// Init this Property from the sequence. 00106 /// Returns 0 on success, -1 on error 00107 int set (const TAO_Notify_PropertySeq& property_seq); 00108 00109 /// Init this Property from the CosNotification::PropertyValue 00110 /// Returns 0 on success, -1 on error 00111 int set (const CosNotification::PropertyValue &value); 00112 }; 00113 00114 /*******************************************************************************/ 00115 /** 00116 * @class TAO_Notify_StructProperty_T 00117 * 00118 * @brief 00119 * 00120 */ 00121 template <class TYPE> 00122 class TAO_Notify_StructProperty_T 00123 { 00124 public: 00125 /// Constuctor 00126 TAO_Notify_StructProperty_T (const char* name, const TYPE& initial); 00127 00128 /// Constuctor 00129 TAO_Notify_StructProperty_T (const char* name); 00130 00131 /// Init this Property from the sequence. 00132 /// Returns 0 on success, -1 on error 00133 int set (const TAO_Notify_PropertySeq& property_seq); 00134 00135 /// Return the name 00136 const char * name (void) const; 00137 00138 /// Return the value. 00139 const TYPE& value (void) const; 00140 00141 /// Is the current value valid 00142 CORBA::Boolean is_valid (void) const; 00143 00144 protected: 00145 /// The Property name. 00146 const char* name_; 00147 00148 /// The value 00149 TYPE value_; 00150 00151 /// Is the value valid 00152 CORBA::Boolean valid_; 00153 }; 00154 00155 TAO_END_VERSIONED_NAMESPACE_DECL 00156 00157 #if defined (__ACE_INLINE__) 00158 #include "orbsvcs/Notify/Property_T.inl" 00159 #endif /* __ACE_INLINE__ */ 00160 00161 #if defined (ACE_TEMPLATES_REQUIRE_SOURCE) 00162 #include "orbsvcs/Notify/Property_T.cpp" 00163 #endif /* ACE_TEMPLATES_REQUIRE_SOURCE */ 00164 00165 #if defined (ACE_TEMPLATES_REQUIRE_PRAGMA) 00166 #pragma implementation ("Property_T.cpp") 00167 #endif /* ACE_TEMPLATES_REQUIRE_PRAGMA */ 00168 00169 #include /**/ "ace/post.h" 00170 #endif /* TAO_Notify_PROPERTY_T_H */