CAllButPredicate

Name

CAllButPredicate -- Select all ring items except some.

Synopsis


#include <CAllButPredicate>
         
 class CAllButPredicate {

  CAllButPredicate();
  CAllButPredicate(unsigned int nType, uint32_t* types);
  CAllButPredicate(unsigned int nType, uint32_t* types, bool* sample);
  CAllButPredicate(const CAllButPredicate& rhs);

  virtual ~CAllButPredicate();

  CAllButPredicate& operator=(const CAllButPredicate& rhs);
  const int operator==(const CAllButPredicate& rhs);
  const int operator!=(const CAllButPredicate& rhs);
  void addExceptionType(uint32_t type, bool sample = false);
  virtual bool selectThis(uint32_t type);
}

Description

CAllButPredicate is a ring selection predicate whose list of type/flag pairs are treated as exceptions to the rule that all types are wanted with no sampling.

If an item is in the exception list and has the flag false, it will be skipped by the predicate when encountered in the ring buffe while blocking on the predicate. If an item is in the exception ilst, but the flag is true, the item will be skipped unless it's the last one in the ring buffer. Any item not in the list is accepted.

Public member functions

CAllButPredicate();

Constructs the predicate. When constructed in this way, all ring buffer item types are accepted without sampling unless the application makes a subsequent call to addExceptionType.

CAllButPredicate(unsigned int nType, uint32_t* types);

Constructs the predicate so that the nType parameters in the array types of item types are not skipped by the predicate.

CAllButPredicate(unsigned int nType, uint32_t* types, bool* sample);

Constructs the predicate so that the nType exceptions described by types and sample are either skipped (if their sample element is false, or sampled if their sample element is true.

CAllButPredicate(const CAllButPredicate& rhs);

Supports copy construction of the predicate.

CAllButPredicate& operator=(const CAllButPredicate& rhs);

Supports assignment of the predicate.

const int operator==(const CAllButPredicate& rhs);

Supports testing for equality of the predicate with another.

const int operator!=(const CAllButPredicate& rhs);

Supports testing for inequality between the predicate and another.

void addExceptionType(uint32_t type, bool sample = false);

Adds an excpetion to the list of exceptions to the rule that all item types are accepted without sampling. If sample is false, ring items of type type will be skipped. If sample is true Items of that type will be sampled.

Specifying a type already in the exculsion list will overwrite the existing definition (e.g. you can change the state of the sampling flag). It is not possible, however to remove an entry from the exception list.