Public Member Functions | Private Attributes

TAO_Notify::NVPList Class Reference

Collection of Name/Value Pairs. More...

#include <Name_Value_Pair.h>

Collaboration diagram for TAO_Notify::NVPList:
Collaboration graph
[legend]

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,
ACE_CString val 
) const

low level access: find

Definition at line 105 of file Name_Value_Pair.cpp.

  {
    for (size_t i = 0; i < list_.size(); ++i)
    {
      if (list_[i].name == name)
      {
        val = list_[i].value;
        return true;
      }
    }
    return false;
  }

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.

  {
    for (size_t i = 0; i < list_.size(); ++i)
    {
      if (list_[i].name == name)
      {
        val = list_[i].value.c_str ();
        return true;
      }
    }
    return false;
  }

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.

  {
    const char * val;
    if (find(n, val))
    {
      v = static_cast<CORBA::Long> (ACE_OS::atoi(val));
      return true;
    }
    return false;
  }

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

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

Definition at line 140 of file Name_Value_Pair.cpp.

  {
    const char * v;
    if (find(p.name(), v))
    {
      p.assign (static_cast<CORBA::Long> (ACE_OS::atoi(v)));
    }
  }

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.

  {
    ACE_CString v;
    if (find(p.name (), v))
    {
      if (v == "true")
      {
        p = 1;
      }
      else
      {
        p = 0;
      }
    }
  }

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.

  {
    const char * v;
    if (find(p.name(), v))
    {
      p.assign (static_cast<CORBA::Short> (ACE_OS::atoi(v)));
    }
  }

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.

  {
    return find(n, v);
  }

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

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

Definition at line 149 of file Name_Value_Pair.cpp.

  {
    const char * v;
    if (find(p.name (), v))
    {
      p.assign (static_cast<TimeBase::TimeT> (string_to_uint64(v)));
    }
  }

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.

  {
    ACE_ASSERT (ndx < list_.size());
    return list_[ndx];
  }

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.

  {
    for (size_t i = 0; i < list_.size(); ++i)
    {
      if (list_[i].name == v.name)
      {
        list_[i].value = v.value;
        return;
      }
    }
    list_.push_back(v);
  }

size_t TAO_Notify::NVPList::size ( void   )  const

size of the collection.

Definition at line 203 of file Name_Value_Pair.cpp.

  {
    return list_.size();
  }


Member Data Documentation

Definition at line 95 of file Name_Value_Pair.h.


The documentation for this class was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines