#include <ball_categorymanager.h>
|
| | CategoryManager (bslma::Allocator *basicAllocator=0) |
| |
| | ~CategoryManager () |
| | Destroy this category manager.
|
| |
| Category & | operator[] (int index) |
| |
| Category * | addCategory (const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel) |
| |
| Category * | addCategory (CategoryHolder *categoryHolder, const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel) |
| |
| Category * | lookupCategory (const char *categoryName) |
| |
| Category * | lookupCategory (CategoryHolder *categoryHolder, const char *categoryName) |
| |
| void | resetCategoryHolders () |
| |
| Category * | setThresholdLevels (const char *categoryName, int recordLevel, int passLevel, int triggerLevel, int triggerAllLevel) |
| |
| int | addRule (const Rule &ruleToAdd) |
| |
| int | addRules (const RuleSet &ruleSet) |
| |
| int | removeRule (const Rule &ruleToRemove) |
| |
| int | removeRules (const RuleSet &ruleSet) |
| |
| void | removeAllRules () |
| |
| bslmt::Mutex & | rulesetMutex () |
| |
| template<class t_CATEGORY_VISITOR > |
| void | visitCategories (const t_CATEGORY_VISITOR &visitor) |
| |
| const Category & | operator[] (int index) const |
| |
| int | length () const |
| |
| const Category * | lookupCategory (const char *categoryName) const |
| |
| const RuleSet & | ruleSet () const |
| |
| bsls::Types::Int64 | ruleSetSequenceNumber () const |
| |
| template<class t_CATEGORY_VISITOR > |
| void | visitCategories (const t_CATEGORY_VISITOR &visitor) const |
| |
This class manages a set (or "registry") of categories. Categories may be added to the registry, but they cannot be removed. However, the threshold levels of existing categories may be accessed and modified directly.
See ball_categorymanager
◆ CategoryManager()
Create a category manager. Optionally specify a basicAllocator used to supply memory. If basicAllocator is 0, the currently installed default allocator is used.
◆ ~CategoryManager()
| ball::CategoryManager::~CategoryManager |
( |
| ) |
|
◆ addCategory() [1/2]
| Category * ball::CategoryManager::addCategory |
( |
CategoryHolder * |
categoryHolder, |
|
|
const char * |
categoryName, |
|
|
int |
recordLevel, |
|
|
int |
passLevel, |
|
|
int |
triggerLevel, |
|
|
int |
triggerAllLevel |
|
) |
| |
Add to the registry of this category manager a category having the specified categoryName and the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold values, respectively, if there is no category having categoryName and each of the specified threshold values is in the range [0 .. 255]. Return the address of the newly-created, modifiable category on success, and 0 otherwise. If a newly-created category is returned and the specified categoryHolder is non-null, then also load into categoryHolder the returned category and its maximum level and link categoryHolder to the category. The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex. Note that if a category having categoryName already exists in the registry, 0 is returned.
◆ addCategory() [2/2]
| Category * ball::CategoryManager::addCategory |
( |
const char * |
categoryName, |
|
|
int |
recordLevel, |
|
|
int |
passLevel, |
|
|
int |
triggerLevel, |
|
|
int |
triggerAllLevel |
|
) |
| |
Add to the registry of this category manager a category having the specified categoryName and the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold values, respectively, if there is no category having categoryName and each of the specified threshold values is in the range [0 .. 255]. Return the address of the newly-created, modifiable category on success, and 0 otherwise. The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex. Note that if a category having categoryName already exists in the registry, 0 is returned.
◆ addRule()
| int ball::CategoryManager::addRule |
( |
const Rule & |
ruleToAdd | ) |
|
Add the specified ruleToAdd to the set of (unique) rules maintained by // this object. Return the number of rules added (i.e., 1 on success and 0 if a rule with the same value is already present). The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex.
◆ addRules()
| int ball::CategoryManager::addRules |
( |
const RuleSet & |
ruleSet | ) |
|
Add each rule in the specified ruleSet to the set of (unique) rules maintained by this object. Return the number of rules added. The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex. Note that each rule having the same value as an existing rule will be ignored.
◆ length()
| int ball::CategoryManager::length |
( |
| ) |
const |
|
inline |
Return the number of categories in the registry of this category manager.
◆ lookupCategory() [1/3]
| Category * ball::CategoryManager::lookupCategory |
( |
CategoryHolder * |
categoryHolder, |
|
|
const char * |
categoryName |
|
) |
| |
Return the address of the modifiable category having the specified categoryName in the registry of this category manager, or 0 if no such category exists. If a category is returned and the specified categoryHolder is non-null, then also load into categoryHolder the returned category and its maximum level and link categoryHolder to the category if it has not yet been linked.
◆ lookupCategory() [2/3]
| Category * ball::CategoryManager::lookupCategory |
( |
const char * |
categoryName | ) |
|
Return the address of the modifiable category having the specified categoryName in the registry of this category manager, or 0 if no such category exists.
◆ lookupCategory() [3/3]
| const Category * ball::CategoryManager::lookupCategory |
( |
const char * |
categoryName | ) |
const |
Return the address of the non-modifiable category having the specified categoryName in the registry of this category manager, or 0 if no such category exists.
◆ operator[]() [1/2]
| Category & ball::CategoryManager::operator[] |
( |
int |
index | ) |
|
|
inline |
Return a non-const reference to the category at the specified index in the registry of this category manager. The behavior is undefined unless 0 <= index < length().
◆ operator[]() [2/2]
| const Category & ball::CategoryManager::operator[] |
( |
int |
index | ) |
const |
|
inline |
Return a const reference to the category at the specified index in the registry of this category manager. The behavior is undefined unless 0 <= index < length().
◆ removeAllRules()
| void ball::CategoryManager::removeAllRules |
( |
| ) |
|
Remove every rule from the set of rules maintained by this object. The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex.
◆ removeRule()
| int ball::CategoryManager::removeRule |
( |
const Rule & |
ruleToRemove | ) |
|
Remove the specified ruleToRemove from the set of (unique) rules maintained by this object. Return the number of rules removed (i.e., 1 on success and 0 if no rule having the same value is found). The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex.
◆ removeRules()
| int ball::CategoryManager::removeRules |
( |
const RuleSet & |
ruleSet | ) |
|
Remove each rule in the specified ruleSet from the set of rules maintained by this object. Return the number of rules removed. The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex.
◆ resetCategoryHolders()
| void ball::CategoryManager::resetCategoryHolders |
( |
| ) |
|
Reset the category holders to which all categories in the registry of this category manager are linked to their default value. See the function-level documentation of CategoryHolder::reset() for further information on the default value of category holders.
◆ ruleSet()
| const RuleSet & ball::CategoryManager::ruleSet |
( |
| ) |
const |
|
inline |
Return a const reference to the rule set maintained by this category manager. The mutex returned by rulesetMutex should be locked prior to accessing the rule set.
◆ rulesetMutex()
Return a non-const reference to the mutex that is used to guard against concurrent access to the rule set. A lock on the returned mutex should be acquired before accessing the properties of the rule set returned by ruleSet. The behavior is undefined unless a lock is acquired solely for the purpose of calling ruleSet.
◆ ruleSetSequenceNumber()
Return the sequence number that tracks changes to the rule set maintained by this category manager. The value returned by this method is guaranteed to monotonically increase between calls before and after the rule set is changed, and is otherwise implementation defined.
◆ setThresholdLevels()
| Category * ball::CategoryManager::setThresholdLevels |
( |
const char * |
categoryName, |
|
|
int |
recordLevel, |
|
|
int |
passLevel, |
|
|
int |
triggerLevel, |
|
|
int |
triggerAllLevel |
|
) |
| |
Set the threshold levels of the category having the specified categoryName in the registry of this category manager to the specified recordLevel, passLevel, triggerLevel, and triggerAllLevel values, respectively, if a category having categoryName exists and each of the specified threshold values is in the range [0 .. 255]. Otherwise, add to the registry a category having categoryName and recordLevel, passLevel, triggerLevel, and triggerAllLevel threshold values, respectively, if there is no category having categoryName and each of the specified threshold values is in the range [0 .. 255]. Return the address of the (possibly newly-created) modifiable category on success, and 0 otherwise (with no effect on any category). The behavior is undefined unless a lock is not held by this thread on the mutex returned by rulesetMutex.
◆ visitCategories() [1/2]
template<class t_CATEGORY_VISITOR >
| void ball::CategoryManager::visitCategories |
( |
const t_CATEGORY_VISITOR & |
visitor | ) |
|
Invoke the specified visitor functor on each category managed by this object, supplying that functor modifiable access to each category. visitor must be a functor that can be called as if it had the following signature:
Definition ball_category.h:184
◆ visitCategories() [2/2]
template<class t_CATEGORY_VISITOR >
| void ball::CategoryManager::visitCategories |
( |
const t_CATEGORY_VISITOR & |
visitor | ) |
const |
Invoke the specified visitor functor on each category managed by this object, supplying that functor non-modifiable access to each category. visitor must be a functor that can be called as if it had the following signature:
The documentation for this class was generated from the following file: