TAO_Notify::NVPList Class Reference

Collection of Name/Value Pairs. More...

#include <Name_Value_Pair.h>

List of all members.

Public Member Functions

void load (TAO_Notify_Property_Short &p) const
 Find the NVP with the same name as the property, copy the value.
void load (TAO_Notify_Property_Long &p) const
 Find the NVP with the same name as the property, copy the value.
void load (TAO_Notify_Property_Time &p) const
 Find the NVP with the same name as the property, copy the value.
void load (TAO_Notify_Property_Boolean &p) const
 Find the NVP with the same name as the property, copy the value.
bool load (const char *n, CORBA::Long &v) const
 Find the NVP with specified name, copy the value to a string.
bool load (const char *n, ACE_CString &v) const
 Find the NVP with specified name, copy the value to a long.
void push_back (const NVP &v)
 add a new name/value pair.
size_t size () const
 size of the collection.
const NVPoperator[] (size_t ndx) const
 access NVP via numeric index.
bool find (const char *name, ACE_CString &val) const
 low level access: find
bool find (const char *name, const char *&val) const
 low level access: use this when you don't need a CString

Private Attributes

ACE_Vector< NVPlist_


Detailed Description

Collection of Name/Value Pairs.

Definition at line 69 of file Name_Value_Pair.h.


Member Function Documentation

bool TAO_Notify::NVPList::find ( const char *  name,
const char *&  val 
) const

low level access: use this when you don't need a CString

Definition at line 118 of file Name_Value_Pair.cpp.

References list_.

00119   {
00120     for (size_t i = 0; i < list_.size(); ++i)
00121     {
00122       if (list_[i].name == name)
00123       {
00124         val = list_[i].value.c_str ();
00125         return true;
00126       }
00127     }
00128     return false;
00129   }

bool TAO_Notify::NVPList::find ( const char *  name,
ACE_CString val 
) const

low level access: find

Definition at line 105 of file Name_Value_Pair.cpp.

References list_.

Referenced by load(), and TAO_Notify_Admin::load_attrs().

00106   {
00107     for (size_t i = 0; i < list_.size(); ++i)
00108     {
00109       if (list_[i].name == name)
00110       {
00111         val = list_[i].value;
00112         return true;
00113       }
00114     }
00115     return false;
00116   }

bool TAO_Notify::NVPList::load ( const char *  n,
ACE_CString v 
) const

Find the NVP with specified name, copy the value to a long.

Definition at line 185 of file Name_Value_Pair.cpp.

References find().

00186   {
00187     return find(n, v);
00188   }

bool TAO_Notify::NVPList::load ( const char *  n,
CORBA::Long v 
) const

Find the NVP with specified name, copy the value to a string.

Definition at line 174 of file Name_Value_Pair.cpp.

References ACE_OS::atoi(), and find().

00175   {
00176     const char * val;
00177     if (find(n, val))
00178     {
00179       v = static_cast<CORBA::Long> (ACE_OS::atoi(val));
00180       return true;
00181     }
00182     return false;
00183   }

void TAO_Notify::NVPList::load ( TAO_Notify_Property_Boolean p  )  const

Find the NVP with the same name as the property, copy the value.

Definition at line 158 of file Name_Value_Pair.cpp.

References find(), and TAO_Notify_Property_Boolean::name().

00159   {
00160     ACE_CString v;
00161     if (find(p.name (), v))
00162     {
00163       if (v == "true")
00164       {
00165         p = 1;
00166       }
00167       else
00168       {
00169         p = 0;
00170       }
00171     }
00172   }

void TAO_Notify::NVPList::load ( TAO_Notify_Property_Time p  )  const

Find the NVP with the same name as the property, copy the value.

void TAO_Notify::NVPList::load ( TAO_Notify_Property_Long p  )  const

Find the NVP with the same name as the property, copy the value.

void TAO_Notify::NVPList::load ( TAO_Notify_Property_Short p  )  const

Find the NVP with the same name as the property, copy the value.

Definition at line 131 of file Name_Value_Pair.cpp.

References TAO_Notify_PropertyBase_T< TYPE >::assign(), ACE_OS::atoi(), find(), and TAO_Notify_PropertyBase_T< TYPE >::name().

Referenced by TAO_Notify_EventType::init(), TAO_Notify_StructuredProxyPushSupplier::load_attrs(), TAO_Notify_StructuredProxyPushConsumer::load_attrs(), TAO_Notify_SequenceProxyPushSupplier::load_attrs(), TAO_Notify_SequenceProxyPushConsumer::load_attrs(), TAO_Notify_ProxyPushSupplier::load_attrs(), TAO_Notify_ProxyPushConsumer::load_attrs(), TAO_Notify_Object::load_attrs(), TAO_Notify_EventChannel::load_attrs(), TAO_Notify::Reconnection_Registry::load_child(), and TAO_Notify_FilterAdmin::load_child().

00132   {
00133     const char * v;
00134     if (find(p.name(), v))
00135     {
00136       p.assign (static_cast<CORBA::Short> (ACE_OS::atoi(v)));
00137     }
00138   }

const NVP & TAO_Notify::NVPList::operator[] ( size_t  ndx  )  const

access NVP via numeric index.

Definition at line 208 of file Name_Value_Pair.cpp.

References ACE_ASSERT, and list_.

00209   {
00210     ACE_ASSERT (ndx < list_.size());
00211     return list_[ndx];
00212   }

void TAO_Notify::NVPList::push_back ( const NVP v  ) 

add a new name/value pair.

Definition at line 190 of file Name_Value_Pair.cpp.

References list_, TAO_Notify::NVP::name, and TAO_Notify::NVP::value.

Referenced by add_attr(), add_qos_attr(), TAO_Notify::XML_Saver::open(), TAO_Notify_Proxy::save_attrs(), TAO_Notify_Admin::save_attrs(), and TAO_Notify_EventType::save_persistent().

00191   {
00192     for (size_t i = 0; i < list_.size(); ++i)
00193     {
00194       if (list_[i].name == v.name)
00195       {
00196         list_[i].value = v.value;
00197         return;
00198       }
00199     }
00200     list_.push_back(v);
00201   }

size_t TAO_Notify::NVPList::size (  )  const

size of the collection.

Definition at line 203 of file Name_Value_Pair.cpp.

References list_.

Referenced by TAO_Notify::XML_Saver::begin_object().

00204   {
00205     return list_.size();
00206   }


Member Data Documentation

ACE_Vector<NVP> TAO_Notify::NVPList::list_ [private]

Definition at line 95 of file Name_Value_Pair.h.

Referenced by find(), operator[](), push_back(), and size().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:46:42 2010 for TAO_CosNotification by  doxygen 1.4.7