SNAP Library 2.3, Developer Reference  2014-06-16 11:58:46
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
TPpVal Class Reference

#include <pp.h>

Collaboration diagram for TPpVal:

Public Member Functions

 TPpVal ()
 
 TPpVal (const TPpVal &PpVal)
 
 TPpVal (const bool &b)
 
 TPpVal (const TBool &b)
 
 TPpVal (const int &_Int)
 
 TPpVal (const TInt &_Int)
 
 TPpVal (const double &_Flt)
 
 TPpVal (const TFlt &_Flt)
 
 TPpVal (const TStr &_Str)
 
 TPpVal (const char *CStr)
 
 TPpVal (const TVec< TPpVal > &_ValV)
 
 TPpVal (TSIn &SIn)
 
void Save (TSOut &SOut)
 
TPpValoperator= (const TPpVal &PpVal)
 
bool operator== (const TPpVal &PpVal) const
 
bool operator< (const TPpVal &PpVal) const
 
int GetTag () const
 
TBool GetBool () const
 
TInt GetInt () const
 
TFlt GetFlt () const
 
TStr GetStr () const
 
TVec< TPpValGetValV () const
 
TStr GetValStr (const bool &DoAddTag=false) const
 
void SaveTxt (TOLx &Lx) const
 

Static Public Member Functions

static TPpVal LoadTxt (TILx &Lx)
 

Private Attributes

TInt Tag
 
TBool Bool
 
TInt Int
 
TFlt Flt
 
TStr Str
 
TVec< TPpValValV
 

Detailed Description

Definition at line 19 of file pp.h.

Constructor & Destructor Documentation

TPpVal::TPpVal ( )
inline

Definition at line 24 of file pp.h.

Referenced by LoadTxt().

24 : Tag(ptUndef){}
TInt Tag
Definition: pp.h:21
Definition: pp.h:4

Here is the caller graph for this function:

TPpVal::TPpVal ( const TPpVal PpVal)
inline

Definition at line 25 of file pp.h.

25  : Tag(PpVal.Tag), Bool(PpVal.Bool),
26  Int(PpVal.Int), Flt(PpVal.Flt), Str(PpVal.Str), ValV(PpVal.ValV){}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
TStr Str
Definition: pp.h:22
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
TPpVal::TPpVal ( const bool &  b)
inline

Definition at line 27 of file pp.h.

27 : Tag(ptBool), Bool(b){}
TInt Tag
Definition: pp.h:21
TBool Bool
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( const TBool b)
inline

Definition at line 28 of file pp.h.

28 : Tag(ptBool), Bool(b){}
TInt Tag
Definition: pp.h:21
TBool Bool
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( const int &  _Int)
inline

Definition at line 29 of file pp.h.

29 : Tag(ptInt), Int(_Int){}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( const TInt _Int)
inline

Definition at line 30 of file pp.h.

30 : Tag(ptInt), Int(_Int){}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( const double &  _Flt)
inline

Definition at line 31 of file pp.h.

31 : Tag(ptFlt), Flt(_Flt){}
TInt Tag
Definition: pp.h:21
Definition: pp.h:4
TFlt Flt
Definition: pp.h:22
TPpVal::TPpVal ( const TFlt _Flt)
inline

Definition at line 32 of file pp.h.

32 : Tag(ptFlt), Flt(_Flt){}
TInt Tag
Definition: pp.h:21
Definition: pp.h:4
TFlt Flt
Definition: pp.h:22
TPpVal::TPpVal ( const TStr _Str)
inline

Definition at line 33 of file pp.h.

33 : Tag(ptStr), Str(_Str){}
TInt Tag
Definition: pp.h:21
TStr Str
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( const char *  CStr)
inline

Definition at line 34 of file pp.h.

34 : Tag(ptStr), Str(TStr(CStr)){}
TInt Tag
Definition: pp.h:21
TStr Str
Definition: pp.h:22
Definition: dt.h:412
Definition: pp.h:4
TPpVal::TPpVal ( const TVec< TPpVal > &  _ValV)
inline

Definition at line 35 of file pp.h.

35 : Tag(ptValV), ValV(_ValV){}
TInt Tag
Definition: pp.h:21
TVec< TPpVal > ValV
Definition: pp.h:22
Definition: pp.h:4
TPpVal::TPpVal ( TSIn SIn)
inline

Definition at line 36 of file pp.h.

36  :
37  Tag(SIn), Bool(SIn), Int(SIn), Flt(SIn), Str(SIn), ValV(SIn){}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
TStr Str
Definition: pp.h:22
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22

Member Function Documentation

TBool TPpVal::GetBool ( ) const
inline

