1 #ifndef CPPAD_CG_INDEX_ASSIGN_OPERATION_NODE_INCLUDED
2 #define CPPAD_CG_INDEX_ASSIGN_OPERATION_NODE_INCLUDED
37 const std::vector<Argument<Base> >& args = this->
getArguments();
38 CPPADCG_ASSERT_KNOWN(!args.empty(),
"Invalid number of arguments");
41 CPPADCG_ASSERT_KNOWN(aNode !=
nullptr && aNode->
getOperationType() == CGOpCode::IndexDeclaration,
"Invalid argument operation type");
54 inline std::vector<const OperationNode<Base>*> getIndexPatternIndexes()
const {
55 std::vector<const OperationNode<Base>*> iargs;
57 const std::vector<Argument<Base> >& args = this->
getArguments();
59 CPPADCG_ASSERT_KNOWN(args[1].getOperation() !=
nullptr &&
60 args[1].getOperation()->
getOperationType() == CGOpCode::Index,
"Invalid argument operation type");
63 if (args.size() > 2) {
64 CPPADCG_ASSERT_KNOWN(args[2].getOperation() !=
nullptr &&
65 args[2].getOperation()->
getOperationType() == CGOpCode::Index,
"Invalid argument operation type");
87 OperationNode<Base>(handler, CGOpCode::IndexAssign,{index, index1}),
88 indexPattern_(indexPattern) {
92 OperationNode<Base>& index,
93 IndexPattern& indexPattern,
94 IndexOperationNode<Base>* index1,
95 IndexOperationNode<Base>* index2) :
96 OperationNode<Base>(handler, CGOpCode::IndexAssign, std::
vector<size_t> (0), createArguments(index, index1, index2)),
97 indexPattern_(indexPattern) {
100 inline static std::vector<Argument<Base> > createArguments(OperationNode<Base>& index,
101 IndexOperationNode<Base>* index1,
102 IndexOperationNode<Base>* index2) {
103 std::vector<Argument<Base> > args(1 + (index1 !=
nullptr)+ (index2 !=
nullptr));
106 if (index1 !=
nullptr)
108 if (index2 !=
nullptr) {
109 args.back() = *index2;
IndexAssignOperationNode(CodeHandler< Base > *handler, OperationNode< Base > &index, IndexPattern &indexPattern, IndexOperationNode< Base > &index1)
CGOpCode getOperationType() const
const std::vector< Argument< Base > > & getArguments() const