ROSE 0.11.145.192
Public Member Functions | Static Public Member Functions | Protected Member Functions | List of all members
Sawyer::Message::SequenceFilter Class Reference

Description

Filters messages based on how many messages have been seen.

The first n messages are skipped (not forwarded to children), the first one of every m messages thereafter is forwarded, for a total of t messages forwarded.

Definition at line 750 of file Message.h.

#include <Sawyer/Message.h>

Inheritance diagram for Sawyer::Message::SequenceFilter:
Inheritance graph
[legend]
Collaboration diagram for Sawyer::Message::SequenceFilter:
Collaboration graph
[legend]

Public Member Functions

size_t nPosted () const
 Number of messages processed.
 
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.
 
size_t nSkip () const
 Property: number of initial messages to skip.
 
SequenceFilterPtr nSkip (size_t n)
 Property: number of initial messages to skip.
 
size_t rate () const
 Property: rate of messages to emit after initial messages are skipped.
 
SequenceFilterPtr rate (size_t n)
 Property: rate of messages to emit after initial messages are skipped.
 
size_t limit () const
 Property: total number of messages forwarded.
 
SequenceFilterPtr limit (size_t n)
 Property: total number of messages forwarded.
 
- 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 MesgPropsdefaultPropertiesNS () const
 Default values for message properties.
 
MesgPropsdefaultPropertiesNS ()
 Default values for message properties.
 
const MesgPropsoverridePropertiesNS () const
 Overrides message properties.
 
MesgPropsoverridePropertiesNS ()
 Overrides message properties.
 
- Public Member Functions inherited from Sawyer::SharedObject
 SharedObject ()
 Default constructor.
 
 SharedObject (const SharedObject &)
 Copy constructor.
 
virtual ~SharedObject ()
 Virtual destructor.
 
SharedObjectoperator= (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 SequenceFilterPtr instance (size_t nskip, size_t rate, size_t limit)
 Construct an instance.
 
- Static Public Member Functions inherited from Sawyer::Message::Multiplexer
static MultiplexerPtr instance ()
 Allocating constructor.
 

Protected Member Functions

 SequenceFilter (size_t nskip, size_t rate, size_t limit)
 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.
 

Constructor & Destructor Documentation

◆ SequenceFilter()

Sawyer::Message::SequenceFilter::SequenceFilter ( size_t  nskip,
size_t  rate,
size_t  limit 
)
inlineprotected

Constructor for derived classes.

Non-subclass users should use instance instead.

Definition at line 757 of file Message.h.

Member Function Documentation

◆ instance()

static SequenceFilterPtr Sawyer::Message::SequenceFilter::instance ( size_t  nskip,
size_t  rate,
size_t  limit 
)
inlinestatic

Construct an instance.

The node will skip the first nskip messages, then forward the first of every rate following messages, for a grand total of limit messages forwarded. If rate is zero or one then every message after the first nskip is forwarded (up to the limit). If limit is zero then there is no limit.

Definition at line 765 of file Message.h.

◆ nSkip() [1/2]

size_t Sawyer::Message::SequenceFilter::nSkip ( ) const

Property: number of initial messages to skip.

The first n messages sent through this filter are discarded.

Thread safety: This method is thread-safe.

◆ nSkip() [2/2]

SequenceFilterPtr Sawyer::Message::SequenceFilter::nSkip ( size_t  n)

Property: number of initial messages to skip.

The first n messages sent through this filter are discarded.

Thread safety: This method is thread-safe.

◆ rate() [1/2]

size_t Sawyer::Message::SequenceFilter::rate ( ) const

Property: rate of messages to emit after initial messages are skipped.

A rate of n means the first message of every group of n messages is forwarded to children nodes in the plumbing lattice. A rate of zero means the same thing as a rate of one–every message is forwarded.

Thread safety: This method is thread-safe.

◆ rate() [2/2]

SequenceFilterPtr Sawyer::Message::SequenceFilter::rate ( size_t  n)

Property: rate of messages to emit after initial messages are skipped.

A rate of n means the first message of every group of n messages is forwarded to children nodes in the plumbing lattice. A rate of zero means the same thing as a rate of one–every message is forwarded.

Thread safety: This method is thread-safe.

◆ limit() [1/2]

size_t Sawyer::Message::SequenceFilter::limit ( ) const

Property: total number of messages forwarded.

At most n messages are forwarded to children in the lattice, after which messages are discarded. A value of zero means no limit is in effect.

Thread safety: This method is thread-safe.

◆ limit() [2/2]

SequenceFilterPtr Sawyer::Message::SequenceFilter::limit ( size_t  n)

Property: total number of messages forwarded.

At most n messages are forwarded to children in the lattice, after which messages are discarded. A value of zero means no limit is in effect.

Thread safety: This method is thread-safe.

◆ nPosted()

size_t Sawyer::Message::SequenceFilter::nPosted ( ) const

Number of messages processed.

This includes messages forwarded and messages not forwarded.

Thread safety: This method is thread-safe.

◆ shouldForward()

virtual bool Sawyer::Message::SequenceFilter::shouldForward ( const MesgProps )
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.

◆ forwarded()

virtual void Sawyer::Message::SequenceFilter::forwarded ( const MesgProps )
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.

Definition at line 812 of file Message.h.


The documentation for this class was generated from the following file: