#include <dds_generator.h>
Public Member Functions | |
NestedForLoops (const char *type, const char *prefix, AST_Array *arr, std::string &indent, bool followTypedefs=false) | |
~NestedForLoops () | |
Public Attributes | |
size_t | n_ |
std::string & | indent_ |
std::string | index_ |
Definition at line 325 of file dds_generator.h.
NestedForLoops::NestedForLoops | ( | const char * | type, | |
const char * | prefix, | |||
AST_Array * | arr, | |||
std::string & | indent, | |||
bool | followTypedefs = false | |||
) |
Definition at line 201 of file dds_generator.cpp.
References be_global, index_, n_, and AstTypeClassification::resolveActualType().
00204 : n_(arr->n_dims()) 00205 , indent_(indent) 00206 { 00207 std::ostringstream index_oss; 00208 size_t i = 0, j = 0; 00209 while (true) { 00210 for (; i < n_; ++i) { 00211 be_global->impl_ << 00212 indent << "for (" << type << ' ' << prefix << i << " = 0; " << 00213 prefix << i << " < " << arr->dims()[i - j]->ev()->u.ulval << "; ++" << 00214 prefix << i << ") {\n"; 00215 indent += " "; 00216 index_oss << "[" << prefix << i << "]"; 00217 } 00218 if (!followTypedefs) { 00219 break; 00220 } 00221 AST_Type* const base = 00222 AstTypeClassification::resolveActualType(arr->base_type()); 00223 if (base->node_type() == AST_Decl::NT_array) { 00224 arr = AST_Array::narrow_from_decl(base); 00225 n_ += arr->n_dims(); 00226 j = i; 00227 } else { 00228 break; 00229 } 00230 } 00231 index_ = index_oss.str(); 00232 }
NestedForLoops::~NestedForLoops | ( | ) |
std::string& NestedForLoops::indent_ |
Definition at line 331 of file dds_generator.h.
Referenced by ~NestedForLoops().
std::string NestedForLoops::index_ |
Definition at line 332 of file dds_generator.h.
Referenced by SafetyProfileGenerator::gen_struct(), FaceGenerator::gen_struct(), and NestedForLoops().
Definition at line 330 of file dds_generator.h.
Referenced by NestedForLoops(), and ~NestedForLoops().