AFI
Advanced Forwarding Interface
 All Classes Functions Variables Typedefs Enumerations Enumerator Friends Groups
Public Types | Public Member Functions | Static Public Member Functions | Protected Attributes | List of all members
AftMatch Class Reference

Simple two-way conditional class. More...

#include <AftNode.h>

Inheritance diagram for AftMatch:
AftNode

Public Types

enum  OpEnum {
  AftMatchOpEQ = 0, AftMatchOpNEQ, AftMatchOpLT, AftMatchOpLET,
  AftMatchOpGT, AftMatchOpGET
}
 AftMatch operand enum. Used to indicate the comparison to perform in AftMatch. More...
 
typedef std::shared_ptr< AftMatchPtr
 Pointer type for matches.
 

Public Member Functions

 AftMatch (const AftMatch &node)
 Copy constructor for a match conditional. More...
 
 AftMatch (const AftField newMatchField, const AftMatch::OpEnum newMatchOp, const AftData newMatchValue, const AftNodeToken newTrueNode, const AftNodeToken newFalseNode, const bool newFalsePresent)
 Construct an if()else match conditional. More...
 
const AftField matchField () const
 
const AftMatch::OpEnum matchOp () const
 
const AftDatamatchValue () const
 
const AftNodeToken trueNode () const
 
const AftNodeToken falseNode () const
 
const bool falsePresent () const
 
virtual const std::string nodeType () const
 
- Public Member Functions inherited from AftNode
 AftNode (const AftNode &node)
 Copy constructor for a basic node. More...
 
 AftNode (const AftNodeToken newToken=AFT_NODE_TOKEN_NONE, const AftNodeToken newNext=AFT_NODE_TOKEN_NONE, const std::string newName="")
 Construct an entry for a basic node. More...
 
 operator const AftNodeToken () const
 
const AftNodeToken nodeToken () const
 
const std::string nodeName () const
 
const AftTypeIndex nodeTypeIndex () const
 
void setNodeNext (AftNodeToken newNext)
 Set the (optional) next node. More...
 
const AftNodeToken nodeNext () const
 
void setNodeParameters (const AftParameters::Ptr &newParams)
 Set the optional parameters of the node. More...
 
const AftParameters::Ptr nodeParameters () const
 
template<class T >
std::shared_ptr< T > nodeParameter (const std::string &name)
 Convenience parameter access template. Use this to access node parameters. More...
 
void setNodeParameter (const std::string &name, const AftDataPtr &data)
 Convenience parameter setter. Use this to set node parameters. More...
 
virtual const bool nodeIsContainer () const
 @ returns true if node can take entries
 
virtual const bool nodeIsDelete () const
 @ returns true if node is a delete
 
virtual const bool nodeIsValid (const AftValidatorPtr &validator, std::ostream &os)
 @ returns true if node is valid
 
virtual void nextNodes (AftTokenVector &nextTokens)
 
virtual std::ostream & description (std::ostream &os) const
 Append a description of the node to an output stream. More...
 

Static Public Member Functions

static AftMatch::Ptr create (const AftField newMatchField, const AftMatch::OpEnum newMatchOp, const AftData newMatchValue, const AftNodeToken newTrueNode, const AftNodeToken newFalseNode, const bool newFalsePresent)
 Construct an if() match conditional. More...
 
- Static Public Member Functions inherited from AftNode
template<class T >
static std::shared_ptr< T > downcast (const AftNodePtr &node)
 Convenience downcast template. Use this instead of manual casting if required. More...
 

Protected Attributes

AftField _matchField
 Packet field to match against.
 
AftMatch::OpEnum _matchOp
 Conditional operation to perform as match.
 
AftData _matchValue
 Value to match against.
 
AftNodeToken _trueNode
 Node to execute if match is true.
 
AftNodeToken _falseNode
 Node to execute if match is false.
 
bool _falsePresent
 True if we have a valid falseNode value.
 
- Protected Attributes inherited from AftNode
friend AftInsert
 AftInsert accesses the setNodeName and setNodeToken methods.
 
friend AftSandbox
 AftSandbox accesses the setNodeName and setNodeToken methods.
 
friend AfiNodeRpc
 AfiNodeRpc accesses the setNodeName and setNodeToken methods.
 
AftNodeToken _nodeToken
 Unique token value for node.
 
AftNodeToken _nodeNext
 Optional value of next node.
 
std::string _nodeName
 Optional name of node.
 
AftParameters::Ptr _nodeParams
 Optional node parameters.
 
AftTypeIndex _nodeTypeIndex
 Scalar index type for node.
 

Additional Inherited Members

- Protected Member Functions inherited from AftNode
void setNodeName (std::string newName)
 Set the name of the node. More...
 
void setNodeToken (AftNodeToken newToken)
 Set the token value of the node. More...
 
void setNodeTypeIndex (AftTypeIndex newTypeIndex)
 Set the sandbox node type index. More...
 

Detailed Description

Simple two-way conditional class.

Constructor & Destructor Documentation

AftMatch::AftMatch ( const AftMatch node)
inline

Copy constructor for a match conditional.

Parameters
[in]nodeAftMatch to copy
AftMatch::AftMatch ( const AftField  newMatchField,
const AftMatch::OpEnum  newMatchOp,
const AftData  newMatchValue,
const AftNodeToken  newTrueNode,
const AftNodeToken  newFalseNode,
const bool  newFalsePresent 
)
inline

Construct an if()else match conditional.

Parameters
[in]newMatchFieldPacket field to match against
[in]newMatchOpConditional operation to perform
[in]newMatchValueData value to compare field against
[in]newTrueNodeNode to execute if match is true
[in]newFalseNodeNode to execute if match is false
[in]newFalsePresentFalse node is used by the match

Member Function Documentation

static AftMatch::Ptr AftMatch::create ( const AftField  newMatchField,
const AftMatch::OpEnum  newMatchOp,
const AftData  newMatchValue,
const AftNodeToken  newTrueNode,
const AftNodeToken  newFalseNode,
const bool  newFalsePresent 
)
inlinestatic

Construct an if() match conditional.

Parameters
[in]newMatchFieldPacket field to match against
[in]newMatchOpConditional operation to perform
[in]newMatchValueData value to compare field against
[in]newTrueNodeNode to execute if match is true
[in]newFalseNodeNode to execute if match is false
[in]newFalsePresentNode to execute if match is false
const AftNodeToken AftMatch::falseNode ( ) const
inline
Returns
Node to execute if match is false
const bool AftMatch::falsePresent ( ) const
inline
Returns
True if falseNode is present
const AftField AftMatch::matchField ( ) const
inline
Returns
Packet field to match against
const AftMatch::OpEnum AftMatch::matchOp ( ) const
inline
Returns
Conditional operation to perform
const AftData& AftMatch::matchValue ( ) const
inline
Returns
Data value to compare field against
virtual const std::string AftMatch::nodeType ( ) const
inlinevirtual
Returns
Printable class type of node

Reimplemented from AftNode.

const AftNodeToken AftMatch::trueNode ( ) const
inline
Returns
Node to execute if match is true

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