1 #ifndef CPPAD_CG_LOOP_START_OPERATION_NODE_INCLUDED 2 #define CPPAD_CG_LOOP_START_OPERATION_NODE_INCLUDED 31 class LoopStartOperationNode :
public OperationNode<Base> {
32 friend class CodeHandler<Base>;
35 inline OperationNode<Base>& getIndex()
const {
36 const std::vector<Argument<Base> >& args = this->
getArguments();
37 CPPADCG_ASSERT_KNOWN(!args.empty(),
"Invalid number of arguments")
39 OperationNode<Base>* aNode = args[0].getOperation();
40 CPPADCG_ASSERT_KNOWN(aNode !=
nullptr && aNode->getOperationType() == CGOpCode::IndexDeclaration,
"Invalid argument operation type")
42 return static_cast<OperationNode<Base>&
> (*aNode);
45 inline IndexOperationNode<Base>* getIterationCountNode()
const {
47 CPPADCG_ASSERT_KNOWN(this->
getArguments().size() > 1,
"Invalid number of arguments.")
49 OperationNode<Base>* aNode = this->
getArguments()[1].getOperation();
50 CPPADCG_ASSERT_KNOWN(aNode !=
nullptr && aNode->
getOperationType() == CGOpCode::Index, "Invalid argument node type")
52 return static_cast<IndexOperationNode<Base>*> (aNode);
58 inline const
size_t getIterationCount()
const {
65 inline virtual ~LoopStartOperationNode() =
default;
69 inline LoopStartOperationNode(CodeHandler<Base>* handler,
70 OperationNode<Base>& indexDcl,
71 size_t iterationCount) :
72 OperationNode<Base>(handler, CGOpCode::LoopStart, indexDcl) {
73 this->
getInfo().push_back(iterationCount);
76 inline LoopStartOperationNode(CodeHandler<Base>* handler,
77 OperationNode<Base>& indexDcl,
78 IndexOperationNode<Base>& iterCount) :
79 OperationNode<Base>(handler, CGOpCode::LoopStart,{indexDcl, iterCount}) {
const std::vector< Argument< Base > > & getArguments() const
CGOpCode getOperationType() const
const std::vector< size_t > & getInfo() const