#include <Containers_T.h>
Collaboration diagram for ACE_Fixed_Set< T, ACE_SIZE >:

| Public Types | |
| typedef ACE_Fixed_Set_Iterator< T, ACE_SIZE > | ITERATOR | 
| typedef ACE_Fixed_Set_Const_Iterator< T, ACE_SIZE > | CONST_ITERATOR | 
| Public Member Functions | |
| ACE_Fixed_Set (void) | |
| Default Constructor. | |
| ACE_Fixed_Set (const ACE_Fixed_Set< T, ACE_SIZE > &) | |
| Copy constructor. | |
| void | operator= (const ACE_Fixed_Set< T, ACE_SIZE > &) | 
| Assignment operator. | |
| ~ACE_Fixed_Set (void) | |
| Destructor. | |
| int | is_empty (void) const | 
| Returns 1 if the container is empty, otherwise returns 0. | |
| int | is_full (void) const | 
| Returns 1 if the container is full, otherwise returns 0. | |
| int | insert (const T &new_item) | 
| Linear time insertion of an item unique to the set. | |
| int | remove (const T &item) | 
| Linear time removal operation of an item. | |
| int | find (const T &item) const | 
| Finds if item occurs in the set. Returns 0 if finds, else -1. | |
| size_t | size (void) const | 
| Size of the set. | |
| void | dump (void) const | 
| Dump the state of an object. | |
| Public Attributes | |
| ACE_ALLOC_HOOK_DECLARE | |
| Declare the dynamic allocation hooks. | |
| Private Attributes | |
| struct { | |
| T item_ | |
| int is_free_ | |
| } | search_structure_ [ACE_SIZE] | 
| Holds the contents of the set. | |
| size_t | cur_size_ | 
| Current size of the set. | |
| size_t | max_size_ | 
| Maximum size of the set. | |
| Friends | |
| class | ACE_Fixed_Set_Iterator_Base< T, ACE_SIZE > | 
| class | ACE_Fixed_Set_Iterator< T, ACE_SIZE > | 
| class | ACE_Fixed_Set_Const_Iterator< T, ACE_SIZE > | 
This implementation of an unordered set uses a fixed array. It does not allow duplicate members. The set provides linear insertion/deletion operations.
Requirements and Performance Characteristics
Definition at line 1353 of file Containers_T.h.
| 
 | |||||
| 
 Definition at line 1362 of file Containers_T.h. | 
| 
 | |||||
| 
 Definition at line 1361 of file Containers_T.h. | 
| 
 | ||||||||||
| Default Constructor. Creates an empy set Definition at line 955 of file Containers_T.cpp. References ACE_TRACE, and ACE_Fixed_Set< T, ACE_SIZE >::search_structure_. 
 00956 : cur_size_ (0), 00957 max_size_ (ACE_SIZE) 00958 { 00959 ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::ACE_Fixed_Set"); 00960 for (size_t i = 0; i < this->max_size_; i++) 00961 this->search_structure_[i].is_free_ = 1; 00962 } | 
| 
 | ||||||||||
| Copy constructor. Initializes a set to be a copy of the set parameter. Definition at line 929 of file Containers_T.cpp. References ACE_TRACE, ACE_Fixed_Set< T, ACE_SIZE >::max_size_, and ACE_Fixed_Set< T, ACE_SIZE >::search_structure_. 
 00930 : cur_size_ (fs.cur_size_) 00931 { 00932 ACE_TRACE ("ACE_Fixed_Set<T>::ACE_Fixed_Set"); 00933 00934 for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i) 00935 if (fs.search_structure_[i].is_free_ == 0) 00936 this->search_structure_[j++] = fs.search_structure_[i]; 00937 } | 
| 
 | ||||||||||
| Destructor. Destroys a set. Definition at line 922 of file Containers_T.cpp. References ACE_TRACE. 
 | 
| 
 | ||||||||||
| Dump the state of an object. 
 Definition at line 914 of file Containers_T.cpp. References ACE_TRACE. 
 00915 {
00916 #if defined (ACE_HAS_DUMP)
00917   ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::dump");
00918 #endif /* ACE_HAS_DUMP */
00919 }
 | 
| 
 | ||||||||||
| Finds if item occurs in the set. Returns 0 if finds, else -1. Performs a linear find operation for the specified item. Definition at line 965 of file Containers_T.cpp. References ACE_TRACE, and ACE_Fixed_Set< T, ACE_SIZE >::search_structure_. 
 00966 {
00967   ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::find");
00968 
00969   for (size_t i = 0, j = 0; i < this->max_size_ && j < this->cur_size_; ++i)
00970     if (this->search_structure_[i].is_free_ == 0)
00971       {
00972         if (this->search_structure_[i].item_ == item)
00973           return 0;
00974         ++j;
00975       }
00976 
00977   return -1;
00978 }
 | 
| 
 | ||||||||||
