Utilities
Andrey Semashev
12.07.2009
This header contains tools for exception handlers support in different parts of the library.
An exception handler functional object. The handler aggregates a user-defined functional object that will be called when one of the specified exception types is caught. The exception handler type. HandlerT
The handler result type. void
voidException launcher. Rethrows the current exception in order to detect its type and pass it to the aggregated function object.Must be called from within a catch statement.
handler_type const &Initializing constructor. Creates an exception handler with the specified function object that will receive the exception.
boost::log::exception_handler< SequenceT, HandlerT >A no-throw exception handler functional object. Acts similar to exception_handler, but in case if the exception cannot be handled the exception is not propagated from the handler. Instead the user-defined functional object is called with no parameters. The exception handler type. HandlerT
The handler result type. void
voidException launcher. Rethrows the current exception in order to detect its type and pass it to the aggregated function object. If the type of the exception could not be detected, the user-defined handler is called with no arguments.Must be called from within a catch statement.
handler_type const &Initializing constructor. Creates an exception handler with the specified function object that will receive the exception.
nopThe function creates an empty exception handler that effectively suppresses any exception
exception_handler< typename HandlerT::exception_types, HandlerT >
HandlerT const &User-defined functional object that will receive exceptions. The function creates an exception handler functional object. The handler will call to the user-specified functional object with an exception as its argument.
This form requires the user-defined functional object to have an exception_types nested type. This type should be an MPL sequence of all expected exception types.
A nullary functional object that should be called from within a catch statement.
nothrow_exception_handler< typename HandlerT::exception_types, HandlerT >
HandlerT const &User-defined functional object that will receive exceptions. std::nothrow_t const &The function creates an exception handler functional object. The handler will call to the user-specified functional object with an exception as its argument. If the exception type cannot be identified, the handler will call the user-defined functor with no arguments, instead of propagating exception to the caller.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
This form requires the user-defined functional object to have an exception_types nested type. This type should be an MPL sequence of all expected exception types.
A nullary functional object that should be called from within a catch statement.
exception_handler< MPL_sequence_of_ExceptionsT, HandlerT >
typename...
HandlerT const &User-defined functional object that will receive exceptions. The function creates an exception handler functional object. The handler will call to the user-specified functional object with an exception as its argument. All expected exception types should be specified as first template parameters explicitly, in the order they would be specified in a corresponding try/catch statement.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
A nullary functional object that should be called from within a catch statement.
nothrow_exception_handler< MPL_sequence_of_ExceptionsT, HandlerT >
typename...
HandlerT const &User-defined functional object that will receive exceptions. std::nothrow_t const &The function creates an exception handler functional object. The handler will call to the user-specified functional object with an exception as its argument. If the exception type cannot be identified, the handler will call the user-defined functor with no arguments, instead of propagating exception to the caller. All expected exception types should be specified as first template parameters explicitly, in the order they would be specified in a corresponding try/catch statement.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
A nullary functional object that should be called from within a catch statement.
Maximum number of exception types that can be specified for exception handlers.
Andrey Semashev
11.07.2012
The header contains implementation of a string stream used for log record formatting.
unspecified
StreamT &T
unspecified
StreamT &T const &
unspecified
StreamT &T &
unspecified
StreamT &&T
unspecified
StreamT &&T const &
unspecified
StreamT &&T &
Andrey Semashev
11.07.2012
The header contains forward declaration of a string stream used for log record formatting.
Stream for log records formatting. Stream wrapper for log records formatting.This stream wrapper is used by the library for log record formatting. It implements the standard string stream interface with a few differences:
It does not derive from standard types std::basic_ostream, std::basic_ios and std::ios_base, although it tries to implement their interfaces closely. There are a few small differences, mostly regarding rdbuf and str signatures, as well as the supported insertion operator overloads. The actual wrapped stream can be accessed through the stream methods.
By default, bool values are formatted using alphabetical representation rather than numeric.
The stream supports writing strings of character types different from the stream character type. The stream will perform character code conversion as needed using the imbued locale.
The stream operates on an external string object rather than on the embedded one. The string can be attached or detached from the stream dynamically.
Although basic_formatting_ostream does not derive from std::basic_ostream, users are not required to add special overloads of operator<< for it since the stream will by default reuse the operators for std::basic_ostream. However, one can define special overloads of operator<< for basic_formatting_ostream if a certain type needs special formatting when output to log.
voidstring_type &The string buffer to attach. Attaches the stream to the string. The string will be used to store the formatted characters.
voidDetaches the stream from the string. Any buffered data is flushed to the string.
string_type const &
Reference to the attached string. The string must be attached before calling this method.
ostream_type &
Reference to the wrapped stream
ostream_type const &
Reference to the wrapped stream
fmtflags
fmtflagsfmtflags
fmtflagsfmtflags
fmtflagsfmtflagsfmtflags
voidfmtflags
std::streamsize
std::streamsizestd::streamsize
std::streamsize
std::streamsizestd::streamsize
std::locale
std::localestd::locale const &
long &int
void *&int
voidevent_callbackint
bool
bool
iostate
voidiostategoodbit
voidiostate
bool
bool
bool
bool
iostate
voidiostate
ostream_type *
ostream_type *ostream_type *
streambuf_type *
basic_formatting_ostream &std::basic_ios< char_type, traits_type > &
basic_formatting_ostream &basic_formatting_ostream &
char_type
char_typechar_type
charchar_typechar
char_typechar
basic_formatting_ostream &
pos_type
basic_formatting_ostream &pos_type
basic_formatting_ostream &off_typestd::ios_base::seekdir
basic_formatting_ostream &char_type
unspecified
OtherCharT
basic_formatting_ostream &const char_type *std::streamsize
unspecified
const OtherCharT *std::streamsize
basic_formatting_ostream &ios_base_manip
basic_formatting_ostream &basic_ios_manip
basic_formatting_ostream &stream_manip
basic_formatting_ostream &char
basic_formatting_ostream &const char *
basic_formatting_ostream &wchar_t
basic_formatting_ostream &const wchar_t *
basic_formatting_ostream &char16_t
basic_formatting_ostream &const char16_t *
basic_formatting_ostream &char32_t
basic_formatting_ostream &const char32_t *
basic_formatting_ostream &bool
basic_formatting_ostream &signed char
basic_formatting_ostream &unsigned char
basic_formatting_ostream &short
basic_formatting_ostream &unsigned short
basic_formatting_ostream &int
basic_formatting_ostream &unsigned int
basic_formatting_ostream &long
basic_formatting_ostream &unsigned long
basic_formatting_ostream &long long
basic_formatting_ostream &unsigned long long
basic_formatting_ostream &float
basic_formatting_ostream &double
basic_formatting_ostream &long double
basic_formatting_ostream &std::basic_streambuf< char_type, traits_type > *
Default constructor. Creates an empty record that is equivalent to the invalid record handle. The stream capability is not available after construction.
!*this == true
string_type &The string buffer to attach. Initializing constructor. Attaches the string to the constructed stream. The string will be used to store the formatted characters.
!*this == false
Destructor. Destroys the record, releases any sinks and attribute values that were involved in processing this record.
int
boolbooltrue
void
basic_formatting_ostream &const char_type *std::streamsize
basic_formatting_ostream &
const OtherCharT *std::streamsize
voidconst char_type *std::streamsize
void
const OtherCharT *std::streamsize
basic_formatting_ostream const &Copy constructor (closed)
basic_formatting_ostream &basic_formatting_ostream const &Assignment (closed)
basic_formatting_ostream< char >
basic_formatting_ostream< wchar_t >
Andrey Semashev
30.03.2008
This header includes all functional helpers.
Andrey Semashev
30.03.2008
This header contains function object adapter for compatibility with Boost.Spirit actions interface requirements.
Function object adapter for Boost.Spirit actions. FunT::result_type
result_type
AttributeT const &ContextT const &bool &
FunT const &
as_action_adapter< FunT >
FunT const &
Andrey Semashev
30.03.2008
This header contains a predicate for checking if the provided string begins with a substring.
The begins_with functor. bool
bool
T const &U const &
Andrey Semashev
30.03.2008
This header contains function object adapters. This is a lightweight alternative to what Boost.Phoenix and Boost.Bind provides.
FunTFirst argument binder. FunT::result_type
result_type
result_type
T0 const &
result_type
T0 const &T1 const &
FunT const &unspecified
FunT &FirstArgTFirst argument binder. remove_cv< FunT >::type::result_type
result_type
result_type
T0 const &
result_type
T0 const &T1 const &
FunT &unspecified
FunTSecond argument binder. FunT::result_type
result_type
T const &
result_type
T0 const &T1 const &
FunT const &unspecified
FunT &SecondArgTSecond argument binder. remove_cv< FunT >::type::result_type
result_type
T const &
result_type
T0 const &T1 const &
FunT &unspecified
FunTThird argument binder. FunT::result_type
result_type
T0 const &T1 const &
FunT const &unspecified
FunT &ThirdArgTThird argument binder. remove_cv< FunT >::type::result_type
result_type
T0 const &T1 const &
FunT &unspecified
binder1st< FunT, FirstArgT >
FunTFirstArgT const &
binder1st< FunT, FirstArgT >
FunTFirstArgT &
binder2nd< FunT, SecondArgT >
FunTSecondArgT const &
binder2nd< FunT, SecondArgT >
FunTSecondArgT &
binder3rd< FunT, ThirdArgT >
FunTThirdArgT const &
binder3rd< FunT, ThirdArgT >
FunTThirdArgT &
Andrey Semashev
30.03.2008
This header contains a function object that assigns the received value to the bound object. This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
The function object that assigns its second operand to the first one. void
void
LeftT &RightT const &
binder1st< assign_fun, AssigneeT & >
AssigneeT &
Andrey Semashev
30.03.2008
This header contains a function object that puts the received value to the bound stream. This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
The function object that outputs its second operand to the first one. void
void
StreamT &T const &
binder1st< output_fun, StreamT & >
StreamT &
Andrey Semashev
06.11.2012
This header contains a function object that puts the received value to the bound stream using the to_log manipulator. This is a lightweight alternative to what Boost.Phoenix and Boost.Lambda provides.
void
The function object that outputs its second operand to the first one. void
void
StreamT &T const &
voidThe function object that outputs its second operand to the first one. void
void
StreamT &T const &
binder1st< to_log_fun< >, StreamT & >
StreamT &
binder1st< to_log_fun< TagT >, StreamT & >
StreamT &
Andrey Semashev
30.03.2008
This header contains a predicate for checking if the provided string contains a substring.
The contains functor. bool
bool
T const &U const &
Andrey Semashev
30.03.2008
This header contains a predicate for checking if the provided string ends with a substring.
The ends_with functor. bool
bool
T const &U const &
Andrey Semashev
30.03.2008
This header contains function object reference adapter. The adapter stores a reference to external function object and forwards all calls to the referred function.
Reference wrapper for function objects. FunT::result_type
result_type
result_type
typename...
ArgsT const &...
FunT &
function_reference_wrapper< FunT >
FunT &
Andrey Semashev
30.03.2008
This header contains a predicate for checking if the provided value is within a half-open range.
The in_range functor. bool
bool
T const &std::pair< U, U > const &
bool
T const &std::pair< U, U > const &mpl::false_ const &
bool
T const &std::pair< U, U > const &mpl::true_ const &
Andrey Semashev
30.03.2008
This header contains logical predicates for value comparison, analogous to std::less, std::greater and others. The main difference from the standard equivalents is that the predicates defined in this header are not templates and therefore do not require a fixed argument type. Furthermore, both arguments may have different types, in which case the comparison is performed without type conversion.In case if arguments are integral, the conversion is performed according to the standard C++ rules in order to avoid warnings from the compiler.
Equality predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Greater predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Greater or equal predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Less predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Less or equal predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Inequality predicate. bool
bool
T const &U const &
bool
T const &U const &mpl::false_ const &
bool
T const &U const &mpl::true_ const &
Andrey Semashev
30.03.2008
This header contains a predicate for checking if the provided string matches a regular expression.
The regex matching functor. bool
bool
StringT const &ExpressionT const &
bool
StringT const &ExpressionT const &ArgT const &
Andrey Semashev
30.03.2008
This header contains a function object that does nothing.
The function object that does nothing. void
void
void
typename...
ArgsT const &
Andrey Semashev
19.01.2013
This header contains function object adapter that saves the result of the adopted function to an external variable.
Function object wrapper for saving the adopted function object result. void
result_type
ArgT const &
FunTAssigneeT &
save_result_wrapper< FunT, AssigneeT >
FunT const &AssigneeT &
Andrey Semashev
05.03.2016
The header contains declaration of a system object name wrapper.
A system object name class. In order to identify a system-wide object such as a shared memory segment or a named synchronization primitive the object has to be given a name. The format of the name is specific to the operating system and the object_name class provides an abstraction for names of objects. It also provides means for scoping, which allows to avoid name clashes between different processes.The object name is a UTF-8 encoded string. The portable object name should consist of the following characters:
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
a b c d e f g h i j k l m n o p q r s t u v w x y z
0 1 2 3 4 5 6 7 8 9 . _ -
The character set corresponds to the POSIX Portable Filename Character Set (http://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap03.html#tag_03_278).
Use of other characters may result in non-portable system-specific behavior.The name can have one of the following scopes:
global - objects within this scope are visible to any process on the system. In order to use this scope the process may need to have extended privileges. This scope is not available for Windows Store applications.
user - objects within this scope can be opened by processes running under the same user as the current process.
session - objects within this scope are visible to processes within the session of the current process. The definition of a session may vary between operating systems. On POSIX, a session is typically a group of processes attached to a single virtual terminal device. On Windows a session is started when a user logs into the system. There is also a separate session for Windows services.
process_group - objects within this scope are visible to processes within the process group of the current process. Currently, on Windows all processes running in the current session are considered members of the same process group. This may change in future.
The scopes are not overlapping. For instance, if an object is created in the global scope, the object cannot be opened with the same name but in user's scope.Note that name scoping is not a security feature. On some systems any process on the system has technical capability to open objects within any scope. The scope is only used to help avoid name clashes between processes using object_name to identify objects. The name has global scope; any process in the system has the potential to open the resource identified by the name. The name is limited to processes running under the current user. The name is limited to processes running in the current login session. The name is limited to processes running in the current process group. Name scopes.
boolReturns true if the object name is empty
std::size_tReturns length of the name, in bytes
const char *Returns the name string
voidobject_name &Swaps the object name with another object name
Default constructor. The method creates an empty object name.
empty() == true
object_name &&Move constructor.
object_name const &Copy constructor.
scopeThe scope of the object name const char *The object name, must not be NULL. Constructor from the object name
scopeThe scope of the object name std::string const &The object name Constructor from the object name
object_name &object_name &&Move assignment
object_name &object_name const &Copy assignment
object_nameconst char *The object name string, must not be NULL. The string format is specific to the operating system. Constructor from the native string.
object_namestd::string const &The object name string. The string format is specific to the operating system. Constructor from the native string.
friend voidobject_name &object_name &Swaps two object names
friend std::stringobject_name const &Returns string representation of the object name
friend boolobject_name const &object_name const &Equality operator
friend boolobject_name const &object_name const &Inequality operator
friend boolobject_name const &object_name const &Less operator
friend boolobject_name const &object_name const &Greater operator
friend boolobject_name const &object_name const &Less or equal operator
friend boolobject_name const &object_name const &Greater or equal operator
friend std::basic_ostream< CharT, TraitsT > &
std::basic_ostream< CharT, TraitsT > &object_name const &Stream ouput operator
Lingxi Li
Andrey Semashev
01.01.2016
The header contains declaration of a reliable interprocess message queue.
A reliable interprocess message queue. The queue implements a reliable one-way channel of passing messages from one or multiple writers to a single reader. The format of the messages is user-defined and must be consistent across all writers and the reader. The queue does not enforce any specific format of the messages, other than they should be supplied as a contiguous array of bytes.The queue internally uses a process-shared storage identified by an object_name (the queue name). Refer to object_name documentation for details on restrictions imposed on object names.The queue storage is organized as a fixed number of blocks of a fixed size. The block size must be an integer power of 2 and is expressed in bytes. Each written message, together with some metadata added by the queue, consumes an integer number of blocks. Each read message received by the reader releases the blocks allocated for that message. As such the maximum size of a message is slightly less than block size times capacity of the queue. For efficiency, it is recommended to choose block size large enough to accommodate most of the messages to be passed through the queue.The queue is considered empty when no messages are enqueued (all blocks are free). The queue is considered full at the point of enqueueing a message when there is not enough free blocks to accommodate the message.The queue is reliable in that it will not drop successfully sent messages that are not received by the reader, other than the case when a non-empty queue is destroyed by the last user. If a message cannot be enqueued by the writer because the queue is full, the queue can either block the writer or return an error or throw an exception, depending on the policy specified at the queue creation. The policy is object local, i.e. different writers and the reader can have different overflow policies.If the queue is empty and the reader attempts to dequeue a message, it will block until a message is enqueued by a writer.A blocked reader or writer can be unblocked by calling stop_local. After this method is called, all threads blocked on this particular object are released and return operation_result::aborted. The other instances of the queue (in the current or other processes) are unaffected. In order to restore the normal functioning of the queue instance after the stop_local call the user has to invoke reset_local.The queue does not guarantee any particular order of received messages from different writer threads. Messages sent by a particular writer thread will be received in the order of sending.Methods of this class are not thread-safe, unless otherwise specified. The operation has completed successfully. The message could not be sent because the queue is full. The operation has been aborted because the queue method stop_local() has been called. Result codes for various operations on the queue.
Block the send operation when the queue is full. Return operation_result::no_space when the queue is full. Throw capacity_limit_reached exception when the queue is full. Interprocess queue overflow policies.
Queue message size type. uint32_t
voidreliable_message_queue &The other object to swap with. The method swaps the object with that.
voidobject_name const &Name of the message queue to be associated with. uint32_tMaximum number of allocation blocks the queue can hold. size_typeSize in bytes of allocation block. Must be a power of 2. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. The method creates the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created.
is_open() == false
is_open() == true
voidobject_name const &Name of the message queue to be associated with. uint32_tMaximum number of allocation blocks the queue can hold. size_typeSize in bytes of allocation block. Must be a power of 2. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. The method creates or opens the message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from this object after this method returns.
is_open() == false
is_open() == true
voidobject_name const &Name of the message queue to be associated with. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems. The method opens the existing message queue to be associated with the object. After the call, the object will be in running state if a message queue is successfully opened.
is_open() == false
is_open() == true
boolTests whether the object is associated with any message queue.
true if the object is associated with a message queue, and false otherwise.
voidThis method empties the associated message queue. Concurrent calls to this method, send(), try_send(), receive(), try_receive(), and stop_local() are allowed.
is_open() == true
object_name const &The method returns the name of the associated message queue.
is_open() == true
Name of the associated message queue
uint32_tThe method returns the maximum number of allocation blocks the associated message queue can hold. Note that the returned value may be different from the corresponding value passed to the constructor or open_or_create(), for the message queue may not have been created by this object.
is_open() == true
Maximum number of allocation blocks the associated message queue can hold.
size_typeThe method returns the allocation block size, in bytes. Each message in the associated message queue consumes an integer number of allocation blocks. Note that the returned value may be different from the corresponding value passed to the constructor or open_or_create(), for the message queue may not have been created by this object.
is_open() == true
Allocation block size, in bytes.
voidThe method wakes up all threads that are blocked in calls to send() or receive(). Those calls would then return operation_result::aborted. Note that, the method does not block until the woken-up threads have actually returned from send() or receive(). Other means is needed to ensure that calls to send() or receive() have returned, e.g., joining the threads that might be blocking on the calls.The method also puts the object in stopped state. When in stopped state, calls to send() or receive() will return immediately with return value operation_result::aborted when they would otherwise block in running state.Concurrent calls to this method, send(), try_send(), receive(), try_receive(), and clear() are allowed.
is_open() == true
voidThe method puts the object in running state where calls to send() or receive() may block. This method is not thread-safe.
is_open() == true
voidThe method disassociates the associated message queue, if any. No other threads should be using this object before calling this method. The stop_local() method can be used to have any threads currently blocked in send() or receive() return, and prevent further calls to them from blocking. Typically, before calling this method, one would first call stop_local() and then join all threads that might be blocking on send() or receive() to ensure that they have returned from the calls. The associated message queue is destroyed if the object represents the last outstanding reference to it.
is_open() == false
operation_resultvoid const *The message data to send. Ignored when message_size is 0. size_typeSize of the message data in bytes. If the size is larger than the associated message queue capacity, an std::logic_error exception is thrown.The method sends a message to the associated message queue. When the object is in running state and the queue has no free space for the message, the method either blocks or throws an exception, depending on the overflow policy that was specified on the queue opening/creation. If blocking policy is in effect, the blocking can be interrupted by calling stop_local(), in which case the method returns operation_result::aborted. When the object is already in the stopped state, the method does not block but returns immediately with return value operation_result::aborted.It is possible to send an empty message by passing 0 to the parameter message_size.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
Throws: std::logic_error in case if the message size exceeds the queue capacity, system_error in case if a native OS method fails. is_open() == true
boolvoid const *The message data to send. Ignored when message_size is 0. size_typeSize of the message data in bytes. If the size is larger than the maximum size allowed by the associated message queue, an std::logic_error exception is thrown.The method performs an attempt to send a message to the associated message queue. The method is non-blocking, and always returns immediately. boost::system::system_error is thrown for errors resulting from native operating system calls. Note that it is possible to send an empty message by passing 0 to the parameter message_size. Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
Throws: std::logic_error in case if the message size exceeds the queue capacity, system_error in case if a native OS method fails. is_open() == true
true if the message is successfully sent, and false otherwise (e.g., when the queue is full).
operation_resultvoid *The memory buffer to store the received message in. size_typeThe size of the buffer, in bytes. size_type &Receives the size of the received message, in bytes.The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
operation_result
size_type
ElementT(&)The memory buffer to store the received message in. size_type &Receives the size of the received message, in bytes.The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
operation_result
ContainerT &The container to store the received message in. The container should have value type of char, signed char or unsigned char and support inserting elements at the end.The method takes a message from the associated message queue. When the object is in running state and the queue is empty, the method blocks. The blocking is interrupted when stop_local() is called, in which case the method returns operation_result::aborted. When the object is already in the stopped state and the queue is empty, the method does not block but returns immediately with return value operation_result::aborted.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
boolvoid *The memory buffer to store the received message in. size_typeThe size of the buffer, in bytes. size_type &Receives the size of the received message, in bytes.The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
true if a message is successfully received, and false otherwise (e.g., when the queue is empty).
bool
size_type
ElementT(&)The memory buffer to store the received message in. size_type &Receives the size of the received message, in bytes.The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
true if a message is successfully received, and false otherwise (e.g., when the queue is empty).
bool
ContainerT &The container to store the received message in. The container should have value type of char, signed char or unsigned char and support inserting elements at the end.The method performs an attempt to take a message from the associated message queue. The method is non-blocking, and always returns immediately.Concurrent calls to send(), try_send(), receive(), try_receive(), stop_local(), and clear() are allowed.
is_open() == true
true if a message is successfully received, and false otherwise (e.g., when the queue is empty).
Default constructor. The method constructs an object that is not associated with any message queue.
is_open() == false
open_mode::create_only_tagobject_name const &Name of the message queue to be associated with. uint32_tMaximum number of allocation blocks the queue can hold. size_typeSize in bytes of allocation block. Must be a power of 2. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. Constructor. The method is used to construct an object and create the associated message queue. The constructed object will be in running state if the message queue is successfully created.
is_open() == true
open_mode::open_or_create_tagobject_name const &Name of the message queue to be associated with. uint32_tMaximum number of allocation blocks the queue can hold. size_typeSize in bytes of allocation block. Must be a power of 2. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. Constructor. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created or opened. If the message queue that is identified by the name already exists then the other queue parameters are ignored. The actual queue parameters can be obtained with accessors from the constructed object.
is_open() == true
open_mode::open_only_tagobject_name const &Name of the message queue to be associated with. overflow_policyblock_on_overflowQueue behavior policy in case of overflow. permissions const &permissions()Access permissions for the associated message queue. The permissions will only be used if the queue implementation has to create system objects while operating. This parameter is currently not used on POSIX systems. Constructor. The method is used to construct an object and open the existing message queue. The constructed object will be in running state if the message queue is successfully opened.
is_open() == true
typename...
Args const &...Constructor with named parameters. The method is used to construct an object and create or open the associated message queue. The constructed object will be in running state if the message queue is successfully created.The following named parameters are accepted:
open_mode - One of the open mode tags: open_mode::create_only, open_mode::open_only or open_mode::open_or_create.
name - Name of the message queue to be associated with.
capacity - Maximum number of allocation blocks the queue can hold. Used only if the queue is created.
block_size - Size in bytes of allocation block. Must be a power of 2. Used only if the queue is created.
overflow_policy - Queue behavior policy in case of overflow, see overflow_policy.
permissions - Access permissions for the associated message queue.
is_open() == true
Destructor. Calls close().
reliable_message_queue &&The object to be moved. Move constructor. The method move-constructs an object from other. After the call, the constructed object becomes other, while other is left in default constructed state.
reliable_message_queue &reliable_message_queue &&The object to be moved.Move assignment operator. If the object is associated with a message queue, close() is first called and the precondition to calling close() applies. After the call, the object becomes that while that is left in default constructed state.
A reference to the assigned object.
friend voidreliable_message_queue &reliable_message_queue &Swaps the two reliable_message_queue objects.
voidobject_name const &Name of the message queue to be removed. The method frees system-wide resources, associated with the interprocess queue with the supplied name. The queue referred to by the specified name must not be opened in any process at the point of this call. After this call succeeds a new queue with the specified name can be created.This call can be useful to recover from an earlier process misbehavior (e.g. a crash without properly closing the message queue). In this case resources allocated for the interprocess queue may remain allocated after the last process closed the queue, which in turn may prevent creating a new queue with the same name. By calling this method before creating a queue the application can attempt to ensure it starts with a clean slate.On some platforms resources associated with the queue are automatically reclaimed by the operating system when the last process using those resources terminates (even if it terminates abnormally). On these platforms this call may be a no-op. However, portable code should still call this method at appropriate places to ensure compatibility with other platforms and future library versions, which may change implementation of the queue.
Andrey Semashev
06.11.2012
This header includes all manipulators.
Andrey Semashev
26.11.2012
This header contains the add_value manipulator.
Attribute value manipulator. Stored reference type. RefT
Attribute value type. remove_cv< typename remove_reference< reference_type >::type >::type
attribute_nameReturns attribute name.
get_value_result_typeReturns attribute value.
attribute_name const &reference_typeInitializing constructor.
basic_record_ostream< CharT > &
basic_record_ostream< CharT > &add_value_manip< RefT > const &The operator attaches an attribute value to the log record.
add_value_manip< T && >
attribute_name const &T &&add_value_manip< typename DescriptorT::value_type && >
template< typename > class
expressions::attribute_keyword< DescriptorT, ActorT > const &typename DescriptorT::value_type &&add_value_manip< typename DescriptorT::value_type & >
template< typename > class
expressions::attribute_keyword< DescriptorT, ActorT > const &typename DescriptorT::value_type &add_value_manip< typename DescriptorT::value_type const & >
template< typename > class
expressions::attribute_keyword< DescriptorT, ActorT > const &typename DescriptorT::value_type const &The function creates a manipulator that attaches an attribute value to a log record.
Andrey Semashev
23.06.2019
The header contains implementation of a stream manipulator for inserting a newline, unless there is already one inserted.
Stream manipulator for inserting a newline character, unless the last character inserted into the stream is already a newline. struct boost::log::auto_newline_manip
basic_formatting_ostream< CharT, TraitsT, AllocatorT > &
basic_formatting_ostream< CharT, TraitsT, AllocatorT > &auto_newline_manipStream output operator for the auto_newline manipulator
Andrey Semashev
03.05.2013
This header contains the dump output manipulator.
dump_manipManipulator for printing binary representation of the data with a size limit.
std::size_t
const void *std::size_tstd::size_t
bounded_dump_manip const &
Manipulator for printing binary representation of the data.
const void *
std::size_t
const void *std::size_t
dump_manip const &
std::basic_ostream< CharT, TraitsT > &
std::basic_ostream< CharT, TraitsT > &dump_manip const &The operator outputs binary data to a stream.
std::basic_ostream< CharT, TraitsT > &
std::basic_ostream< CharT, TraitsT > &bounded_dump_manip const &The operator outputs binary data to a stream.
unspecified
T *The pointer to the beginning of the region std::size_tThe size of the region, in bytes Creates a stream manipulator that will output contents of a memory region in hexadecimal form.
The manipulator that is to be put to a stream
dump_manip
T *The pointer to the beginning of the array std::size_tThe size of the region, in number of T elements Creates a stream manipulator that will dump elements of an array in hexadecimal form.
The manipulator that is to be put to a stream
unspecified
T *The pointer to the beginning of the region std::size_tThe size of the region, in bytes std::size_tThe maximum number of bytes of the region to output Creates a stream manipulator that will output contents of a memory region in hexadecimal form.
The manipulator that is to be put to a stream
bounded_dump_manip
T *The pointer to the beginning of the array std::size_tThe size of the region, in number of T elements std::size_tThe maximum number of elements to output Creates a stream manipulator that will dump elements of an array in hexadecimal form.
The manipulator that is to be put to a stream
Andrey Semashev
06.11.2012
This header contains the to_log output manipulator.
void
Generic manipulator for customizing output to log. Output value type. T
Value tag type. TagT
value_type const &
value_type const &
to_log_manip const &
unspecified
StreamT &to_log_manip< T, TagT >
to_log_manip< T >
T const &
to_log_manip< T, TagT >
T const &
The header defines classes and macros for once-blocks. Andrey Semashev
23.06.2010
A flag to detect if a code block has already been executed. This structure should be used in conjunction with the BOOST_LOG_ONCE_BLOCK_FLAG macro. Usage example: once_block_flag flag = BOOST_LOG_ONCE_BLOCK_INIT;void foo() { BOOST_LOG_ONCE_BLOCK_FLAG(flag) { puts("Hello, world once!"); } }
The static initializer for once_block_flag.
Begins a code block to be executed only once, with protection against thread concurrency. User has to provide the flag variable that controls whether the block has already been executed.
Begins a code block to be executed only once, with protection against thread concurrency.
Andrey Semashev
01.01.2016
The header defines resource opening modes.
Create a new resource; fail if exists already. Opens an existing resource; fail if not exist. Creates a new resource or opens an existing one. struct boost::log::open_mode::create_only_tag
struct boost::log::open_mode::open_only_tag
struct boost::log::open_mode::open_or_create_tag
Lingxi Li
Andrey Semashev
14.10.2015
The header contains an abstraction wrapper for security permissions.
Access permissions wrapper. On Windows platforms, it represents a pointer to SECURITY_ATTRIBUTES. The user is responsible for allocating and reclaiming resources associated with the pointer, permissions instance does not own them.On POSIX platforms, it represents a mode_t value. The type of security permissions, specific to the operating system. implementation_defined
voidnative_typeSets permissions from the OS-specific permissions.
native_typeReturns the underlying OS-specific permissions.
voidSets the default permissions, which are equivalent to NULL SECURITY_ATTRIBUTES on Windows and 0644 on POSIX platforms.
voidSets unrestricted permissions, which are equivalent to SECURITY_ATTRIBUTES with NULL DACL on Windows and 0666 on POSIX platforms.
voidpermissions &The other object to swap with. The method swaps the object with that.
Default constructor. The method constructs an object that represents a null SECURITY_ATTRIBUTES pointer on Windows platforms, and a mode_t value 0644 on POSIX platforms.
permissions const &Copy constructor.
permissions &permissions const &Copy assignment.
native_typeInitializing constructor.
boost::interprocess::permissions const &Initializing constructor.
permissions &&Move constructor.
permissions &permissions &&Move assignment.
friend voidpermissions &permissions &Swaps the two permissions objects.
Andrey Semashev
23.08.2009
This header contains ordering predicates for logging records.
less
FunTOrdering predicate, based on opaque pointers to the record view implementation data. Since record views only refer to a shared implementation data, this predicate is able to order the views by comparing the pointers to the data. Therefore two views are considered to be equivalent if they refer to the same implementation data. Otherwise it is not specified whether one record is ordered before the other until the predicate is applied. Note that the ordering may change every time the application runs.This kind of ordering may be useful if log records are to be stored in an associative container with as least performance overhead as possible, when the particular order is not important.The FunT template argument is the predicate that is used to actually compare pointers. It should be able to compare const void* pointers. The compared pointers may refer to distinct memory regions, the pointers must not be interpreted in any way. Result type. bool
result_typerecord_view const &record_view const &Ordering operator
Default constructor. Requires FunT to be default constructible.
FunT const &Initializing constructor. Constructs FunT instance as a copy of the fun argument.
less
FunTOrdering predicate, based on attribute values associated with records. This predicate allows to order log records based on values of a specifically named attribute associated with them. Two given log records being compared should both have the specified attribute value of the specified type to be able to be ordered properly. As a special case, if neither of the records have the value, these records are considered equivalent. Otherwise, the ordering results are unspecified. void
result_type
LeftT const &
attribute_value_ordering const &record_view const &bool &
void
result_type
RightT const &
FunT const &LeftT const &bool &
Result type. bool
Compared attribute value type. ValueT
result_typerecord_view const &record_view const &Ordering operator
attribute_name const &The attribute value name to be compared FunT const &FunT()The ordering functor Initializing constructor.
attribute_value_ordering< ValueT, FunT >
attribute_name const &FunT const &The function constructs a log record ordering predicate
unspecified
attribute_name const &FunT const &The function constructs a log record ordering predicate
Andrey Semashev
16.02.2013
This header includes all library setup helpers.
Andrey Semashev
16.05.2008
The header contains implementation of convenience functions for registering commonly used attributes.
voidSimple attribute initialization routine. The function adds commonly used attributes to the logging system. Specifically, the following attributes are registered globally:
LineID - logging records counter with value type unsigned int
TimeStamp - local time generator with value type boost::posix_time::ptime
ProcessID - current process identifier with value type attributes::current_process_id::value_type
ThreadID - in multithreaded builds, current thread identifier with value type attributes::current_thread_id::value_type
Andrey Semashev
16.05.2008
The header contains implementation of convenience functions for enabling logging to console.
shared_ptr< sinks::synchronous_sink< sinks::basic_text_ostream_backend< CharT > >>
typename...
std::basic_ostream< CharT > &One of the standard console streams: std::cout, std::cerr or std::clog (or the corresponding wide-character analogues). ArgsT... const &Optional additional named arguments for the sink initialization. The following arguments are supported:
filter Specifies a filter to install into the sink. May be a string that represents a filter, or a filter lambda expression.
format Specifies a formatter to install into the sink. May be a string that represents a formatter, or a formatter lambda expression (either streaming or Boost.Format-like notation).
auto_flush A boolean flag that shows whether the sink should automatically flush the stream after each written record.
auto_newline_mode - Specifies automatic trailing newline insertion mode. Must be a value of the auto_newline_mode enum. By default, is auto_newline_mode::insert_if_missing.
The function constructs sink for the specified console stream and adds it to the core
Pointer to the constructed sink.
shared_ptr< sinks::synchronous_sink< sinks::basic_text_ostream_backend< CharT > >>
typename...
ArgsT... const &Equivalent to: add_console_log(std::clog); or add_console_log(std::wclog);, depending on the CharT type.This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
shared_ptr< sinks::synchronous_sink< sinks::text_ostream_backend >>The function constructs sink for the std::clog stream and adds it to the coreThis is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.
Pointer to the constructed sink.
shared_ptr< sinks::synchronous_sink< sinks::wtext_ostream_backend >>The function constructs sink for the std::wclog stream and adds it to the core
Pointer to the constructed sink.
Andrey Semashev
16.05.2008
The header contains implementation of convenience functions for enabling logging to a file.
shared_ptr< sinks::synchronous_sink< sinks::text_file_backend > >
typename...
ArgsT... const &A number of named arguments. The following parameters are supported:
file_name The active file name or its pattern. This parameter is mandatory.
target_file_name - Specifies the target file name pattern to use to rename the log file on rotation, before passing it to the file collector. The pattern may contain the same placeholders as the file_name parameter. By default, no renaming is done, i.e. the written log file keeps its name according to file_name.
open_mode The mask that describes the open mode for the file. See std::ios_base::openmode.
rotation_size The size of the file at which rotation should occur. See basic_text_file_backend.
time_based_rotation The predicate for time-based file rotations. See basic_text_file_backend.
auto_flush A boolean flag that shows whether the sink should automatically flush the file after each written record.
auto_newline_mode - Specifies automatic trailing newline insertion mode. Must be a value of the auto_newline_mode enum. By default, is auto_newline_mode::insert_if_missing.
target The target directory to store rotated files in. See sinks::file::make_collector.
max_size The maximum total size of rotated files in the target directory. See sinks::file::make_collector.
min_free_space Minimum free space in the target directory. See sinks::file::make_collector.
max_files The maximum total number of rotated files in the target directory. See sinks::file::make_collector.
scan_method The method of scanning the target directory for log files. See sinks::file::scan_method.
filter Specifies a filter to install into the sink. May be a string that represents a filter, or a filter lambda expression.
format Specifies a formatter to install into the sink. May be a string that represents a formatter, or a formatter lambda expression (either streaming or Boost.Format-like notation).
The function initializes the logging library to write logs to a file stream.
Pointer to the constructed sink.
Andrey Semashev
31.03.2008
The header contains definition of a filter parser function.
boost::log::filter_factory< CharT >The base class for filter factories. The class defines default implementations for most filter expressions. In order to be able to construct filters, the attribute value type must support reading from a stream. Also, the default filters will rely on relational operators for the type, so these operators must also be defined. The type(s) of the attribute value expected. AttributeValueT
base_type::string_type
filterattribute_name const &The callback for filter for the attribute existence test
filterattribute_name const &string_type const &The callback for equality relation filter
filterattribute_name const &string_type const &The callback for inequality relation filter
filterattribute_name const &string_type const &The callback for less relation filter
filterattribute_name const &string_type const &The callback for greater relation filter
filterattribute_name const &string_type const &The callback for less or equal relation filter
filterattribute_name const &string_type const &The callback for greater or equal relation filter
filterattribute_name const &string_type const &string_type const &The callback for custom relation filter
value_typestring_type const &The function parses the argument value for a binary relation
The interface class for all filter factories. Character type. CharT
String type. std::basic_string< char_type >
filterattribute_name const &The callback for filter for the attribute existence test
filterattribute_name const &string_type const &The callback for equality relation filter
filterattribute_name const &string_type const &The callback for inequality relation filter
filterattribute_name const &string_type const &The callback for less relation filter
filterattribute_name const &string_type const &The callback for greater relation filter
filterattribute_name const &string_type const &The callback for less or equal relation filter
filterattribute_name const &string_type const &The callback for greater or equal relation filter
filterattribute_name const &string_type const &string_type const &The callback for custom relation filter
Default constructorVirtual destructor
filter_factory const &
filter_factory &filter_factory const &
void
attribute_name const &Attribute name to associate the factory with shared_ptr< filter_factory< CharT > > const &The filter factory The function registers a filter factory object for the specified attribute name. The factory will be used to construct a filter during parsing the filter string.
name != NULL && factory != NULL, name points to a zero-terminated string
boost::enable_if_c< is_base_and_derived< filter_factory< typename FactoryT::char_type >, FactoryT >::value >::type
attribute_name const &Attribute name to associate the factory with shared_ptr< FactoryT > const &The filter factory The function registers a filter factory object for the specified attribute name. The factory will be used to construct a filter during parsing the filter string.
name != NULL && factory != NULL, name points to a zero-terminated string
void
attribute_name const &Attribute name to associate the factory with The function registers a simple filter factory object for the specified attribute name. The factory will support attribute values of type AttributeValueT, which must support all relation operations, such as equality comparison and less/greater ordering, and also extraction from stream.
name != NULL, name points to a zero-terminated string
void
attribute_name const &Attribute name to associate the factory with The function registers a simple filter factory object for the specified attribute name. The factory will support attribute values of type AttributeValueT, which must support all relation operations, such as equality comparison and less/greater ordering, and also extraction from stream.
name != NULL, name points to a zero-terminated string
void
template< typename > class
expressions::attribute_keyword< DescriptorT, ActorT > const &Attribute keyword to associate the factory with The function registers a simple filter factory object for the specified attribute keyword. The factory will support attribute values described by the keyword. The values must support all relation operations, such as equality comparison and less/greater ordering, and also extraction from stream.
name != NULL, name points to a zero-terminated string
filter
const CharT *Pointer to the first character of the sequence const CharT *Pointer to the after-the-last character of the sequence The function parses a filter from the sequence of characters
Throws: An std::exception-based exception, if a filter cannot be recognized in the character sequence. begin <= end, both pointers must not be NULL
A function object that can be used as a filter.
filter
std::basic_string< CharT, TraitsT, AllocatorT > const &A string that contains filter description The function parses a filter from the string
Throws: An std::exception-based exception, if a filter cannot be recognized in the character sequence. A function object that can be used as a filter.
filter
const CharT *A string that contains filter description. The function parses a filter from the string
Throws: An std::exception-based exception, if a filter cannot be recognized in the character sequence. str != NULL, str points to a zero-terminated string.
A function object that can be used as a filter.
Andrey Semashev
07.04.2008
The header contains definition of a formatter parser function, along with facilities to add support for custom formatters.
boost::log::formatter_factory< CharT >Base class for formatter factories. This class provides default implementation of formatter expressions for types supporting stream output. The factory does not take into account any additional parameters that may be specified. Attribute value type. AttributeValueT
base_type::formatter_type
base_type::args_map
formatter_typeattribute_name const &Attribute name args_map const &Formatter arguments The function creates a formatter for the specified attribute.
Formatter factory base interface. Character type. CharT
String type. std::basic_string< char_type >
The formatter function object. basic_formatter< char_type >
Type of the map of formatter factory arguments [argument name -> argument value]. This type of maps will be passed to formatter factories on attempt to create a formatter. std::map< string_type, string_type >
formatter_typeattribute_name const &Attribute name args_map const &Formatter arguments The function creates a formatter for the specified attribute.
Default constructorVirtual destructor
formatter_factory const &
formatter_factory &formatter_factory const &
void
attribute_name const &Attribute name shared_ptr< formatter_factory< CharT > > const &Pointer to the formatter factory The function registers a user-defined formatter factory. The function registers a user-defined formatter factory. The registered factory function will be called when the formatter parser detects the specified attribute name in the formatter string.
!!attr_name && !!factory.
boost::enable_if_c< is_base_and_derived< formatter_factory< typename FactoryT::char_type >, FactoryT >::value >::type
attribute_name const &Attribute name shared_ptr< FactoryT > const &Pointer to the formatter factory The function registers a user-defined formatter factory. The function registers a user-defined formatter factory. The registered factory function will be called when the formatter parser detects the specified attribute name in the formatter string.
!!attr_name && !!factory.
void
attribute_name const &Attribute name The function registers a simple formatter factory. The function registers a simple formatter factory. The registered factory will generate formatters that will be equivalent to the log::expressions::attr formatter (i.e. that will use the native operator<< to format the attribute value). The factory does not use any arguments from the format string, if specified.
!!attr_name.
basic_formatter< CharT >
const CharT *Pointer to the first character of the sequence const CharT *Pointer to the after-the-last character of the sequence The function parses a formatter from the sequence of characters
Throws: An std::exception-based exception, if a formatter cannot be recognized in the character sequence. begin <= end, both pointers must not be NULL
The parsed formatter.
basic_formatter< CharT >
std::basic_string< CharT, TraitsT, AllocatorT > const &A string that contains format description The function parses a formatter from the string
Throws: An std::exception-based exception, if a formatter cannot be recognized in the character sequence. The parsed formatter.
basic_formatter< CharT >
const CharT *A string that contains format description. The function parses a formatter from the string
Throws: An std::exception-based exception, if a formatter cannot be recognized in the character sequence. str != NULL, str points to a zero-terminated string
The parsed formatter.
Andrey Semashev
11.10.2009
The header contains definition of facilities that allows to initialize the library from settings.
Sink factory base interface Character type. CharT
String type. std::basic_string< char_type >
Settings section type. basic_settings_section< char_type >
shared_ptr< sinks::sink >settings_section const &Sink parameters The function creates a formatter for the specified attribute.
Default constructorVirtual destructor
sink_factory const &
sink_factory &sink_factory const &
void
basic_settings_section< CharT > const &Library settings containerThe function initializes the logging library from a settings container
Throws: An std::exception-based exception if the provided settings are not valid.
void
const char *The custom sink name. Must point to a zero-terminated sequence of characters, must not be NULL. shared_ptr< sink_factory< CharT > > const &Pointer to the custom sink factory. Must not be NULL. The function registers a factory for a custom sink. The function registers a factory for a sink. The factory will be called to create sink instance when the parser discovers the specified sink type in the settings file. The factory must accept a map of parameters [parameter name -> parameter value] that it may use to initialize the sink. The factory must return a non-NULL pointer to the constructed sink instance.
void
std::string const &The custom sink name shared_ptr< sink_factory< CharT > > const &Pointer to the custom sink factory. Must not be NULL. The function registers a factory for a custom sink. The function registers a factory for a sink. The factory will be called to create sink instance when the parser discovers the specified sink type in the settings file. The factory must accept a map of parameters [parameter name -> parameter value] that it may use to initialize the sink. The factory must return a non-NULL pointer to the constructed sink instance.
boost::enable_if_c< is_base_and_derived< sink_factory< typename FactoryT::char_type >, FactoryT >::value >::type
const char *The custom sink name. Must point to a zero-terminated sequence of characters, must not be NULL. shared_ptr< FactoryT > const &Pointer to the custom sink factory. Must not be NULL. The function registers a factory for a custom sink. The function registers a factory for a sink. The factory will be called to create sink instance when the parser discovers the specified sink type in the settings file. The factory must accept a map of parameters [parameter name -> parameter value] that it may use to initialize the sink. The factory must return a non-NULL pointer to the constructed sink instance.
boost::enable_if_c< is_base_and_derived< sink_factory< typename FactoryT::char_type >, FactoryT >::value >::type
std::string const &The custom sink name shared_ptr< FactoryT > const &Pointer to the custom sink factory. Must not be NULL. The function registers a factory for a custom sink. The function registers a factory for a sink. The factory will be called to create sink instance when the parser discovers the specified sink type in the settings file. The factory must accept a map of parameters [parameter name -> parameter value] that it may use to initialize the sink. The factory must return a non-NULL pointer to the constructed sink instance.
Andrey Semashev
22.03.2008
The header contains definition of facilities that allows to initialize the library from a settings file.
void
std::basic_istream< CharT > &Stream, that provides library settingsThe function initializes the logging library from a stream containing logging settings
Throws: An std::exception-based exception if the read data cannot be interpreted as the library settings
Andrey Semashev
11.10.2009
The header contains definition of the library settings container.
boost::log::basic_settings_section< CharT >The class represents settings container. All settings are presented as a number of named parameters divided into named sections. The parameters values are stored as strings. Individual parameters may be queried via subscript operators, like this:
optional< string > param = settings["Section1"]["Param1"]; // reads parameter "Param1" in section "Section1"
// returns an empty value if no such parameter exists
settings["Section2"]["Param2"] = 10; // sets the parameter "Param2" in section "Section2"
// to value "10"
There are also other methods to work with parameters. Section type. basic_settings_section< CharT >
Property tree type. section::property_tree_type
Default constructor. Creates an empty settings container.
basic_settings const &Copy constructor.
this_type &&Move constructor.
property_tree_type const &Initializing constructor. Creates a settings container with the copy of the specified property tree.
Destructor
basic_settings &basic_settings const &Copy assignment operator.
basic_settings &basic_settings &&Move assignment operator.
The class represents a reference to the settings container section. The section refers to a sub-tree of the library settings container. It does not own the referred sub-tree but allows for convenient access to parameters within the subsection. Character type. CharT
String type. std::basic_string< char_type >
Property tree type. property_tree::basic_ptree< std::string, string_type >
Property tree path type. property_tree_type::path_type
Constant reference to the parameter value implementation_defined
Mutable reference to the parameter value implementation_defined
Constant iterator over nested parameters and subsections implementation_defined
Mutable iterator over nested parameters and subsections implementation_defined
boolChecks if the section refers to the container.
boolChecks if the section refers to the container.
iteratorReturns an iterator over the nested subsections and parameters.
iteratorReturns an iterator over the nested subsections and parameters.
const_iteratorReturns an iterator over the nested subsections and parameters.
const_iteratorReturns an iterator over the nested subsections and parameters.
reverse_iteratorReturns a reverse iterator over the nested subsections and parameters.
reverse_iteratorReturns a reverse iterator over the nested subsections and parameters.
const_reverse_iteratorReturns a reverse iterator over the nested subsections and parameters.
const_reverse_iteratorReturns a reverse iterator over the nested subsections and parameters.
boolChecks if the container is empty (i.e. contains no sections and parameters).
referencestd::string const &The name of the section in which the parameter resides Accessor to a single parameter. This operator should be used in conjunction with the subsequent subscript operator that designates the parameter name.
An unspecified reference type that can be used for parameter name specifying
const_referencestd::string const &The name of the section in which the parameter resides Accessor to a single parameter. This operator should be used in conjunction with the subsequent subscript operator that designates the parameter name.
An unspecified reference type that can be used for parameter name specifying
referenceconst char *The name of the section in which the parameter resides Accessor to a single parameter. This operator should be used in conjunction with the subsequent subscript operator that designates the parameter name.
An unspecified reference type that can be used for parameter name specifying
const_referenceconst char *The name of the section in which the parameter resides Accessor to a single parameter. This operator should be used in conjunction with the subsequent subscript operator that designates the parameter name.
An unspecified reference type that can be used for parameter name specifying
property_tree_type const &Accessor for the embedded property tree
property_tree_type &Accessor for the embedded property tree
boolstring_type const &The name of the section Checks if the specified section is present in the container.
boolstring_type const &The name of the section in which the parameter resides string_type const &The name of the parameter Checks if the specified parameter is present in the container.
voidbasic_settings_section &Swaps two references to settings sections.
Default constructor. Creates an empty settings container.
basic_settings_section const &Copy constructor.
property_tree_type *
Convenience typedef for narrow-character logging. basic_settings< char >
Convenience typedef for narrow-character logging. basic_settings_section< char >
Convenience typedef for wide-character logging. basic_settings< wchar_t >
Convenience typedef for wide-character logging. basic_settings_section< wchar_t >
void
basic_settings_section< CharT > &basic_settings_section< CharT > &
Andrey Semashev
20.07.2012
The header contains definition of a settings parser function.
basic_settings< CharT >
std::basic_istream< CharT > &Stream, that provides library settingsThe function parses library settings from an input stream
Throws: An std::exception-based exception if the read data cannot be interpreted as the library settings
Andrey Semashev
30.05.2010
The header contains definition of the strictest_lock metafunction that allows to select a lock with the strictest access requirements.
typename...
The metafunction selects the most strict lock type of the specified. The template supports all lock types provided by the Boost.Thread library (except for upgrade_to_unique_lock), plus additional pseudo-lock no_lock that indicates no locking at all. Exclusive locks are considered the strictest, shared locks are weaker, and no_lock is the weakest. implementation_defined
The trait allows to select an access mode by the lock type.
boost::log::aux::exclusive_lock_guard< MutexT >mpl::integral_c< lock_access_mode, exclusive_access >
boost::log::aux::shared_lock_guard< MutexT >mpl::integral_c< lock_access_mode, shared_access >
lock_guard< MutexT >mpl::integral_c< lock_access_mode, exclusive_access >
no_lock< MutexT >mpl::integral_c< lock_access_mode, unlocked_access >
shared_lock< MutexT >mpl::integral_c< lock_access_mode, shared_access >
shared_lock_guard< MutexT >mpl::integral_c< lock_access_mode, shared_access >
unique_lock< MutexT >mpl::integral_c< lock_access_mode, exclusive_access >
upgrade_lock< MutexT >mpl::integral_c< lock_access_mode, shared_access >A thread that owns this kind of lock doesn't restrict other threads in any way. A thread that owns this kind of lock requires that no other thread modify the locked data. A thread that owns this kind of lock requires that no other thread has access to the locked data. Access modes for different types of locks.
Andrey Semashev
24.06.2007
The header contains implementation of a constant string literal wrapper.
std::basic_ostream< CharT, StrmTraitsT > &
std::basic_ostream< CharT, StrmTraitsT > &basic_string_literal< CharT, LitTraitsT > const &Output operator.
constexpr void
basic_string_literal< CharT, TraitsT > &basic_string_literal< CharT, TraitsT > &External swap.
constexpr basic_string_literal< T >
std::size_t
T(&)Creates a string literal wrapper from a constant string literal.
Andrey Semashev
24.06.2007
The header contains forward declaration of a constant string literal wrapper.
String literal wrapper. The basic_string_literal is a thin wrapper around a constant string literal. It provides interface similar to STL strings, but because of read-only nature of string literals, lacks ability to modify string contents. However, basic_string_literal objects can be assigned to and cleared.The main advantage of this class comparing to other string classes is that it doesn't dynamically allocate memory and therefore is fast, thin and exception safe.
boolthis_type const &Comparand Lexicographical comparison (equality)
true if the comparand string equals to this string, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (equality)
true if the comparand string equals to this string, false otherwise
boolstring_type const &Comparand Lexicographical comparison (equality)
true if the comparand string equals to this string, false otherwise
boolthis_type const &Comparand Lexicographical comparison (inequality)
true if the comparand string is not equal to this string, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (inequality)
true if the comparand string is not equal to this string, false otherwise
boolstring_type const &Comparand Lexicographical comparison (inequality)
true if the comparand string is not equal to this string, false otherwise
boolthis_type const &Comparand Lexicographical comparison (less ordering)
true if this string is less than the comparand, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (less ordering)
true if this string is less than the comparand, false otherwise
boolstring_type const &Comparand Lexicographical comparison (less ordering)
true if this string is less than the comparand, false otherwise
boolthis_type const &Comparand Lexicographical comparison (less or equal ordering)
true if this string is less or equal to the comparand, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (less or equal ordering)
true if this string is less or equal to the comparand, false otherwise
boolstring_type const &Comparand Lexicographical comparison (less or equal ordering)
true if this string is less or equal to the comparand, false otherwise
boolthis_type const &Comparand Lexicographical comparison (greater ordering)
true if this string is greater than the comparand, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (greater ordering)
true if this string is greater than the comparand, false otherwise
boolstring_type const &Comparand Lexicographical comparison (greater ordering)
true if this string is greater than the comparand, false otherwise
boolthis_type const &Comparand Lexicographical comparison (greater or equal ordering)
true if this string is greater or equal to the comparand, false otherwise
boolconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographical comparison (greater or qual ordering)
true if this string is greater or equal to the comparand, false otherwise
boolstring_type const &Comparand Lexicographical comparison (greater or equal ordering)
true if this string is greater or equal to the comparand, false otherwise
constexpr const_referencesize_typeRequested character index Subscript operator
i < size()
Constant reference to the requested character
const_referencesize_typeRequested character index Checked subscript
Throws: An std::exception-based exception if index i is out of string boundaries Constant reference to the requested character
constexpr const_pointer
Pointer to the beginning of the literal
constexpr const_pointer
Pointer to the beginning of the literal
constexpr size_type
Length of the literal
constexpr size_type
Length of the literal
constexpr bool
true if the literal is an empty string, false otherwise
constexpr const_iterator
Iterator that points to the first character of the literal
constexpr const_iterator
Iterator that points after the last character of the literal
const_reverse_iterator
Reverse iterator that points to the last character of the literal
const_reverse_iterator
Reverse iterator that points before the first character of the literal
string_type
STL string constructed from the literal
constexpr voidThe method clears the literal
empty() == true
constexpr voidthis_type &The method swaps two literals
constexpr this_type &this_type const &Source literal to copy string from Assignment from another literal
*this == that
constexpr this_type &
size_type
T(&)A zero-terminated constant sequence of characters Assignment from another literal
*this == p
size_typevalue_type *Pointer to the external buffer beginning. Must not be NULL. The buffer must have enough capacity to accommodate the requested number of characters. size_typeMaximum number of characters to copy size_type0Starting position to start copying from The method copies the literal or its portion to an external buffer
Throws: An std::exception-based exception if pos is out of range. pos <= size()
Number of characters copied
intsize_typeStarting position within this string to perform comparison to size_typeLength of the substring of this string to perform comparison to const_pointerComparand. Must point to a sequence of characters, must not be NULL. size_typeNumber of characters in the sequence str. Lexicographically compares the argument string to a part of this string
Throws: An std::exception-based exception if pos is out of range. pos <= size()
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
intsize_typeStarting position within this string to perform comparison to size_typeLength of the substring of this string to perform comparison to const_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographically compares the argument string to a part of this string
Throws: An std::exception-based exception if pos is out of range. pos <= size()
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
intsize_typeStarting position within this string to perform comparison to size_typeLength of the substring of this string to perform comparison to this_type const &Comparand Lexicographically compares the argument string literal to a part of this string
Throws: An std::exception-based exception if pos is out of range. pos <= size()
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
intconst_pointerComparand. Must point to a sequence of characters, must not be NULL. size_typeNumber of characters in the sequence str. Lexicographically compares the argument string to this string
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
intconst_pointerComparand. Must point to a zero-terminated sequence of characters, must not be NULL. Lexicographically compares the argument string to this string
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
intthis_type const &Comparand Lexicographically compares the argument string to this string
Zero if the comparand equals this string, a negative value if this string is less than the comparand, a positive value if this string is greater than the comparand.
Constructor
empty() == true
size_type
T(&)A zero-terminated constant sequence of characters Constructor from a string literal
*this == p
basic_string_literal const &Source literal to copy string from Copy constructor
*this == that
constexpr this_type &this_type const &Source literal to copy string from Assignment operator
*this == that
constexpr this_type &
size_type
T(&)A zero-terminated constant sequence of characters Assignment from a string literal
*this == p
String literal type for narrow characters. basic_string_literal< char >
String literal type for wide characters. basic_string_literal< wchar_t >
Andrey Semashev
13.03.2008
The header contains definition of date and time-related types supported by the library by default.
An MPL-sequence of natively supported date and time types of attributes mpl::vector<>
An MPL-sequence of Boost date and time types of attributes mpl::vector<>
An MPL-sequence with the complete list of the supported date and time types mpl::vector<>
An MPL-sequence of natively supported date types of attributes native_date_time_types
An MPL-sequence of Boost date types of attributes mpl::vector<>
An MPL-sequence with the complete list of the supported date types mpl::vector<>
An MPL-sequence of natively supported time types native_date_time_types
An MPL-sequence of Boost time types. boost_date_time_types
An MPL-sequence with the complete list of the supported time types date_time_types
An MPL-sequence of natively supported time duration types of attributes mpl::vector<>
An MPL-sequence of Boost time duration types of attributes mpl::vector<>
An MPL-sequence with the complete list of the supported time duration types mpl::vector<>
An MPL-sequence of Boost time duration types of attributes mpl::vector<>
An MPL-sequence with the complete list of the supported time period types boost_time_period_types
Boost.Preprocessor sequence of the standard C date/time types.
Boost.Preprocessor sequence of the standard C date types.
Boost.Preprocessor sequence of the Boost date/time types.
Boost.Preprocessor sequence of date/time types.
Boost.Preprocessor sequence of the Boost date types.
Boost.Preprocessor sequence of date types.
Boost.Preprocessor sequence of the standard time duration types.
Boost.Preprocessor sequence of the Boost time duration types.
Boost.Preprocessor sequence of time duration types.
Boost.Preprocessor sequence of the Boost time period types.
Boost.Preprocessor sequence of time period types.
Andrey Semashev
15.04.2007
The header contains implementation of the run-time type dispatcher.
type_dispatcherA dynamic type dispatcher. The type dispatcher can be used to pass objects of arbitrary types from one component to another. With regard to the library, the type dispatcher can be used to extract attribute values.The dynamic type dispatcher can be initialized in run time and, therefore, can support different types, depending on runtime conditions. Each supported type is associated with a functional object that will be called when an object of the type is dispatched.
void
VisitorT const &Function object that will be associated with the type T The method registers a new type
dispatching_map::size_typeThe method returns the number of registered types
Default constructor
dynamic_type_dispatcher const &Copy constructor
dynamic_type_dispatcher &dynamic_type_dispatcher const &Copy assignment
Andrey Semashev
19.05.2007
The header contains definition of standard types supported by the library by default.
An MPL-sequence of integral types of attributes, supported by default mpl::vector<>
An MPL-sequence of FP types of attributes, supported by default mpl::vector<>
An MPL-sequence of all numeric types of attributes, supported by default mpl::vector<>
Deprecated alias. arithmetic_types
An MPL-sequence of string types of attributes, supported by default mpl::vector<>
Deprecated alias. default_attribute_value_types
typedefmpl::vectorBOOST_PP_SEQ_SIZE((bool)(signed char)(unsigned char)(short)(unsigned short)(int)(unsigned int)(long)(unsigned long)(char)(wchar_t)(char16_t)(char32_t)(float)(double)(long double)(std::string)(boost::log::string_literal)(std::wstring)(boost::log::wstring_literal))An MPL-sequence of all attribute value types that are supported by the library by default.
Boost.Preprocessor sequence of character types.
Boost.Preprocessor sequence of integral types.
Boost.Preprocessor sequence of floating point types.
Boost.Preprocessor sequence of arithmetic types.
Boost.Preprocessor sequence of string types.
Boost.Preprocessor sequence of the default attribute value types supported by the library.
Andrey Semashev
15.04.2007
The header contains implementation of a compile-time type dispatcher.
A static type dispatcher class. The type dispatcher can be used to pass objects of arbitrary types from one component to another. With regard to the library, the type dispatcher can be used to extract attribute values.Static type dispatchers allow to specify one or several supported types at compile time.
ReceiverT &Unary function object that will be called on a dispatched value. The receiver must be callable with an argument of any of the supported types of the dispatcher. Constructor. Initializes the dispatcher internals.The receiver object is not copied inside the dispatcher, but references to it may be kept by the dispatcher after construction. The receiver object must remain valid until the dispatcher is destroyed.
static_type_dispatcher const &
static_type_dispatcher &static_type_dispatcher const &
Andrey Semashev
15.04.2007
The header contains definition of generic type dispatcher interfaces.
A type dispatcher interface. All type dispatchers support this interface. It is used to acquire the visitor interface for the requested type.
This interface is used by type dispatchers to consume the dispatched value.
voidT const &The dispatched value The operator invokes the visitor-specific logic with the given value
boolThe operator checks if the visitor is attached to a receiver
boolThe operator checks if the visitor is not attached to a receiver
type_dispatcher(type_dispatcher const &that):m_get_callback_impl(that.m_get_callback_impl) {}The method requests a callback for the value of type T
The type-specific callback or an empty value, if the type is not supported
get_callback_impl_typeInitializing constructor
Andrey Semashev
30.04.2008
The header contains BOOST_LOG_UNIQUE_IDENTIFIER_NAME macro definition. Constructs a unique (in the current file scope) token that can be used as a variable name. The name will contain a prefix passed in the prefix argument. This allows to use the macro multiple times on a single line.
Andrey Semashev
10.05.2008
The header contains definition of a macro to suppress compiler warnings about unused variables.
The macro suppresses compiler warnings for var being unused.
Andrey Semashev
27.07.2012
The header contains implementation of a value reference wrapper.
void
value_ref< T, TagT > &value_ref< T, TagT > &Free swap function.
std::basic_ostream< CharT, TraitsT > &
std::basic_ostream< CharT, TraitsT > &value_ref< T, TagT > const &Stream output operator.
basic_formatting_ostream< CharT, TraitsT, AllocatorT > &
basic_formatting_ostream< CharT, TraitsT, AllocatorT > &value_ref< T, TagT > const &Log formatting operator.
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
bool
value_ref< T, TagT > const &U const &
bool
U const &value_ref< T, TagT > const &
bool
value_ref< T1, TagT1 > const &value_ref< T2, TagT2 > const &
Andrey Semashev
27.07.2012
The header contains forward declaration of a value reference wrapper.
Reference wrapper for a stored attribute value. The value_ref class template provides access to the stored attribute value. It is not a traditional reference wrapper since it may be empty (i.e. refer to no value at all) and it can also refer to values of different types. Therefore its interface and behavior combines features of Boost.Ref, Boost.Optional and Boost.Variant, depending on the use case.The template parameter T can be a single type or an MPL sequence of possible types being referred. The reference wrapper will act as either an optional reference or an optional variant of references to the specified types. In any case, the referred values will not be modifiable (i.e. value_ref always models a const reference).Template parameter TagT is optional. It can be used for customizing the operations on this reference wrapper, such as putting the referred value to log.
value_ref(value_ref const &that)noexcept :base_type(static_cast< base_type const & >(that)) {}Default constructor. Creates a reference wrapper that does not refer to a value.Copy constructor.Initializing constructor. Creates a reference wrapper that refers to the specified value.
boolThe operator verifies if the wrapper refers to a value.
boolThe operator verifies if the wrapper does not refer to a value.
bool
true if the wrapper does not refer to a value.
voidvalue_ref &Swaps two reference wrappers