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
AftSwitch Class Reference

Static multi-part conditional class. More...

#include <AftNode.h>

Inheritance diagram for AftSwitch:
AftNode

Public Types

typedef std::map< uint64_t,
AftNodeToken
Cases
 Map of case values and match tokens.
 
typedef std::shared_ptr
< AftSwitch
Ptr
 Pointer type for cases.
 

Public Member Functions

 AftSwitch (const AftSwitch &node)
 Copy constructor for a switch. More...
 
 AftSwitch (const AftField newSwitchField, const AftNodeToken newSwitchDefaultNode, const AftSwitch::Cases newSwitchCaseValues)
 Construct a switch conditional. More...
 
const AftField switchField () const
 
const AftNodeToken switchDefaultNode () const
 
const AftSwitch::Cases switchCaseValues () const
 
virtual void nextNodes (AftTokenVector &nextTokens)
 
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 std::ostream & description (std::ostream &os) const
 Append a description of the node to an output stream. More...
 

Static Public Member Functions

static AftSwitch::Ptr create (const AftField newSwitchField, const AftNodeToken newSwitchDefaultNode, const AftSwitch::Cases newSwitchCaseValues)
 Factory generate a switch 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 _switchField
 Field to use for switch comparison.
 
AftNodeToken _switchDefaultNode
 Default node to execute if no match is made.
 
AftSwitch::Cases _switchCaseValues
 Map of case value/node token tuples.
 
- 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

Static multi-part conditional class.

Constructor & Destructor Documentation

AftSwitch::AftSwitch ( const AftSwitch node)
inline

Copy constructor for a switch.

Parameters
[in]nodeAftSwitch to copy
AftSwitch::AftSwitch ( const AftField  newSwitchField,
const AftNodeToken  newSwitchDefaultNode,
const AftSwitch::Cases  newSwitchCaseValues 
)
inline

Construct a switch conditional.

Parameters
[in]newSwitchFieldPacket field to switch against
[in]newSwitchDefaultNodeDefault node to execute if no match made
[in]newSwitchCaseValuesMap of switch cases

Member Function Documentation

static AftSwitch::Ptr AftSwitch::create ( const AftField  newSwitchField,
const AftNodeToken  newSwitchDefaultNode,
const AftSwitch::Cases  newSwitchCaseValues 
)
inlinestatic

Factory generate a switch conditional.

Parameters
[in]newSwitchFieldPacket field to switch against
[in]newSwitchDefaultNodeDefault node to execute if no match made
[in]newSwitchCaseValuesMap of switch cases
virtual void AftSwitch::nextNodes ( AftTokenVector nextTokens)
inlinevirtual
Returns
Appends valid next tokens to token vector

Reimplemented from AftNode.

virtual const std::string AftSwitch::nodeType ( ) const
inlinevirtual
Returns
Printable class type of node

Reimplemented from AftNode.

const AftSwitch::Cases AftSwitch::switchCaseValues ( ) const
inline
Returns
Map of switch cases
const AftNodeToken AftSwitch::switchDefaultNode ( ) const
inline
Returns
Default node to execute if no match made
const AftField AftSwitch::switchField ( ) const
inline
Returns
Packet field to match against

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