API
4.2
For C++ developers
|
FileAdapter is a DataAdapter that reads and writes files with methods read and writeFile respectively. More...
Public Member Functions | |
FileAdapter ()=default | |
FileAdapter (const FileAdapter &)=default | |
FileAdapter (FileAdapter &&)=default | |
FileAdapter & | operator= (const FileAdapter &)=default |
FileAdapter & | operator= (FileAdapter &&)=default |
virtual | ~FileAdapter ()=default |
Public Member Functions inherited from OpenSim::DataAdapter | |
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... | |
Static Public Member Functions | |
static void | writeFile (const InputTables &tables, const std::string &fileName) |
Write a collection of tables to the given file. More... | |
static std::string | findExtension (const std::string &filename) |
Find the extension from a filename. More... | |
static std::vector< std::string > | getNextLine (std::istream &stream, const std::string &delims) |
Get the next line from the stream and tokenize/split the line using the given delimiters. More... | |
static std::vector< std::string > | tokenize (const std::string &str, const std::string &delims) |
Tokenize/split a given string using the given delimiters. More... | |
static std::shared_ptr< DataAdapter > | createAdapterFromExtension (const std::string &fileName) |
Create a concerte FileAdapter based on the extension of the passed in file and return it. More... | |
Static Public Member Functions inherited from OpenSim::DataAdapter | |
static bool | registerDataAdapter (const std::string &identifier, const DataAdapter &adapter) |
Register a concrete DataAdapter by its unique string identifier. More... | |
Additional Inherited Members | |
Public Types inherited from OpenSim::DataAdapter | |
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... | |
Protected Member Functions inherited from OpenSim::DataAdapter | |
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 inherited from OpenSim::DataAdapter | |
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... | |
FileAdapter is a DataAdapter that reads and writes files with methods read and writeFile respectively.
The read method is implemented in the base class and it calls the virtual extendRead method implemented by format specific subclasses. Typically you don't need to call read explicitly if reading one DataTable from file, instead use a constructor of the table from the specific file. e.g.
|
default |
|
default |
|
default |
|
virtualdefault |
|
static |
Create a concerte FileAdapter based on the extension of the passed in file and return it.
This serves as a Factory of FileAdapters so clients don't need to know specific concrete subclasses, as long as the generic base class read interface is used
Referenced by OpenSim::DataTable_< double, SimTK::Real >::DataTable_(), and OpenSim::TimeSeriesTable_< Rotation >::TimeSeriesTable_().
|
static |
Find the extension from a filename.
|
static |
Get the next line from the stream and tokenize/split the line using the given delimiters.
|
default |
|
default |
|
static |
Tokenize/split a given string using the given delimiters.
The delimiters are each required to be one character and the string is split if/when any of those characters are found. For example, a delimiter string " \t" specifies that either a space or a tab can act as the delimiter.
|
static |
Write a collection of tables to the given file.
Different file formats require different number/type of tables. See specific adapter's documentation to see what is required.