An attribute set class. More...
#include <attribute_set.hpp>
Public Types | |
typedef attribute_name | key_type |
Key type. More... | |
typedef attribute | 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 |
Difference type. More... | |
typedef iter< false > | iterator |
Iterator type. More... | |
typedef iter< true > | const_iterator |
Const iterator type. More... | |
Public Member Functions | |
BOOST_LOG_API | attribute_set () |
Default constructor. More... | |
BOOST_LOG_API | attribute_set (attribute_set const &that) |
Copy constructor. More... | |
attribute_set (BOOST_RV_REF(attribute_set) that) BOOST_NOEXCEPT | |
Move constructor. More... | |
BOOST_LOG_API | ~attribute_set () BOOST_NOEXCEPT |
Destructor. More... | |
attribute_set & | operator= (attribute_set that) BOOST_NOEXCEPT |
Copy assignment operator. More... | |
void | swap (attribute_set &that) BOOST_NOEXCEPT |
Swaps two instances of the container. More... | |
BOOST_LOG_API iterator | begin () BOOST_NOEXCEPT |
BOOST_LOG_API iterator | end () BOOST_NOEXCEPT |
BOOST_LOG_API const_iterator | begin () const BOOST_NOEXCEPT |
BOOST_LOG_API const_iterator | end () const BOOST_NOEXCEPT |
BOOST_LOG_API size_type | size () const BOOST_NOEXCEPT |
bool | empty () const BOOST_NOEXCEPT |
BOOST_LOG_API iterator | find (key_type key) BOOST_NOEXCEPT |
The method finds the attribute by name. More... | |
const_iterator | find (key_type key) const BOOST_NOEXCEPT |
The method finds the attribute by name. More... | |
size_type | count (key_type key) const BOOST_NOEXCEPT |
The method counts the number of the attribute occurrences in the container. More... | |
aux::attribute_set_reference_proxy | operator[] (key_type key) BOOST_NOEXCEPT |
Combined lookup/insertion operator. More... | |
mapped_type | operator[] (key_type key) const BOOST_NOEXCEPT |
Lookup operator. More... | |
BOOST_LOG_API std::pair < iterator, bool > | insert (key_type key, mapped_type const &data) |
Insertion method. More... | |
std::pair< iterator, bool > | insert (const_reference value) |
Insertion method. 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... | |
BOOST_LOG_API size_type | erase (key_type key) BOOST_NOEXCEPT |
The method erases all attributes with the specified name. More... | |
BOOST_LOG_API void | erase (iterator it) BOOST_NOEXCEPT |
The method erases the specified attribute. More... | |
BOOST_LOG_API void | erase (iterator begin, iterator end) BOOST_NOEXCEPT |
The method erases all attributes within the specified range. More... | |
BOOST_LOG_API void | clear () BOOST_NOEXCEPT |
The method removes all elements from the container. More... | |
Friends | |
class | attribute_value_set |
class | aux::attribute_set_reference_proxy |
An attribute set class.
An attribute set is an associative container with attribute name as a key and pointer to the attribute as a mapped value. The container allows storing only one element for each distinct key value. In most regards attribute set container provides interface similar to std::unordered_map
. However, there are differences in operator
[] semantics and a number of optimizations with regard to iteration. Besides, attribute names are stored as a read-only attribute_name
's instead of std::string
, which saves memory and CPU time.
typedef iter< true > boost::attribute_set::const_iterator |
Const iterator type.
typedef value_type const* boost::attribute_set::const_pointer |
Const pointer type.
typedef value_type const& boost::attribute_set::const_reference |
Const reference type.
typedef std::ptrdiff_t boost::attribute_set::difference_type |
Difference type.
typedef iter< false > boost::attribute_set::iterator |
Iterator type.
Key type.
Mapped attribute type.
typedef value_type* boost::attribute_set::pointer |
Pointer type.
Reference type.
typedef std::size_t boost::attribute_set::size_type |
Size type.
typedef std::pair< const key_type, mapped_type > boost::attribute_set::value_type |
Value type.
BOOST_LOG_API boost::attribute_set::attribute_set | ( | ) |
Default constructor.
empty() == true
BOOST_LOG_API boost::attribute_set::attribute_set | ( | attribute_set const & | that | ) |
Copy constructor.
size() == that.size() && std::equal(begin(), end(), that.begin()) == true
|
inline |
Move constructor.
BOOST_LOG_API boost::attribute_set::~attribute_set | ( | ) |
Destructor.
All stored references to attributes are released.
BOOST_LOG_API iterator boost::attribute_set::begin | ( | ) |
BOOST_LOG_API const_iterator boost::attribute_set::begin | ( | ) | const |
BOOST_LOG_API void boost::attribute_set::clear | ( | ) |
The method removes all elements from the container.
empty() == true
Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_all_attributes_unlocked().
The method counts the number of the attribute occurrences in the container.
Since there can be only one attribute with a particular key, the method always return 0 or 1.
key | Attribute name. |
References boost::end, and boost::algorithm::find().
|
inline |
References boost::size().
BOOST_LOG_API iterator boost::attribute_set::end | ( | ) |
Referenced by boost::aux::attribute_set_reference_proxy::operator mapped_type().
BOOST_LOG_API const_iterator boost::attribute_set::end | ( | ) | const |
The method erases all attributes with the specified name.
key | Attribute name. |
Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::remove_attribute_unlocked().
BOOST_LOG_API void boost::attribute_set::erase | ( | iterator | it | ) |
The method erases the specified attribute.
it | A valid iterator to the element to be erased. |
The method erases all attributes within the specified range.
begin | An iterator that points to the first element to be erased. |
end | An iterator that points to the after-the-last element to be erased. |
The method finds the attribute by name.
key | Attribute name. |
Referenced by boost::aux::attribute_set_reference_proxy::operator mapped_type().
|
inline |
The method finds the attribute by name.
key | Attribute name. |
end()
if the attribute with such name is not found. References boost::algorithm::find().
BOOST_LOG_API std::pair< iterator, bool > boost::attribute_set::insert | ( | key_type | key, |
mapped_type const & | data | ||
) |
Insertion method.
key | Attribute name. |
data | Pointer to the attribute. Must not be NULL. |
Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::add_attribute_unlocked(), and boost::aux::attribute_set_reference_proxy::operator=().
|
inline |
Insertion method.
value | An element to be inserted. |
References boost::xpressive::insert.
|
inline |
Mass insertion method.
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. |
References boost::asio::begin, boost::end, and boost::xpressive::insert.
|
inline |
Mass insertion method with ability to acquire iterators to the inserted elements.
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 boost::asio::begin, boost::end, boost::xpressive::insert, and boost::out.
|
inline |
Copy assignment operator.
size() == that.size() && std::equal(begin(), end(), that.begin()) == true
References boost::swap.
|
inline |
Combined lookup/insertion operator.
The operator semantics depends on the further usage of the returned reference.
operator
[] as a key and the second argument of assignment as a mapped value. operator
[] as a key, if such an element exists in the container, or a default-constructed mapped value, if an element does not exist in the container.key | Attribute name. |
|
inline |
Lookup operator.
key | Attribute name. |
References boost::end, boost::algorithm::find(), and boost::it.
BOOST_LOG_API size_type boost::attribute_set::size | ( | ) | const |
|
inline |
Swaps two instances of the container.
Throws: Nothing.
References boost::multiprecision::backends::p.
Referenced by boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::basic_logger(), and boost::sources::basic_logger< CharT, FinalT, ThreadingModelT >::swap_unlocked().
|
friend |
|
friend |