Mantid
Loading...
Searching...
No Matches
Functions | Variables
generate_mdevent_declarations Namespace Reference

Functions

def build_macro (padding, min_dimension=1, max_dimensions=4, const="")
 
def find_line_number (lines, pattern, startat=0)
 
def find_num_dim (lines)
 
def generate ()
 
def get_padding (line)
 
def parse_file (file_name, start_marker, end_marker)
 

Variables

string footer
 
string header
 
list mdevent_types = ["MDLeanEvent", "MDEvent"]
 

Function Documentation

◆ build_macro()

def generate_mdevent_declarations.build_macro (   padding,
  min_dimension = 1,
  max_dimensions = 4,
  const = "" 
)
Return the macro code CALL_MDEVENT_FUNCTION
Parameter:
    min_dimension :: to avoid compiler warnings, limit to dimensions higher than this
    mad_dimension :: by default, maximal numner of dimesnions to be generated
    const :: set to "const " to make a const equivalent

Definition at line 33 of file generate_mdevent_declarations.py.

Referenced by generate().

◆ find_line_number()

def generate_mdevent_declarations.find_line_number (   lines,
  pattern,
  startat = 0 
)
Look line-by-line in lines[] for a line that starts with pattern. Return
the line number in source where the line was found, and the padding (in spaces) before it

Definition at line 89 of file generate_mdevent_declarations.py.

References get_padding().

Referenced by parse_file().

◆ find_num_dim()

def generate_mdevent_declarations.find_num_dim (   lines)
Look up through header file and the string which identifies how many dimensions have to be instantiated

Definition at line 103 of file generate_mdevent_declarations.py.

Referenced by generate().

◆ generate()

def generate_mdevent_declarations.generate ( )

Definition at line 145 of file generate_mdevent_declarations.py.

References build_macro(), find_num_dim(), generate(), and parse_file().

Referenced by generate().

◆ get_padding()

def generate_mdevent_declarations.get_padding (   line)
Return a string with the spaces padding the start of the given line.

Definition at line 78 of file generate_mdevent_declarations.py.

Referenced by find_line_number().

◆ parse_file()

def generate_mdevent_declarations.parse_file (   file_name,
  start_marker,
  end_marker 
)
Read the file and separate it into three parts with the part between input markers to be generated and two others left unchanged.

@param -- file_name -- full file name to open
@param -- start_marker -- the marker which indicate first line of autogenerated file
@param -- end_marger -- the margker which indicate last line of autogenerated file

@return padding -- the number of spaces to insert in front of autogenerated lines
@return lines_before -- list of lines before autogenerated one (including start_marker)
@return lines_after  -- list of lines after autogenerated one (including end_marker)

Definition at line 115 of file generate_mdevent_declarations.py.

References find_line_number().

Referenced by generate().

Variable Documentation

◆ footer

string generate_mdevent_declarations.footer
Initial value:
1= """
2/* CODE ABOWE WAS AUTO-GENERATED BY %s - DO NOT EDIT! */
3""" % (
4 os.path.basename(__file__)
5)

Definition at line 26 of file generate_mdevent_declarations.py.

◆ header

string generate_mdevent_declarations.header
Initial value:
1= """/* Code below Auto-generated by '%s'
2 * on %s
3 *
4 * DO NOT EDIT!
5 */
6""" % (
7 os.path.basename(__file__),
8 datetime.datetime.now(),
9)

Definition at line 16 of file generate_mdevent_declarations.py.

◆ mdevent_types

list generate_mdevent_declarations.mdevent_types = ["MDLeanEvent", "MDEvent"]

Definition at line 14 of file generate_mdevent_declarations.py.