Deeploy.DeeployTypes.NodeMapper
- class Deeploy.DeeployTypes.NodeMapper(parser: NodeParser, bindings: List[NodeBinding])
Bases:
object
Deeploy class to link a NodeParser and several NodeBindings
Methods
- __init__(parser: NodeParser, bindings: List[NodeBinding])
__init__
(parser, bindings)bind
(ctxt, node)Invokes the binder's bind method to setup the executionBlock and buffer hoisting
Returns whether all bindings have been tried
Discards the binder object
generate
(ctxt)Generates the C Code of the binder elected by this mapper
Reset the discardedBindings set
typeCheck
(ctxt, node)Tries to elect a binder object whose typeChecker allows the node configuration
Attributes
The NodeParser object which is used to determine whether an operator may be bound to one of the associated bindings
All possible bindings that correspond to the linked parser
The currently chosen NodeBinding
Indicates whether a binder has been chosen or not
Set of all bindings which have been tried unsuccessfully.
- parser
The NodeParser object which is used to determine whether an operator may be bound to one of the associated bindings
- Type:
- bindings
All possible bindings that correspond to the linked parser
- Type:
List[NodeBinding]
- binder: NodeBinding
The currently chosen NodeBinding
- Type:
- bound
Indicates whether a binder has been chosen or not
- Type:
bool
- discardedBindings
Set of all bindings which have been tried unsuccessfully.
- Type:
Set[NodeBinding]
- bindingsExhausted() bool
Returns whether all bindings have been tried
- Returns:
True is no more bindings are possible
- Return type:
bool
- discardCurrentBinder()
Discards the binder object
- resetDiscardedBindings()
Reset the discardedBindings set
- typeCheck(ctxt: NetworkContext, node: Graph) Tuple[NetworkContext, bool]
Tries to elect a binder object whose typeChecker allows the node configuration
- Parameters:
ctxt (NetworkContext) – Current NetworkContext
node (gs.Graph) – The node that is being evaluated
- Returns:
Updated NetworkContext and bool to indicate success or failure
- Return type:
Tuple[NetworkContext, bool]
- bind(ctxt: NetworkContext, node: Node) Tuple[NetworkContext, List[str], bool]
Invokes the binder’s bind method to setup the executionBlock and buffer hoisting
- Parameters:
ctxt (NetworkContext) – Current NetworkContext
node (gs.Node) – Node that should be bound
- Returns:
Updated NetworkContext, list of hoisted TransientBuffers’ names, boolean to indicate success or failure
- Return type:
Tuple[NetworkContext, List[str], bool]
- generate(ctxt: NetworkContext) List[str]
Generates the C Code of the binder elected by this mapper
- Parameters:
ctxt (NetworkContext) – Current NetworkContext
- Returns:
Returns a list of code snippets that correspond to the operator’s invocation
- Return type:
List[str]
- Raises:
RuntimeError – Raises a RuntimeError if no binder has been elected or the binder has not been bound yet.