OpenSim::IO Class Reference

A class for performing input and output with OpenSim API. More...

#include <IO.h>

List of all members.

Static Public Member Functions

static char * ConstructDateAndTimeStamp ()
 Construct a date and time stamp with the format YYYYMMDD_HHMMSS.
static std::string FixSlashesInFilePath (const std::string &path)
 Ensures slashes are back slashes ('\') in Windows and forward slashes ('/') in Linux.
static void SetScientific (bool aTrueFalse)
 Set whether or not output of numbers should be in scientific or float format.
static bool GetScientific ()
 Set whether or not output of numbers should be in scientific or float format.
static void SetGFormatForDoubleOutput (bool aTrueFalse)
 Set whether or not output of numbers should be printed using g.
static bool GetGFormatForDoubleOutput ()
static void SetDigitsPad (int aPad)
 Set the number of digits with which to pad output of numbers.
static int GetDigitsPad ()
 Get the number of digits with which output of numbers is padded.
static void SetPrecision (int aPlaces)
 Set the precision with which numbers are output.
static int GetPrecision ()
 Get the precision with which numbers are output.
static const char * GetDoubleOutputFormat ()
 Get the current output format for numbers of type double.
static void SetPrintOfflineDocuments (bool aTrueFalse)
 If Object::print is called and an xml node has a file attribute pointing to an external file, then the _PrintOfflineDocuments determines whether that file's contents will be printed to that file or not.
static bool GetPrintOfflineDocuments ()
static std::string ReadToTokenLine (std::istream &aIS, const std::string &aToken)
static std::string ReadLine (std::istream &aIS)
static int ComputeNumberOfSteps (double aTI, double aTF, double aDT)
 Compute the number of steps of a given size to get from some initial time to some final time.
static std::string ReadCharacters (std::istream &aIS, int aNChar)
static FILE * OpenFile (const std::string &aFileName, const std::string &aMode)
static std::ifstream * OpenInputFile (const std::string &aFileName, std::ios_base::openmode mode=std::ios_base::in)
static std::ofstream * OpenOutputFile (const std::string &aFileName, std::ios_base::openmode mode=std::ios_base::out)
static int makeDir (const std::string &aDirName)
static int chDir (const std::string &aDirName)
static std::string getCwd ()
 Get current working directory.
static std::string getParentDirectory (const std::string &fileName)
static std::string GetFileNameFromURI (const std::string &aURI)
static std::string formatText (const std::string &aComment, const std::string &leadingWhitespace, int width, const std::string &endlineTokenToInsert="\n")
static std::string GetSuffix (const std::string &aStr, int aLen)
static void RemoveSuffix (std::string &rStr, int aLen)
static std::string replaceSubstring (const std::string &aStr, const std::string &aFrom, const std::string &aTo)
static void TrimLeadingWhitespace (std::string &rStr)
static void TrimTrailingWhitespace (std::string &rStr)
static void TrimWhitespace (std::string &rStr)
static std::string Lowercase (const std::string &aStr)
static std::string Uppercase (const std::string &aStr)

Detailed Description

A class for performing input and output with OpenSim API.

Version:
1.0
Author:
Frank C. Anderson

Member Function Documentation

static int OpenSim::IO::chDir ( const std::string &  aDirName  )  [static]
int IO::ComputeNumberOfSteps ( double  aTI,
double  aTF,
double  aDT 
) [static]

Compute the number of steps of a given size to get from some initial time to some final time.

If (aTF-aTI)/aDT has a remainder that is greater than 1% of the step size, an additional step is assumed to be needed to step completely to the end of the interval.

Parameters:
aTI Initial time.
aTF Final time.
aDT Step size. Should be greater than 0.0.
char * IO::ConstructDateAndTimeStamp (  )  [static]

Construct a date and time stamp with the format YYYYMMDD_HHMMSS.

Returns:
Null terminated character array of the stamp. The caller must delete this memory.
std::string IO::FixSlashesInFilePath ( const std::string &  path  )  [static]

Ensures slashes are back slashes ('\') in Windows and forward slashes ('/') in Linux.

static std::string OpenSim::IO::formatText ( const std::string &  aComment,
const std::string &  leadingWhitespace,
int  width,
const std::string &  endlineTokenToInsert = "\n" 
) [static]
string IO::getCwd (  )  [static]

Get current working directory.

Potentially platform dependent.

Returns:
working directory on success, NULL on error
int IO::GetDigitsPad (  )  [static]

Get the number of digits with which output of numbers is padded.

The pad number is used to set the minimum field width by the following formula: width = pad + precision

The formated output string, for example, would have the form width.precisionlf.

Returns:
aPad Number of digits with which output of number is padded.
const char * IO::GetDoubleOutputFormat (  )  [static]

Get the current output format for numbers of type double.

The format is maintained as a static variable in class IO, so any changes made to the output parameters in class IO will be seen globally by all classes using this method.

The returned output format will be of the form

"% width.precision lf" (if not scientific) or "% width.precision le" (if scientific),

where the spaces have been removed and width = pad + precision.

Returns:
Format string for output of doubles.
See also:
SetScientific(), SetDigitsPad, SetPrecision.
static std::string OpenSim::IO::GetFileNameFromURI ( const std::string &  aURI  )  [static]
bool IO::GetGFormatForDoubleOutput (  )  [static]
static std::string OpenSim::IO::getParentDirectory ( const std::string &  fileName  )  [static]
int IO::GetPrecision (  )  [static]

Get the precision with which numbers are output.

The precision is usually simply the number of decimal places.

Returns:
Precision (often number of decimal places).
bool IO::GetPrintOfflineDocuments (  )  [static]
bool IO::GetScientific (  )  [static]

Set whether or not output of numbers should be in scientific or float format.

Returns:
True if scientific notation, false if float.
string IO::GetSuffix ( const std::string &  aStr,
int  aLen 
) [static]
std::string IO::Lowercase ( const std::string &  aStr  )  [static]
static int OpenSim::IO::makeDir ( const std::string &  aDirName  )  [static]
static FILE* OpenSim::IO::OpenFile ( const std::string &  aFileName,
const std::string &  aMode 
) [static]
static std::ifstream* OpenSim::IO::OpenInputFile ( const std::string &  aFileName,
std::ios_base::openmode  mode = std::ios_base::in 
) [static]
static std::ofstream* OpenSim::IO::OpenOutputFile ( const std::string &  aFileName,
std::ios_base::openmode  mode = std::ios_base::out 
) [static]
static std::string OpenSim::IO::ReadCharacters ( std::istream &  aIS,
int  aNChar 
) [static]
static std::string OpenSim::IO::ReadLine ( std::istream &  aIS  )  [static]
static std::string OpenSim::IO::ReadToTokenLine ( std::istream &  aIS,
const std::string &  aToken 
) [static]
void IO::RemoveSuffix ( std::string &  rStr,
int  aLen 
) [static]
string IO::replaceSubstring ( const std::string &  aStr,
const std::string &  aFrom,
const std::string &  aTo 
) [static]
void IO::SetDigitsPad ( int  aPad  )  [static]

Set the number of digits with which to pad output of numbers.

The pad number is used to set the minimum field width by the following formula: width = pad + precision

The formated output string, for example, would have the form width.precisionlf.

Parameters:
aPad Number of digits with which output of numbers is padded.
void IO::SetGFormatForDoubleOutput ( bool  aTrueFalse  )  [static]

Set whether or not output of numbers should be printed using g.

void IO::SetPrecision ( int  aPrecision  )  [static]

Set the precision with which numbers are output.

The precision is usually simply the number of decimal places.

Parameters:
aPrecision Precision.
void IO::SetPrintOfflineDocuments ( bool  aTrueFalse  )  [static]

If Object::print is called and an xml node has a file attribute pointing to an external file, then the _PrintOfflineDocuments determines whether that file's contents will be printed to that file or not.

It's "offline" because it represents non-inlined xml code.

void IO::SetScientific ( bool  aTrueFalse  )  [static]

Set whether or not output of numbers should be in scientific or float format.

Parameters:
aTrueFalse Scientific notation if true, and float if false.
void IO::TrimLeadingWhitespace ( std::string &  rStr  )  [static]
void IO::TrimTrailingWhitespace ( std::string &  rStr  )  [static]
static void OpenSim::IO::TrimWhitespace ( std::string &  rStr  )  [inline, static]
std::string IO::Uppercase ( const std::string &  aStr  )  [static]

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

Generated on Sun Sep 25 00:19:48 2011 for OpenSim by  doxygen 1.6.1