CORBA::ContextList Class Reference

ContextList definition taken from CORBA v2.3a Dec 1998. More...

#include <Context.h>

Collaboration diagram for CORBA::ContextList:

Collaboration graph
[legend]
List of all members.

Public Types

typedef CORBA::ContextList_ptr _ptr_type
typedef CORBA::ContextList_var _var_type
typedef CORBA::ContextList_out _out_type

Public Member Functions

 ContextList (void)
 Constructor.
 ContextList (CORBA::ULong len, char **ctx_list)
 ~ContextList (void)
 Destructor.
CORBA::ULong count (void)
 Return the number of elements.
ContextList_ptr _duplicate (void)
 Increment the reference count.
void _destroy (void)
 Decrement the reference count and delete if it is 0.
void add (char *ctx)
 Add a string to the list.
void add_consume (char *ctx)
 Add and consume a string to the list.
char * item (CORBA::ULong slot)
 Return the typecode at slot i. Raises the "Bounds" exception.
void remove (CORBA::ULong slot)
 Remove the typecode at slot i. Raises the "Bounds" exception.
void _incr_refcnt (void)
 Increment and decrement ref counts.
void _decr_refcnt (void)

Static Public Member Functions

static ContextList_ptr _duplicate (ContextList *)
 Increment the reference count.
static ContextList_ptr _nil ()
 Return null pointer of this type.

Private Member Functions

 ContextList (const ContextList &)
ContextListoperator= (const ContextList &)

Private Attributes

ACE_Atomic_Op< TAO_SYNCH_MUTEX,
CORBA::ULong
ref_count_
 Reference counter.
ACE_Unbounded_Queue< char * > ctx_list_
 Internal list of typecodes.

Detailed Description

ContextList definition taken from CORBA v2.3a Dec 1998.

Maintains a list of strings for Contexts.

Definition at line 125 of file Context.h.


Member Typedef Documentation

typedef CORBA::ContextList_out CORBA::ContextList::_out_type

Definition at line 172 of file Context.h.

typedef CORBA::ContextList_ptr CORBA::ContextList::_ptr_type

Definition at line 170 of file Context.h.

typedef CORBA::ContextList_var CORBA::ContextList::_var_type

Definition at line 171 of file Context.h.


Constructor & Destructor Documentation

ACE_INLINE CORBA::ContextList::ContextList ( void   ) 

Constructor.

Definition at line 67 of file Context.inl.

00068 {
00069 }

CORBA::ContextList::ContextList ( CORBA::ULong  len,
char **  ctx_list 
)

Constructor - initialize given a length and an array of strings.

Definition at line 92 of file Context.cpp.

00093   : ref_count_ (1)
00094 {
00095   for (CORBA::ULong i=0; i < len; i++)
00096     {
00097       this->add (ctx_list [i]);
00098     }
00099 }

CORBA::ContextList::~ContextList ( void   ) 

Destructor.

Definition at line 101 of file Context.cpp.

References count(), and CORBA::string_free().

00102 {
00103   for (CORBA::ULong i = 0; i < this->count (); ++i)
00104     {
00105       char **ctx = 0;
00106 
00107       if (this->ctx_list_.get (ctx, i) == -1)
00108         {
00109           return;
00110         }
00111 
00112       CORBA::string_free (*ctx);
00113     }
00114 }

CORBA::ContextList::ContextList ( const ContextList  )  [private]


Member Function Documentation

void CORBA::ContextList::_decr_refcnt ( void   ) 

Definition at line 174 of file Context.cpp.

References ref_count_.

00175 {
00176   --this->ref_count_;
00177 
00178   if (this->ref_count_ != 0)
00179     {
00180       delete this;
00181     }
00182 }

void CORBA::ContextList::_destroy ( void   ) 

Decrement the reference count and delete if it is 0.

Definition at line 157 of file Context.cpp.

References ref_count_.

00158 {
00159   CORBA::ULong const current = --this->ref_count_;
00160 
00161   if (current == 0)
00162     {
00163       delete this;
00164     }
00165 }

static ContextList_ptr CORBA::ContextList::_duplicate ( ContextList  )  [static]

Increment the reference count.

CORBA::ContextList_ptr CORBA::ContextList::_duplicate ( void   ) 

Increment the reference count.

Definition at line 150 of file Context.cpp.

References ref_count_.

00151 {
00152   ++this->ref_count_;
00153   return this;
00154 }

void CORBA::ContextList::_incr_refcnt ( void   ) 

Increment and decrement ref counts.

Definition at line 168 of file Context.cpp.

References ref_count_.

00169 {
00170   ++this->ref_count_;
00171 }

ACE_INLINE CORBA::ContextList_ptr CORBA::ContextList::_nil (  )  [static]

Return null pointer of this type.

Definition at line 80 of file Context.inl.

00081 {
00082   return (CORBA::ContextList_ptr)0;
00083 }

void CORBA::ContextList::add ( char *  ctx  ) 

Add a string to the list.

Definition at line 117 of file Context.cpp.

References ctx_list_, ACE_Unbounded_Queue< T >::enqueue_tail(), and CORBA::string_dup().

00118 {
00119   this->ctx_list_.enqueue_tail (CORBA::string_dup (ctx));
00120 }

void CORBA::ContextList::add_consume ( char *  ctx  ) 

Add and consume a string to the list.

Definition at line 123 of file Context.cpp.

References ctx_list_, and ACE_Unbounded_Queue< T >::enqueue_tail().

00124 {
00125   this->ctx_list_.enqueue_tail (ctx);
00126 }

ACE_INLINE CORBA::ULong CORBA::ContextList::count ( void   ) 

Return the number of elements.

Definition at line 73 of file Context.inl.

References ctx_list_, and ACE_Unbounded_Queue< T >::size().

Referenced by ~ContextList().

00074 {
00075   return (CORBA::ULong) this->ctx_list_.size ();
00076 }

char * CORBA::ContextList::item ( CORBA::ULong  slot  ) 

Return the typecode at slot i. Raises the "Bounds" exception.

Definition at line 129 of file Context.cpp.

References CORBA::string_dup().

00130 {
00131   char **ctx = 0;
00132 
00133   if (this->ctx_list_.get (ctx, slot) == -1)
00134     {
00135       throw ::CORBA::TypeCode::Bounds ();
00136     }
00137   else
00138     {
00139       return CORBA::string_dup (*ctx);
00140     }
00141 }

ContextList& CORBA::ContextList::operator= ( const ContextList  )  [private]

void CORBA::ContextList::remove ( CORBA::ULong  slot  ) 

Remove the typecode at slot i. Raises the "Bounds" exception.

Definition at line 144 of file Context.cpp.

00145 {
00146   throw ::CORBA::NO_IMPLEMENT ();
00147 }


Member Data Documentation

ACE_Unbounded_Queue<char *> CORBA::ContextList::ctx_list_ [private]

Internal list of typecodes.

Definition at line 183 of file Context.h.

Referenced by add(), add_consume(), and count().

ACE_Atomic_Op<TAO_SYNCH_MUTEX, CORBA::ULong> CORBA::ContextList::ref_count_ [private]

Reference counter.

Definition at line 180 of file Context.h.

Referenced by _decr_refcnt(), _destroy(), _duplicate(), and _incr_refcnt().


The documentation for this class was generated from the following files:
Generated on Tue Feb 2 17:43:31 2010 for TAO_DynamicInterface by  doxygen 1.4.7