Quick Links:

bal | bbl | bdl | bsl

Classes | Public Types | Public Member Functions | Static Public Member Functions | Friends

ball::ManagedAttributeSet Class Reference

#include <ball_managedattributeset.h>

List of all members.

Classes

struct  AttributeHash

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 ()
ManagedAttributeSetoperator= (const ManagedAttributeSet &rhs)
bool addAttribute (const ManagedAttribute &value)
int addPredicate (const ManagedAttribute &value)
void removeAll ()
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
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 Component ball_managedattributeset


Member Typedef Documentation


Constructor & Destructor Documentation

ball::ManagedAttributeSet::ManagedAttributeSet (  ) 
ball::ManagedAttributeSet::ManagedAttributeSet ( const allocator_type allocator  )  [explicit]

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.

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

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.

ball::ManagedAttributeSet::~ManagedAttributeSet (  ) 

Destroy this attribute set.


Member Function Documentation

ball::ManagedAttributeSet::BSLMF_NESTED_TRAIT_DECLARATION ( ManagedAttributeSet  ,
bslma::UsesBslmaAllocator   
)
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.

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.

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

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.

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

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.

void ball::ManagedAttributeSet::removeAll (  ) 

Remove all attributes from this attribute set.

void ball::ManagedAttributeSet::removeAllPredicates (  ) 

DEPRECATED: Use removeAll instead.

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

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.

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

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.

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.

allocator_type ball::ManagedAttributeSet::get_allocator (  )  const

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.

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

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

int ball::ManagedAttributeSet::numAttributes (  )  const

Return the number of attributes managed by this object.

int ball::ManagedAttributeSet::numPredicates (  )  const

DEPRECATED: Use numAttributes instead.

const_iterator ball::ManagedAttributeSet::begin (  )  const

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

const_iterator ball::ManagedAttributeSet::end (  )  const

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

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.


Friends And Related Function Documentation

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.

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.

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.


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