ROSE 0.11.145.147
|
Filters messages based on importance level.
For instance, to disable all messages except fatal and error messages:
#include <Sawyer/Message.h>
Public Member Functions | |
ImportanceFilterPtr | enable (Importance) |
Enable an importance level. | |
ImportanceFilterPtr | disable (Importance) |
Disable an importance level. | |
virtual bool | shouldForward (const MesgProps &) |
Predicate determines when a message should be forwarded onward. | |
virtual void | forwarded (const MesgProps &) |
Called once by bakeDestinations if shouldForward() returned true. | |
bool | enabled (Importance imp) const |
Property: the enabled/disabled state for a message importance level. | |
ImportanceFilterPtr | enabled (Importance imp, bool b) |
Property: the enabled/disabled state for a message importance level. | |
Public Member Functions inherited from Sawyer::Message::Filter | |
virtual void | bakeDestinations (const MesgProps &, BakedDestinations &) |
Bakes message properties according to the plumbing lattice. | |
Public Member Functions inherited from Sawyer::Message::Multiplexer | |
virtual void | post (const Mesg &, const MesgProps &) |
Causes a message to be emitted. | |
MultiplexerPtr | addDestination (const DestinationPtr &) |
Adds a child node to this node of the lattice. | |
MultiplexerPtr | removeDestination (const DestinationPtr &) |
Removes the specified child from this node of the lattice. | |
MultiplexerPtr | to (const DestinationPtr &) |
Add a child nodes to this node of the lattice and returns this node. | |
MultiplexerPtr | to (const DestinationPtr &, const DestinationPtr &) |
Add a child nodes to this node of the lattice and returns this node. | |
MultiplexerPtr | to (const DestinationPtr &, const DestinationPtr &, const DestinationPtr &) |
Add a child nodes to this node of the lattice and returns this node. | |
MultiplexerPtr | to (const DestinationPtr &, const DestinationPtr &, const DestinationPtr &, const DestinationPtr &) |
Add a child nodes to this node of the lattice and returns this node. | |
Public Member Functions inherited from Sawyer::Message::Destination | |
MesgProps | mergePropertiesNS (const MesgProps &props) |
Merge properties of this lattice node into the specified properties. | |
const MesgProps & | defaultPropertiesNS () const |
Default values for message properties. | |
MesgProps & | defaultPropertiesNS () |
Default values for message properties. | |
const MesgProps & | overridePropertiesNS () const |
Overrides message properties. | |
MesgProps & | overridePropertiesNS () |
Overrides message properties. | |
Public Member Functions inherited from Sawyer::SharedObject | |
SharedObject () | |
Default constructor. | |
SharedObject (const SharedObject &) | |
Copy constructor. | |
virtual | ~SharedObject () |
Virtual destructor. | |
SharedObject & | operator= (const SharedObject &) |
Assignment. | |
Public Member Functions inherited from Sawyer::SharedFromThis< Destination > | |
SharedPointer< Destination > | sharedFromThis () |
Create a shared pointer from this . | |
SharedPointer< const Destination > | sharedFromThis () const |
Create a shared pointer from this . | |
Static Public Member Functions | |
static ImportanceFilterPtr | instance (bool dflt) |
Allocating constructor. | |
Static Public Member Functions inherited from Sawyer::Message::Multiplexer | |
static MultiplexerPtr | instance () |
Allocating constructor. | |
Protected Member Functions | |
ImportanceFilter (bool dflt) | |
Constructor for derived classes. | |
Protected Member Functions inherited from Sawyer::Message::Filter | |
Filter () | |
Constructor for derived classes. | |
Protected Member Functions inherited from Sawyer::Message::Multiplexer | |
Multiplexer () | |
Constructor for derived classes. | |
Additional Inherited Members | |
Protected Attributes inherited from Sawyer::Message::Destination | |
Sawyer::SynchronizationTraits< Sawyer::SingleThreadedTag >::RecursiveMutex | mutex_ |
Mutex protecting data members here and in subclasses. | |
MesgProps | dflts_ |
Default properties merged into each incoming message. | |
MesgProps | overrides_ |
Override properties applied to incoming message. | |
|
inlineexplicitprotected |
|
inlinestatic |
bool Sawyer::Message::ImportanceFilter::enabled | ( | Importance | imp | ) | const |
Property: the enabled/disabled state for a message importance level.
Importance levels that are enabled are forwarded to children in the lattice, and those that are disable are discarded.
Thread safety: This method is thread-safe.
ImportanceFilterPtr Sawyer::Message::ImportanceFilter::enabled | ( | Importance | imp, |
bool | b | ||
) |
Property: the enabled/disabled state for a message importance level.
Importance levels that are enabled are forwarded to children in the lattice, and those that are disable are discarded.
Thread safety: This method is thread-safe.
ImportanceFilterPtr Sawyer::Message::ImportanceFilter::enable | ( | Importance | ) |
Enable an importance level.
Returns this node so that the method can be chained.
ImportanceFilterPtr Sawyer::Message::ImportanceFilter::disable | ( | Importance | ) |
Disable an importance level.
Returns this node so that the method can be chained.
|
virtual |
Predicate determines when a message should be forwarded onward.
This method is called once from bakeDestinations(), and if it returns true then the baking is forwarded on to the child nodes in the plumbing lattice. If this method returns false then none of the descendents will see the properties (unless they can be reached by some other path), and the unreached leaf nodes will not be returned by bakeDestinations().
Thread safety: all implementations must be thread-safe.
Implements Sawyer::Message::Filter.
|
inlinevirtual |
Called once by bakeDestinations if shouldForward() returned true.
This method is called after the properties have been forwarded to the child nodes.
Implements Sawyer::Message::Filter.