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 325 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 
)

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 }

Here is the call graph for this function:

NestedForLoops::~NestedForLoops (  ) 

Definition at line 234 of file dds_generator.cpp.

References be_global, indent_, and n_.

00235 {
00236   for (size_t i = 0; i < n_; ++i) {
00237     indent_.resize(indent_.size() - 2);
00238     be_global->impl_ << indent_ << "}\n";
00239   }
00240 }


Member Data Documentation

Definition at line 331 of file dds_generator.h.

Referenced by ~NestedForLoops().

Definition at line 330 of file dds_generator.h.

Referenced by NestedForLoops(), and ~NestedForLoops().


The documentation for this struct was generated from the following files:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

Generated on 10 Aug 2018 for OpenDDS by  doxygen 1.6.1