Clean up io_* code #330

This commit is contained in:
Derek Bankieris 2016-10-20 14:53:21 -05:00
parent 0039b95a73
commit 4f49460a6f
8 changed files with 533 additions and 559 deletions

View File

@ -411,7 +411,7 @@ namespace Trick {
@param attr - pointer to parent attributes structure.
@return 0 on success, otherwise failure.
*/
int add_attr_info(std::string& type_name , ATTRIBUTES* attr , const char * file_name = "None" , unsigned int line_num = 0 ) ;
int add_attr_info(const std::string& type_name , ATTRIBUTES* attr , const char * file_name = "None" , unsigned int line_num = 0 ) ;
/**
Adds a template name translation to our map. The base template type is mangled to the io_src name

View File

@ -2,6 +2,7 @@
#ifndef PRINTFILECONTENTS10_HH
#define PRINTFILECONTENTS10_HH
#include <iostream>
#include <string>
#include <vector>
#include <map>
@ -28,80 +29,80 @@ class PrintFileContents10 : public PrintFileContentsBase {
PrintFileContents10() ;
/** Prints the io_src header information */
virtual void printIOHeader(std::ofstream & outfile , std::string header_file_name) ;
virtual void printIOHeader(std::ostream & outfile , std::string header_file_name) ;
/** Prints all io_src code for incoming class */
virtual void printClass(std::ofstream & outfile , ClassValues * cv) ;
virtual void printClass(std::ostream & outfile , ClassValues * cv) ;
/** Prints all io_src code for incoming enum */
virtual void printEnum(std::ofstream & outfile , EnumValues * ev) ;
virtual void printEnum(std::ostream & outfile , EnumValues * ev) ;
/** Prints all classes for global map */
virtual void printClassMapHeader(std::ofstream & out, std::string function_name ) ;
virtual void printClassMap(std::ofstream & outfile , ClassValues * cv) ;
virtual void printClassMapFooter(std::ofstream & out) ;
virtual void printClassMapHeader(std::ostream & out, std::string function_name ) ;
virtual void printClassMap(std::ostream & outfile , ClassValues * cv) ;
virtual void printClassMapFooter(std::ostream & out) ;
/** Prints all enums for global map */
virtual void printEnumMapHeader(std::ofstream & out, std::string function_name ) ;
virtual void printEnumMap(std::ofstream & out, EnumValues * ev) ;
virtual void printEnumMapFooter(std::ofstream & out) ;
virtual void printEnumMapHeader(std::ostream & out, std::string function_name ) ;
virtual void printEnumMap(std::ostream & out, EnumValues * ev) ;
virtual void printEnumMapFooter(std::ostream & out) ;
private:
/** Prints enumeration attributes */
void print_enum_attr(std::ofstream & outfile , EnumValues * in_enum) ;
void print_enum_attr(std::ostream & outfile , EnumValues * in_enum) ;
/** Prints attributes for a field */
void print_field_attr(std::ofstream & outfile , FieldDescription * fdes ) ;
void print_field_attr(std::ostream & outfile , FieldDescription * fdes ) ;
/** Prints class attributes */
void print_class_attr(std::ofstream & outfile , ClassValues * in_class) ;
void print_class_attr(std::ostream & outfile , ClassValues * in_class) ;
/** Prints init_attr function for each class */
void print_field_init_attr_stmts(std::ofstream & outfile , FieldDescription * fdes ,
void print_field_init_attr_stmts(std::ostream & outfile , FieldDescription * fdes ,
ClassValues * cv , unsigned int index ) ;
/** Prints add_attr_info statements for each inherited class */
void print_inherited_add_attr_info(std::ofstream & outfile , ClassValues * cv ) ;
void print_inherited_add_attr_info(std::ostream & outfile , ClassValues * cv ) ;
/** Prints init_attr function for each class */
void print_init_attr_func(std::ofstream & outfile , ClassValues * c ) ;
void print_init_attr_func(std::ostream & outfile , ClassValues * c ) ;
/** Prints the io_src_sizeof function for enumerations */
void print_enum_io_src_sizeof(std::ofstream & outfile , EnumValues * ev ) ;
void print_enum_io_src_sizeof(std::ostream & outfile , EnumValues * ev ) ;
/** Prints the C linkage init_attr function */
void print_init_attr_c_intf(std::ofstream & outfile , ClassValues * cv ) ;
void print_init_attr_c_intf(std::ostream & outfile , ClassValues * cv ) ;
/** Prints the io_src_sizeof function */
void print_io_src_sizeof(std::ofstream & outfile , ClassValues * cv ) ;
void print_io_src_sizeof(std::ostream & outfile , ClassValues * cv ) ;
/** Prints the io_src_allocate function */
void print_io_src_allocate(std::ofstream & outfile , ClassValues * cv ) ;
void print_io_src_allocate(std::ostream & outfile , ClassValues * cv ) ;
/** Prints the io_src_destruct function */
void print_io_src_destruct(std::ofstream & outfile , ClassValues * cv ) ;
void print_io_src_destruct(std::ostream & outfile , ClassValues * cv ) ;
/** Prints the io_src_delete function */
void print_io_src_delete(std::ofstream & outfile , ClassValues * cv ) ;
void print_io_src_delete(std::ostream & outfile , ClassValues * cv ) ;
/** Prints stl helper function prototypes */
void print_stl_helper_proto(std::ofstream & outfile , ClassValues * in_class) ;
void print_stl_helper_proto(std::ostream & outfile , ClassValues * in_class) ;
/** Prints stl helper function */
void print_stl_helper(std::ofstream & outfile , ClassValues * in_class) ;
void print_stl_helper(std::ostream & outfile , ClassValues * in_class) ;
/** Prints stl checkpoint function */
void print_checkpoint_stl(std::ofstream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
void print_checkpoint_stl(std::ostream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
/** Prints stl post_checkpoint function */
void print_post_checkpoint_stl(std::ofstream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
void print_post_checkpoint_stl(std::ostream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
/** Prints stl restart function */
void print_restore_stl(std::ofstream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
void print_restore_stl(std::ostream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
/** Prints stl clear function */
void print_clear_stl(std::ofstream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
void print_clear_stl(std::ostream & outfile , FieldDescription * fdes , ClassValues * in_class) ;
} ;
#endif

View File

@ -1,7 +1,5 @@
#include <sstream>
#include <iostream>
#include <fstream>
#include <libgen.h>
#include <sys/stat.h>
@ -14,11 +12,11 @@ PrintFileContents13::PrintFileContents13() {}
/**
*/
void PrintFileContents13::printIOHeader(std::ofstream & outfile , std::string header_file_name) {
void PrintFileContents13::printIOHeader(std::ostream & ostream , std::string header_file_name) {
if ( ! header_file_name.compare("S_source.hh") ) {
header_file_name = "../S_source.hh" ;
}
outfile << "\n"
ostream << "\n"
"/*\n"
" * This file was automatically generated by the ICG based on the file:\n"
" * " << header_file_name << "\n"
@ -47,10 +45,10 @@ std::string PrintFileContents13::enumeration_identifier( EnumValues * e ) {
}
/** Prints enumeration attributes */
void PrintFileContents13::print_enum_attr(std::ofstream & outfile , EnumValues * e ) {
void PrintFileContents13::print_enum_attr(std::ostream & ostream , EnumValues * e ) {
EnumValues::NameValueIterator nvit ;
outfile << "class type_" << enumeration_identifier(e) << " {\n"
ostream << "class type_" << enumeration_identifier(e) << " {\n"
<< "public:\n"
<< " type_" << enumeration_identifier(e) << "() {\n"
<< " TypeDictionary * type_dict = TypeDictionary::getInstance();\n"
@ -59,10 +57,10 @@ void PrintFileContents13::print_enum_attr(std::ofstream & outfile , EnumValues *
;
for ( nvit = e->begin() ; nvit != e->end() ; nvit++ ) {
outfile << " dataType->addEnumerator(\"" << (*nvit).first << "\" , " << (*nvit).second << ");\n" ;
ostream << " dataType->addEnumerator(\"" << (*nvit).first << "\" , " << (*nvit).second << ");\n" ;
}
outfile << " typeDictionary->addTypeDefinition( \"" << e->getName() << "\", dataType );\n"
ostream << " typeDictionary->addTypeDefinition( \"" << e->getName() << "\", dataType );\n"
<< " } catch ( std::logic_error e ) {\n"
<< " std::cerr << e.what();\n"
<< " }\n"
@ -102,11 +100,11 @@ std::string PrintFileContents13::bit_field_setter_name(ClassValues * c, FieldDes
}
/** Prints attributes for a field */
void PrintFileContents13::print_field_attr(std::ofstream & outfile , ClassValues * c, FieldDescription * fv ) {
void PrintFileContents13::print_field_attr(std::ostream & ostream , ClassValues * c, FieldDescription * fv ) {
if (fv->isBitField()) {
outfile << " " ;
outfile << "dataType->addBitFieldMember(\"" << fv->getName() << "\", "
ostream << " " ;
ostream << "dataType->addBitFieldMember(\"" << fv->getName() << "\", "
<< bit_field_getter_name(c,fv) << ", "
<< bit_field_setter_name(c,fv) << ");\n"
;
@ -115,40 +113,40 @@ void PrintFileContents13::print_field_attr(std::ofstream & outfile , ClassValues
// For arrays and/or pointers, generate a dimension-size array.
if (ndims) {
outfile << " " ;
outfile << "unsigned int dim_" << fv->getName() << "[] = {";
ostream << " " ;
ostream << "unsigned int dim_" << fv->getName() << "[] = {";
for ( unsigned int ii = 0 ; ii < ndims ; ii++ ) {
if (ii) {
outfile << ",";
ostream << ",";
}
outfile << fv->getArrayDim(ii) ;
ostream << fv->getArrayDim(ii) ;
}
outfile << "};\n";
ostream << "};\n";
}
outfile << " " ;
ostream << " " ;
if (fv->isStatic()) {
outfile << "dataType->addStaticMember( \"";
outfile << fv->getName()
ostream << "dataType->addStaticMember( \"";
ostream << fv->getName()
<< "\", &" << c->getName() << "::" << fv->getName() << ", \"" << fv->getTypeName() << "\", ";
} else {
outfile << "dataType->addRegularMember( \"";
outfile << fv->getName() << "\", offsetof(" << c->getName() << ", " << fv->getName() << "), \"" << fv->getTypeName() << "\", ";
ostream << "dataType->addRegularMember( \"";
ostream << fv->getName() << "\", offsetof(" << c->getName() << ", " << fv->getName() << "), \"" << fv->getTypeName() << "\", ";
}
if (ndims) {
outfile << ndims << ", " << "dim_" << fv->getName() ;
ostream << ndims << ", " << "dim_" << fv->getName() ;
} else {
outfile << "0, NULL" ;
ostream << "0, NULL" ;
}
outfile <<");\n" ;
ostream <<");\n" ;
}
}
/** Prints class attributes */
void PrintFileContents13::print_class_attr(std::ofstream & outfile , ClassValues * c ) {
void PrintFileContents13::print_class_attr(std::ostream & ostream , ClassValues * c ) {
ClassValues::FieldIterator fit ;
@ -160,20 +158,20 @@ void PrintFileContents13::print_class_attr(std::ofstream & outfile , ClassValues
if ( f->isBitField()) {
// Create bitfield getter.
outfile << "static " << f->getTypeName() << " " << bit_field_getter_name(c,f) << "()(void* addr) {\n"
ostream << "static " << f->getTypeName() << " " << bit_field_getter_name(c,f) << "()(void* addr) {\n"
<< " return ((" << class_identifier(c) << "*)addr)->" << f->getName() << ";\n"
<< "}\n"
;
// Create bitfield setter.
outfile << "static void " << bit_field_setter_name(c,f) << "(void* addr, "<< f->getTypeName() << " v) {\n"
ostream << "static void " << bit_field_setter_name(c,f) << "(void* addr, "<< f->getTypeName() << " v) {\n"
<< " ((" << class_identifier(c) << "*)addr)->" << f->getName() << " = v;\n"
<< "}\n"
;
}
}
outfile << "class type_" << class_identifier(c) << " {\n"
ostream << "class type_" << class_identifier(c) << " {\n"
<< "public:\n"
<< " type_" << class_identifier(c) << "() {\n"
<< " TypeDictionary * type_dict = TypeDictionary::getInstance();\n"
@ -184,11 +182,11 @@ void PrintFileContents13::print_class_attr(std::ofstream & outfile , ClassValues
for ( fit = c->field_begin() ; fit != c->field_end() ; fit++ ) {
FieldDescription * field = *fit;
if ( determinePrintAttr(c , field) ) {
print_field_attr( outfile, c, field) ;
print_field_attr( ostream, c, field) ;
}
}
outfile << " typeDictionary->addTypeDefinition( \"" << c->getName() << "\", dataType );\n"
ostream << " typeDictionary->addTypeDefinition( \"" << c->getName() << "\", dataType );\n"
<< " } catch ( std::logic_error e ) {\n"
<< " std::cerr << e.what();\n"
<< " }\n"
@ -200,12 +198,12 @@ void PrintFileContents13::print_class_attr(std::ofstream & outfile , ClassValues
/** Prints io_src for a class */
void PrintFileContents13::printClass( std::ofstream & outfile , ClassValues * cv ) {
print_class_attr(outfile, cv) ;
void PrintFileContents13::printClass( std::ostream & ostream , ClassValues * cv ) {
print_class_attr(ostream, cv) ;
}
/** Prints io_src for an enum */
void PrintFileContents13::printEnum( std::ofstream & outfile , EnumValues * ev ) {
print_enum_attr(outfile, ev) ;
void PrintFileContents13::printEnum( std::ostream & ostream , EnumValues * ev ) {
print_enum_attr(ostream, ev) ;
}

View File

@ -2,6 +2,7 @@
#ifndef PRINTFILECONTENTS13_HH
#define PRINTFILECONTENTS13_HH
#include <iostream>
#include <string>
#include <vector>
#include <map>
@ -28,11 +29,11 @@ class PrintFileContents13 : public PrintFileContentsBase {
PrintFileContents13() ;
/** Prints the io_src header information */
virtual void printIOHeader(std::ofstream & outfile , std::string header_file_name) ;
virtual void printIOHeader(std::ostream & ostream , std::string header_file_name) ;
std::string enumeration_identifier( EnumValues * e );
/** Prints enumeration attributes */
void print_enum_attr(std::ofstream & outfile , EnumValues * in_enum) ;
void print_enum_attr(std::ostream & ostream , EnumValues * in_enum) ;
std::string bit_field_getter_name(ClassValues * c, FieldDescription * f);
@ -41,16 +42,16 @@ class PrintFileContents13 : public PrintFileContentsBase {
std::string class_identifier( ClassValues * c ) ;
/** Prints attributes for a field */
void print_field_attr(std::ofstream & outfile , ClassValues * c, FieldDescription * fv ) ;
void print_field_attr(std::ostream & ostream , ClassValues * c, FieldDescription * fv ) ;
/** Prints class attributes */
void print_class_attr(std::ofstream & outfile , ClassValues * in_class) ;
void print_class_attr(std::ostream & ostream , ClassValues * in_class) ;
/** Prints attributes for a class */
virtual void printClass(std::ofstream & outfile , ClassValues * cv) ;
virtual void printClass(std::ostream & ostream , ClassValues * cv) ;
/** Prints attributes for an enum */
virtual void printEnum(std::ofstream & outfile , EnumValues * ev) ;
virtual void printEnum(std::ostream & ostream , EnumValues * ev) ;
} ;

View File

@ -1,10 +1,9 @@
#include <iostream>
#include <fstream>
#include <sys/stat.h>
#include <libgen.h>
#include <string.h>
#include <iomanip>
#include <sstream>
#include "llvm/Support/CommandLine.h"
@ -18,59 +17,59 @@ extern llvm::cl::opt< bool > no_offset_of ;
PrintFileContentsBase::PrintFileContentsBase() {}
// provide empty default implementation of these routines.
void PrintFileContentsBase::printClassMapHeader(std::ofstream & out, std::string function_name ) {}
void PrintFileContentsBase::printClassMap(std::ofstream & out, ClassValues * cv) {}
void PrintFileContentsBase::printClassMapFooter(std::ofstream & out) {}
void PrintFileContentsBase::printClassMapHeader(std::ostream & ostream, std::string function_name ) {}
void PrintFileContentsBase::printClassMap(std::ostream & ostream, ClassValues * cv) {}
void PrintFileContentsBase::printClassMapFooter(std::ostream & ostream) {}
void PrintFileContentsBase::printEnumMapHeader(std::ofstream & out, std::string function_name ) {}
void PrintFileContentsBase::printEnumMap(std::ofstream & out, EnumValues * ev) {}
void PrintFileContentsBase::printEnumMapFooter(std::ofstream & out) {}
void PrintFileContentsBase::printEnumMapHeader(std::ostream & ostream, std::string function_name ) {}
void PrintFileContentsBase::printEnumMap(std::ostream & ostream, EnumValues * ev) {}
void PrintFileContentsBase::printEnumMapFooter(std::ostream & ostream) {}
void PrintFileContentsBase::print_units_map(std::ofstream & outfile, ClassValues * cv ) {
void PrintFileContentsBase::print_units_map(std::ostream & ostream, ClassValues * cv ) {
ClassValues::FieldIterator fit ;
unsigned int ii ;
outfile << "struct UnitsMap" ;
printNamespaces( outfile, cv , "__" ) ;
printContainerClasses( outfile, cv , "__" ) ;
outfile << cv->getMangledTypeName() ;
outfile << " {\n" ;
outfile << " UnitsMap" ;
printNamespaces( outfile, cv , "__" ) ;
printContainerClasses( outfile, cv , "__" ) ;
outfile << cv->getMangledTypeName() ;
outfile << "() {\n" ;
ostream << "struct UnitsMap" ;
printNamespaces( ostream, cv , "__" ) ;
printContainerClasses( ostream, cv , "__" ) ;
ostream << cv->getMangledTypeName() ;
ostream << " {\n" ;
std::ostringstream text;
outfile << " Trick::UnitsMap * units_map_ptr __attribute__((unused)) = Trick::UnitsMap::units_map() ;\n" ;
for ( fit = cv->field_begin() ; fit != cv->field_end() ; fit++ ) {
if ( determinePrintAttr(cv , *fit) and (*fit)->getUnits().compare("1")) {
FieldDescription * fdes = *fit ;
outfile << " units_map_ptr->add_param(\"" ;
printContainerClasses( outfile, cv , "__" ) ;
outfile << cv->getName() << "_" << fdes->getName() << "\", \"" << fdes->getUnits() << "\") ;\n" ;
text << " units_map_ptr->add_param(\"" ;
printContainerClasses( text, cv , "__" ) ;
text << cv->getName() << "_" << fdes->getName() << "\", \"" << fdes->getUnits() << "\") ;\n" ;
}
}
outfile << " }\n" ;
outfile << "} ;\n\n" ;
outfile << "UnitsMap" ;
printNamespaces( outfile, cv , "__" ) ;
printContainerClasses( outfile, cv , "__" ) ;
outfile << cv->getMangledTypeName() ;
outfile << " um" ;
printNamespaces( outfile, cv , "__" ) ;
printContainerClasses( outfile, cv , "__" ) ;
outfile << cv->getMangledTypeName() ;
outfile << " ;\n\n" ;
if (text.str().size()) {
ostream << " UnitsMap" ;
printNamespaces( ostream, cv , "__" ) ;
printContainerClasses( ostream, cv , "__" ) ;
ostream << cv->getMangledTypeName() ;
ostream << "() {\n" ;
ostream << " Trick::UnitsMap * units_map_ptr = Trick::UnitsMap::units_map() ;\n" ;
ostream << text.str() ;
ostream << " }\n" ;
}
ostream << "} um" ;
printNamespaces( ostream, cv , "__" ) ;
printContainerClasses( ostream, cv , "__" ) ;
ostream << cv->getMangledTypeName() ;
ostream << " ;\n" ;
}
/* Utility routines for printing */
void PrintFileContentsBase::print_open_extern_c(std::ofstream & outfile) {
outfile << "extern \"C\" {\n\n" ;
void PrintFileContentsBase::print_open_extern_c(std::ostream & ostream) {
ostream << "extern \"C\" {\n\n" ;
}
void PrintFileContentsBase::print_close_extern_c(std::ofstream & outfile) {
outfile << "\n} //extern \"C\"\n\n" ;
void PrintFileContentsBase::print_close_extern_c(std::ostream & ostream) {
ostream << "\n} //extern \"C\"\n\n" ;
}
/* internal function determines if a particular field is printable based
@ -104,34 +103,30 @@ bool PrintFileContentsBase::determinePrintAttr( ClassValues * c , FieldDescripti
}
/** Prints namespace containers of a class delimited by delim */
void PrintFileContentsBase::printNamespaces( std::ofstream & outfile , ConstructValues * c , const char * delim ) {
ClassValues::NamespaceIterator nsi ;
for ( nsi = c->namespace_begin() ; nsi != c->namespace_end() ; nsi++ ) {
outfile << *nsi << delim ;
void PrintFileContentsBase::printNamespaces( std::ostream & ostream , ConstructValues * c , const char * delim ) {
for ( ClassValues::NamespaceIterator nsi = c->namespace_begin() ; nsi != c->namespace_end() ; ++nsi ) {
ostream << *nsi << delim ;
}
}
/** Prints namespace open block */
void PrintFileContentsBase::printOpenNamespaceBlocks( std::ofstream & outfile , ClassValues * c ) {
ClassValues::NamespaceIterator nsi ;
for ( nsi = c->namespace_begin() ; nsi != c->namespace_end() ; nsi++ ) {
outfile << "namespace " << *nsi << " {\n" ;
void PrintFileContentsBase::printOpenNamespaceBlocks( std::ostream & ostream , ClassValues * c ) {
for ( ClassValues::NamespaceIterator nsi = c->namespace_begin() ; nsi != c->namespace_end() ; ++nsi ) {
ostream << "namespace " << *nsi << " {\n" ;
}
}
/** Prints namespace close block */
void PrintFileContentsBase::printCloseNamespaceBlocks( std::ofstream & outfile , ClassValues * c ) {
ClassValues::NamespaceIterator nsi ;
for ( nsi = c->namespace_begin() ; nsi != c->namespace_end() ; nsi++ ) {
outfile << "}\n" ;
void PrintFileContentsBase::printCloseNamespaceBlocks( std::ostream & ostream , ClassValues * c ) {
for ( ClassValues::NamespaceIterator nsi = c->namespace_begin() ; nsi != c->namespace_end() ; ++nsi ) {
ostream << "}\n" ;
}
}
/** Prints class containers of a class delimited by delim */
void PrintFileContentsBase::printContainerClasses( std::ofstream & outfile , ConstructValues * c , const char * delim ) {
ClassValues::ContainerClassIterator ci ;
for ( ci = c->container_class_begin() ; ci != c->container_class_end() ; ci++ ) {
outfile << *ci << delim ;
void PrintFileContentsBase::printContainerClasses( std::ostream & ostream , ConstructValues * c , const char * delim ) {
for ( ClassValues::ContainerClassIterator ci = c->container_class_begin() ; ci != c->container_class_end() ; ci++ ) {
ostream << *ci << delim ;
}
}

View File

@ -2,6 +2,7 @@
#ifndef PRINTFILECONTENTSBASE_HH
#define PRINTFILECONTENTSBASE_HH
#include <iostream>
#include <string>
#include <vector>
#include <map>
@ -28,47 +29,47 @@ class PrintFileContentsBase {
public:
PrintFileContentsBase() ;
virtual void printIOHeader(std::ofstream & out, std::string header_file_name) = 0 ;
virtual void printClass(std::ofstream & out, ClassValues * cv) = 0 ;
virtual void printEnum(std::ofstream & out, EnumValues * ev) = 0 ;
virtual void printIOHeader(std::ostream & ostream, std::string header_file_name) = 0 ;
virtual void printClass(std::ostream & ostream, ClassValues * cv) = 0 ;
virtual void printEnum(std::ostream & ostream, EnumValues * ev) = 0 ;
// these routines provide default empty implementation
virtual void printClassMapHeader(std::ofstream & out, std::string function_name ) ;
virtual void printClassMap(std::ofstream & out, ClassValues * cv) ;
virtual void printClassMapFooter(std::ofstream & out) ;
virtual void printClassMapHeader(std::ostream & ostream, std::string function_name ) ;
virtual void printClassMap(std::ostream & ostream, ClassValues * cv) ;
virtual void printClassMapFooter(std::ostream & ostream) ;
virtual void printEnumMapHeader(std::ofstream & out, std::string function_name ) ;
virtual void printEnumMap(std::ofstream & out, EnumValues * ev) ;
virtual void printEnumMapFooter(std::ofstream & out) ;
virtual void printEnumMapHeader(std::ostream & ostream, std::string function_name ) ;
virtual void printEnumMap(std::ostream & ostream, EnumValues * ev) ;
virtual void printEnumMapFooter(std::ostream & ostream) ;
protected:
/** Prints the io_src_allocate function */
virtual void print_units_map(std::ofstream & out, ClassValues * cv) ;
virtual void print_units_map(std::ostream & ostream, ClassValues * cv) ;
/** Prints "extern \"C\" {" */
void print_open_extern_c(std::ofstream & out) ;
void print_open_extern_c(std::ostream & ostream) ;
/** Prints "} // extern C" */
void print_close_extern_c(std::ofstream & out) ;
void print_close_extern_c(std::ostream & ostream) ;
/* internal function determines if a particular field is printable */
bool determinePrintAttr(ClassValues * c , FieldDescription *fdes) ;
/** Prints namespace containers of a class delimited by delim */
void printNamespaces(std::ofstream & out, ConstructValues * c , const char * delim ) ;
void printNamespaces(std::ostream & ostream, ConstructValues * c , const char * delim ) ;
/** Prints namespace open block */
void printOpenNamespaceBlocks( std::ofstream & out, ClassValues * c ) ;
void printOpenNamespaceBlocks( std::ostream & ostream, ClassValues * c ) ;
/** Prints namespace close block */
void printCloseNamespaceBlocks( std::ofstream & out, ClassValues * c ) ;
void printCloseNamespaceBlocks( std::ostream & ostream, ClassValues * c ) ;
/* Note: There are no open/close namespace blocks for enums. The
enum attributes do not have anything that needs to be enclosed in
namespaces */
/** Prints class containers of a class delimited by delim */
void printContainerClasses(std::ofstream & out, ConstructValues * c , const char * delim ) ;
void printContainerClasses(std::ostream & ostream, ConstructValues * c , const char * delim ) ;
} ;

View File

@ -13,7 +13,7 @@
/**
*
*/
int Trick::MemoryManager::add_attr_info( std::string & user_type_string , ATTRIBUTES * attr , const char * file_name , unsigned int line_num ) {
int Trick::MemoryManager::add_attr_info( const std::string & user_type_string , ATTRIBUTES * attr , const char * file_name , unsigned int line_num ) {
std::string user_type_name ;
std::string sub_attr_name ;