API

Storage

class SSD.sofa.database.Database(*args: Any, **kwargs: Any)[source]
__init__(root: Sofa.Core.Node, database_dir: str = '', database_name: str = 'runSofa', *args, **kwargs)[source]

Manage the creation and loading of Tables in the Database. User interface to dynamically add, get and update entries. Additional callbacks to automatically get sofa objects Data.

Parameters:
  • root – Root node of the scene graph.

  • database_dir – Directory which contains the Database file.

  • database_name – Name of the Database file.

add_callback(table_name: str, field_name: str, record_object: str, record_field: str)[source]

Add a callback on an object Data field. If the specified Table or Field does not exist, create them.

Parameters:
  • table_name – Name of the Table.

  • field_name – Name of the Field.

  • record_object – Path to the sofa object in the scene graph from root node (@child_node.object_name’).

  • record_field – The name of the Data field to record.

add_data(table_name: str, data: Dict[str, Any])[source]

Execute a line insert query.

Parameters:
  • table_name – Name of the Table.

  • data – New line of the Table.

onAnimateBeginEvent(_)[source]

At the beginning of a time step.

onAnimateEndEvent(_)[source]

At the end of a time step.

print_architecture()[source]

Print the content of the Database with Table(s), Field(s) and connected sofa objects.