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

Public Member Functions

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

 dirname
 
 kind
 

Static Public Attributes

int CHUNK_SIZE = 200
 

Private Member Functions

def _get_filename
 
def _generate_files
 
def _split_stmts_into_chunks
 

Static Private Attributes

list _generated_header_files = []
 

Detailed Description

Definition at line 16 of file TableFunctionsFactory_linker.py.

Constructor & Destructor Documentation

def TableFunctionsFactory_linker.BaseGenerateFiles.__init__ (   self,
  dirname,
  kind 
)

Member Function Documentation

def TableFunctionsFactory_linker.BaseGenerateFiles._generate_files (   self,
  chunk 
)
private

Definition at line 54 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.GenerateTemplateFiles._generate_cpp_content(), TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles._generate_cpp_content(), TableFunctionsFactory_linker.GenerateTemplateFiles._generate_hpp_content(), TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles._generate_hpp_content(), TableFunctionsFactory_linker.BaseGenerateFiles._get_filename(), TableFunctionsFactory_linker.BaseGenerateFiles.file_counter(), TableFunctionsFactory_linker.get_existing_file_content(), TableFunctionsFactory_linker.BaseGenerateFiles.increment_file_counter(), and heavyai.open().

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles.generate_files().

54 
55  def _generate_files(self, chunk):
57  fileno = self.file_counter()
58  cpp_filename = self._get_filename(ext="cpp")
59  hpp_filename = self._get_filename(ext="h")
60 
61  BaseGenerateFiles._generated_header_files.append(hpp_filename)
62 
63  cpp_content = self._generate_cpp_content(chunk, hpp_filename, fileno)
64  hpp_content = self._generate_hpp_content(chunk, fileno)
65 
66  cpp_ec = get_existing_file_content(cpp_filename)
67  hpp_ec = get_existing_file_content(hpp_filename)
68 
69  if cpp_content == cpp_ec and hpp_content == hpp_ec:
70  return
71 
72  with open(cpp_filename, "w") as f:
73  f.write(cpp_content)
74 
75  with open(hpp_filename, "w") as f:
76  f.write(hpp_content)
int open(const char *path, int flags, int mode)
Definition: heavyai_fs.cpp:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles._get_filename (   self,
  ext 
)
private

Definition at line 49 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.BaseGenerateFiles.dirname, TableFunctionsFactory_linker.BaseGenerateFiles.file_counter(), TableFunctionsFactory_linker.GenerateTemplateFiles.filename_prefix(), TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles.filename_prefix(), TableFunctionsFactory_linker.BaseGenerateFiles.get_filename(), TableFunctionsFactory_linker.BaseGenerateFiles.kind, lockmgr::TableSchemaLockMgr.kind, lockmgr::InsertDataLockMgr.kind, lockmgr::TableDataLockMgr.kind, org.apache.calcite.sql.SqlOperator.kind, heavydb.serialized_result_set.ttypes.TTargetInfo.kind, org.apache.calcite.sql2rel.StandardConvertletTable.RegrCovarianceConvertlet.kind, and org.apache.calcite.sql2rel.StandardConvertletTable.AvgVarianceConvertlet.kind.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._generate_files().

49 
50  def _get_filename(self, ext):
51  fileno = self.file_counter()
52  filename = self.get_filename(self.filename_prefix, self.kind, fileno, ext)
53  return os.path.join(self.dirname, filename)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles._split_stmts_into_chunks (   self)
private

Definition at line 77 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.BaseGenerateFiles.CHUNK_SIZE, TableFunctionsFactory_linker.GenerateTemplateFiles.stmts, and TableFunctionsFactory_linker.GenerateAddTableFunctionsFiles.stmts.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles.generate_files().

77 
78  def _split_stmts_into_chunks(self):
79  stmts = self.stmts
80  L = len(stmts)
81  chunks = []
82  for i in range(0, L, self.CHUNK_SIZE):
83  chunks.append(stmts[i : i + self.CHUNK_SIZE])
84  return chunks

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles.file_counter (   cls)

Definition at line 26 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._generate_files(), and TableFunctionsFactory_linker.BaseGenerateFiles._get_filename().

26 
27  def file_counter(cls):
28  return cls._file_counter

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles.generate_files (   self)

Definition at line 85 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.BaseGenerateFiles._generate_files(), and TableFunctionsFactory_linker.BaseGenerateFiles._split_stmts_into_chunks().

85 
86  def generate_files(self):
87  chunks = self._split_stmts_into_chunks()
88  for chunk in chunks:
89  self._generate_files(chunk)
90 

+ Here is the call graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles.generated_header_files (   self)

Definition at line 30 of file TableFunctionsFactory_linker.py.

References TableFunctionsFactory_linker.BaseGenerateFiles._generated_header_files.

30 
31  def generated_header_files(self):
32  return self._generated_header_files
def TableFunctionsFactory_linker.BaseGenerateFiles.get_filename (   self,
  prefix,
  kind,
  fileno,
  ext 
)

Definition at line 42 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._get_filename().

42 
43  def get_filename(self, prefix, kind, fileno, ext):
44  raise NotImplementedError()

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles.get_num_generated_files (   cls)

Definition at line 46 of file TableFunctionsFactory_linker.py.

46 
47  def get_num_generated_files(cls):
48  return cls.file_counter()
def TableFunctionsFactory_linker.BaseGenerateFiles.increment_file_counter (   cls)

Definition at line 34 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._generate_files().

34 
35  def increment_file_counter(cls):
36  cls._file_counter += 1

+ Here is the caller graph for this function:

def TableFunctionsFactory_linker.BaseGenerateFiles.should_generate_files (   self)

Definition at line 38 of file TableFunctionsFactory_linker.py.

38 
39  def should_generate_files(self):
40  raise NotImplementedError()

Member Data Documentation

list TableFunctionsFactory_linker.BaseGenerateFiles._generated_header_files = []
staticprivate

Definition at line 19 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles.generated_header_files().

int TableFunctionsFactory_linker.BaseGenerateFiles.CHUNK_SIZE = 200
static

Definition at line 18 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._split_stmts_into_chunks().

TableFunctionsFactory_linker.BaseGenerateFiles.dirname

Definition at line 22 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._get_filename().

TableFunctionsFactory_linker.BaseGenerateFiles.kind

Definition at line 23 of file TableFunctionsFactory_linker.py.

Referenced by TableFunctionsFactory_linker.BaseGenerateFiles._get_filename().


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