A set of attribute values. More...
#include <attribute_value_set.hpp>
Classes | |
class | const_iterator |
Public Types | |
typedef attribute_name | key_type |
Key type. More... | |
typedef attribute_value | mapped_type |
Mapped attribute type. More... | |
typedef std::pair< const key_type, mapped_type > | value_type |
Value type. More... | |
typedef value_type & | reference |
Reference type. More... | |
typedef value_type const & | const_reference |
Const reference type. More... | |
typedef value_type * | pointer |
Pointer type. More... | |
typedef value_type const * | const_pointer |
Const pointer type. More... | |
typedef std::size_t | size_type |
Size type. More... | |
typedef std::ptrdiff_t | difference_type |
Pointer difference type. More... | |
Public Member Functions | |
BOOST_LOG_API | attribute_value_set (size_type reserve_count=8) |
Default constructor. More... | |
attribute_value_set (BOOST_RV_REF(attribute_value_set) that) BOOST_NOEXCEPT | |
Move constructor. More... | |
BOOST_LOG_API | attribute_value_set (attribute_set const &source_attrs, attribute_set const &thread_attrs, attribute_set const &global_attrs, size_type reserve_count=8) |
The constructor adopts three attribute sets into the value set. More... | |
BOOST_LOG_API | attribute_value_set (attribute_value_set const &source_attrs, attribute_set const &thread_attrs, attribute_set const &global_attrs, size_type reserve_count=8) |
The constructor adopts three attribute sets into the value set. More... | |
attribute_value_set (BOOST_RV_REF(attribute_value_set) source_attrs, attribute_set const &thread_attrs, attribute_set const &global_attrs, size_type reserve_count=8) | |
The constructor adopts three attribute sets into the value set. More... | |
BOOST_LOG_API | attribute_value_set (attribute_value_set const &that) |
Copy constructor. More... | |
BOOST_LOG_API | ~attribute_value_set () BOOST_NOEXCEPT |
Destructor. More... | |
attribute_value_set & | operator= (attribute_value_set that) BOOST_NOEXCEPT |
Assignment operator. More... | |
void | swap (attribute_value_set &that) BOOST_NOEXCEPT |
Swaps two sets. More... | |
BOOST_LOG_API const_iterator | begin () const |
BOOST_LOG_API const_iterator | end () const |
BOOST_LOG_API size_type | size () const |
bool | empty () const |
BOOST_LOG_API const_iterator | find (key_type key) const |
The method finds the attribute value by name. More... | |
mapped_type | operator[] (key_type key) const |
Alternative lookup syntax. More... | |
template<typename DescriptorT , template< typename > class ActorT> | |
result_of::extract< typename expressions::attribute_keyword < DescriptorT, ActorT > ::value_type, DescriptorT > ::type | operator[] (expressions::attribute_keyword< DescriptorT, ActorT > const &keyword) const |
Alternative lookup syntax. More... | |
size_type | count (key_type key) const |
The method counts the number of the attribute value occurrences in the set. More... | |
BOOST_LOG_API void | freeze () |
The method acquires values of all adopted attributes. More... | |
BOOST_LOG_API std::pair < const_iterator, bool > | insert (key_type key, mapped_type const &mapped) |
Inserts an element into the set. More... | |
std::pair< const_iterator, bool > | insert (const_reference value) |
Inserts an element into the set. More... | |
template<typename FwdIteratorT > | |
void | insert (FwdIteratorT begin, FwdIteratorT end) |
Mass insertion method. More... | |
template<typename FwdIteratorT , typename OutputIteratorT > | |
void | insert (FwdIteratorT begin, FwdIteratorT end, OutputIteratorT out) |
Mass insertion method with ability to acquire iterators to the inserted elements. More... | |
Friends | |
struct | implementation |
struct | node |
class | const_iterator |
A set of attribute values.
The set of attribute values is an associative container with attribute name as a key and a pointer to attribute value object as a mapped type. This is a collection of elements with unique keys, that is, there can be only one attribute value with a given name in the set. With respect to read-only capabilities, the set interface is close to std::unordered_map
.
The set is designed to be only capable of adding elements to it. Once added, the attribute value cannot be removed from the set.
An instance of attribute value set can be constructed from three attribute sets. The constructor attempts to accommodate values of all attributes from the sets. The situation when a same-named attribute is found in more than one attribute set is possible. This problem is solved on construction of the value set: the three attribute sets have different priorities when it comes to solving conflicts.
From the library perspective the three source attribute sets are global, thread-specific and source-specific attributes, with the latter having the highest priority. This feature allows to override attributes of wider scopes with the more specific ones.
For sake of performance, the attribute values are not immediately acquired from attribute sets at construction. Instead, on-demand acquisition is performed either on iterator dereferencing or on call to the freeze
method. Once acquired, the attribute value stays within the set until its destruction. This nuance does not affect other set properties, such as size or lookup ability. The logging core automatically freezes the set at the right point, so users should not be bothered unless they manually create attribute value sets.
typedef value_type const* boost::attribute_value_set::const_pointer |
Const pointer type.
typedef value_type const& boost::attribute_value_set::const_reference |
Const reference type.
typedef std::ptrdiff_t boost::attribute_value_set::difference_type |
Pointer difference type.
Key type.
Mapped attribute type.
Pointer type.
Reference type.
typedef std::size_t boost::attribute_value_set::size_type |
Size type.
typedef std::pair< const key_type, mapped_type > boost::attribute_value_set::value_type |
Value type.
|
explicit |
Default constructor.
The constructor creates an empty set which can be filled later by subsequent calls of insert
method. Optionally, the amount of storage reserved for elements to be inserted may be passed to the constructor. The constructed set is frozen.
reserve_count | Number of elements to reserve space for. |
|
inline |
Move constructor.
BOOST_LOG_API boost::attribute_value_set::attribute_value_set | ( | attribute_set const & | source_attrs, |
attribute_set const & | thread_attrs, | ||
attribute_set const & | global_attrs, | ||
size_type | reserve_count = 8 |
||
) |
The constructor adopts three attribute sets into the value set.
The source_attrs attributes have the greatest preference when a same-named attribute is found in several sets, global_attrs has the least. The constructed set is not frozen.
source_attrs | A set of source-specific attributes. |
thread_attrs | A set of thread-specific attributes. |
global_attrs | A set of global attributes. |
reserve_count | Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. |
BOOST_LOG_API boost::attribute_value_set::attribute_value_set | ( | attribute_value_set const & | source_attrs, |
attribute_set const & | thread_attrs, | ||
attribute_set const & | global_attrs, | ||
size_type | reserve_count = 8 |
||
) |
The constructor adopts three attribute sets into the value set.
The source_attrs attributes have the greatest preference when a same-named attribute is found in several sets, global_attrs has the least. The constructed set is not frozen.
source_attrs | A set of source-specific attributes. |
thread_attrs | A set of thread-specific attributes. |
global_attrs | A set of global attributes. |
reserve_count | Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. |
|
inline |
The constructor adopts three attribute sets into the value set.
The source_attrs attributes have the greatest preference when a same-named attribute is found in several sets, global_attrs has the least. The constructed set is not frozen.
source_attrs | A set of source-specific attributes. |
thread_attrs | A set of thread-specific attributes. |
global_attrs | A set of global attributes. |
reserve_count | Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. |
BOOST_LOG_API boost::attribute_value_set::attribute_value_set | ( | attribute_value_set const & | that | ) |
Copy constructor.
std::equal(begin(), end(), that.begin()) == true
BOOST_LOG_API boost::attribute_value_set::~attribute_value_set | ( | ) |
Destructor.
Releases all referenced attribute values.
BOOST_LOG_API const_iterator boost::attribute_value_set::begin | ( | ) | const |
Referenced by insert().
The method counts the number of the attribute value occurrences in the set.
Since there can be only one attribute value with a particular key, the method always return 0 or 1.
key | Attribute name. |
|
inline |
References size().
BOOST_LOG_API const_iterator boost::attribute_value_set::end | ( | ) | const |
Referenced by count(), insert(), boost::expressions::has_attribute< void >::operator()(), boost::value_visitor_invoker< channel_value_type, channel_fallback_policy >::operator()(), boost::value_extractor< T, FallbackPolicyT, TagT >::operator()(), and operator[]().
BOOST_LOG_API const_iterator boost::attribute_value_set::find | ( | key_type | key | ) | const |
The method finds the attribute value by name.
key | Attribute name. |
end()
if the attribute with such name is not found. Referenced by count(), boost::expressions::has_attribute< void >::operator()(), boost::value_visitor_invoker< channel_value_type, channel_fallback_policy >::operator()(), boost::value_extractor< T, FallbackPolicyT, TagT >::operator()(), and operator[]().
BOOST_LOG_API void boost::attribute_value_set::freeze | ( | ) |
The method acquires values of all adopted attributes.
BOOST_LOG_API std::pair< const_iterator, bool > boost::attribute_value_set::insert | ( | key_type | key, |
mapped_type const & | mapped | ||
) |
Inserts an element into the set.
The complexity of the operation is amortized constant.
key | The attribute name. |
mapped | The attribute value. |
true
if insertion succeeded. Otherwise, if the set already contains a same-named attribute value, iterator to the existing element and false
. Referenced by insert(), and boost::operator<<().
|
inline |
Inserts an element into the set.
The complexity of the operation is amortized constant.
value | The attribute name and value. |
true
if insertion succeeded. Otherwise, if the set already contains a same-named attribute value, iterator to the existing element and false
. References insert().
Referenced by insert().
|
inline |
Mass insertion method.
The complexity of the operation is linear to the number of elements inserted.
begin | A forward iterator that points to the first element to be inserted. |
end | A forward iterator that points to the after-the-last element to be inserted. |
|
inline |
Mass insertion method with ability to acquire iterators to the inserted elements.
The complexity of the operation is linear to the number of elements inserted times the complexity of filling the out iterator.
begin | A forward iterator that points to the first element to be inserted. |
end | A forward iterator that points to the after-the-last element to be inserted. |
out | An output iterator that receives results of insertion of the elements. |
References begin(), end(), insert(), and boost::out.
|
inline |
Assignment operator.
References swap().
|
inline |
|
inline |
Alternative lookup syntax.
keyword | Attribute keyword. |
References end(), find(), boost::expressions::attribute_keyword< DescriptorT, ActorT >::get_name(), boost::it, and boost::detail::type.
BOOST_LOG_API size_type boost::attribute_value_set::size | ( | ) | const |
Referenced by empty().
|
inline |
Swaps two sets.
Throws: Nothing.
References implementation, and boost::multiprecision::backends::p.
Referenced by operator=().
|
friend |
|
friend |
Referenced by swap().
|
friend |