Boost  v1.57.0
doxygen for www.boost.org
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
boost::attributes::named_scope Class Reference

A class of an attribute that holds stack of named scopes of the current thread. More...

#include <named_scope.hpp>

Inheritance diagram for boost::attributes::named_scope:
Collaboration diagram for boost::attributes::named_scope:

Classes

struct  sentry
 Sentry object class to automatically push and pop scopes. More...
 

Public Types

typedef named_scope_list value_type
 Scope names stack (the attribute value type) More...
 
typedef value_type::value_type scope_entry
 Scope entry. More...
 

Public Member Functions

 named_scope ()
 Constructor. More...
 
 named_scope (cast_source const &source)
 Constructor for casting support. More...
 
bool operator! () const BOOST_NOEXCEPT
 Verifies that the factory is not in empty state. More...
 
attribute_value get_value () const
 
void swap (attribute &that) BOOST_NOEXCEPT
 The method swaps two factories (i.e. More...
 

Static Public Member Functions

static void push_scope (scope_entry const &entry) BOOST_NOEXCEPT
 The method pushes the scope to the back of the current thread's scope list. More...
 
static void pop_scope () BOOST_NOEXCEPT
 The method pops the last pushed scope from the current thread's scope list. More...
 
static value_type const & get_scopes ()
 

Protected Member Functions

implget_impl () const BOOST_NOEXCEPT
 
void set_impl (intrusive_ptr< impl > p) BOOST_NOEXCEPT
 Sets the pointer to the factory implementation. More...
 

Detailed Description

A class of an attribute that holds stack of named scopes of the current thread.

The basic_named_scope attribute is essentially a hook to the thread-specific instance of scope list. This means that the attribute will generate different values if get_value is called in different threads. The attribute generates value with stored type basic_named_scope_list< CharT >.

The attribute class can also be used to gain access to the scope stack instance, e.g. to get its copy or to push or pop a scope entry. However, it is highly not recommended to maintain scope list manually. Use BOOST_LOG_NAMED_SCOPE or BOOST_LOG_FUNCTION macros instead.

Member Typedef Documentation

Scope names stack (the attribute value type)

Constructor & Destructor Documentation

boost::attributes::named_scope::named_scope ( )

Constructor.

Creates an attribute.

boost::attributes::named_scope::named_scope ( cast_source const &  source)
explicit

Constructor for casting support.

Member Function Documentation

static value_type const& boost::attributes::named_scope::get_scopes ( )
static
Returns
The current thread's list of scopes
Note
The returned reference is only valid until the current thread ends. The scopes in the returned container may change if the execution scope is changed (i.e. either push_scope or pop_scope is called). User has to copy the stack if he wants to keep it intact regardless of the execution scope.

Referenced by boost::current_scope().

attribute_value boost::attribute::get_value ( ) const
inherited
Returns
The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors).
bool boost::attribute::operator! ( ) const
inlineinherited

Verifies that the factory is not in empty state.

Verifies that the factory is in empty state

static void boost::attributes::named_scope::pop_scope ( )
static

The method pops the last pushed scope from the current thread's scope list.

Throws: Nothing.

Referenced by boost::attributes::named_scope::sentry::~sentry().

static void boost::attributes::named_scope::push_scope ( scope_entry const &  entry)
static

The method pushes the scope to the back of the current thread's scope list.

Throws: Nothing.

Referenced by boost::attributes::named_scope::sentry::sentry().

void boost::attribute::set_impl ( intrusive_ptr< impl p)
inlineprotectedinherited

Sets the pointer to the factory implementation.

Parameters
pPointer to the implementation. Must not be NULL.

References boost::multiprecision::backends::p, and boost::intrusive_ptr< T >::swap().

Referenced by boost::attributes::counter< T >::counter().

void boost::attribute::swap ( attribute that)
inlineinherited

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