API
4.2
For C++ developers
|
DataAdapter is an abstract class defining an interface for reading/writing in/out the contents of a DataTable. More...
Public Member Functions | |
virtual DataAdapter * | clone () const =0 |
DataAdapter ()=default | |
DataAdapter (const DataAdapter &)=default | |
DataAdapter (DataAdapter &&)=default | |
DataAdapter & | operator= (const DataAdapter &)=default |
DataAdapter & | operator= (DataAdapter &&)=default |
virtual | ~DataAdapter ()=default |
DataAdapter::OutputTables | read (const std::string &dataSourceSpecification) const |
Public interface to read data from a dataSourceSpecification, typically a file or folder. More... | |
const std::shared_ptr< AbstractDataTable > | getDataTable (const OutputTables &tables, const std::string tableName) |
Generic interface to retrieve a specific table by name from read result. More... | |
Public Types | |
typedef std::map< std::string, std::shared_ptr< DataAdapter > > | RegisteredDataAdapters |
Type of the registry containing registered adapters. More... | |
typedef std::map< std::string, std::shared_ptr< AbstractDataTable > > | OutputTables |
Collection of tables returned by reading methods implemented in derived classes. More... | |
typedef std::map< std::string, const AbstractDataTable * > | InputTables |
Collection of tables accepted by writing methods implemented in derived classes. More... | |
Static Public Member Functions | |
static bool | registerDataAdapter (const std::string &identifier, const DataAdapter &adapter) |
Register a concrete DataAdapter by its unique string identifier. More... | |
Protected Member Functions | |
virtual OutputTables | extendRead (const std::string &sourceName) const =0 |
Implements reading functionality. More... | |
virtual void | extendWrite (const InputTables &tables, const std::string &sinkName) const =0 |
Implements writing functionality. More... | |
Static Protected Member Functions | |
static std::shared_ptr< DataAdapter > | createAdapter (const std::string &identifier) |
Creator of concrete DataAdapter(s) for the specified source type by its unique identifier (string). More... | |
DataAdapter is an abstract class defining an interface for reading/writing in/out the contents of a DataTable.
It enables access to/from various data sources/sinks such as: streams, files, databases and devices. The DataTable is independent of the form and format of the data in/out of the source/sink. Concrete classes handle the details (e.g. format, sequential access, etc...) associated with a particular data source/sink. The base DataAdapter contains a static registry to serve as a factory for concrete DataAdpaters, given a string identifier of the type of adapter. The adapter knows the source format and data flow (read, write, both). String identifiers can be associated with file formats according to known file extensions.
typedef std::map<std::string, const AbstractDataTable*> OpenSim::DataAdapter::InputTables |
Collection of tables accepted by writing methods implemented in derived classes.
typedef std::map<std::string, std::shared_ptr<AbstractDataTable> > OpenSim::DataAdapter::OutputTables |
Collection of tables returned by reading methods implemented in derived classes.
typedef std::map<std::string, std::shared_ptr<DataAdapter> > OpenSim::DataAdapter::RegisteredDataAdapters |
Type of the registry containing registered adapters.
|
default |
|
default |
|
default |
|
virtualdefault |
|
pure virtual |
|
staticprotected |
Creator of concrete DataAdapter(s) for the specified source type by its unique identifier (string).
For example, for file based sources, a component can acquire the necessary adapter instance to read the data by the file extension if the extension is used as its identifier.
|
protectedpure virtual |
Implements reading functionality.
Implemented in OpenSim::TRCFileAdapter, OpenSim::C3DFileAdapter, OpenSim::DelimFileAdapter< T >, OpenSim::DelimFileAdapter< double >, OpenSim::APDMDataReader, and OpenSim::XsensDataReader.
|
protectedpure virtual |
Implements writing functionality.
Implemented in OpenSim::TRCFileAdapter, OpenSim::C3DFileAdapter, OpenSim::DelimFileAdapter< T >, OpenSim::DelimFileAdapter< double >, OpenSim::APDMDataReader, and OpenSim::XsensDataReader.
|
inline |
Generic interface to retrieve a specific table by name from read result.
|
default |
|
default |
|
inline |
Public interface to read data from a dataSourceSpecification, typically a file or folder.
|
static |
Register a concrete DataAdapter by its unique string identifier.
Registration permits access to the required concrete adapter by identifier lookup. As such, identifiers must be unique, but adapters may be registered with multiple identifiers. For example, a data file may have multiple valid extensions (e.g. ".jpg: and ".jpeg") in which case both extensions would be valid identifiers for the same adapter. If an identifier is already in use an Exception is thrown. All OpenSim data adapters are automatically registered at start of the program.