| Linear time insertion of an item unique to the set. Insert new_item into the set (doesn't allow duplicates). Returns -1 if failures occur, 1 if item is already present, else 0. Definition at line 981 of file Containers_T.cpp. References ACE_TRACE, ACE_Fixed_Set< T, ACE_SIZE >::search_structure_, and ssize_t. Referenced by ACE_Sig_Handlers::handler(), and ACE_Sig_Handlers::register_handler(). 
 00982 {
00983   ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::insert");
00984   ssize_t first_free = -1;   // Keep track of first free slot.
00985   size_t i;
00986 
00987   for (i = 0;
00988        i < this->max_size_  && first_free == -1;
00989        ++i)
00990 
00991     // First, make sure we don't allow duplicates.
00992 
00993     if (this->search_structure_[i].is_free_ == 0)
00994       {
00995         if (this->search_structure_[i].item_ == item)
00996           return 1;
00997       }
00998     else
00999       first_free = static_cast<ssize_t> (i);
01000 
01001   // If we found a free spot let's reuse it.
01002 
01003   if (first_free > -1)
01004     {
01005       this->search_structure_[first_free].item_ = item;
01006       this->search_structure_[first_free].is_free_ = 0;
01007       this->cur_size_++;
01008       return 0;
01009     }
01010   else /* No more room! */
01011     {
01012       errno = ENOMEM;
01013       return -1;
01014     }
01015 }
 | 
| 
 | ||||||||||
| Returns 1 if the container is empty, otherwise returns 0. Performs constant time check to determine if a set is empty. Definition at line 166 of file Containers_T.inl. References ACE_TRACE. 
 | 
| 
 | ||||||||||
| Returns 1 if the container is full, otherwise returns 0. Performs a constant time check to see if the set is full. Definition at line 173 of file Containers_T.inl. References ACE_TRACE. 
 | 
| 
 | ||||||||||
| Assignment operator. Deep copy of one set to another. Definition at line 940 of file Containers_T.cpp. References ACE_TRACE, ACE_Fixed_Set< T, ACE_SIZE >::cur_size_, ACE_Fixed_Set< T, ACE_SIZE >::max_size_, and ACE_Fixed_Set< T, ACE_SIZE >::search_structure_. 
 00941 {
00942   ACE_TRACE ("ACE_Fixed_Set<T>::operator=");
00943 
00944   if (this != &fs)
00945     {
00946       this->cur_size_ = fs.cur_size_;
00947 
00948       for (size_t i = 0, j = 0; i < fs.max_size_ && j < this->cur_size_; ++i)
00949         if (fs.search_structure_[i].is_free_ == 0)
00950           this->search_structure_[j++] = fs.search_structure_[i];
00951     }
00952 }
 | 
| 
 | ||||||||||
| Linear time removal operation of an item. Remove first occurrence of {item} from the set. Returns 0 if it removes the item, -1 if it can't find the item, and -1 if a failure occurs. Removal doesn't reclaim memory for the item. Definition at line 1018 of file Containers_T.cpp. References ACE_TRACE, and ACE_Fixed_Set< T, ACE_SIZE >::search_structure_. Referenced by ACE_Sig_Handlers::dispatch(), ACE_Sig_Handlers::handler(), ACE_Sig_Handlers::register_handler(), and ACE_Sig_Handlers::remove_handler(). 
 01019 {
01020   ACE_TRACE ("ACE_Fixed_Set<T, ACE_SIZE>::remove");
01021 
01022   for (size_t i = 0, j = 0;
01023        i < this->max_size_ && j < this->cur_size_;
01024        ++i)
01025     if (this->search_structure_[i].is_free_ == 0)
01026       {
01027         if (this->search_structure_[i].item_ == item)
01028           {
01029             // Mark this entry as being free.
01030             this->search_structure_[i].is_free_ = 1;
01031 
01032             --this->cur_size_;
01033             return 0;
01034           }
01035         else
01036           ++j;
01037       }
01038 
01039   return -1;
01040 }
 | 
| 
 | ||||||||||
| Size of the set. Returns the current size of the set. Definition at line 907 of file Containers_T.cpp. References ACE_TRACE. Referenced by ACE_Sig_Handlers::remove_handler(). 
 | 
| 
 | |||||
| 
 Definition at line 1358 of file Containers_T.h. | 
| 
 | |||||
| 
 Definition at line 1357 of file Containers_T.h. | 
| 
 | |||||
| 
 Definition at line 1356 of file Containers_T.h. | 
| 
 | |||||
| Declare the dynamic allocation hooks. 
 Definition at line 1437 of file Containers_T.h. | 
| 
 | |||||
| Current size of the set. 
 Definition at line 1451 of file Containers_T.h. Referenced by ACE_Fixed_Set< T, ACE_SIZE >::operator=(). | 
| 
 | |||||
| Keeps track of whether this item is in use or not. 
 Definition at line 1447 of file Containers_T.h. | 
| 
 | |||||
| Item in the set. 
 Definition at line 1444 of file Containers_T.h. | 
| 
 | |||||
| Maximum size of the set. 
 Definition at line 1454 of file Containers_T.h. Referenced by ACE_Fixed_Set< T, ACE_SIZE >::ACE_Fixed_Set(), and ACE_Fixed_Set< T, ACE_SIZE >::operator=(). | 
| 
 | 
| Holds the contents of the set. 
 Referenced by ACE_Fixed_Set< T, ACE_SIZE >::ACE_Fixed_Set(), ACE_Fixed_Set< T, ACE_SIZE >::find(), ACE_Fixed_Set< T, ACE_SIZE >::insert(), ACE_Fixed_Set< T, ACE_SIZE >::operator=(), and ACE_Fixed_Set< T, ACE_SIZE >::remove(). | 
 1.3.6
 
1.3.6