NestedForLoops Struct Reference

#include <dds_generator.h>

Collaboration diagram for NestedForLoops:

Collaboration graph
[legend]
List of all members.

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_

Detailed Description

Definition at line 330 of file dds_generator.h.


Constructor & Destructor Documentation

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]

Definition at line 362 of file dds_generator.h.

References be_global, BE_GlobalData::impl_, indent_, and n_.

00363   {
00364     for (size_t i = 0; i < n_; ++i) {
00365       indent_.resize(indent_.size() - 2);
00366       be_global->impl_ << indent_ << "}\n";
00367     }
00368   }


Member Data Documentation

std::string& NestedForLoops::indent_

Definition at line 371 of file dds_generator.h.

Referenced by ~NestedForLoops().

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().


The documentation for this struct was generated from the following file:
Generated on Fri Feb 12 20:05:57 2016 for OpenDDS by  doxygen 1.4.7