Jetson Inference
DNN Vision Library

Text file parsing for Comma-Separated Value (CSV) formats, with user-defined delimiters beyond just commas, including spaces, tabs, or other symbols. More...

Namespaces

 csv
 csv stream manipulators
 

Classes

class  csvData
 csvData More...
 
class  csvReader
 csvReader More...
 
class  csvWriter
 csvWriter More...
 

Detailed Description

Text file parsing for Comma-Separated Value (CSV) formats, with user-defined delimiters beyond just commas, including spaces, tabs, or other symbols.


Class Documentation

◆ csvData

class csvData

Public Member Functions

 csvData (char *str)
 
 csvData (const char *str)
 
 csvData (std::string &str)
 
template<typename T >
 csvData (T value)
 
template<typename T >
void set (T value)
 
 operator std::string & ()
 
 operator const std::string & () const
 
 operator const char * () const
 
 operator int () const
 
 operator float () const
 
 operator double () const
 
bool toInt (int *value) const
 
bool toFloat (float *value) const
 
bool toDouble (double *value) const
 
int toInt (bool *valid=NULL) const
 
float toFloat (bool *valid=NULL) const
 
double toDouble (bool *valid=NULL) const
 

Static Public Member Functions

static std::vector< csvDataParse (const char *str, const char *delimiters=",;\t ")
 
static bool Parse (std::vector< csvData > &data, const char *str, const char *delimiters=",;\t ")
 

Public Attributes

std::string string
 

Friends

std::istream & operator>> (std::istream &in, csvData &obj)
 
std::ostream & operator<< (std::ostream &out, const csvData &obj)
 

Constructor & Destructor Documentation

◆ csvData() [1/4]

csvData::csvData ( char *  str)
inline

◆ csvData() [2/4]

csvData::csvData ( const char *  str)
inline

◆ csvData() [3/4]

csvData::csvData ( std::string &  str)
inline

◆ csvData() [4/4]

template<typename T >
csvData::csvData ( value)
inline

Member Function Documentation

◆ operator const char *()

csvData::operator const char * ( ) const
inline

◆ operator const std::string &()

csvData::operator const std::string & ( ) const
inline

◆ operator double()

csvData::operator double ( ) const
inline

◆ operator float()

csvData::operator float ( ) const
inline

◆ operator int()

csvData::operator int ( ) const
inline

◆ operator std::string &()

csvData::operator std::string & ( )
inline

◆ Parse() [1/2]

std::vector< csvData > csvData::Parse ( const char *  str,
const char *  delimiters = ",;\t " 
)
inlinestatic

◆ Parse() [2/2]

bool csvData::Parse ( std::vector< csvData > &  data,
const char *  str,
const char *  delimiters = ",;\t " 
)
inlinestatic

◆ set()

template<typename T >
void csvData::set ( value)
inline

◆ toDouble() [1/2]

double csvData::toDouble ( bool *  valid = NULL) const
inline

◆ toDouble() [2/2]

bool csvData::toDouble ( double *  value) const
inline

◆ toFloat() [1/2]

float csvData::toFloat ( bool *  valid = NULL) const
inline

◆ toFloat() [2/2]

bool csvData::toFloat ( float *  value) const
inline

◆ toInt() [1/2]

int csvData::toInt ( bool *  valid = NULL) const
inline

◆ toInt() [2/2]

bool csvData::toInt ( int *  value) const
inline

Friends And Related Function Documentation

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const csvData obj 
)
friend

◆ operator>>

std::istream& operator>> ( std::istream &  in,
csvData obj 
)
friend

Member Data Documentation

◆ string

std::string csvData::string

◆ csvReader

class csvReader

Public Member Functions

 csvReader (const char *filename, const char *delimiters=",;\t ")
 
 ~csvReader ()
 
void Close ()
 
bool IsOpen () const
 
bool IsClosed () const
 
std::vector< csvDataRead ()
 
std::vector< csvDataRead (const char *delimiters)
 
bool Read (std::vector< csvData > &data)
 
bool Read (std::vector< csvData > &data, const char *delimiters)
 
void SetDelimiters (const char *delimiters)
 
const char * GetDelimiters () const
 
const char * GetFilename () const
 

