Back

ScriptEvent

sofa::core::objectmodel::ScriptEvent
Event
Doc (from source)

Generic Event class to send a message through the simulation graph.

Abstract (AI generated)

`ScriptEvent` facilitates communication between components in SOFA by enabling the transmission of named messages through the simulation graph.

Metadata
module
Sofa.framework.Core
namespace
sofa::core::objectmodel
include
sofa/core/objectmodel/ScriptEvent.h
inherits
  • Event
description

The ScriptEvent class in the SOFA framework is designed to facilitate communication between different components within the scene-graph architecture by sending messages. It does not directly contribute to any governing equations, constitutive laws, or numerical methods related to FEM simulations. Instead, it serves a role in coordinating and managing interactions between various simulation elements. The primary functionalities of ScriptEvent include:

  • Message Passing: It enables the transmission of named messages from one component (the sender) to another within the SOFA simulation graph.

  • Sender Identification: Each ScriptEvent instance is associated with a specific sender, which is represented by a smart pointer (sofa::core::sptr<sofa::core::objectmodel::BaseNode>). This indicates that the event can originate from any node in the scene-graph hierarchy.

  • Event Name Retrieval: The ScriptEvent class provides methods to retrieve both the sender and the event name. Specifically, getSender() returns the sender of the message, and getEventName() retrieves the name of the event.

  • Type Checking and Introspection: Utility functions such as checkEventType, getEventTypeIndex, and GetClassName are provided for introspection and type-checking purposes. These methods help in identifying and verifying the types of events within the simulation graph.

In summary, while ScriptEvent is crucial for enabling communication between components, it does not involve any mathematical or physical content directly related to FEM simulations. Its role is purely coordination and messaging.

Methods
int getEventTypeIndex ()
bool checkEventType (const Event * event)
const int getSender ()
const int & getEventName ()
const char * GetClassName ()
{
  "name": "ScriptEvent",
  "namespace": "sofa::core::objectmodel",
  "module": "Sofa.framework.Core",
  "include": "sofa/core/objectmodel/ScriptEvent.h",
  "doc": "Generic Event class to send a message through the simulation graph.",
  "inherits": [
    "Event"
  ],
  "templates": [],
  "data_fields": [],
  "links": [],
  "methods": [
    {
      "name": "getEventTypeIndex",
      "return_type": "int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "checkEventType",
      "return_type": "bool",
      "params": [
        {
          "name": "event",
          "type": "const Event *"
        }
      ],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    },
    {
      "name": "getSender",
      "return_type": "const int",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "getEventName",
      "return_type": "const int &",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": false,
      "access": "public"
    },
    {
      "name": "GetClassName",
      "return_type": "const char *",
      "params": [],
      "is_virtual": false,
      "is_pure_virtual": false,
      "is_static": true,
      "access": "public"
    }
  ],
  "description": "The `ScriptEvent` class is part of the SOFA framework and is used to send messages through the simulation graph, facilitating communication between different components within the scene-graph architecture. It inherits from the base `Event` class. \n\n**Role & Purpose:**\nThe primary role of `ScriptEvent` is to act as a generic event mechanism for sending named messages from one component (sender) to another across the SOFA simulation graph.\n\n**Interactions with Other Components:**\n- It interacts through inheritance with the base `Event` class, which likely defines common behavior and properties for all types of events in SOFA.\n- The sender is represented as a smart pointer (`sofa::core::sptr<sofa::core::objectmodel::BaseNode>`), indicating that it can originate from any node in the scene-graph hierarchy.\n\n**Practical Usage Guidance:**\nThe `ScriptEvent` can be instantiated with a sender and an event name. It provides methods to retrieve the sender (`getSender`) and the event name (`getEventName`). The class also includes utility functions like `checkEventType`, `getEventTypeIndex`, and `GetClassName` for introspection and type-checking purposes.\n\n**Data Fields:**\nThe `ScriptEvent` encapsulates two private data fields: a smart pointer to the sender node and a string representing the event name.",
  "maths": "The `ScriptEvent` class in the SOFA framework is designed to facilitate communication between different components within the scene-graph architecture by sending messages. It does not directly contribute to any governing equations, constitutive laws, or numerical methods related to FEM simulations. Instead, it serves a role in coordinating and managing interactions between various simulation elements. The primary functionalities of `ScriptEvent` include:\n\n- **Message Passing**: It enables the transmission of named messages from one component (the sender) to another within the SOFA simulation graph.\n\n- **Sender Identification**: Each `ScriptEvent` instance is associated with a specific sender, which is represented by a smart pointer (`sofa::core::sptr<sofa::core::objectmodel::BaseNode>`). This indicates that the event can originate from any node in the scene-graph hierarchy.\n\n- **Event Name Retrieval**: The `ScriptEvent` class provides methods to retrieve both the sender and the event name. Specifically, `getSender()` returns the sender of the message, and `getEventName()` retrieves the name of the event.\n\n- **Type Checking and Introspection**: Utility functions such as `checkEventType`, `getEventTypeIndex`, and `GetClassName` are provided for introspection and type-checking purposes. These methods help in identifying and verifying the types of events within the simulation graph.\n\nIn summary, while `ScriptEvent` is crucial for enabling communication between components, it does not involve any mathematical or physical content directly related to FEM simulations. Its role is purely coordination and messaging.",
  "abstract": "`ScriptEvent` facilitates communication between components in SOFA by enabling the transmission of named messages through the simulation graph.",
  "sheet": "# ScriptEvent\n\n## Overview\nThe `ScriptEvent` class is a generic event mechanism within the SOFA framework, designed to send named messages from one component (sender) to another across the simulation graph. It inherits from the base `Event` class and facilitates coordination between various components in the scene-graph architecture.\n\n## Parameters and Data\n- **Sender**: A smart pointer (`sofa::core::sptr<sofa::core::objectmodel::BaseNode>`) representing the sender of the message, indicating that it can originate from any node in the scene-graph hierarchy.\n- **Event Name**: A string representing the name of the event."
}