Definition at line 52 of file pp.h.

References Bool, IAssert, ptBool, and Tag.

Referenced by TPp::GetValBool().

52 {IAssert(int(Tag)==ptBool); return Bool;}
#define IAssert(Cond)
Definition: bd.h:262
TInt Tag
Definition: pp.h:21
TBool Bool
Definition: pp.h:22
Definition: pp.h:4

Here is the caller graph for this function:

TFlt TPpVal::GetFlt ( ) const
inline

Definition at line 54 of file pp.h.

References Flt, IAssert, ptFlt, and Tag.

Referenced by TPp::GetValFlt().

54 {IAssert(int(Tag)==ptFlt); return Flt;}
#define IAssert(Cond)
Definition: bd.h:262
TInt Tag
Definition: pp.h:21
Definition: pp.h:4
TFlt Flt
Definition: pp.h:22

Here is the caller graph for this function:

TInt TPpVal::GetInt ( ) const
inline

Definition at line 53 of file pp.h.

References IAssert, Int, ptInt, and Tag.

Referenced by TPp::GetValInt(), and TPp::PutVal().

53 {IAssert(int(Tag)==ptInt); return Int;}
#define IAssert(Cond)
Definition: bd.h:262
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
Definition: pp.h:4

Here is the caller graph for this function:

TStr TPpVal::GetStr ( ) const
inline

Definition at line 55 of file pp.h.

References IAssert, ptStr, Str, and Tag.

Referenced by TPp::GetValStr(), and TPp::PutVal().

55 {IAssert(int(Tag)==ptStr); return Str;}
#define IAssert(Cond)
Definition: bd.h:262
TInt Tag
Definition: pp.h:21
TStr Str
Definition: pp.h:22
Definition: pp.h:4

Here is the caller graph for this function:

int TPpVal::GetTag ( ) const
inline

Definition at line 51 of file pp.h.

References Tag.

Referenced by TPp::AddCcVal(), TPp::PutMnMxVal(), TPp::PutVal(), and TPp::SaveTxt().

51 {return (int)Tag;}
TInt Tag
Definition: pp.h:21

Here is the caller graph for this function:

TStr TPpVal::GetValStr ( const bool &  DoAddTag = false) const

Definition at line 46 of file pp.cpp.