Static Public Member Functions

static csvReaderOpen (const char *filename, const char *delimiters=",;\t ")
 

Public Attributes

const size_t MaxLineLength =2048
 

Constructor & Destructor Documentation

◆ csvReader()

csvReader::csvReader ( const char *  filename,
const char *  delimiters = ",;\t " 
)

◆ ~csvReader()

csvReader::~csvReader ( )

Member Function Documentation

◆ Close()

void csvReader::Close ( )
inline

◆ GetDelimiters()

const char * csvReader::GetDelimiters ( ) const
inline

◆ GetFilename()

const char * csvReader::GetFilename ( ) const
inline

◆ IsClosed()

bool csvReader::IsClosed ( ) const
inline

◆ IsOpen()

bool csvReader::IsOpen ( ) const
inline

◆ Open()

csvReader * csvReader::Open ( const char *  filename,
const char *  delimiters = ",;\t " 
)
inlinestatic

◆ Read() [1/4]

std::vector< csvData > csvReader::Read ( )
inline

◆ Read() [2/4]

std::vector< csvData > csvReader::Read ( const char *  delimiters)
inline

◆ Read() [3/4]

bool csvReader::Read ( std::vector< csvData > &  data)
inline

◆ Read() [4/4]

bool csvReader::Read ( std::vector< csvData > &  data,
const char *  delimiters 
)
inline

◆ SetDelimiters()

void csvReader::SetDelimiters ( const char *  delimiters)
inline

Member Data Documentation

◆ MaxLineLength

const size_t csvReader::MaxLineLength =2048

◆ csvWriter

class csvWriter

Public Member Functions

 csvWriter (const char *filename, const char *delimiter=", ")
 
 ~csvWriter ()
 
void Close ()
 
void Flush ()
 
bool IsOpen () const
 
bool IsClosed () const
 
void EndLine ()
 
template<typename T >
csvWriterWrite (const T &value)
 
template<typename T , typename... Args>
csvWriterWrite (const T &value, const Args &... args)
 
template<typename T , typename... Args>
csvWriterWriteLine (const T &value, const Args &... args)
 
template<typename T >
csvWriteroperator<< (const T &value)
 
csvWriteroperator<< (csvWriter &(*value)(csvWriter &))
 
void SetDelimiter (const char *delimiters)
 
const char * GetDelimiter () const
 
const char * GetFilename () const
 

Static Public Member Functions

static csvWriterOpen (const char *filename, const char *delimiter=", ")
 

Constructor & Destructor Documentation

◆ csvWriter()

csvWriter::csvWriter ( const char *  filename,
const char *  delimiter = ", " 
)

◆ ~csvWriter()

csvWriter::~csvWriter ( )

Member Function Documentation

◆ Close()

void csvWriter::Close ( )
inline

◆ EndLine()

void csvWriter::EndLine ( )
inline

◆ Flush()

void csvWriter::Flush ( )
inline

◆ GetDelimiter()

const char * csvWriter::GetDelimiter ( ) const
inline

◆ GetFilename()

const char * csvWriter::GetFilename ( ) const
inline

◆ IsClosed()

bool csvWriter::IsClosed ( ) const
inline

◆ IsOpen()

bool csvWriter::IsOpen ( ) const
inline

◆ Open()

csvWriter * csvWriter::Open ( const char *  filename,
const char *  delimiter = ", " 
)
inlinestatic

◆ operator<<() [1/2]

template<typename T >
csvWriter & csvWriter::operator<< ( const T &  value)
inline

◆ operator<<() [2/2]

csvWriter & csvWriter::operator<< ( csvWriter &(*)(csvWriter &)  value)
inline

◆ SetDelimiter()

void csvWriter::SetDelimiter ( const char *  delimiters)
inline

◆ Write() [1/2]

template<typename T >
csvWriter & csvWriter::Write ( const T &  value)
inline

◆ Write() [2/2]

template<typename T , typename... Args>
csvWriter & csvWriter::Write ( const T &  value,
const Args &...  args 
)
inline

◆ WriteLine()

template<typename T , typename... Args>
csvWriter & csvWriter::WriteLine ( const T &  value,
const Args &...  args 
)
inline