Type Database

The MARTe2Application instance uses our Type Database class to store fundamental and complex types of MARTe2 which it uses when generating the error state and a simulation version of a given config using the Simulation Framework.

The Type Database stores types internally as a class definition of Type and Field which can be recursive. As files it supports storing these in header format, this header uses a UKAEA pre-defined format inline with ITER usage of storing type definitions of SDN Types (SDN is a form of network layer which MARTe2 also supports).

The Type Database can also support exporting your types into a MARTe2 C++ format for compiling and creating libraries for.

The fundamental MARTe2 types are already built in.

The Type Database is used to replace signals for simulation and error states, knowing complex types beforehand is necessary for the frameworks to:

  • Replace these types when they are not available in a given state or function.

  • Write/log these types

The Type Database includes a template setup and is capable of outputting to C++ library format.

Using the toLibrary function you can generate C++ headers and source files that can be compiled and included in a MARTe .cfg to define a type.

You may also modify the template as per your needs.

Main user functions:

class martepy.marte2.type_database.TypeDBv2

The Type Database class

getTypeByName(type_name)

Get a type based on it’s name

incrementVersion(version)

Increment the version number of our type

isFundamental(type_name)

Check if a given type is a fundamental type of MARTe2

loadDb(directory_path)

Load a directory of types into the database

loadFile(file_path)

Load a type file

saveType(typedef, file_path)

Save the type to file

saveTypeDef(type_db_filepath, type_name, type_value)

Save a given type definition to file

toLibrary(output_path)

Output our type database as it’s C++ compilable MARTe2 format

updateDb(type_db_filepath)

For each type, save them

updateFileVersion(file_path, new_version)

Update the version def in the file contents