trick/trick_source/codegen/Interface_Code_Gen/PrintFileContentsBase.hh

64 lines
2.1 KiB
C++
Raw Permalink Normal View History

2015-02-26 15:02:31 +00:00
#ifndef PRINTFILECONTENTSBASE_HH
#define PRINTFILECONTENTSBASE_HH
2015-02-26 15:02:31 +00:00
2016-10-20 19:53:21 +00:00
#include <iostream>
2015-02-26 15:02:31 +00:00
#include <string>
#include <vector>
#include <map>
#include <set>
class ConstructValues ;
class ClassValues ;
class EnumValues ;
class FieldDescription ;
/**
This class prints Trick 10 style io_src code. Given a vector of class information,
this class determines the io_src code file names, excluding files in system directories,
and writes out the attributes.
@author Alexander S. Lin
@date July 2012
*/
class PrintFileContentsBase {
public:
PrintFileContentsBase() ;
2016-10-20 19:53:21 +00:00
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 ;
2015-02-26 15:02:31 +00:00
// these routines provide default empty implementation
2016-10-20 19:53:21 +00:00
virtual void printClassMapHeader(std::ostream & ostream, std::string function_name ) ;
virtual void printClassMap(std::ostream & ostream, ClassValues * cv) ;
virtual void printClassMapFooter(std::ostream & ostream) ;
2015-02-26 15:02:31 +00:00
2016-10-20 19:53:21 +00:00
virtual void printEnumMapHeader(std::ostream & ostream, std::string function_name ) ;
virtual void printEnumMap(std::ostream & ostream, EnumValues * ev) ;
virtual void printEnumMapFooter(std::ostream & ostream) ;
2015-02-26 15:02:31 +00:00
/* gets a vector of fields that can be printed */
std::vector<FieldDescription*> getPrintableFields(ClassValues& classValues, unsigned int ioMask = 0xFFFFFFF);
2015-02-26 15:02:31 +00:00
protected:
/** Prints the io_src_allocate function */
2016-10-20 19:53:21 +00:00
virtual void print_units_map(std::ostream & ostream, ClassValues * cv) ;
2015-02-26 15:02:31 +00:00
/** Prints "extern \"C\" {" */
2016-10-20 19:53:21 +00:00
void print_open_extern_c(std::ostream & ostream) ;
2015-02-26 15:02:31 +00:00
/** Prints "} // extern C" */
2016-10-20 19:53:21 +00:00
void print_close_extern_c(std::ostream & ostream) ;
2015-02-26 15:02:31 +00:00
/* internal function determines if a particular field is printable */
bool isPrintable(ClassValues * c , FieldDescription *fdes , unsigned int ioMask = 0xFFFFFFF) ;
2015-02-26 15:02:31 +00:00
} ;
#endif