Attributes
Andrey Semashev 15.04.2007 The header contains attribute interface definition. A base class for an attribute value factory. Every attribute is represented with a factory that is basically an attribute value generator. The sole purpose of an attribute is to return an actual value when requested. A simplest attribute can always return the same value that it stores internally, but more complex ones can perform a considerable amount of work to return a value, and the returned values may differ each time requested.A word about thread safety. An attribute should be prepared to be requested a value from multiple threads concurrently. boost::intrusive_ref_counter< impl >A base class for an attribute value factory. All attributes must derive their implementation from this class. attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). Virtual destructor. void *std::size_t voidvoid *std::size_t boolVerifies that the factory is not in empty state boolVerifies that the factory is in empty state attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). voidattribute &The method swaps two factories (i.e. their implementations). attribute const &Default constructor. Creates an empty attribute value factory, which is not usable until set_impl is called.Copy constructor attribute &&Move constructor intrusive_ptr< impl >Pointer to the implementation. Must not be NULL. Initializing constructor attribute &attribute const &Copy assignment attribute &attribute &&Move assignment impl * The pointer to the implementation voidintrusive_ptr< impl >Pointer to the implementation. Must not be NULL. Sets the pointer to the factory implementation. friend Tattribute const &The function casts one attribute factory to another voidattribute &attribute &The function swaps two attribute value factories
Andrey Semashev 06.08.2010 The header contains utilities for casting between attribute factories. The class holds a reference to the attribute factory implementation being casted T *The function attempts to cast the aggregated pointer to the implementation to the specified type. The converted pointer or NULL, if the conversion fails. attribute::impl *Initializing constructor. Creates a source that refers to the specified factory implementation. Tattribute const &The function casts one attribute factory to another
Andrey Semashev 28.06.2010 The header contains attribute name interface definition. The class represents an attribute name in containers used by the library. The class mostly serves for optimization purposes. Each attribute name that is used with the library is automatically associated with a unique identifier, which is much lighter in terms of memory footprint and operations complexity. This is done transparently by this class, on object construction. Passing objects of this class to other library methods, such as attribute lookup functions, will not require this translation and/or string copying and thus will result in a more efficient code. String type. std::string Associated identifier. unspecified boolattribute_name const &Compares the attribute names true if *this and that refer to the same attribute name, and false otherwise. boolattribute_name const &Compares the attribute names true if *this and that refer to different attribute names, and false otherwise. boolconst char *Compares the attribute names true if *this and that refer to the same attribute name, and false otherwise. boolconst char *Compares the attribute names true if *this and that refer to different attribute names, and false otherwise. boolstring_type const &Compares the attribute names true if *this and that refer to the same attribute name, and false otherwise. boolstring_type const &Compares the attribute names true if *this and that refer to different attribute names, and false otherwise. boolChecks if the object was default-constructed true if *this was constructed with an attribute name, false otherwise boolChecks if the object was default-constructed true if *this was default-constructed and does not refer to any attribute name, false otherwise id_type (!*this) == false The associated id value string_type const & (!*this) == false The attribute name string that was used during the object construction Default constructor. Creates an object that does not refer to any attribute name. const char *An attribute name Constructs an attribute name from the specified string name is not NULL and points to a zero-terminated string string_type const &An attribute name Constructs an attribute name from the specified string std::basic_ostream< CharT, TraitsT > &std::basic_ostream< CharT, TraitsT > &attribute_name const &
Andrey Semashev 08.03.2007 This header contains definition of the attribute set container. 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. Key type. attribute_name Mapped attribute type. attribute Value type. std::pair< const key_type, mapped_type > Reference type. value_type & Const reference type. value_type const & Pointer type. value_type * Const pointer type. value_type const * Size type. std::size_t Difference type. std::ptrdiff_t Iterator type. The iterator complies to the bidirectional iterator requirements. implementation_defined Constant iterator type. The iterator complies to the bidirectional iterator requirements with read-only capabilities. implementation_defined voidattribute_set &Swaps two instances of the container.Throws: Nothing. iterator Iterator to the first element of the container. iterator Iterator to the after-the-last element of the container. const_iterator Constant iterator to the first element of the container. const_iterator Constant iterator to the after-the-last element of the container. size_type Number of elements in the container. bool true if there are no elements in the container, false otherwise. iteratorkey_typeAttribute name. The method finds the attribute by name. Iterator to the found element or end() if the attribute with such name is not found. const_iteratorkey_typeAttribute name. The method finds the attribute by name. Iterator to the found element or end() if the attribute with such name is not found. size_typekey_typeAttribute name. 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. The number of times the attribute is found in the container. unspecifiedkey_typeAttribute name. Combined lookup/insertion operator. The operator semantics depends on the further usage of the returned reference. If the reference is used as an assignment target, the assignment expression is equivalent to element insertion, where the element is composed of the second argument of the operator[] as a key and the second argument of assignment as a mapped value. If the returned reference is used in context where a conversion to the mapped type is required, the result of the conversion is equivalent to the mapped value found with the second argument of the 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. A smart reference object of unspecified type. mapped_typekey_typeAttribute name. Lookup operator If an element with the corresponding attribute name is found in the container, its mapped value is returned. Otherwise a default-constructed mapped value is returned. std::pair< iterator, bool >key_typeAttribute name. mapped_type const &Pointer to the attribute. Must not be NULL. Insertion method A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion. std::pair< iterator, bool >const_referenceAn element to be inserted. Insertion method A pair of values. If second is true, the insertion succeeded and the first component points to the inserted element. Otherwise the first component points to the element that prevents insertion. voidFwdIteratorTA forward iterator that points to the first element to be inserted. FwdIteratorTA forward iterator that points to the after-the-last element to be inserted. Mass insertion method. voidFwdIteratorTA forward iterator that points to the first element to be inserted. FwdIteratorTA forward iterator that points to the after-the-last element to be inserted. OutputIteratorTAn output iterator that receives results of insertion of the elements Mass insertion method with ability to acquire iterators to the inserted elements. size_typekey_typeAttribute name. The method erases all attributes with the specified name All iterators to the erased elements become invalid. Tne number of erased elements voiditeratorA valid iterator to the element to be erased. The method erases the specified attribute All iterators to the erased element become invalid. Tne number of erased elements voiditeratorAn iterator that points to the first element to be erased. iteratorAn iterator that points to the after-the-last element to be erased. The method erases all attributes within the specified range end is reachable from begin with a finite number of increments. All iterators to the erased elements become invalid. voidThe method removes all elements from the container empty() == true Default constructor. empty() == true attribute_set const &Copy constructor. size() == that.size() && std::equal(begin(), end(), that.begin()) == true attribute_set &&Move constructor Destructor. All stored references to attributes are released. attribute_set &attribute_setCopy assignment operator. size() == that.size() && std::equal(begin(), end(), that.begin()) == true voidattribute_set &attribute_set &Free swap overload
Andrey Semashev 21.05.2010 The header contains attribute_value class definition. An attribute value class. An attribute value is an object that contains a piece of data that represents an attribute state at the point of the value acquisition. All major operations with log records, such as filtering and formatting, involve attribute values contained in a single view. Most likely an attribute value is implemented as a simple holder of some typed value. This holder implements the attribute_value::implementation interface and acts as a pimpl for the attribute_value object. The attribute_value class provides type dispatching support in order to allow to extract the value from the holder.Normally, attributes and their values shall be designed in order to exclude as much interference as reasonable. Such approach allows to have more than one attribute value simultaneously, which improves scalability and allows to implement generating attributes.However, there are cases when this approach does not help to achieve the required level of independency of attribute values and attribute itself from each other at a reasonable performance tradeoff. For example, an attribute or its values may use thread-specific data, which is global and shared between all the instances of the attribute/value. Passing such an attribute value to another thread would be a disaster. To solve this the library defines an additional method for attribute values, namely detach_from_thread. The attribute_value class forwards the call to its pimpl, which is supposed to ensure that it no longer refers to any thread-specific data after the call. The pimpl can create a new holder as a result of this method and return it to the attribute_value wrapper, which will keep the returned reference for any further calls. This method is called for all attribute values that are passed to another thread. attribute::implA base class for an attribute value implementation. All attribute value holders should derive from this interface. booltype_dispatcher &The object that attempts to dispatch the stored value. The method dispatches the value to the given object. true if dispatcher was capable to consume the real attribute value type and false otherwise. intrusive_ptr< impl >The method is called when the attribute value is passed to another thread (e.g. in case of asynchronous logging). The value should ensure it properly owns all thread-specific data. An actual pointer to the attribute value. It may either point to this object or another. In the latter case the returned pointer replaces the pointer used by caller to invoke this method and is considered to be a functional equivalent to the previous pointer. attribute_value The attribute value that refers to self implementation. typeindex::type_index The attribute value type boolThe operator checks if the attribute value is empty boolThe operator checks if the attribute value is empty typeindex::type_indexThe method returns the type information of the stored value of the attribute. The returned type info wrapper may be empty if the attribute value is empty or the information cannot be provided. If the returned value is not empty, the type can be used for value extraction. voidThe method is called when the attribute value is passed to another thread (e.g. in case of asynchronous logging). The value should ensure it properly owns all thread-specific data. The attribute value no longer refers to any thread-specific resources. booltype_dispatcher &The object that attempts to dispatch the stored value. The method dispatches the value to the given object. This method is a low level interface for attribute value visitation and extraction. For typical usage these interfaces may be more convenient. true if the value is not empty and the dispatcher was capable to consume the real attribute value type and false otherwise. result_of::extract< T, TagT >::typeThe method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.Include value_extraction.hpp prior to using this method. The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns an empty value. See description of the result_of::extract metafunction for information on the nature of the result value. result_of::extract_or_throw< T, TagT >::typeThe method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.Include value_extraction.hpp prior to using this method. The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise an exception is thrown. See description of the result_of::extract_or_throw metafunction for information on the nature of the result value. result_of::extract_or_default< T, T, TagT >::typeT const &Default value.The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence. If extraction fails, the default value is returned.Include value_extraction.hpp prior to using this method. The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns the default value. See description of the result_of::extract_or_default metafunction for information on the nature of the result value. result_of::extract_or_default< T, DefaultT, TagT >::typeDefaultT const &Default value.The method attempts to extract the stored value, assuming the value has the specified type. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence. If extraction fails, the default value is returned.Include value_extraction.hpp prior to using this method. The extracted value, if the attribute value is not empty and the value is the same as specified. Otherwise returns the default value. See description of the result_of::extract_or_default metafunction for information on the nature of the result value. visitation_resultVisitorTA function object that will be invoked on the extracted attribute value. The visitor should be capable to be called with a single argument of any type of the specified types in T.The method attempts to extract the stored value, assuming the value has the specified type, and pass it to the visitor function object. One can specify either a single type or an MPL type sequence, in which case the stored value is checked against every type in the sequence.Include value_visitation.hpp prior to using this method. The result of visitation. voidattribute_value &The method swaps two attribute values attribute_value const &Default constructor. Creates an empty (absent) attribute value.Copy constructor attribute_value &&Move constructor intrusive_ptr< impl >A pointer to the attribute value holder. Initializing constructor. Creates an attribute value that refers to the specified holder. attribute_value &attribute_value const &Copy assignment attribute_value &attribute_value &&Move assignment voidattribute_value &attribute_value &The function swaps two attribute values
Andrey Semashev 24.06.2007 The header contains an implementation of a basic attribute value implementation class. attribute_value::implBasic attribute value implementation class. This class can be used as a boilerplate for simple attribute values. The class implements all needed interfaces of attribute values and allows to store a single value of the type specified as a template parameter. The stored value can be dispatched with type dispatching mechanism. Value type. T booltype_dispatcher &The dispatcher that receives the stored valueAttribute value dispatching method. true if the value has been dispatched, false otherwise typeindex::type_index The attribute value type value_type const & Reference to the contained value. value_type const &Constructor with initialization of the stored value value_type &&Constructor with initialization of the stored value attribute_valueT &&The function creates an attribute value from the specified object.
Andrey Semashev 21.04.2007 This header file contains definition of attribute value set. The set is constructed from three attribute sets (global, thread-specific and source-specific) and contains attribute values. 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.The attribute sets that were used for the value set construction must not be modified or destroyed until the value set is frozen. Otherwise the behavior is undefined. Key type. attribute_name Mapped attribute type. attribute_value Value type. std::pair< const key_type, mapped_type > Reference type. value_type & Const reference type. value_type const & Pointer type. value_type * Const pointer type. value_type const * Size type. std::size_t Pointer difference type. std::ptrdiff_t Constant iterator type with bidirectional capabilities. implementation_defined voidattribute_value_set &Swaps two setsThrows: Nothing. const_iterator Iterator to the first element of the set. const_iterator Iterator to the after-the-last element of the set. size_type Number of elements in the set. bool true if there are no elements in the container, false otherwise. const_iteratorkey_typeAttribute name. The method finds the attribute value by name. Iterator to the found element or end() if the attribute with such name is not found. mapped_typekey_typeAttribute name. Alternative lookup syntax. A pointer to the attribute value if it is found with key, default-constructed mapped value otherwise. result_of::extract< typename expressions::attribute_keyword< DescriptorT, ActorT >::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &Attribute keyword. Alternative lookup syntax. A value_ref with extracted attribute value if it is found, empty value_ref otherwise. size_typekey_typeAttribute name. 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. The number of times the attribute value is found in the container. voidThe method acquires values of all adopted attributes. The set is frozen. std::pair< const_iterator, bool >key_typeThe attribute name. mapped_type const &The attribute value.Inserts an element into the set. The complexity of the operation is amortized constant. The set is frozen. An iterator to the inserted element and true if insertion succeeded. Otherwise, if the set already contains a same-named attribute value, iterator to the existing element and false. std::pair< const_iterator, bool >const_referenceThe attribute name and value.Inserts an element into the set. The complexity of the operation is amortized constant. The set is frozen. An iterator to the inserted element and true if insertion succeeded. Otherwise, if the set already contains a same-named attribute value, iterator to the existing element and false. voidFwdIteratorTA forward iterator that points to the first element to be inserted. FwdIteratorTA forward iterator that points to the after-the-last element to be inserted. Mass insertion method. The complexity of the operation is linear to the number of elements inserted. The set is frozen. voidFwdIteratorTA forward iterator that points to the first element to be inserted. FwdIteratorTA forward iterator that points to the after-the-last element to be inserted. OutputIteratorTAn output iterator that receives results of insertion of the elements. 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. The set is frozen. size_type8Number of elements to reserve space for. Default constructorThe 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. attribute_value_set &&Move constructor attribute_set const &A set of source-specific attributes. attribute_set const &A set of thread-specific attributes. attribute_set const &A set of global attributes. size_type8Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. 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. attribute_value_set const &A set of source-specific attributes. attribute_set const &A set of thread-specific attributes. attribute_set const &A set of global attributes. size_type8Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. 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. The source_attrs set is frozen. attribute_value_set &&A set of source-specific attributes. attribute_set const &A set of thread-specific attributes. attribute_set const &A set of global attributes. size_type8Amount of elements to reserve space for, in addition to the elements in the three attribute sets provided. 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. The source_attrs set is frozen. attribute_value_set const &Copy constructor. The original set is frozen. The constructed set is frozen, std::equal(begin(), end(), that.begin()) == true Destructor. Releases all referenced attribute values. attribute_value_set &attribute_value_setAssignment operator voidattribute_value_set &attribute_value_set &Free swap overload
Andrey Semashev 01.12.2007 The header contains wall clock attribute implementation and typedefs. attributeA class of an attribute that makes an attribute value of the current date and time. The attribute generates current time stamp as a value. The type of the attribute value is determined with time traits passed to the class template as a template parameter. The time traits provided by the library use boost::posix_time::ptime as the time type.Time traits also determine the way time is acquired. There are two types of time traits provided by the library: utc_time_traits and local_time_traits. The first returns UTC time, the second returns local time. attribute::implAttribute factory implementation. attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). Generated value type. TimeTraitsT::time_type Default constructor cast_source const &Constructor for casting support Attribute that returns current UTC time. basic_clock< utc_time_traits > Attribute that returns current local time. basic_clock< local_time_traits >
Andrey Semashev 15.04.2007 The header contains implementation of a constant attribute. attributeA class of an attribute that holds a single constant value. The constant is a simplest and one of the most frequently used types of attributes. It stores a constant value, which it eventually returns as its value each time requested. attribute_value_impl< value_type >Factory implementation. value_type const &Constructor with the stored value initialization value_type &&Constructor with the stored value initialization Attribute value type. T value_type const & Reference to the contained value. value_type const &Constructor with the stored value initialization value_type &&Constructor with the stored value initialization cast_source const &Constructor for casting support unspecifiedBOOST_FWD_REF(T)The function constructs a constant attribute containing the provided value. The function automatically converts C string arguments to std::basic_string objects.
Andrey Semashev 01.05.2007 The header contains implementation of the counter attribute. attributeA class of an attribute that counts an integral value. This attribute acts as a counter - it returns a monotonously changing value each time requested. The attribute value type can be specified as a template parameter. The type must be an integral type. attribute::implFactory implementation. attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). value_typevalue_type A counter value type. T is_integral< T >::value"Boost.Log: Only integral types are supported by the counter attribute" value_type(value_type) 0Initial value of the counter value_type(value_type) 1Changing step of the counter. Each value acquired from the attribute will be greater than the previous one by this amount. Constructor cast_source const &Constructor for casting support
Andrey Semashev 12.09.2009 The header contains implementation of a current process id attribute constant< process_id >A class of an attribute that holds the current process identifier. Constructor. Initializes the attribute with the current process identifier. cast_source const &Constructor for casting support Process identifier type used by the library. unspecified
Andrey Semashev 29.07.2012 The header contains implementation of a current process name attribute constant< std::string >A class of an attribute that holds the current process name. Constructor. Initializes the attribute with the current process name. cast_source const &Constructor for casting support
Andrey Semashev 12.09.2009 The header contains implementation of a current thread id attribute attributeA class of an attribute that always returns the current thread identifier. This attribute can be registered globally, it will still return the correct thread identifier, no matter which thread emits the log record. attribute_value::implFactory implementation. booltype_dispatcher &The object that attempts to dispatch the stored value. The method dispatches the value to the given object. true if dispatcher was capable to consume the real attribute value type and false otherwise. intrusive_ptr< attribute_value::impl >The method is called when the attribute value is passed to another thread (e.g. in case of asynchronous logging). The value should ensure it properly owns all thread-specific data. An actual pointer to the attribute value. It may either point to this object or another. In the latter case the returned pointer replaces the pointer used by caller to invoke this method and is considered to be a functional equivalent to the previous pointer. typeindex::type_index The attribute value type A held attribute value type. thread_id Default constructor cast_source const &Constructor for casting support Thread identifier type. unspecified
Andrey Semashev 18.08.2012 The header contains definition of fallback policies when attribute value visitation or extraction fails. The fallback_to_none policy results in returning an empty value reference if the attribute value cannot be extracted. = false boolFunT &The method is called in order to apply a function object to the default value. boolFunT const &The method is called in order to apply a function object to the default value. voidtypeindex::type_index const &The method is called when value extraction failed because the attribute value has different type than requested. voidThe method is called when value extraction failed because the attribute value was not found. The fallback_to_throw policy results in throwing an exception if the attribute value cannot be extracted. = true boolFunT &The method is called in order to apply a function object to the default value. boolFunT const &The method is called in order to apply a function object to the default value. voidtypeindex::type_index const &The method is called when value extraction failed because the attribute value has different type than requested. voidThe method is called when value extraction failed because the attribute value was not found.
Andrey Semashev 18.08.2012 The header contains forward declaration of fallback policies when attribute value visitation or extraction fails. The fallback_to_default policy results in a default value if the attribute value cannot be extracted. boolFunT &The method is called in order to apply a function object to the default value. boolFunT const &The method is called in order to apply a function object to the default value. Default constructor. default_type const &Initializing constructor. voidtypeindex::type_index const &The method is called when value extraction failed because the attribute value has different type than requested. voidThe method is called when value extraction failed because the attribute value was not found.
Andrey Semashev 24.06.2007 The header contains implementation of an attribute that calls a third-party function on value acquisition. attributeA class of an attribute that acquires its value from a third-party function object. The attribute calls a stored nullary function object to acquire each value. The result type of the function object is the attribute value type.It is not recommended to use this class directly. Use make_function convenience functions to construct the attribute instead. attribute::implBase class for factory implementation. function< R >::implFactory implementation. attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). T const &Constructor with the stored delegate initialization The attribute value type. R !is_void< R >::value"Boost.Log: Function object return type must not be void" T const &Initializing constructor cast_source const &Constructor for casting support function< typename remove_cv< typename remove_reference< typename boost::result_of< T() >::type >::type >::type >T const &Nullary functional object that returns an actual stored value for an attribute value. The function constructs function attribute instance with the provided function object. Pointer to the attribute instance
Andrey Semashev 06.11.2007 The header contains implementation of a mutable constant attribute. attributeA class of an attribute that holds a single constant value with ability to change it. The mutable_constant attribute stores a single value of type, specified as the first template argument. This value is returned on each attribute value acquisition.The attribute also allows to modify the stored value, even if the attribute is registered in an attribute set. In order to ensure thread safety of such modifications the mutable_constant class is also parametrized with three additional template arguments: mutex type, scoped write and scoped read lock types. If not specified, the lock types are automatically deduced based on the mutex type.The implementation may avoid using these types to actually create and use the mutex, if a more efficient synchronization method is available (such as atomic operations on the value type). By default no synchronization is done. attribute::implFactory implementation. !"Boost.Log: Mutex and both lock types either must not be void or must all be void" attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). voidvalue_type const & voidvalue_type && value_type value_type const &Initializing constructor value_type &&Initializing constructor The attribute value type. T voidvalue_type const &The method sets a new attribute value. The implementation exclusively locks the mutex in order to protect the value assignment. voidvalue_type &&The method sets a new attribute value. value_typeThe method acquires the current attribute value. The implementation non-exclusively locks the mutex in order to protect the value acquisition. value_type const &Constructor with the stored value initialization value_type &&Constructor with the stored value initialization cast_source const &Constructor for casting support impl * Pointer to the factory implementation TvoidvoidvoidattributeSpecialization for unlocked case. This version of attribute does not perform thread synchronization to access the stored value. attribute::implFactory implementation. attribute_value The actual attribute value. It shall not return empty values (exceptions shall be used to indicate errors). voidvalue_type const & voidvalue_type && value_type value_type const &Initializing constructor value_type &&Initializing constructor The attribute value type. T voidvalue_type const &The method sets a new attribute value. voidvalue_type &&The method sets a new attribute value. value_typeThe method acquires the current attribute value. value_type const &Constructor with the stored value initialization value_type &&Constructor with the stored value initialization cast_source const &Constructor for casting support impl * Pointer to the factory implementation
Andrey Semashev 24.06.2007 The header contains implementation of named scope container and an attribute that allows to put the named scope to log. A number of convenience macros are also provided. attributeA 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. Sentry object class to automatically push and pop scopes. string_literal const &Scope name. string_literal const &File name, in which the scope is located. unsigned intLine number in the file. scope_entry::scope_name_typescope_entry::generalConstructor. Pushes the specified scope to the end of the thread-local list of scopes. Destructor. Removes the last pushed scope from the thread-local list of scopes. sentry const & sentry &sentry const & Scope names stack (the attribute value type) named_scope_list Scope entry. value_type::value_type Constructor. Creates an attribute. cast_source const &Constructor for casting support voidscope_entry const &The method pushes the scope to the back of the current thread's scope listThrows: Nothing. voidThe method pops the last pushed scope from the current thread's scope listThrows: Nothing. value_type const & 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. The current thread's list of scopes The structure contains all information about a named scope. The named scope entries are stored as elements of basic_named_scope_list container, which in turn can be acquired either from the basic_named_scope attribute value or from a thread-local instance. The scope name contains some unstructured string that should not be interpreted by the library. The scope name contains a function signature. Scope entry type. Describes scope name specifics string_literalThe scope name (e.g. a function signature) string_literalThe source file name unsigned intThe line number in the source file scope_name_typeThe scope name type string_literal const &string_literal const &unsigned intscope_name_typegeneralInitializing constructor Throws: Nothing. scope_name == sn && file_name == fn && line == ln The class implements the list of scopes. The scope list provides a read-only access to a doubly-linked list of scopes. Allocator type. std::allocator< named_scope_entry > allocator_type::value_type allocator_type::reference allocator_type::const_reference allocator_type::pointer allocator_type::const_pointer allocator_type::size_type allocator_type::difference_type A constant iterator to the sequence of scopes. Complies to bidirectional iterator requirements. implementation_defined An iterator to the sequence of scopes. Complies to bidirectional iterator requirements. implementation_defined A constant reverse iterator to the sequence of scopes. Complies to bidirectional iterator requirements. implementation_defined A reverse iterator to the sequence of scopes. Complies to bidirectional iterator requirements. implementation_defined const_iterator Constant iterator to the first element of the container. const_iterator Constant iterator to the after-the-last element of the container. const_reverse_iterator Constant iterator to the last element of the container. const_reverse_iterator Constant iterator to the before-the-first element of the container. size_type The number of elements in the container bool true if the container is empty and false otherwise voidnamed_scope_list &Swaps two instances of the container const_reference Last pushed scope entry const_reference First pushed scope entry Default constructor empty() == true named_scope_list const &Copy constructor std::equal(begin(), end(), that.begin()) == true Destructor. Destroys the stored entries. named_scope_list &named_scope_list const &Assignment operator std::equal(begin(), end(), that.begin()) == true std::basic_ostream< CharT, TraitsT > &std::basic_ostream< CharT, TraitsT > &named_scope_list const &Stream output operator. Macro for scope markup. The specified scope name is pushed to the end of the current thread scope list. Macro for function scope markup. The scope name is constructed with help of compiler and contains the current function signature. The scope name is pushed to the end of the current thread scope list.Not all compilers have support for this macro. The exact form of the scope name may vary from one compiler to another. Macro for function scope markup. The scope name is constructed with help of compiler and contains the current function name. It may be shorter than what BOOST_LOG_FUNCTION macro produces. The scope name is pushed to the end of the current thread scope list.Not all compilers have support for this macro. The exact form of the scope name may vary from one compiler to another.
Andrey Semashev 13.05.2007 The header contains definition of facilities to define scoped attributes. Scoped attribute guard type. unspecified unspecifiedLoggerT &Logger to register the attribute in attribute_name const &Attribute name attribute const &The attribute. Must not be NULL. Registers an attribute in the logger An unspecified guard object which may be used to initialize a scoped_attribute variable. unspecifiedattribute_name const &Attribute name attribute const &The attribute. Must not be NULL. Registers a thread-specific attribute An unspecified guard object which may be used to initialize a scoped_attribute variable. The macro sets a scoped logger-wide attribute in a more compact way. The macro sets a scoped logger-wide tag in a more compact way. The macro sets a scoped thread-wide attribute in a more compact way. The macro sets a scoped thread-wide tag in a more compact way.
Andrey Semashev 01.12.2007 The header contains implementation of time traits that are used in various parts of the library to acquire current time. Base class for time traits involving Boost.DateTime. Time type. posix_time::ptime Current time source. posix_time::second_clock basic_time_traitsTime traits that describes local time acquirement via Boost.DateTime facilities. time_type Current time stamp basic_time_traitsTime traits that describes UTC time acquirement via Boost.DateTime facilities. time_type Current time stamp
Andrey Semashev 02.12.2007 The header contains implementation of a stop watch attribute. attributeA class of an attribute that makes an attribute value of the time interval since construction. The timer attribute calculates the time passed since its construction and returns it on value acquisition. The attribute value type is boost::posix_time::time_duration.On Windows platform there are two implementations of the attribute. The default one is more precise but a bit slower. This version uses QueryPerformanceFrequence/QueryPerformanceCounter API to calculate elapsed time.There are known problems with these functions when used with some CPUs, notably AMD Athlon with Cool'n'Quiet technology enabled. See the following links for more information and possible resolutions:http://support.microsoft.com/?scid=kb;en-us;895980 http://support.microsoft.com/?id=896256In case if none of these solutions apply, you are free to define BOOST_LOG_NO_QUERY_PERFORMANCE_COUNTER macro to fall back to another implementation based on Boost.DateTime. Attribute value type. utc_time_traits::time_type::time_duration_type Constructor. Starts time counting. cast_source const &Constructor for casting support
Andrey Semashev 01.03.2008 The header contains implementation of tools for extracting an attribute value from the view. result_of::extract< T, TagT >::typeattribute_name const &The name of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract< T, TagT >::typeattribute_name const &The name of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract< T, TagT >::typeattribute_name const &The name of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract< T, TagT >::typeattribute_value const &Attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract_or_throw< T, TagT >::typeattribute_name const &The name of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_throw< T, TagT >::typeattribute_name const &The name of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_throw< T, TagT >::typeattribute_name const &The name of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_throw< T, TagT >::typeattribute_value const &Attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_default< T, DefaultT, TagT >::typeattribute_name const &The name of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract_or_default< T, DefaultT, TagT >::typeattribute_name const &The name of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract_or_default< T, DefaultT, TagT >::typeattribute_name const &The name of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract_or_default< T, DefaultT, TagT >::typeattribute_value const &Attribute value. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. A value_ref that refers to the extracted value, if found. An empty value otherwise. result_of::extract_or_throw< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_throw< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_throw< typename DescriptorT::value_type, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted. The extracted value or a non-empty value_ref that refers to the value. An exception is thrown if the requested value cannot be extracted. result_of::extract_or_default< typename DescriptorT::value_type, DefaultT, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be extracted.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract_or_default< typename DescriptorT::value_type, DefaultT, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record const &A log record. The attribute value will be sought among those associated with the record. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise. result_of::extract_or_default< typename DescriptorT::value_type, DefaultT, DescriptorT >::typeexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to extract. record_view const &A log record view. The attribute value will be sought among those associated with the record. DefaultT const &The default value The function extracts an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited.Caution must be exercised if the default value is a temporary object. Because the function returns a reference, if the temporary object is destroyed, the reference may become dangling. The extracted value, if found. The default value otherwise.
Andrey Semashev 01.03.2008 The header contains forward declaration of tools for extracting attribute values from the view. FallbackPolicyTGeneric attribute value extractor. Attribute value extractor is a functional object that attempts to find and extract the stored attribute value from the attribute values view or a log record. The extracted value is returned from the extractor. result_typeattribute_value const &The attribute value to extract from. Extraction operator. Attempts to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned. The extracted value, if extraction succeeded, an empty value otherwise. result_typeattribute_name const &Attribute value name. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned. The extracted value, if extraction succeeded, an empty value otherwise. result_typeattribute_name const &Attribute value name. record const &A log record. The attribute value will be sought among those associated with the record. Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned. The extracted value, if extraction succeeded, an empty value otherwise. result_typeattribute_name const &Attribute value name. record_view const &A log record view. The attribute value will be sought among those associated with the record. Extraction operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If extraction succeeds, the extracted value is returned. The extracted value, if extraction succeeded, an empty value otherwise. fallback_policy const & Fallback policy value_extractor const &Default constructorCopy constructor U const &Fallback policy constructor argument Constructor A metafunction that allows to acquire the result of the value extraction. The metafunction results in a type that is in form of value_ref< T, TagT >. A metafunction that allows to acquire the result of the value extraction. The metafunction results in a type that is in form of T const&, if T is not an MPL type sequence and DefaultT is the same as T, or value_ref< TypesT, TagT > otherwise, with TypesT being a type sequence comprising the types from sequence T and DefaultT, if it is not present in T already. A metafunction that allows to acquire the result of the value extraction. The metafunction results in a type that is in form of T const&, if T is not an MPL type sequence, or value_ref< T, TagT > otherwise. In the latter case the value reference shall never be empty.
Andrey Semashev 01.03.2008 The header contains implementation of convenience tools to apply visitors to an attribute value in the view. The class represents attribute value visitation result. The main purpose of this class is to provide a convenient interface for checking whether the attribute value visitation succeeded or not. It also allows to discover the actual cause of failure, should the operation fail. The attribute value has been visited successfully. The attribute value is not present in the view. The attribute value is present in the view, but has an unexpected type. Error codes for attribute value visitation. boolChecks if the visitation was successful. true if the value was visited successfully, false otherwise. boolChecks if the visitation was unsuccessful. false if the value was visited successfully, true otherwise. error_code The actual result code of value visitation error_codeokInitializing constructor. Creates the result that is equivalent to the specified error code. visitation_resultattribute_name const &The name of the attribute value to visit. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultattribute_name const &The name of the attribute value to visit. record const &A log record. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultattribute_name const &The name of the attribute value to visit. record_view const &A log record view. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultattribute_value const &The attribute value to visit. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to visit. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to visit. record const &A log record. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation. visitation_resultexpressions::attribute_keyword< DescriptorT, ActorT > const &The keyword of the attribute value to visit. record_view const &A log record view. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. The function applies a visitor to an attribute value from the view. The user has to explicitly specify the type or set of possible types of the attribute value to be visited. The result of visitation.
Andrey Semashev 01.03.2008 The header contains forward declaration of convenience tools to apply visitors to an attribute value in the view. FallbackPolicyTGeneric attribute value visitor invoker. Attribute value invoker is a functional object that attempts to find and extract the stored attribute value from the attribute value view or a log record. The extracted value is passed to a unary function object (the visitor) provided by user.The invoker can be specialized on one or several attribute value types that should be specified in the second template argument. result_typeattribute_value const &An attribute value to apply the visitor to. VisitorTA receiving function object to pass the attribute value to. Visitation operator. Attempts to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor. The result of visitation. result_typeattribute_name const &Attribute value name. attribute_value_set const &A set of attribute values in which to look for the specified attribute value. VisitorTA receiving function object to pass the attribute value to. Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor. The result of visitation. result_typeattribute_name const &Attribute value name. record const &A log record. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor. The result of visitation. result_typeattribute_name const &Attribute value name. record_view const &A log record view. The attribute value will be sought among those associated with the record. VisitorTA receiving function object to pass the attribute value to. Visitation operator. Looks for an attribute value with the specified name and tries to acquire the stored value of one of the supported types. If acquisition succeeds, the value is passed to visitor. The result of visitation. fallback_policy const & Fallback policy value_visitor_invoker const &Default constructorCopy constructor U const &Fallback policy argument Initializing constructor