BOSS 7.0.8
BESIII Offline Software System
|
filtering stream More...
#include <FilterStream.h>
Public Member Functions | |
FilterStream (Stream *target_ptr, const std::vector< std::string > &include_list, const std::vector< std::string > &exclude_list) | |
~FilterStream () | |
destructor | |
virtual bool | is_accept (const Issue *issue_ptr) |
filter method | |
virtual void | send (const Issue *issue_ptr) |
send method | |
virtual void | print_to (std::ostream &stream) const |
Public Member Functions inherited from ers::Stream | |
Stream () | |
Stream (const Stream &other) | |
operator std::string () const | |
virtual | ~Stream () |
virtual void | send (const Issue *i) |
Sends an issue into the stream. | |
virtual Issue * | receive () |
Receives an issue from the stream. | |
virtual void | print_to (std::ostream &stream) const |
Static Public Member Functions | |
static FilterStream * | factory (const std::string &include_str, const ::std::string &exclude_str, const std::string &target_str) |
factory method for partially parse information | |
static FilterStream * | factory (const std::string ¶meters) |
factory method for unparsed information | |
Static Public Attributes | |
static const char *const | FILTER_STREAM_TAG = "filter" |
tag used to identity this stream | |
static const char *const | INCLUDE_TAG = "?" |
tag used to mark the start of the include list | |
static const char *const | EXCLUDE_TAG = "!" |
tag used to mark the start of the exclude list | |
static const char *const | TARGET_TAG = "@" |
tag used to mark the target stream | |
static const char *const | SEPARATORS = "," |
separators between include and exclude qualifiers | |
Static Public Attributes inherited from ers::Stream | |
static const char *const | NULL_STREAM_KEY = "null" |
Protected Member Functions | |
FilterStream () | |
FilterStream (const FilterStream &other) | |
Protected Attributes | |
Stream * | m_target_stream_ptr |
chained target stream | |
std::vector< std::string > | m_include |
include list | |
std::vector< std::string > | m_exclude |
exclude list | |
filtering stream
This stream offers basic filtering capacities It basically hooks up in front of another stream and filters the data output. Filtering is based on two list and include list and and exclude list To be accepted an Issue needs two match two criteria
If the include list is empty, the second condition is not applied. This stream should only be used for severity levels where filtering makes sense, i.e warning, debugs, etc... The syntax to request a filter stream is the following:
filter:filter:?include_qualifier1,include_qualifier2!exclude_qualifier1,exclude_qualifier2@stream_identifier
The stream_identifier can be any stream_key used by the ERS system (including a second filter).
For more information on associating a stream to a severity level, see the documentation on the StreamFactory class.
Definition at line 38 of file FilterStream.h.
|
protected |
|
protected |
Disabled copy constructor
Definition at line 79 of file FilterStream.cxx.
ers::FilterStream::FilterStream | ( | ers::Stream * | target_ptr, |
const std::vector< std::string > & | include_list, | ||
const std::vector< std::string > & | exclude_list | ||
) |
Constructor
target_ptr | pointer to the target stream, the target pointer is assumed to be allocated on the stack and owned by the current object, i.e it will be deleted upon destruction |
include_list | collection of strings, at least one of these strings need to be present in the qualifiers in order for the Issue to be accepted. |
exclude_list | collection of strings, no qualifier of the Issue must match those in this collection in order for the Issue to be accepted. |
Definition at line 92 of file FilterStream.cxx.
ers::FilterStream::~FilterStream | ( | ) |
|
static |
factory method for partially parse information
Builds a stream out of a set of parameters
include_str | string containing all the coma separated include qualifiers |
exclude_str | string containing all the coma separated exclude qualifiers |
target_str | string containing the key for the target stream, i.e the stream where accepted Issues are sent. |
Definition at line 43 of file FilterStream.cxx.
|
static |
factory method for unparsed information
Builds a stream out of a key string. This method parses the string and calls a more specialised version of the factory
method.
params | single string describing the requested filter stream |
Definition at line 57 of file FilterStream.cxx.
filter method
Filtering method This method checks if an Issue is to be accepted or not.
issue_ptr | the issue to check |
true
if the Issue passes filtering, false
otherwise. Definition at line 115 of file FilterStream.cxx.
|
virtual |
Prints stream description to stream
stream | STL target stream |
Reimplemented from ers::Stream.
Definition at line 162 of file FilterStream.cxx.
|
virtual |
send method
Send method basically calls is_accept
to check if the issue is accepted. If this is the case, the send
method on the target is called with issue_ptr
.
issue_ptr | pointer to the issue to send. |
Reimplemented from ers::Stream.
Definition at line 147 of file FilterStream.cxx.
|
static |
tag used to mark the start of the exclude list
Definition at line 48 of file FilterStream.h.
|
static |
tag used to identity this stream
Tag used to identify the stream
Definition at line 46 of file FilterStream.h.
|
static |
tag used to mark the start of the include list
Definition at line 47 of file FilterStream.h.
|
protected |
|
protected |
|
protected |
|
static |
separators between include and exclude qualifiers
Definition at line 50 of file FilterStream.h.
Referenced by factory().
|
static |
tag used to mark the target stream
Definition at line 49 of file FilterStream.h.