#include <dds_generator.h>
Collaboration diagram for NestedForLoops:
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 330 of file dds_generator.h.
NestedForLoops::NestedForLoops | ( | const char * | type, | |
const char * | prefix, | |||
AST_Array * | arr, | |||
std::string & | indent, | |||
bool | followTypedefs = false | |||
) | [inline] |
Definition at line 331 of file dds_generator.h.
References be_global, BE_GlobalData::impl_, index_, n_, and AstTypeClassification::resolveActualType().
00333 : n_(arr->n_dims()), indent_(indent) 00334 { 00335 std::ostringstream index_oss; 00336 size_t i = 0, j = 0; 00337 while (true) { 00338 for (; i < n_; ++i) { 00339 be_global->impl_ << 00340 indent << "for (" << type << ' ' << prefix << i << " = 0; " << 00341 prefix << i << " < " << arr->dims()[i - j]->ev()->u.ulval << "; ++" << 00342 prefix << i << ") {\n"; 00343 indent += " "; 00344 index_oss << "[" << prefix << i << "]"; 00345 } 00346 if (!followTypedefs) { 00347 break; 00348 } 00349 AST_Type* const base = 00350 AstTypeClassification::resolveActualType(arr->base_type()); 00351 if (base->node_type() == AST_Decl::NT_array) { 00352 arr = AST_Array::narrow_from_decl(base); 00353 n_ += arr->n_dims(); 00354 j = i; 00355 } else { 00356 break; 00357 } 00358 } 00359 index_ = index_oss.str(); 00360 }
NestedForLoops::~NestedForLoops | ( | ) | [inline] |
std::string& NestedForLoops::indent_ |
std::string NestedForLoops::index_ |
Definition at line 372 of file dds_generator.h.
Referenced by assign_field(), gen_array(), SafetyProfileGenerator::gen_struct(), FaceGenerator::gen_struct(), and NestedForLoops().
size_t NestedForLoops::n_ |
Definition at line 370 of file dds_generator.h.
Referenced by NestedForLoops(), and ~NestedForLoops().