BDE 4.14.0 Production release
Loading...
Searching...
No Matches
ball::AttributeContainerList Class Reference

#include <ball_attributecontainerlist.h>

Public Types

typedef bsl::allocator< char > allocator_type
 
typedef AttributeContainerListIterator iterator
 An iterator over this list.
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (AttributeContainerList, bslma::UsesBslmaAllocator)
 
 AttributeContainerList ()
 
 AttributeContainerList (const allocator_type &allocator)
 
 AttributeContainerList (const AttributeContainerList &original, const allocator_type &allocator=allocator_type())
 
 ~AttributeContainerList ()
 Destroy this object.
 
AttributeContainerListoperator= (const AttributeContainerList &rhs)
 
iterator pushFront (const AttributeContainer *container)
 
void remove (const iterator &element)
 
void removeAll ()
 
void removeAllAndRelease ()
 
iterator begin () const
 
iterator end () const
 
int numContainers () const
 
bool hasValue (const Attribute &value) const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 
allocator_type get_allocator () const
 

Detailed Description

This class provides an in-core value-semantic list of AttributeContainer object addresses. Attribute container addresses are added to this list using pushFront(), which returns an iterator located at the new element. A AttributeContainerList::iterator object remains valid until the element referred to by the iterator is removed. Attribute container addresses can be removed using either remove(), removeAll(), or removeAllAndRelease(). This list object attempts to minimize the number of memory allocations it requires by placing the memory for elements that have been released in a free memory store, and re-using the memory when new elements are added. The removeAll() removes all the elements from the list, but does not release any allocated memory (placing it in the free store). The removeAllAndRelease() operation removes all elements and releases all allocated memory. Note that maintaining a free store is important for this component because the expectation is that elements will be both added and removed frequently.

See ball_attributecontainerlist

Member Typedef Documentation

◆ allocator_type

◆ iterator

Constructor & Destructor Documentation

◆ AttributeContainerList() [1/3]

ball::AttributeContainerList::AttributeContainerList ( )
inline

◆ AttributeContainerList() [2/3]

ball::AttributeContainerList::AttributeContainerList ( const allocator_type allocator)
inlineexplicit

Create an empty container list. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

◆ AttributeContainerList() [3/3]

ball::AttributeContainerList::AttributeContainerList ( const AttributeContainerList original,
const allocator_type allocator = allocator_type() 
)

Create a container list having the same value as the specified original. Optionally specify an allocator (e.g., the address of a bslma::Allocator object) to supply memory; otherwise, the default allocator is used.

◆ ~AttributeContainerList()

ball::AttributeContainerList::~AttributeContainerList ( )
inline

Member Function Documentation

◆ begin()

AttributeContainerList::iterator ball::AttributeContainerList::begin ( ) const
inline

Return an iterator positioned at the beginning of the list of AttributeContainer object addresses represented by this object.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

ball::AttributeContainerList::BSLMF_NESTED_TRAIT_DECLARATION ( AttributeContainerList  ,
bslma::UsesBslmaAllocator   
)

◆ end()

AttributeContainerList::iterator ball::AttributeContainerList::end ( ) const
inline

Return an iterator positioned one past the final AttributeContainer object address in the list of addresses represented by this object.

◆ get_allocator()

AttributeContainerList::allocator_type ball::AttributeContainerList::get_allocator ( ) const
inline

Return the allocator used by this object to supply memory. Note that if no allocator was supplied at construction the default allocator in effect at construction is used.

◆ hasValue()

bool ball::AttributeContainerList::hasValue ( const Attribute value) const

Return true if the attribute having specified value exists in any of the attribute containers referred to by this object, and false otherwise.

◆ numContainers()

int ball::AttributeContainerList::numContainers ( ) const
inline

Return the number of attribute container addresses currently in this list.

◆ operator=()

AttributeContainerList & ball::AttributeContainerList::operator= ( const AttributeContainerList rhs)

Assign this container list the value of the specified rhs one, and return a reference to this list.

◆ print()

bsl::ostream & ball::AttributeContainerList::print ( bsl::ostream &  stream,
int  level = 0,
int  spacesPerLevel = 4 
) const

Format this object to the specified output stream at the (absolute value of) the optionally specified indentation level and return a reference to stream. If level is specified, optionally specify spacesPerLevel, the number of spaces per indentation level for this and all of its nested objects. If level is negative, suppress indentation of the first line. If spacesPerLevel is negative, format the entire output on one line, suppressing all but the initial indentation (as governed by level). If stream is not valid on entry, this operation has no effect.

◆ pushFront()

iterator ball::AttributeContainerList::pushFront ( const AttributeContainer container)

Prepend the address of the specified container to this list of attribute container addresses, and return an iterator located at the newly added list element.

◆ remove()

void ball::AttributeContainerList::remove ( const iterator element)

Remove the specified element from this list. The behavior is undefined unless element is a valid iterator on this list and the referenced address has not previously been removed (by either remove(), removeAll(), or removeAllAndRelease().

◆ removeAll()

void ball::AttributeContainerList::removeAll ( )

Remove all the elements from this list. After this operation returns, numContainers() will be 0. This operation adds all the allocated memory to an internal free store, and does not deallocate any memory.

◆ removeAllAndRelease()

void ball::AttributeContainerList::removeAllAndRelease ( )

Remove all the elements from this list and deallocate any allocated memory.


The documentation for this class was generated from the following file: