OmniSciDB  a5dc49c757
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
TableFunctionsFactory_linker.GenerateTemplateFiles Class Reference
+ Inheritance diagram for TableFunctionsFactory_linker.GenerateTemplateFiles:
+ Collaboration diagram for TableFunctionsFactory_linker.GenerateTemplateFiles:

Public Member Functions

def __init__
 
def filename_prefix
 
def get_filename
 
- Public Member Functions inherited from TableFunctionsFactory_linker.BaseGenerateFiles
def __init__
 
def file_counter
 
def generated_header_files
 
def increment_file_counter
 
def should_generate_files
 
def get_filename
 
def get_num_generated_files
 
def generate_files
 

Public Attributes

 stmts
 
 header_file
 
- Public Attributes inherited from TableFunctionsFactory_linker.BaseGenerateFiles
 dirname
 
 kind
 

Private Member Functions

def _get_decl_from_cpp_functions
 
def _generate_cpp_content
 
def _generate_hpp_content
 

Static Private Attributes

int _file_counter = -1
 

Additional Inherited Members

- Static Public Attributes inherited from TableFunctionsFactory_linker.BaseGenerateFiles
int CHUNK_SIZE = 200
 

Detailed Description

Definition at line 91 of file TableFunctionsFactory_linker.py.

Constructor & Destructor Documentation

def TableFunctionsFactory_linker.GenerateTemplateFiles.__init__ (   self,
  dirname,
  stmts,
  header_file,
  kind 
)

Definition at line 95 of file TableFunctionsFactory_linker.py.

95 
96  def __init__(self, dirname, stmts, header_file, kind):
97  assert kind in ("cpu", "gpu")
98  self.stmts = stmts
99  self.header_file = header_file
100  super(
101  GenerateTemplateFiles,
102  self,
103  ).__init__(dirname=dirname, kind=kind)

Member Function Documentation

def TableFunctionsFactory_linker.GenerateTemplateFiles._generate_cpp_content (   self,
  stmts,
  hpp_filename,
  fileno 
)
private

Definition at line 118 of file TableFunctionsFactory_linker.py.

References join().

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._generate_files().

119  def _generate_cpp_content(self, stmts, hpp_filename, fileno):
120  content = '''
121  /*
122  This file is generated by %s. Do no edit!
123 
124  */
125  #include "%s"
126 
127  %s
128  '''
129  content = textwrap.dedent(content)
130  funcs_formatted = '\n'.join(stmts)
131  return content % (sys.argv[0], hpp_filename, funcs_formatted)
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.GenerateTemplateFiles._generate_hpp_content (   self,
  funcs,
  fileno 
)
private

Definition at line 132 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.GenerateTemplateFiles._get_decl_from_cpp_functions(), TableFunctionsFactory_linker.GenerateTemplateFiles.header_file, and join().

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._generate_files().

133  def _generate_hpp_content(self, funcs, fileno):
134  content = '''
135  /*
136  This file is generated by %s. Do no edit!
137  */
138  #include "%s"
139 
140  %s
141  '''
142  content = textwrap.dedent(content)
143 
144  decls = '\n\n'.join(self._get_decl_from_cpp_functions(funcs))
145 
146  return content % (sys.argv[0], self.header_file, decls)
147 
148 
std::string join(T const &container, std::string const &delim)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.GenerateTemplateFiles._get_decl_from_cpp_functions (   self,
  cpp_functions 
)
private

Definition at line 111 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.GenerateTemplateFiles._generate_hpp_content().

112  def _get_decl_from_cpp_functions(self, cpp_functions):
113  decls = []
114  for func in cpp_functions:
115  header = func.split("{", 1)[0].rstrip() + ";"
116  decls.append(header)
117  return decls

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.GenerateTemplateFiles.filename_prefix (   self)

Definition at line 105 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._get_filename().

106  def filename_prefix(self):
107  return "TableFunctionsFactory_init"

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.GenerateTemplateFiles.get_filename (   self,
  prefix,
  kind,
  fileno,
  ext 
)

Definition at line 108 of file TableFunctionsFactory_linker.py.

109  def get_filename(self, prefix, kind, fileno, ext):
110  return "%s_%s_%s.%s" % (prefix, kind, fileno, ext)

Member Data Documentation

int TableFunctionsFactory_linker.GenerateTemplateFiles._file_counter = -1
staticprivate

Definition at line 93 of file TableFunctionsFactory_linker.py.

TableFunctionsFactory_linker.GenerateTemplateFiles.header_file

Definition at line 98 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.GenerateTemplateFiles._generate_hpp_content(), and TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles._generate_hpp_content().

TableFunctionsFactory_linker.GenerateTemplateFiles.stmts

Definition at line 97 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._split_stmts_into_chunks(), and TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles.should_generate_files().


The documentation for this class was generated from the following file: