API 4.4.1-2022-10-19-2c4045e59
For MATLAB, Python, Java, and C++ users
|
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... | |
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_< ETX, ETY >::DataTable_(), and OpenSim::TimeSeriesTable_< ETY >::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.