Configurator
|
One Function of a module. More...
Public Member Functions | |
def | __init__ |
Function constructor. | |
def | __format__ |
Format self using fmt string. | |
def | cpp_header_write |
Write the C++ method declaration for self to out_stream. | |
def | cpp_local_source_write |
Write local C++ RPC code for self to out_stream. | |
def | cpp_slave_write |
Write C++ code for RPC request handing for self to out_stream | |
def | cpp_remote_source_write |
Write remote side RPC code for self to out_stream. | |
def | python_write |
Output Python RPC code for self to out_stream | |
Public Member Functions inherited from data_structures.Node | |
def | __init__ |
Node Constructor | |
def | parent_index_find |
Recursively find parent of self starting from root_node. | |
def | show |
Method print self indented by indent. | |
def | sub_node_append |
Append sub_node to the children sub nodes of self. | |
def | xml_write |
Method writes self to out_stream indented by indent. | |
One Function of a module.
A module can have one or more functions that can be invoked via a remote procedure call. A function has zero, one, or more parameters and zero, one, or more results. This shows up in the XML files as:
<Function Name="..." Number="..." Brief="..."> <Description> *Description goes here* </Description> <Parameter Name="..." Type="..." Brief="..." /> ... <Result Name="..." Type="..." Brief="..." /> ... </Function>
def data_structures.Function.__init__ | ( | self, | |
function_element, | |||
style | |||
) |
Function constructor.
self | Function object to initialize |
function_element | Element containing XML to extract from |
style | Style object that specifies how to format generate code. |
This method extacts information about a remote procedure call function from function_element and stuffs it into self.
def data_structures.Function.__format__ | ( | self, | |
fmt | |||
) |
Format self using fmt string.
self | Function to use for formatting. |
fmt | str that specifies the format to use |
Format self using fmt to control formatting and return the formatted string. The allowed formatting strings are:
def data_structures.Function.cpp_header_write | ( | self, | |
module, | |||
out_stream | |||
) |
Write the C++ method declaration for self to out_stream.
self | Function object to use for information |
module | Module (Currently unused) |
out_stream | File output stream to output to |
This routine will output a chunk of C++ code to out_stream that corresponds to method declaration in C++ class definition: The code looks roughly as follows:
// BRIEF RT1 FUNCTION(PT1 PN1,...,PTn PNn,RT2 RN2,...,RTn RNn);
where
def data_structures.Function.cpp_local_source_write | ( | self, | |
module, | |||
out_stream | |||
) |
Write local C++ RPC code for self to out_stream.
self | Function to use for parameters and return results |
module | Module to use for module name and the like. |
out_stream | File to write everything out to. |
This method will output the local remote procedure call C++ code for function out to *out_stream. The code looks basically like this:
// FUNCTION: BRIEF RT1 MODULE::FUNCTION(PT1 PN1,...,PTn PNn, RT2 *RN2,...,RTn *RNn) { RT1 RN1; ... RTn RNn; //////// Edit begins here: {FUNCTION_NAME} //////// Edit ends here: {FUNCTION_NAME} return RN1; }
where
def data_structures.Function.cpp_remote_source_write | ( | self, | |
module, | |||
out_stream | |||
) |
Write remote side RPC code for self to out_stream.
self | Function to output RPC code for |
module | Module to use for module name |
out_stream | File to output code to |
The routine will look something like:
// NAME: BRIEF RT1 MODULE::FUNCTION(PT1 PN1,...,PTn PNn,RT2 *RN2,...,RTn *RNn) { Maker_Bus_Module::command_begin(NUMBER); Maker_Bus_Module::PT1_put(P1); ... Maker_Bus_Module::PTn_put(Pn); RT1 R1 = Maker_Bus_Module::RT1_get(); *RN2 = Maker_Bus_Module::RT2_get(); ... *RNn = Maker_Bus_Module::RTn_get(); Maker_Bus_Module::command_end(); return RN1; }
where
def data_structures.Function.cpp_slave_write | ( | self, | |
module_name, | |||
out_stream | |||
) |
Write C++ code for RPC request handing for self to out_stream
self | Function to process |
module_name | str Module name to use |
out_stream | File to write output to |
This method will output self to out_stream as a case clause as part of a switch statement. The basic format of the code that is generated looks as follows:
case NUMBER: { // FUNCTION_NAME: BRIEF PN1 = maker_bus->PT1_get(); ... PNn = maker_bus->PTn_get(); RT1 RN1; ... RTn RNn; if (execute_mode) { RN1 = FUNCTION_NAME(PN1,...PNn,&RN2,...,&RNn); maker_bus->RT2_put(RN2); ... maker_bus->RTn_put(RNn); break; } }
where
def data_structures.Function.python_write | ( | self, | |
out_stream | |||
) |
Output Python RPC code for self to out_stream
self | Function to output Python code for |
out_stream | File to output Python code to |
This routine will output remote procedure call code for self to out_stream. The code looks as follows:
def FUNCTION(self, PN1, ..., PNn): # BRIEF self.request_begin(NUMBER) self.request_PT1_put(PN1) ... self.request_PTn_put(PNn) self.request_end() RN1 = self.request_RT1_get() ... RNn = self.request_RTn_get() return RN1, ..., RNn
where: