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

#include <ball_managedattributeset.h>

Public Types

typedef bsl::allocator< char > allocator_type
 
typedef SetType::const_iterator const_iterator
 

Public Member Functions

 BSLMF_NESTED_TRAIT_DECLARATION (ManagedAttributeSet, bslma::UsesBslmaAllocator)
 
 ManagedAttributeSet ()
 
 ManagedAttributeSet (const allocator_type &allocator)
 
 ManagedAttributeSet (const ManagedAttributeSet &original, const allocator_type &allocator=allocator_type())
 
 ~ManagedAttributeSet ()=default
 Destroy this attribute set.
 
ManagedAttributeSetoperator= (const ManagedAttributeSet &rhs)
 
bool addAttribute (const ManagedAttribute &value)
 
int addPredicate (const ManagedAttribute &value)
 
void removeAll ()
 Remove all attributes from this attribute set.
 
void removeAllPredicates ()
 
bool removeAttribute (const ManagedAttribute &value)
 
int removePredicate (const ManagedAttribute &value)
 
bool evaluate (const AttributeContainerList &containerList) const
 
allocator_type get_allocator () const
 
bool isMember (const ManagedAttribute &value) const
 
int numAttributes () const
 Return the number of attributes managed by this object.
 
int numPredicates () const
 
const_iterator begin () const
 
const_iterator end () const
 
bsl::ostream & print (bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
 

Static Public Member Functions

static int hash (const ManagedAttributeSet &set, int size)
 

Friends

bool operator== (const ManagedAttributeSet &, const ManagedAttributeSet &)
 
bool operator!= (const ManagedAttributeSet &, const ManagedAttributeSet &)
 
bsl::ostream & operator<< (bsl::ostream &, const ManagedAttributeSet &)
 

Detailed Description

This class implements a value-semantic collection of unique attributes. (Note that an attribute is a compound entity that, as a whole, must be unique although individual parts need not be.) Additionally, the evaluate accessor can be used to determine if every attribute in the set is present in the specified attribute container list.

See ball_managedattributeset

Member Typedef Documentation

◆ allocator_type

◆ const_iterator

Constructor & Destructor Documentation

◆ ManagedAttributeSet() [1/3]

ball::ManagedAttributeSet::ManagedAttributeSet ( )
inline

◆ ManagedAttributeSet() [2/3]

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

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

◆ ManagedAttributeSet() [3/3]

ball::ManagedAttributeSet::ManagedAttributeSet ( const ManagedAttributeSet original,
const allocator_type allocator = allocator_type() 
)
inline

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

◆ ~ManagedAttributeSet()

ball::ManagedAttributeSet::~ManagedAttributeSet ( )
default

Member Function Documentation

◆ addAttribute()

bool ball::ManagedAttributeSet::addAttribute ( const ManagedAttribute value)
inline

Add an attribute having the specified value to this object. Return true on success and false if an attribute having the same value already exists in this object.

◆ addPredicate()

int ball::ManagedAttributeSet::addPredicate ( const ManagedAttribute value)
inline

Add an attribute having the specified value to this object. Return 1 on success and 0 if an attribute having the same value already exists in this object.

Deprecated:
Use addAttribute instead.

◆ begin()

ManagedAttributeSet::const_iterator ball::ManagedAttributeSet::begin ( ) const
inline

Return an iterator referring to the first member of this attribute set.

◆ BSLMF_NESTED_TRAIT_DECLARATION()

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

◆ end()

ManagedAttributeSet::const_iterator ball::ManagedAttributeSet::end ( ) const
inline

Return an iterator referring to one past the last member of this attribute set.

◆ evaluate()

bool ball::ManagedAttributeSet::evaluate ( const AttributeContainerList containerList) const

Return true if for every attribute maintained by this object, an attribute with the same name and value exists in the specified containerList, or if this object has no attributes; otherwise return false.

◆ get_allocator()

ManagedAttributeSet::allocator_type ball::ManagedAttributeSet::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.

◆ hash()

static int ball::ManagedAttributeSet::hash ( const ManagedAttributeSet set,
int  size 
)
static

Return a hash value calculated from the specified set using the specified size as the number of slots. The hash value is guaranteed to be in the range [0 .. size - 1]. The behavior is undefined unless 0 < size.

◆ isMember()

bool ball::ManagedAttributeSet::isMember ( const ManagedAttribute value) const
inline

Return true if an attribute having specified value exists in this object, and false otherwise.

◆ numAttributes()

int ball::ManagedAttributeSet::numAttributes ( ) const
inline

◆ numPredicates()

int ball::ManagedAttributeSet::numPredicates ( ) const
inline

◆ operator=()

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

Assign the value of the specified rhs to this object, and return a reference providing modifiable access to this object.

◆ print()

bsl::ostream & ball::ManagedAttributeSet::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.

◆ removeAll()

void ball::ManagedAttributeSet::removeAll ( )
inline

◆ removeAllPredicates()

void ball::ManagedAttributeSet::removeAllPredicates ( )
inline
Deprecated:
Use removeAll instead.

◆ removeAttribute()

bool ball::ManagedAttributeSet::removeAttribute ( const ManagedAttribute value)
inline

Remove the attribute having the specified value from this object. Return true on success and false if an attribute having the value does not exist in this object.

◆ removePredicate()

int ball::ManagedAttributeSet::removePredicate ( const ManagedAttribute value)
inline

Remove the attribute having the specified value from this object. Return the number of attributes removed (i.e., 1 on success and 0 if an attribute having value does not exist in this object).

Deprecated:
Use removeAttribute instead.

Friends And Related Symbol Documentation

◆ operator!=

bool operator!= ( const ManagedAttributeSet ,
const ManagedAttributeSet  
)
friend

Return true if the specified lhs and rhs objects do not have the same value, and false otherwise. Two ManagedAttributeSet objects do not have the same value if they do not have the same number of attributes or there is at least one attribute value that appears in one object, but not in the other.

◆ operator<<

bsl::ostream & operator<< ( bsl::ostream &  ,
const ManagedAttributeSet  
)
friend

Write the value of the specified attributeSet to the specified output stream. Return the specified output stream.

◆ operator==

bool operator== ( const ManagedAttributeSet ,
const ManagedAttributeSet  
)
friend

Return true if the specified lhs and rhs objects have the same value, and false otherwise. Two ManagedAttributeSet objects have the same value if they have the same number of attributes and every attribute value that appears in one object also appears in the other.


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