Quick Links:

bal | bbl | bdl | bsl

Public Member Functions

balm::Category Class Reference

#include <balm_category.h>

List of all members.

Public Member Functions

 Category (const char *name, bool enabledFlag=true)
 ~Category ()
void setName (const char *name)
void setEnabled (bool enabledFlag)
void registerCategoryHolder (CategoryHolder *holder)
const char * name () const
bool enabled () const
const bsls::AtomicIntisEnabledRaw () const
bsl::ostream & print (bsl::ostream &stream) const

Detailed Description

This class provides a mechanism for representing a category. A category is an identifier used to group related metrics. A Category object contains the address of a null-terminated string, name, holding the name of the category and a boolean value, enabled, indicating whether the category is currently enabled.

See Component balm_category


Constructor & Destructor Documentation

balm::Category::Category ( const char *  name,
bool  enabledFlag = true 
) [explicit]

Create a category having the specified name address. Optionally specify enabledFlag, the enabled status of the category; if enabledFlag is not specified, the enabled status is true. The behavior is undefined unless name remains valid and unmodified for the lifetime of this object.

balm::Category::~Category (  ) 

Destroy this category object.


Member Function Documentation

void balm::Category::setName ( const char *  name  ) 

Set the name of this metric to the specified name address. The behavior is undefined unless name remains valid and unmodified for the lifetime of this object.

void balm::Category::setEnabled ( bool  enabledFlag  ) 

Set the enabled state of this category to the value of the specified enabledFlag and update any CategoryHolder objects registered with this category. Note that this operation is not atomic, and other threads may simultaneously access the current enabled value while this operation is performed. Also note that this operation has linear performance with respect to the number of registered category holders for category.

void balm::Category::registerCategoryHolder ( CategoryHolder *  holder  ) 

Load into the specified holder the address of this category, its enabled() status, and the address of the next holder in the linked list of category holders maintained by this object (prepending holder to this category's linked list of category holders). This category will update holder->enabled() when its enabled state changes, and will reset holder (i.e., holder->reset()) when this category is destroyed. The behavior is undefined unless holder remains valid and unmodified (by the client) for the lifetime of this object and is not registered again with any category (including this one).

const char* balm::Category::name (  )  const

Return the address of the non-modifiable null-terminated string containing the name of this category.

bool balm::Category::enabled (  )  const

Report whether this category is enabled. This function is fully thread-safe.

const bsls::AtomicInt& balm::Category::isEnabledRaw (  )  const

Return a reference to a const value indicating the enabled status of this category, allowing downstream uses to minimize latency by avoiding indirection through abstracted interfaces, albeit at some risk of object-lifetime violations. The returned reference must not be allowed to outlive this category object.

bsl::ostream& balm::Category::print ( bsl::ostream &  stream  )  const

Print this category to the specified output stream in some human readable form, and return the modifiable stream.


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