mpyCppWrapper

class mpyCppWrapper.CppWrapClassTemplate[source]

Bases: object

Template class defining the C++ wrapper class

class mpyCppWrapper.CppWrapperClass(TheSim, taskActivityDir, simTag, outputPath)[source]

Bases: object

This is the main class handling instrospection of the C modules. It generates the C++ wrapper classes (with callbacks to the C algorithms and setters and getters for the C module variables) and it also generates the MicroPython integration patch.

checkMethodType(methodName)[source]

This function checks the method type of the input and returns the corresponding strings.

Returns

methodName: name of the model data algorithm

evalParsedList(list, module)[source]

Second Parsing Method: Collects all the SwigPyObjects present in the list. Only the methods SelfInit_(...), CrossInit_(...), Update_(...) and Restart_(...) are wrapped by Swig in the .i files. Therefore they are the only SwigPyObjects.

Returns

a dictionary D = {method, address}

findAddressMatch(addressVal, modelTagKey, dict)[source]

This function makes sure that each algorithm in a data model is matched with the proper algorithm in the corresponding model wrap. If there’s a match, returns the ID of the model. Otherwise, an ugly error is raised and the whole program quits.

Parameters
  • addressVal – address of the model data algorithm.

  • modelTagKey – modelTag = key with which to search in dict.

  • dict – wrap algorithms’ address dictionary in which to look for a match. For example, use dict[modelTagKey][0] = model wrap algorithm address or dict[modelTagKey][1] = model ID

getTaskIndex(theSim, taskUse)[source]

This function returns the key name of the NameReplace dictionary according to the index of the task and the index of the model inside the task

parseSwigVars(list)[source]

First Parsing Method: Gets rid of all the variables that come after a built-in. The methods SelfInit, CrossInit, Update and Restart will always come first, and so will the variables that are capitalized (this is based on how “dir()” command works in the Python interpreter). Returns a reduced array.

class mpyCppWrapper.MpyWrapCodeTemplate(model_tag, algs_dict, class_name, hpp_line)[source]

Bases: object

Template class defining the glue-code to include in the MicroPython C++ Wrapper source

class mpyCppWrapper.SwigNamer(field_name)[source]

Bases: object

Class to handler creation of setters and getters (i.e. SWIG functionality)