References Bool, Fail, Flt, TPpTag::GetStr(), TBool::GetStr(), TInt::GetStr(), TFlt::GetStr(), Int, TVec< TVal, TSizeTy >::Len(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, Str, Tag, and ValV.

Referenced by TPp::GetChA().

46  {
47  TChA ChA;
48  if (DoAddTag){ChA+='<'; ChA+=TPpTag::GetStr(Tag); ChA+='>';}
49  switch (Tag){
50  case ptUndef: break;
51  case ptBool: ChA+=TBool::GetStr(Bool); break;
52  case ptInt: ChA+=TInt::GetStr(Int); break;
53  case ptFlt: ChA+=TFlt::GetStr(Flt); break;
54  case ptStr: ChA+='"'; ChA+=Str; ChA+='"'; break;
55  case ptValV:{
56  ChA+='[';
57  for (int ValN=0; ValN<ValV.Len(); ValN++){
58  if (ValN>0){ChA+=' ';}
59  ChA+=ValV[ValN].GetValStr(DoAddTag);
60  }
61  ChA+=']'; break;}
62  default: Fail;
63  }
64  return ChA;
65 }
TInt Tag
Definition: pp.h:21
TStr GetStr() const
Definition: dt.h:1104
static TStr GetStr(const int &Tag)
Definition: pp.cpp:3
TInt Int
Definition: pp.h:22
#define Fail
Definition: bd.h:238
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
Definition: pp.h:4
Definition: pp.h:4
TStr Str
Definition: pp.h:22
Definition: pp.h:4
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
Definition: dt.h:201
Definition: pp.h:4
static TStr GetStr(const bool &Val)
Definition: dt.h:918
TStr GetStr() const
Definition: dt.h:1365
Definition: pp.h:4
Definition: pp.h:4

Here is the call graph for this function:

Here is the caller graph for this function:

TVec<TPpVal> TPpVal::GetValV ( ) const
inline

Definition at line 56 of file pp.h.

References IAssert, ptValV, Tag, and ValV.

Referenced by TPp::GetValValV().

56 {IAssert(int(Tag)==ptValV); return ValV;}
#define IAssert(Cond)
Definition: bd.h:262
TInt Tag
Definition: pp.h:21
TVec< TPpVal > ValV
Definition: pp.h:22
Definition: pp.h:4

Here is the caller graph for this function:

TPpVal TPpVal::LoadTxt ( TILx Lx)
static

Definition at line 67 of file pp.cpp.

References TVec< TVal, TSizeTy >::Add(), Fail, TILx::GetBool(), TILx::GetFlt(), TILx::GetInt(), TILx::GetQStr(), TILx::GetSym(), TPpTag::LoadTxt(), TILx::PeekSym(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, syColon, syIdStr, syLBracket, syRBracket, Tag, TPpVal(), and ValV.

Referenced by TPp::LoadTxt().

67  {
69  if (Tag==ptUndef){
70  return TPpVal();
71  } else {
72  Lx.GetSym(syColon);
73  switch (Tag){
74  case ptBool: return TPpVal(Lx.GetBool());
75  case ptInt: return TPpVal(Lx.GetInt());
76  case ptFlt: return TPpVal(Lx.GetFlt());
77  case ptStr: return TPpVal(Lx.GetQStr());
78  case ptValV:{
79  TPpValV ValV;
80  Lx.GetSym(syLBracket);
81  while (Lx.PeekSym()==syIdStr){ValV.Add(LoadTxt(Lx));}
82  Lx.GetSym(syRBracket);
83  return TPpVal(ValV);}
84  default: Fail; return TPpVal();
85  }
86  }
87 }
TInt Tag
Definition: pp.h:21
#define Fail
Definition: bd.h:238
Definition: pp.h:4
int GetInt()
Definition: lx.h:181
Definition: lx.h:45
Definition: pp.h:4
double GetFlt()
Definition: lx.h:182
TPpVal()
Definition: pp.h:24
Definition: pp.h:4
Definition: lx.h:50
TVec< TPpVal > ValV
Definition: pp.h:22
static TPpVal LoadTxt(TILx &Lx)
Definition: pp.cpp:67
TStr GetQStr(const TStr &QStr=TStr())
Definition: lx.h:187
Definition: lx.h:50
bool GetBool()
Definition: lx.h:180
TLxSym PeekSym()
Definition: lx.h:200
TPpTagVal
Definition: pp.h:3
Definition: pp.h:4
Definition: lx.h:46
TLxSym GetSym(const TFSet &Expect)
Definition: lx.cpp:315
Definition: pp.h:4
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
Definition: pp.h:4
static TPpTagVal LoadTxt(TILx &Lx)
Definition: pp.h:10

Here is the call graph for this function:

Here is the caller graph for this function:

bool TPpVal::operator< ( const TPpVal PpVal) const
inline

Definition at line 46 of file pp.h.

References Fail, Flt, Int, ptFlt, ptInt, and Tag.

46  {
47  if ((Tag==PpVal.Tag)&&(int(Tag)==ptInt)){return Int<PpVal.Int;}
48  else if ((Tag==PpVal.Tag)&&(int(Tag)==ptFlt)){return Flt<PpVal.Flt;}
49  else {Fail; return false;}}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
#define Fail
Definition: bd.h:238
Definition: pp.h:4
Definition: pp.h:4
TFlt Flt
Definition: pp.h:22
TPpVal& TPpVal::operator= ( const TPpVal PpVal)
inline

Definition at line 42 of file pp.h.

References Bool, Flt, Int, Str, Tag, and ValV.

42  {
43  Tag=PpVal.Tag; Bool=PpVal.Bool; Int=PpVal.Int;
44  Flt=PpVal.Flt; Str=PpVal.Str; ValV=PpVal.ValV; return *this;}
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
TStr Str
Definition: pp.h:22
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
bool TPpVal::operator== ( const TPpVal PpVal) const

Definition at line 31 of file pp.cpp.

References Bool, Fail, Flt, Int, ptBool, ptFlt, ptInt, ptSel, ptSet, ptStr, ptUndef, ptValV, Str, Tag, and ValV.

31  {
32  if (Tag!=PpVal.Tag){return false;}
33  switch (Tag){
34  case ptUndef: return true;
35  case ptBool: return Bool==PpVal.Bool;
36  case ptInt: return Int==PpVal.Int;
37  case ptFlt: return Flt==PpVal.Flt;
38  case ptStr: return Str==PpVal.Str;
39  case ptValV: return ValV==PpVal.ValV;
40  case ptSel:
41  case ptSet:
42  default: Fail; return false;
43  }
44 }
TInt Tag
Definition: pp.h:21
TInt Int
Definition: pp.h:22
#define Fail
Definition: bd.h:238
Definition: pp.h:4
Definition: pp.h:4
Definition: pp.h:4
TStr Str
Definition: pp.h:22
Definition: pp.h:4
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
Definition: pp.h:4
Definition: pp.h:4
Definition: pp.h:4
Definition: pp.h:4
void TPpVal::Save ( TSOut SOut)
inline

Definition at line 38 of file pp.h.

References Bool, Flt, Int, TStr::Save(), TVec< TVal, TSizeTy >::Save(), TBool::Save(), TInt::Save(), TFlt::Save(), Str, Tag, and ValV.

Referenced by TPp::Save().

38  {
39  Tag.Save(SOut); Bool.Save(SOut); Int.Save(SOut);
40  Flt.Save(SOut); Str.Save(SOut); ValV.Save(SOut);}
TInt Tag
Definition: pp.h:21
void Save(TSOut &SOut) const
Definition: dt.h:1057
TInt Int
Definition: pp.h:22
void Save(TSOut &SOut) const
Definition: dt.h:902
TStr Str
Definition: pp.h:22
void Save(TSOut &SOut) const
Definition: ds.h:885
TVec< TPpVal > ValV
Definition: pp.h:22
void Save(TSOut &SOut, const bool &IsSmall=false) const
Definition: dt.h:440
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
void Save(TSOut &SOut) const
Definition: dt.h:1305

Here is the call graph for this function:

Here is the caller graph for this function:

void TPpVal::SaveTxt ( TOLx Lx) const

Definition at line 89 of file pp.cpp.

References Bool, Fail, Flt, TPpTag::GetStr(), Int, TVec< TVal, TSizeTy >::Len(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, TOLx::PutBool(), TOLx::PutFlt(), TOLx::PutIdStr(), TOLx::PutInt(), TOLx::PutQStr(), TOLx::PutSym(), Str, syColon, syLBracket, syRBracket, Tag, and ValV.

Referenced by TPp::SaveTxt().

89  {
91  if (int(Tag)!=ptUndef){
92  Lx.PutSym(syColon);
93  switch (Tag){
94  case ptBool: Lx.PutBool(Bool); break;
95  case ptInt: Lx.PutInt(Int); break;
96  case ptFlt: Lx.PutFlt(Flt); break;
97  case ptStr: Lx.PutQStr(Str); break;
98  case ptValV:{
99  Lx.PutSym(syLBracket);
100  for (int ValN=0; ValN<ValV.Len(); ValN++){ValV[ValN].SaveTxt(Lx);}
101  Lx.PutSym(syRBracket); break;}
102  default: Fail;
103  }
104  }
105 }
TInt Tag
Definition: pp.h:21
static TStr GetStr(const int &Tag)
Definition: pp.cpp:3
void PutBool(const TBool &Bool)
Definition: lx.h:275
TInt Int
Definition: pp.h:22
#define Fail
Definition: bd.h:238
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
void PutInt(const TInt &Int)
Definition: lx.h:277
Definition: pp.h:4
Definition: pp.h:4
void PutSym(const TLxSym &Sym)
Definition: lx.cpp:751
void PutQStr(const TStr &Str)
Definition: lx.h:289
TStr Str
Definition: pp.h:22
Definition: pp.h:4
Definition: lx.h:50
TVec< TPpVal > ValV
Definition: pp.h:22
TFlt Flt
Definition: pp.h:22
TBool Bool
Definition: pp.h:22
Definition: lx.h:50
void PutFlt(const TFlt &Flt, const int &Width=-1, const int &Prec=-1)
Definition: lx.h:280
Definition: pp.h:4
Definition: lx.h:46
Definition: pp.h:4
Definition: pp.h:4
void PutIdStr(const TStr &Str, const bool &CheckIdStr=true)
Definition: lx.h:286

Here is the call graph for this function:

Here is the caller graph for this function:

Member Data Documentation

TBool TPpVal::Bool
private

Definition at line 22 of file pp.h.

Referenced by GetBool(), GetValStr(), operator=(), operator==(), Save(), and SaveTxt().

TFlt TPpVal::Flt
private

Definition at line 22 of file pp.h.

Referenced by GetFlt(), GetValStr(), operator<(), operator=(), operator==(), Save(), and SaveTxt().

TInt TPpVal::Int
private

Definition at line 22 of file pp.h.

Referenced by GetInt(), GetValStr(), operator<(), operator=(), operator==(), Save(), and SaveTxt().

TStr TPpVal::Str
private

Definition at line 22 of file pp.h.

Referenced by GetStr(), GetValStr(), operator=(), operator==(), Save(), and SaveTxt().

TInt TPpVal::Tag
private
TVec<TPpVal> TPpVal::ValV
private

Definition at line 22 of file pp.h.

Referenced by GetValStr(), GetValV(), LoadTxt(), operator=(), operator==(), Save(), and SaveTxt().


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