Antares Simulator
Power System Simulator
Antares::Expressions::Nodes::FunctionNode Class Referencefinal

AST node representing a function expression (max, min, pow, ...). More...

#include <FunctionNode.h>

Inheritance diagram for Antares::Expressions::Nodes::FunctionNode:
Antares::Expressions::Nodes::ParentNode Antares::Expressions::Nodes::Node Antares::Expressions::IName

Public Member Functions

template<typename... NodePtr>
 FunctionNode (FunctionNodeType type, NodePtr... operands)
 Construct a FunctionNode from a list of operands. More...
 
 FunctionNode (FunctionNodeType type, const std::vector< Node * > &operands)
 Construct a FunctionNode from an existing vector of operands. More...
 
 FunctionNode (FunctionNodeType type, std::vector< Node * > &&operands)
 Construct a FunctionNode by moving operand vector. More...
 
std::string name () const override
 
FunctionNodeType type () const
 
std::string typeToString () const
 
- Public Member Functions inherited from Antares::Expressions::Nodes::ParentNode
template<typename... NodePtr>
 ParentNode (NodePtr... operands)
 
 ParentNode (const std::vector< Node * > &operands)
 Constructs a parent node with the specified operands. More...
 
 ParentNode (std::vector< Node * > &&operands)
 Constructs a parent node with the specified operands. Vector is moved. More...
 
const std::vector< Node * > & getOperands () const
 Retrieves the operands of the parent node. More...
 
const std::vector< const Node * > getConstOperands () const
 
Nodeoperator[] (std::size_t idx) const
 
size_t size () const
 
- Public Member Functions inherited from Antares::Expressions::IName
bool operator== (const IName &other) const =default
 

Detailed Description

AST node representing a function expression (max, min, pow, ...).

FunctionNode is a ParentNode whose operands represent the arguments of the function. The type indicates which function is applied. examples:

  • base^exponent -> FunctionNode(FunctionNodeType::pow, base, exponent)
  • max(a, b, c) -> FunctionNode(FunctionNodeType::max, a, b, c)
  • min(x, y) -> FunctionNode(FunctionNodeType::min, x, y)
  • reduced_cost(var) -> FunctionNode(FunctionNodeType::reduced_cost, VariableNode("var"))
  • dual(constraint) -> FunctionNode(FunctionNodeType::dual, ParameterNode("constraint"))

Constructor & Destructor Documentation

◆ FunctionNode() [1/3]

template<typename... NodePtr>
Antares::Expressions::Nodes::FunctionNode::FunctionNode ( FunctionNodeType  type,
NodePtr...  operands 
)
inlineexplicit

Construct a FunctionNode from a list of operands.

Template Parameters
NodePtrVariadic parameter pack of Node* operands.
Parameters
typeFunction type.
operandsNode* operands passed to ParentNode.

◆ FunctionNode() [2/3]

Antares::Expressions::Nodes::FunctionNode::FunctionNode ( FunctionNodeType  type,
const std::vector< Node * > &  operands 
)
inlineexplicit

Construct a FunctionNode from an existing vector of operands.

Parameters
typeFunction type.
operandsVector of Node* operands.

◆ FunctionNode() [3/3]

Antares::Expressions::Nodes::FunctionNode::FunctionNode ( FunctionNodeType  type,
std::vector< Node * > &&  operands 
)
inlineexplicit

Construct a FunctionNode by moving operand vector.

Parameters
typeFunction type.
operandsRvalue vector of operands.

Member Function Documentation

◆ name()

std::string Antares::Expressions::Nodes::FunctionNode::name ( ) const
inlineoverridevirtual
Returns
The name of this node ("FunctionNode").

Implements Antares::Expressions::IName.

◆ type()

FunctionNodeType Antares::Expressions::Nodes::FunctionNode::type ( ) const
inline
Returns
Function type associated with this node.

◆ typeToString()

std::string Antares::Expressions::Nodes::FunctionNode::typeToString ( ) const
inline
Returns
String representation of the function type.

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