BaseLoader
`BaseLoader` is an abstract base class providing a standardized interface for file loading operations in SOFA simulations.
- module
- Sofa.framework.Core
- namespace
- sofa::core::loader
- include
- sofa/core/loader/BaseLoader.h
- inherits
-
- BaseObject
- description
The BaseLoader is an abstract base class in the SOFA ecosystem responsible for loading and parsing files that represent simulation components or models. It does not directly contribute to mathematical or physical simulations but rather serves as a foundational interface for file handling operations within the framework.
Role and Purpose:
The primary role of BaseLoader is to provide a standardized interface for file loading operations, ensuring consistency across different types of loaders in SOFA. The abstract class enforces that any derived loader must implement the load() method, which performs the actual loading of data from a specified file.
Interactions with Other Components:
The BaseLoader interacts primarily through its virtual methods and inherits capabilities from the objectmodel::BaseObject. It can be extended by other concrete loaders to handle specific file formats. The parse method allows integration with the SOFA object model for parsing descriptions of simulation components.
Practical Usage Guidance and Data Fields:
The setFilename and getFilename methods allow setting and retrieving the filename from which data is loaded. The canLoad method checks whether a file exists, is readable, and meets certain criteria (e.g., correct first line content). If loading fails, the component state is set to invalid.
- *Data Fields:
d_filename: Data field for storing the filename.
Methods
const BaseLoader *
toBaseLoader
()
virtual
bool
load
()
virtual
bool
canLoad
()
virtual
void
parse
(objectmodel::BaseObjectDescription * arg)
virtual
void
setFilename
(int f)
const int &
getFilename
()
void
skipToEOL
(int * f)
bool
readLine
(char * buf, int size, int * f)
{
"name": "BaseLoader",
"namespace": "sofa::core::loader",
"module": "Sofa.framework.Core",
"include": "sofa/core/loader/BaseLoader.h",
"doc": "",
"inherits": [
"BaseObject"
],
"templates": [],
"data_fields": [],
"links": [],
"methods": [
{
"name": "toBaseLoader",
"return_type": "const BaseLoader *",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "load",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": true,
"is_static": false,
"access": "public"
},
{
"name": "canLoad",
"return_type": "bool",
"params": [],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "parse",
"return_type": "void",
"params": [
{
"name": "arg",
"type": "objectmodel::BaseObjectDescription *"
}
],
"is_virtual": true,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "setFilename",
"return_type": "void",
"params": [
{
"name": "f",
"type": "int"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "getFilename",
"return_type": "const int &",
"params": [],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": false,
"access": "public"
},
{
"name": "skipToEOL",
"return_type": "void",
"params": [
{
"name": "f",
"type": "int *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "protected"
},
{
"name": "readLine",
"return_type": "bool",
"params": [
{
"name": "buf",
"type": "char *"
},
{
"name": "size",
"type": "int"
},
{
"name": "f",
"type": "int *"
}
],
"is_virtual": false,
"is_pure_virtual": false,
"is_static": true,
"access": "protected"
}
],
"description": "The `BaseLoader` is an abstract base class in the SOFA ecosystem responsible for loading and parsing files that represent simulation components or models. It inherits from `objectmodel::BaseObject`, indicating it is part of the core object model framework within SOFA.\n\n### Role and Purpose:\nThe primary role of `BaseLoader` is to provide a standardized interface for file loading operations, ensuring consistency across different types of loaders in SOFA. The abstract class enforces that any derived loader must implement the `load()` method, which performs the actual loading of data from a specified file.\n\n### Interactions with Other Components:\nThe `BaseLoader` interacts primarily through its virtual methods and inherits capabilities from the `objectmodel::BaseObject`. It can be extended by other concrete loaders to handle specific file formats. The `parse` method allows integration with the SOFA object model for parsing descriptions of simulation components.\n\n### Practical Usage Guidance and Data Fields:\nThe `setFilename` and `getFilename` methods allow setting and retrieving the filename from which data is loaded. The `canLoad` method checks whether a file exists, is readable, and meets certain criteria (e.g., correct first line content). If loading fails, the component state is set to invalid.\n\n- **Data Fields:**\n - `d_filename`: Data field for storing the filename.",
"maths": "The `BaseLoader` is an abstract base class in the SOFA ecosystem responsible for loading and parsing files that represent simulation components or models. It does not directly contribute to mathematical or physical simulations but rather serves as a foundational interface for file handling operations within the framework.\n\n### Role and Purpose:\nThe primary role of `BaseLoader` is to provide a standardized interface for file loading operations, ensuring consistency across different types of loaders in SOFA. The abstract class enforces that any derived loader must implement the `load()` method, which performs the actual loading of data from a specified file.\n\n### Interactions with Other Components:\nThe `BaseLoader` interacts primarily through its virtual methods and inherits capabilities from the `objectmodel::BaseObject`. It can be extended by other concrete loaders to handle specific file formats. The `parse` method allows integration with the SOFA object model for parsing descriptions of simulation components.\n\n### Practical Usage Guidance and Data Fields:\nThe `setFilename` and `getFilename` methods allow setting and retrieving the filename from which data is loaded. The `canLoad` method checks whether a file exists, is readable, and meets certain criteria (e.g., correct first line content). If loading fails, the component state is set to invalid.\n\n- **Data Fields:*\n - `d_filename`: Data field for storing the filename.",
"abstract": "`BaseLoader` is an abstract base class providing a standardized interface for file loading operations in SOFA simulations.",
"sheet": "# BaseLoader\n\n## Overview\nThe `BaseLoader` is an abstract base class within the SOFA framework that provides a standardized interface for file loading operations. It inherits from `objectmodel::BaseObject`, ensuring consistency across different types of loaders and enforcing the implementation of the `load()` method in derived classes.\n\n## Parameters and Data\n- **d_filename**: Data field for storing the filename from which data is loaded.\n\n## Dependencies and Connections\nThe `BaseLoader` interacts primarily through its virtual methods, inheriting capabilities from `objectmodel::BaseObject`. It can be extended by other concrete loaders to handle specific file formats. The `parse` method allows integration with the SOFA object model for parsing descriptions of simulation components."
}