SNAP Library , Developer Reference  2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines
TPpVal Class Reference

#include <pp.h>

Collaboration diagram for TPpVal:

List of all members.

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().

: Tag(ptUndef){}

Here is the caller graph for this function:

TPpVal::TPpVal ( const TPpVal PpVal) [inline]

Definition at line 25 of file pp.h.

                             : Tag(PpVal.Tag), Bool(PpVal.Bool),
    Int(PpVal.Int), Flt(PpVal.Flt), Str(PpVal.Str), ValV(PpVal.ValV){}
TPpVal::TPpVal ( const bool &  b) [inline]

Definition at line 27 of file pp.h.

: Tag(ptBool), Bool(b){}
TPpVal::TPpVal ( const TBool b) [inline]

Definition at line 28 of file pp.h.

: Tag(ptBool), Bool(b){}
TPpVal::TPpVal ( const int &  _Int) [inline]

Definition at line 29 of file pp.h.

: Tag(ptInt), Int(_Int){}
TPpVal::TPpVal ( const TInt _Int) [inline]

Definition at line 30 of file pp.h.

: Tag(ptInt), Int(_Int){}
TPpVal::TPpVal ( const double &  _Flt) [inline]

Definition at line 31 of file pp.h.

: Tag(ptFlt), Flt(_Flt){}
TPpVal::TPpVal ( const TFlt _Flt) [inline]

Definition at line 32 of file pp.h.

: Tag(ptFlt), Flt(_Flt){}
TPpVal::TPpVal ( const TStr _Str) [inline]

Definition at line 33 of file pp.h.

: Tag(ptStr), Str(_Str){}
TPpVal::TPpVal ( const char *  CStr) [inline]

Definition at line 34 of file pp.h.

: Tag(ptStr), Str(TStr(CStr)){}
TPpVal::TPpVal ( const TVec< TPpVal > &  _ValV) [inline]

Definition at line 35 of file pp.h.

: Tag(ptValV), ValV(_ValV){}
TPpVal::TPpVal ( TSIn SIn) [inline]

Definition at line 36 of file pp.h.

                   :
    Tag(SIn), Bool(SIn), Int(SIn), Flt(SIn), Str(SIn), ValV(SIn){}

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().

{IAssert(int(Tag)==ptBool); return Bool;}

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().

{IAssert(int(Tag)==ptFlt); return Flt;}

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().

{IAssert(int(Tag)==ptInt); return Int;}

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 GetValStr(), TPp::GetValStr(), and TPp::PutVal().

{IAssert(int(Tag)==ptStr); return Str;}

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().

{return (int)Tag;}

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, GetStr(), Int, TVec< TVal >::Len(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, Str, Tag, and ValV.

Referenced by TPp::GetChA().

                                                 {
  TChA ChA;
  if (DoAddTag){ChA+='<'; ChA+=TPpTag::GetStr(Tag); ChA+='>';}
  switch (Tag){
    case ptUndef: break;
    case ptBool: ChA+=TBool::GetStr(Bool); break;
    case ptInt: ChA+=TInt::GetStr(Int); break;
    case ptFlt: ChA+=TFlt::GetStr(Flt); break;
    case ptStr: ChA+='"'; ChA+=Str; ChA+='"'; break;
    case ptValV:{
      ChA+='[';
      for (int ValN=0; ValN<ValV.Len(); ValN++){
        if (ValN>0){ChA+=' ';}
        ChA+=ValV[ValN].GetValStr(DoAddTag);
      }
      ChA+=']'; break;}
    default: Fail;
  }
  return ChA;
}

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().

{IAssert(int(Tag)==ptValV); return ValV;}

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 >::Add(), Fail, TILx::GetBool(), TILx::GetFlt(), TILx::GetInt(), TILx::GetQStr(), TILx::GetSym(), TILx::PeekSym(), ptBool, ptFlt, ptInt, ptStr, ptUndef, ptValV, syColon, syIdStr, syLBracket, syRBracket, Tag, TPpVal(), and ValV.

Referenced by TPp::LoadTxt().

                              {
  TPpTagVal Tag=TPpTag::LoadTxt(Lx);
  if (Tag==ptUndef){
    return TPpVal();
  } else {
    Lx.GetSym(syColon);
    switch (Tag){
      case ptBool: return TPpVal(Lx.GetBool());
      case ptInt: return TPpVal(Lx.GetInt());
      case ptFlt: return TPpVal(Lx.GetFlt());
      case ptStr: return TPpVal(Lx.GetQStr());
      case ptValV:{
        TPpValV ValV;
        Lx.GetSym(syLBracket);
        while (Lx.PeekSym()==syIdStr){ValV.Add(LoadTxt(Lx));}
        Lx.GetSym(syRBracket);
        return TPpVal(ValV);}
      default: Fail; return TPpVal();
    }
  }
}

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.

                                            {
    if ((Tag==PpVal.Tag)&&(int(Tag)==ptInt)){return Int<PpVal.Int;}
    else if ((Tag==PpVal.Tag)&&(int(Tag)==ptFlt)){return Flt<PpVal.Flt;}
    else {Fail; return false;}}
TPpVal& TPpVal::operator= ( const TPpVal PpVal) [inline]

Definition at line 42 of file pp.h.

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

                                        {
    Tag=PpVal.Tag; Bool=PpVal.Bool; Int=PpVal.Int;
    Flt=PpVal.Flt; Str=PpVal.Str; ValV=PpVal.ValV; return *this;}
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.

                                                 {
  if (Tag!=PpVal.Tag){return false;}
  switch (Tag){
    case ptUndef: return true;
    case ptBool: return Bool==PpVal.Bool;
    case ptInt: return Int==PpVal.Int;
    case ptFlt: return Flt==PpVal.Flt;
    case ptStr: return Str==PpVal.Str;
    case ptValV: return ValV==PpVal.ValV;
    case ptSel:
    case ptSet:
    default: Fail; return false;
  }
}
void TPpVal::Save ( TSOut SOut) [inline]

Definition at line 38 of file pp.h.

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

Referenced by TPp::Save().

                        {
    Tag.Save(SOut); Bool.Save(SOut); Int.Save(SOut);
    Flt.Save(SOut); Str.Save(SOut); ValV.Save(SOut);}

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 >::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().

                                   {
  Lx.PutIdStr(TPpTag::GetStr(Tag));
  if (int(Tag)!=ptUndef){
    Lx.PutSym(syColon);
    switch (Tag){
      case ptBool: Lx.PutBool(Bool); break;
      case ptInt: Lx.PutInt(Int); break;
      case ptFlt: Lx.PutFlt(Flt); break;
      case ptStr: Lx.PutQStr(Str); break;
      case ptValV:{
        Lx.PutSym(syLBracket);
        for (int ValN=0; ValN<ValV.Len(); ValN++){ValV[ValN].SaveTxt(Lx);}
        Lx.PutSym(syRBracket); break;}
      default: Fail;
    }
  }
}

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().

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: