1 #ifndef CPPAD_CG_LOOP_START_OPERATION_NODE_INCLUDED 2 #define CPPAD_CG_LOOP_START_OPERATION_NODE_INCLUDED 30 class LoopStartOperationNode :
public OperationNode<Base> {
31 friend class CodeHandler<Base>;
34 inline OperationNode<Base>& getIndex()
const {
35 const std::vector<Argument<Base> >& args = this->
getArguments();
36 CPPADCG_ASSERT_KNOWN(!args.empty(),
"Invalid number of arguments");
38 OperationNode<Base>* aNode = args[0].getOperation();
39 CPPADCG_ASSERT_KNOWN(aNode !=
nullptr && aNode->getOperationType() == CGOpCode::IndexDeclaration,
"Invalid argument operation type");
41 return static_cast<OperationNode<Base>&
> (*aNode);
44 inline IndexOperationNode<Base>* getIterationCountNode()
const {
46 CPPADCG_ASSERT_KNOWN(this->
getArguments().size() > 1,
"Invalid number of arguments.");
48 OperationNode<Base>* aNode = this->
getArguments()[1].getOperation();
49 CPPADCG_ASSERT_KNOWN(aNode !=
nullptr && aNode->getOperationType() == CGOpCode::Index,
"Invalid argument node type");
51 return static_cast<IndexOperationNode<Base>*
> (aNode);
57 inline const size_t getIterationCount()
const {
64 inline virtual ~LoopStartOperationNode() {
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
const std::vector< size_t > & getInfo() const