boost::log::attributes::constant — A class of an attribute that holds a single constant value.
// In header: <boost/log/attributes/constant.hpp> template<typename T> class constant : public attribute, public boost::log::attributes::basic_attribute_value< T > { public: // types typedef base_type::held_type held_type; // A held constant type. // construct/copy/destruct explicit constant(held_type const &); // public member functions shared_ptr< attribute_value > get_value(); shared_ptr< attribute_value > detach_from_thread(); };
The constant is a simpliest and one of the most frequently types of attributes. It stores a constant value, which it eventually returns as its value each time requested.
constant
public member functionsshared_ptr< attribute_value > get_value();
Returns: | The actual attribute value. It shall not return NULL (exceptions shall be used to indicate errors). |
shared_ptr< attribute_value > detach_from_thread();
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.
Returns: | 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. |