#include <Object_Set_T.h>

Public Member Functions | |
| Object_Set (CORBA::ULong init_capacity=10, CORBA::ULong step=10) | |
| ~Object_Set (void) | |
| Default destructor. | |
| CORBA::Long | add (T *objref) |
| CORBA::Long | remove (T *objref) |
| Removing an object from the set. Return -1 if error occurred. | |
| CORBA::Long | remove_all (void) |
| Removing all objects from the set. Return -1 if error occurred. | |
| T_var & | at (CORBA::ULong index) |
| CORBA::ULong | copy (CORBA::ULong size, T **buffer) |
| int | object_in_set (T *objref) |
| CORBA::ULong | size (void) const |
| Query the current size the set contains. | |
| CORBA::ULong | capacity (void) const |
| Query the current capacity the set. | |
| void | release (void) |
Protected Member Functions | |
| void | grow (void) |
| Grow the internal array holding the object references. | |
Protected Attributes | |
| T_var * | buffer_ |
| CORBA::ULong | capacity_ |
| Maximun capacity of this->buffer_;. | |
| CORBA::ULong | size_ |
| Current size in the set. | |
| CORBA::ULong | step_ |
This class provides a naive implementation of an object reference set. It is naive because it simply keeps object references in an objref_var array without checking for duplication. More importantly, it takes O(n) to to look for an object reference and return it. What we really need is a thread-safe hash_set<> like class here. Since this is mostly used only during setup/assemble time for a CIAO application, i.e., not on critical path, this class serves as a place holder for later, more efficient implementation.
| CIAO::Object_Set< T, T_var >::Object_Set | ( | CORBA::ULong | init_capacity = 10, |
|
| CORBA::ULong | step = 10 | |||
| ) | [inline] |
Default contructor that also allows initializing the initial capacity of the set and the increment step.
| CIAO::Object_Set< T, T_var >::~Object_Set | ( | void | ) | [inline] |
Default destructor.
| CORBA::Long CIAO::Object_Set< T, T_var >::add | ( | T * | objref | ) | [inline] |
Adding a new object reference to the set. Return -1 if error occurred.
| CORBA::Long CIAO::Object_Set< T, T_var >::remove | ( | T * | objref | ) | [inline] |
Removing an object from the set. Return -1 if error occurred.
| CORBA::Long CIAO::Object_Set< T, T_var >::remove_all | ( | void | ) | [inline] |
Removing all objects from the set. Return -1 if error occurred.
| ACE_INLINE T_var & CIAO::Object_Set< T, T_var >::at | ( | CORBA::ULong | index | ) | [inline] |
Access the underlying T_var array directly. This is added to get around a bug in TAO's sequence of object C++ mapping.
| CORBA::ULong CIAO::Object_Set< T, T_var >::copy | ( | CORBA::ULong | size, | |
| T ** | buffer | |||
| ) | [inline] |
Get a copy of the object reference set into the incoming array buffer with capacity of size. buffer is usually allocated using a sequence's allocbuf method. Notice that caller is responsible to release the object references in buffer.
| actual | number of objrefs copied into buffer. |
| int CIAO::Object_Set< T, T_var >::object_in_set | ( | T * | objref | ) | [inline] |
Check if an object is in the set. Return 0 if false.
| ACE_INLINE CORBA::ULong CIAO::Object_Set< T, T_var >::size | ( | void | ) | const [inline] |
Query the current size the set contains.
| ACE_INLINE CORBA::ULong CIAO::Object_Set< T, T_var >::capacity | ( | void | ) | const [inline] |
Query the current capacity the set.
| void CIAO::Object_Set< T, T_var >::release | ( | void | ) | [inline] |
Release all object references.
| void CIAO::Object_Set< T, T_var >::grow | ( | void | ) | [inline, protected] |
Grow the internal array holding the object references.
T_var* CIAO::Object_Set< T, T_var >::buffer_ [protected] |
Pointer to the dynamically allocated buffer that holds the object references.
CORBA::ULong CIAO::Object_Set< T, T_var >::capacity_ [protected] |
Maximun capacity of this->buffer_;.
CORBA::ULong CIAO::Object_Set< T, T_var >::size_ [protected] |
Current size in the set.
CORBA::ULong CIAO::Object_Set< T, T_var >::step_ [protected] |
How many more slots to add each time we expand the capacity of this set.
1.5.3