SimpleFilter
filters for testing expressions
A SimpleFilter object stores an attribute filter expression based on attribute, name, operator, and operand. SimpleFilter performs a simple expression test and returns a Boolean containing the value of an attribute.
Hierarchy
precache::util::
Serializable
--> precache::event::
Filter
--> precache::event::SimpleFilter
Constructors
by ChannelInfo
for predefined attributes
SimpleFilter( const
ChannelInfo& rkChannelInfo, const PCSmallString& rkstrAttrIdent,AttrTestOp_t idOp, PC_TypeCode idAttrType, const PCSmallString& kstrAttrName, PC_UINT unAttrPos, PC_CHAR operand) throw(InvalidFilterException)
Creates a new, parsed SimpleFilter object for a test of a single predefined attribute and associates this object with a ChannelInfo.
Note: The application must ensure that the supplied attribute type code, name and position are valid for the channel defined by ChannelInfo.
- rkChannelInfo
- the ChannelInfo with which this object will be associated, providing access to a channel and validation against the associated channel's configuration
- rkstrAttrIdent
- the string expression used to identify the attribute tested by this object
- idOp
- the opcode for the test operator
- idAttrType
- the typecode of the predefined attribute being tested
- kstrAttrName
- the name of the predefined attribute being tested
- unAttrPos
- the position of the predefined attribute being tested
- operand
- the operand value
- throws
- SimpleFilter throws an
InvalidFilterException if the requested combination of operator, attribute type, and operand type is invalid or if the attribute position is too large for the current marshaling scheme.
for discretionary attributes
SimpleFilter( const
ChannelInfo& rkChannelInfo, AttrTestOp_t idOp, const PCSmallString& kstrAttrName, PC_CHAR operand)
Creates a new, parsed SimpleFilter object for a test of a single discretionary attribute and associates this object with a ChannelInfo.
- rkChannelInfo
- the ChannelInfo with which this object will be associated, providing access to a channel and validation against the associated channel's configuration
- idOp
- the opcode for the test operator
- kstrAttrName
- the name of the discretionary attribute being tested
- operand
- the operand value
by Proxy
for predefined attributes
SimpleFilter( const ProxyInfo& rkProxyInfo, const PCSmallString& rkstrAttrIdent, AttrTestOp_t idOp, PC_TypeCode idAttrType, const PCSmallString& kstrAttrName, PC_UINT unAttrPos, PC_CHAR operand) throw(InvalidFilterException)
Creates a new, parsed SimpleFilter object for a test of a single predefined attribute and associates this object with a Proxy.
Note: The application must ensure that the supplied attribute type code, name and position are valid for the channel defined by Proxy.
- rkChannelInfo
- the Proxy with which this object will be associated, providing access to a channel and validation against the associated channel's configuration
- rkstrAttrIdent
- the string expression used to identify the attribute tested by this object
- idOp
- the opcode for the test operator
- idAttrType
- the typecode of the predefined attribute being tested
- kstrAttrName
- the name of the predefined attribute being tested
- unAttrPos
- the position of the predefined attribute being tested
- operand
- the operand value
- throws
- SimpleFilter throws an
InvalidFilterException if the requested combination of operator, attribute type, and operand type is invalid or if the attribute position is too large for the current marshaling scheme.
for discretionary attributes
SimpleFilter( const
Proxy& rkProxy, AttrTestOp_t idOp, const PCSmallString& kstrAttrName, PC_CHAR operand)
Creates a new, parsed SimpleFilter object for a test of a single discretionary attribute and associates this object with a Proxy.
- rkChannelInfo
- the Proxy with which this object will be associated, providing access to a channel and validation against the associated channel's configuration
- idOp
- the opcode for the test operator
- kstrAttrName
- the name of the discretionary attribute being tested
- operand
- the operand value
Methods
Match
virtual bool Match(
Notification& rkNotification)
Verifies whether a notification type matches the OrFilter object.
- rkNotification
- the notification to be matched
- returns
- true, if the notification matches; otherwise false
Clone
virtual
Filter* Clone
Constructs a clone of the Filter object.
We provide this virtual method rather than a public copy constructor because the cloning must be class-specific, and because many of the true classes are hidden from applications.
ToString
virtual string ToString()
Converts the filtered object to a string representation.
OperatorID
AttrTestOp_t OperatorID() const
- returns
- the typecode ID of the operator
AttributeTypeCode
PC_TypeCode AttributeTypeCode() const
- returns
- the typecode of the attribute filtered by this object if a predefined attribute, or the typecode of the operand of this object if a discretionary attribute.
OperandTypeCode
PC_TypeCode OperandTypeCode() const
- returns
- the typecode of the operand
OperandValue
void* OperandValue() const
- returns
- an untyped pointer to the value of the operand of this object, which for an operand of type PC_STRING is a pointer to the string pointer, not the string pointer itself.
AttributePosition
PC_UINT AttributePosition() const throw(InvalidFilterException)
- returns
- the position of the predefined attribute tested by this object
- throws
- AttributePosition throws an
InvalidFilterException if this object is not a test on a predefined attribute.
AttributeName
const string& AttributeName() const
- returns
- for discretionary attributes, a reference to the attribute name; for predefined attributes, a string representation of the position of the attribute (such as $3)
TestsDiscretionaryAttr
bool TestsDiscretionaryAttr() const
Indicates whether or not this object tests a discretionary attribute.
- returns
- true, if this object tests a discretionary attribute; otherwise, false
|