API  4.3
For MATLAB, Python, Java, and C++ users
OpenSim::DataAdapter Class Referenceabstract

DataAdapter is an abstract class defining an interface for reading/writing in/out the contents of a DataTable. More...

+ Inheritance diagram for OpenSim::DataAdapter:

Public Member Functions

virtual DataAdapterclone () const =0
 
 DataAdapter ()=default
 
 DataAdapter (const DataAdapter &)=default
 
 DataAdapter (DataAdapter &&)=default
 
DataAdapteroperator= (const DataAdapter &)=default
 
DataAdapteroperator= (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< AbstractDataTablegetDataTable (const OutputTables &tables, const std::string tableName)
 Generic interface to retrieve a specific table by name from read result. 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...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ DataAdapter() [1/3]

OpenSim::DataAdapter::DataAdapter ( )
default

◆ DataAdapter() [2/3]

OpenSim::DataAdapter::DataAdapter ( const DataAdapter )
default

◆ DataAdapter() [3/3]

OpenSim::DataAdapter::DataAdapter ( DataAdapter &&  )
default

◆ ~DataAdapter()

virtual OpenSim::DataAdapter::~DataAdapter ( )
virtualdefault

Member Typedef Documentation

◆ InputTables

typedef std::map<std::string, const AbstractDataTable*> OpenSim::DataAdapter::InputTables

Collection of tables accepted by writing methods implemented in derived classes.

◆ OutputTables

typedef std::map<std::string, std::shared_ptr<AbstractDataTable> > OpenSim::DataAdapter::OutputTables

Collection of tables returned by reading methods implemented in derived classes.

◆ RegisteredDataAdapters

typedef std::map<std::string, std::shared_ptr<DataAdapter> > OpenSim::DataAdapter::RegisteredDataAdapters

Type of the registry containing registered adapters.

Member Function Documentation

◆ clone()

◆ createAdapter()

static std::shared_ptr<DataAdapter> OpenSim::DataAdapter::createAdapter ( const std::string &  identifier)
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.

◆ extendRead()

virtual OutputTables OpenSim::DataAdapter::extendRead ( const std::string &  sourceName) const
protectedpure virtual

◆ extendWrite()

virtual void OpenSim::DataAdapter::extendWrite ( const InputTables tables,
const std::string &  sinkName 
) const
protectedpure virtual

◆ getDataTable()

const std::shared_ptr<AbstractDataTable> OpenSim::DataAdapter::getDataTable ( const OutputTables tables,
const std::string  tableName 
)
inline

Generic interface to retrieve a specific table by name from read result.

◆ operator=() [1/2]

DataAdapter& OpenSim::DataAdapter::operator= ( const DataAdapter )
default

◆ operator=() [2/2]

DataAdapter& OpenSim::DataAdapter::operator= ( DataAdapter &&  )
default

◆ read()

DataAdapter::OutputTables OpenSim::DataAdapter::read ( const std::string &  dataSourceSpecification) const
inline

Public interface to read data from a dataSourceSpecification, typically a file or folder.

◆ registerDataAdapter()

static bool OpenSim::DataAdapter::registerDataAdapter ( const std::string &  identifier,
const DataAdapter adapter 
)
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.


The documentation for this class was generated from the following file: