SNAP Library 6.0, User Reference
2020-12-09 16:24:20
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <ssmp.h>
Public Member Functions | |
TSsParserMP (const TStr &FNm, const TSsFmt _SsFmt=ssfTabSep, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
Constructor. More... | |
TSsParserMP (const TStr &FNm, const char &Separator, const bool &_SkipLeadBlanks=false, const bool &_SkipCmt=true, const bool &_SkipEmptyFld=false) | |
Constructor. More... | |
~TSsParserMP () | |
bool | Next () |
Loads next line from the input file. More... | |
bool | NextSlow () |
Loads next line from the input file (older, slow implementation - deprecated). More... | |
int | Len () const |
Returns the number of fields in the current line. More... | |
int | GetFlds () const |
Returns the number of fields in the current line. More... | |
uint64 | GetLineNo () const |
Returns the line number of the current line. More... | |
bool | IsCmt () const |
Checks whether the current line is a comment (starts with '#'). More... | |
void | SkipCommentLines () |
Skips lines that begin with a comment character. More... | |
bool | Eof () const |
Checks for end of file. More... | |
TChA | GetLnStr () const |
Returns the current line. More... | |
void | ToLc () |
Transforms the current line to lower case. More... | |
const char * | GetFld (const int &FldN) const |
Returns the contents of the field at index FldN . More... | |
char * | GetFld (const int &FldN) |
Returns the contents of the field at index FldN . More... | |
const char * | operator[] (const int &FldN) const |
Returns the contents of the field at index FldN . More... | |
char * | operator[] (const int &FldN) |
Returns the contents of the field at index FldN . More... | |
bool | GetInt (const int &FldN, int &Val) const |
If the field FldN is an integer its value is returned in Val and the function returns true . More... | |
int | GetInt (const int &FldN) const |
Assumes FldN is an integer its value is returned. If FldN is not an integer an exception is thrown. More... | |
bool | IsInt (const int &FldN) const |
Checks whether fields FldN is an integer. More... | |
bool | GetFlt (const int &FldN, double &Val) const |
If the field FldN is a float its value is returned in Val and the function returns true . More... | |
bool | IsFlt (const int &FldN) const |
Checks whether fields FldN is a float. More... | |
double | GetFlt (const int &FldN) const |
Assumes FldN is a floating point number its value is returned. If FldN is not an integer an exception is thrown. More... | |
uint64 | GetStreamPos () const |
Returns position of stream pointer. More... | |
uint64 | GetStreamLen () const |
Returns length of stream. More... | |
void | SetStreamPos (uint64 Pos) |
Sets position of stream pointer. More... | |
uint64 | CountNewLinesInRange (uint64 Lb, uint64 Ub) const |
Counts number of occurences of ' ' in [Lb, Ub) More... | |
TVec< uint64 > | GetStartPosV (uint64 Lb, uint64 Ub) const |
Finds start positions of all lines ending somewhere in [Lb, Ub) More... | |
void | NextFromIndex (uint64 Index, TVec< char * > &FieldsV) |
Loads next line starting from a given position. More... | |
int | GetIntFromFldV (TVec< char * > &FieldsV, const int &FldN) |
Gets integer at field FldN . More... | |
double | GetFltFromFldV (TVec< char * > &FieldsV, const int &FldN) |
Gets float at field FldN . More... | |
const char * | DumpStr () const |
Static Public Member Functions | |
static PSsParserMP | New (const TStr &FNm, const TSsFmt SsFmt) |
Private Member Functions | |
UndefDefaultCopyAssign (TSsParserMP) | |
Private Attributes | |
TCRef | CRef |
TSsFmt | SsFmt |
Separator type. More... | |
bool | SkipLeadBlanks |
Ignore leading whitespace characters in a line. More... | |
bool | SkipCmt |
Skip comments (lines starting with #). More... | |
bool | SkipEmptyFld |
Skip empty fields (i.e., multiple consecutive separators are considered as one). More... | |
uint64 | LineCnt |
Number of processed lines so far. More... | |
char | SplitCh |
Separator character (if one of the non-started separators is used) More... | |
TChA | LineStr |
Current line. More... | |
TVec< char * > | FldV |
Pointers to fields of the current line. More... | |
TPt< TMIn > | FInPt |
Pointer to the input file stream. More... | |
Friends | |
class | TPt< TSsParserMP > |
TSsParserMP::TSsParserMP | ( | const TStr & | FNm, |
const TSsFmt | _SsFmt = ssfTabSep , |
||
const bool & | _SkipLeadBlanks = false , |
||
const bool & | _SkipCmt = true , |
||
const bool & | _SkipEmptyFld = false |
||
) |
Constructor.
FNm | Input filename. Can be a text file or a compressed file. |
_SsFmt | Spread-sheet separator format. Each line will be broken in a set of fields, where the boundary between the fields is defined by the _SsFmt . |
_SkipLeadBlanks | If true leading/trailing white-spaces of the line will be ignored. |
_SkipCmt | If true lines starting with '#' will be considered as comments and will be skipped. |
_SkipEmptyFld | If true then empty fields (consecutive occurrences of the separator) will be ignored. |
TSsParserMP::TSsParserMP | ( | const TStr & | FNm, |
const char & | Separator, | ||
const bool & | _SkipLeadBlanks = false , |
||
const bool & | _SkipCmt = true , |
||
const bool & | _SkipEmptyFld = false |
||
) |
Constructor.
FNm | Input filename. Can be a text file or a compressed file. |
Separator | Spread-sheet separator character. Each line will be broken in a set of fields, where the boundary between the fields is the Separator character. |
_SkipLeadBlanks | If true leading/trailing white-spaces of the line will be ignored. |
_SkipCmt | If true lines starting with '#' will be considered as comments and will be skipped. |
_SkipEmptyFld | If true then empty fields (consecutive occurrences of the separator) will be ignored. |
Definition at line 3 of file ssmp.cpp.
Counts number of occurences of '
' in [Lb, Ub)
Definition at line 102 of file ssmp.cpp.
|
inline |
|
inline |
|
inline |
|
inline |
bool TSsParserMP::GetFlt | ( | const int & | FldN, |
double & | Val | ||
) | const |
|
inline |
Assumes FldN
is a floating point number its value is returned. If FldN
is not an integer an exception is thrown.
Definition at line 85 of file ssmp.h.
double TSsParserMP::GetFltFromFldV | ( | TVec< char * > & | FieldsV, |
const int & | FldN | ||
) |
bool TSsParserMP::GetInt | ( | const int & | FldN, |
int & | Val | ||
) | const |
|
inline |
Assumes FldN
is an integer its value is returned. If FldN
is not an integer an exception is thrown.
Definition at line 76 of file ssmp.h.
int TSsParserMP::GetIntFromFldV | ( | TVec< char * > & | FieldsV, |
const int & | FldN | ||
) |
|
inline |
|
inline |
Returns the current line.
Definition at line 61 of file ssmp.h.
Finds start positions of all lines ending somewhere in [Lb, Ub)
Definition at line 106 of file ssmp.cpp.
|
inline |
|
inline |
|
inline |
Checks whether the current line is a comment (starts with '#').
|
inline |
Checks whether fields FldN
is a float.
Definition at line 83 of file ssmp.h.
|
inline |
Checks whether fields FldN
is an integer.
Definition at line 79 of file ssmp.h.
|
inline |
Returns the number of fields in the current line.
|
inlinestatic |
bool TSsParserMP::Next | ( | ) |
Loads next line from the input file.
If end of file is reached, return value is false
.
Definition at line 17 of file ssmp.cpp.
Loads next line starting from a given position.
Definition at line 128 of file ssmp.cpp.
bool TSsParserMP::NextSlow | ( | ) |
Loads next line from the input file (older, slow implementation - deprecated).
If end of file is reached, return value is false
. This function is deprecated, use Next instead.
|
inline |
|
inline |
|
inline |
void TSsParserMP::SkipCommentLines | ( | ) |
Skips lines that begin with a comment character.
Definition at line 12 of file ssmp.cpp.
void TSsParserMP::ToLc | ( | ) |
|
private |
|
friend |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |