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

@ -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 ) ;
} ;