API  4.2
For C++ developers
OpenSim::STOFileAdapter_< T > Class Template Reference

STOFileAdapter is a DelimFileAdapter that presets the delimiters appropriately for STO files. More...

+ Inheritance diagram for OpenSim::STOFileAdapter_< T >:

Public Member Functions

 STOFileAdapter_ ()
 
 STOFileAdapter_ (const STOFileAdapter_ &)=default
 
 STOFileAdapter_ (STOFileAdapter_ &&)=default
 
STOFileAdapter_operator= (const STOFileAdapter_ &)=default
 
STOFileAdapter_operator= (STOFileAdapter_ &&)=default
 
 ~STOFileAdapter_ ()=default
 
STOFileAdapter_clone () const override
 
- Public Member Functions inherited from OpenSim::DelimFileAdapter< T >
 DelimFileAdapter ()=delete
 
 DelimFileAdapter (const DelimFileAdapter &)=default
 
 DelimFileAdapter (DelimFileAdapter &&)=default
 
DelimFileAdapteroperator= (const DelimFileAdapter &)=default
 
DelimFileAdapteroperator= (DelimFileAdapter &&)=default
 
 ~DelimFileAdapter ()=default
 
 DelimFileAdapter (const std::string &delimitersRead, const std::string &delimterWrite)
 Create the adapter by setting the delimiters. More...
 
 DelimFileAdapter (const std::string &delimitersRead, const std::string &delimterWrite, const std::string &compDelimRead, const std::string &compDelimWrite)
 Create the adapter by setting the delimiters. More...
 
- Public Member Functions inherited from OpenSim::FileAdapter
 FileAdapter ()=default
 
 FileAdapter (const FileAdapter &)=default
 
 FileAdapter (FileAdapter &&)=default
 
FileAdapteroperator= (const FileAdapter &)=default
 
FileAdapteroperator= (FileAdapter &&)=default
 
virtual ~FileAdapter ()=default
 
- Public Member Functions inherited from OpenSim::DataAdapter
 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 void write (const TimeSeriesTable_< T > &table, const std::string &fileName)
 Write a STO file. More...
 
- Static Public Member Functions inherited from OpenSim::DelimFileAdapter< T >
static const std::string tableString ()
 Key used for table associative array returned/accepted by write/read. More...
 
static std::string dataTypeName ()
 Name of the data type T (template parameter). More...
 
- Static Public Member Functions inherited from OpenSim::FileAdapter
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< DataAdaptercreateAdapterFromExtension (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::DelimFileAdapter< T >
OutputTables extendRead (const std::string &filename) const override
 Implementation of the read functionality. More...
 
void extendWrite (const InputTables &tables, const std::string &filename) const override
 Implementation of the write functionality. More...
 
SimTK::RowVector_< T > readElems (const std::vector< std::string > &tokens) const
 Read elements of type T (template parameter) from a sequence of tokens. More...
 
void writeElem (std::ostream &stream, const T &elem, const unsigned &prec) const
 Write an element of type T (template parameter) to stream with the specified precision. More...
 
- Static Protected Member Functions inherited from OpenSim::DataAdapter
static std::shared_ptr< DataAdaptercreateAdapter (const std::string &identifier)
 Creator of concrete DataAdapter(s) for the specified source type by its unique identifier (string). More...
 

Detailed Description

template<typename T>
class OpenSim::STOFileAdapter_< T >

STOFileAdapter is a DelimFileAdapter that presets the delimiters appropriately for STO files.

The format of the file is as follows:

.................................
.................................
........ <metadata> .............
.................................
.................................
endheader
time colname1 colname2 ..........
.................................
.................................
............ <data-rows> ........
.................................
.................................

For example a TimeSeriesTable_<SimTK::Vec3> could look like:

units=m
DataType=Vec3
endheader
time r_shoulder l_shoulder r_leg l_leg
0.1 0.11,0.22,0.33 0.44,0.55,0.66 0.77,0.88,0.99 0.10,0.11,0.12
0.2 0.22,0.44,0.66 0.88,0.99,0.35 0.75,0.65,0.43 0.47,0.57,0.67

Columns are delimited by tab character. Elements within a column are delimited by comma character. STOFileAdapter allows reading/writing following tables:

TimeSeriesTable_<double> DataType=double
TimeSeriesTable_<SimTK::Vec2> DataType=Vec2
TimeSeriesTable_<SimTK::Vec3> DataType=Vec3
TimeSeriesTable_<SimTK::Vec4> DataType=Vec4
TimeSeriesTable_<SimTK::Vec5> DataType=Vec5
TimeSeriesTable_<SimTK::Vec6> DataType=Vec6
TimeSeriesTable_<SimTK::Vec7> DataType=Vec7
TimeSeriesTable_<SimTK::Vec8> DataType=Vec8
TimeSeriesTable_<SimTK::Vec9> DataType=Vec9
TimeSeriesTable_<SimTK::Vec<10>> DataType=Vec10
TimeSeriesTable_<SimTK::Vec<11>> DataType=Vec11
TimeSeriesTable_<SimTK::Vec<12>> DataType=Vec12
TimeSeriesTable_<SimTK::UnitVec3> DataType=UnitVec3
TimeSeriesTable_<SimTK::Quaternion> DataType=Quaternion
TimeSeriesTable_<SimTK::SpatialVec> DataType=SpatialVec

Files contain metadata (in form of "DataType=<something>" as shown above) indicating the type of the table they contain.

Constructor & Destructor Documentation

◆ STOFileAdapter_() [1/3]

template<typename T >
OpenSim::STOFileAdapter_< T >::STOFileAdapter_ ( )

◆ STOFileAdapter_() [2/3]

template<typename T >
OpenSim::STOFileAdapter_< T >::STOFileAdapter_ ( const STOFileAdapter_< T > &  )
default

◆ STOFileAdapter_() [3/3]

template<typename T >
OpenSim::STOFileAdapter_< T >::STOFileAdapter_ ( STOFileAdapter_< T > &&  )
default

◆ ~STOFileAdapter_()

template<typename T >
OpenSim::STOFileAdapter_< T >::~STOFileAdapter_ ( )
default

Member Function Documentation

◆ clone()

template<typename T >
STOFileAdapter_< T > * OpenSim::STOFileAdapter_< T >::clone ( ) const
overridevirtual

Reimplemented from OpenSim::DelimFileAdapter< T >.

◆ operator=() [1/2]

template<typename T >
STOFileAdapter_& OpenSim::STOFileAdapter_< T >::operator= ( const STOFileAdapter_< T > &  )
default

◆ operator=() [2/2]

template<typename T >
STOFileAdapter_& OpenSim::STOFileAdapter_< T >::operator= ( STOFileAdapter_< T > &&  )
default

◆ write()

template<typename T >
void OpenSim::STOFileAdapter_< T >::write ( const TimeSeriesTable_< T > &  table,
const std::string &  fileName 
)
static

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