|
SNAP Library 2.1, Developer Reference
2013-09-25 10:47:25
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
#include <pp.h>

Public Member Functions | |
| TPp () | |
| TPp (const TPp &Pp) | |
| TPp (const TStr &_IdNm, const TStr &_DescNm, const TPpTagVal &_Tag=ptUndef, const TPpTagVal &_ValVTag=ptUndef) | |
| TPp (TSIn &SIn) | |
| void | Save (TSOut &SOut) |
| TPp & | operator= (const TPp &Pp) |
| TStr | GetIdNm () const |
| TStr | GetUcIdNm () const |
| TStr | GetDescNm () const |
| int | GetTag () const |
| int | GetValVTag () const |
| void | PutVal (const TPpVal &_Val) |
| TPpVal | GetVal () const |
| void | PutDfVal (const TPpVal &_DfVal) |
| TPpVal | GetDfVal () const |
| void | PutMnMxVal (const TPpVal &_MnVal, const TPpVal &_MxVal) |
| TPpVal | GetMnVal () const |
| TPpVal | GetMxVal () const |
| void | AddCcVal (const TPpVal &_Val) |
| void | PutCcValV (const TPpValV &CcValV) |
| int | GetCcVals () const |
| TPpVal | GetCcVal (const int &CcValN) const |
| bool | IsPp (const TStr &IdNm) const |
| bool | IsPp (const TStr &IdNm, PPp &Pp) const |
| int | GetPps () const |
| int | AddPp (const PPp &Pp) |
| void | AddPpV (const TPpV &PpV) |
| PPp | GetPp (const int &PpN) const |
| PPp | GetPp (const TStr &IdPath) const |
| PPp | GetSelPp () const |
| int | AddPpInt (const TStr &IdNm, const TStr &DescNm=TStr()) |
| int | AddPpInt (const TStr &IdNm, const TStr &DescNm, const int &MnVal, const int &MxVal, const int &DfVal) |
| int | AddPpFlt (const TStr &IdNm, const TStr &DescNm=TStr()) |
| int | AddPpFlt (const TStr &IdNm, const TStr &DescNm, const double &MnVal, const double &MxVal, const double &DfVal) |
| int | AddPpStr (const TStr &IdNm, const TStr &DescNm=TStr(), const TStr &DfVal=TStr()) |
| void | PutValBool (const bool &Val) |
| TBool | GetValBool () const |
| void | PutValBool (const TStr &IdPath, const bool &Val) |
| TBool | GetValBool (const TStr &IdPath) const |
| void | PutValInt (const int &Val) |
| TInt | GetValInt () const |
| void | PutValInt (const TStr &IdPath, const int &Val) |
| TInt | GetValInt (const TStr &IdPath) const |
| void | PutValFlt (const double &Val) |
| TFlt | GetValFlt () const |
| void | PutValFlt (const TStr &IdPath, const double &Val) |
| TFlt | GetValFlt (const TStr &IdPath) const |
| void | PutValStr (const TStr &Val) |
| TStr | GetValStr () const |
| void | PutValStr (const TStr &IdPath, const TStr &Val) |
| TStr | GetValStr (const TStr &IdPath) const |
| void | PutValValV (const TPpValV &Val) |
| TPpValV | GetValValV () const |
| void | PutValValV (const TStr &IdPath, const TPpValV &Val) |
| TPpValV | GetValValV (const TStr &IdPath) const |
| TStr | GetStr (const bool &Brief=true) const |
| void | SaveTxt (const PSOut &SOut) const |
| void | SaveTxt (TOLx &Lx, const int &Lev=0) const |
Static Public Member Functions | |
| static PPp | Load (TSIn &SIn) |
| static PPp | GetSetPp (const TStr &IdNm, const TStr &DescNm=TStr()) |
| static PPp | LoadTxt (const PSIn &SIn) |
| static PPp | LoadTxt (TILx &Lx) |
Private Member Functions | |
| void | IAssertSubPp () const |
| int | GetPpN (const TStr &IdNm) const |
| void | GetChA (const int &Lev, const bool &Brief, TChA &ChA) const |
Private Attributes | |
| TCRef | CRef |
| TStr | IdNm |
| TStr | UcIdNm |
| TStr | DescNm |
| TInt | Tag |
| TInt | ValVTag |
| TPpVal | Val |
| TPpVal | DfVal |
| TPpVal | MnVal |
| TPpVal | MxVal |
| TPpValV | CcValV |
| TPpV | PpV |
Static Private Attributes | |
| static TStr | PpNm = "Pp" |
Friends | |
| class | TPt< TPp > |
| TPp::TPp | ( | ) | [inline] |
Definition at line 86 of file pp.h.
Referenced by AddPpFlt(), AddPpInt(), AddPpStr(), GetSetPp(), Load(), and LoadTxt().
:
IdNm(), UcIdNm(), DescNm(),
Tag(ptUndef), ValVTag(),
Val(), DfVal(), MnVal(), MxVal(),
CcValV(), PpV(){}

| void TPp::AddCcVal | ( | const TPpVal & | _Val | ) | [inline] |
Definition at line 140 of file pp.h.
References TVec< TVal, TSizeTy >::Add(), CcValV, TPpVal::GetTag(), IAssert, ptStr, TVec< TVal, TSizeTy >::SearchForw(), and Tag.
Referenced by PutCcValV().
{
IAssert((int(Tag)==ptStr)||(int(Tag)==_Val.GetTag()));
IAssert(CcValV.SearchForw(_Val)==-1); CcValV.Add(_Val);}


| int TPp::AddPp | ( | const PPp & | Pp | ) | [inline] |
Definition at line 155 of file pp.h.
References TVec< TVal, TSizeTy >::Add(), IAssertSubPp(), and PpV.
Referenced by AddPpFlt(), AddPpInt(), AddPpStr(), and AddPpV().
{IAssertSubPp(); return PpV.Add(Pp);}


| int TPp::AddPpFlt | ( | const TStr & | IdNm, |
| const TStr & | DescNm = TStr() |
||
| ) | [inline] |
| int TPp::AddPpFlt | ( | const TStr & | IdNm, |
| const TStr & | DescNm, | ||
| const double & | MnVal, | ||
| const double & | MxVal, | ||
| const double & | DfVal | ||
| ) | [inline] |
| int TPp::AddPpInt | ( | const TStr & | IdNm, |
| const TStr & | DescNm = TStr() |
||
| ) | [inline] |
| int TPp::AddPpInt | ( | const TStr & | IdNm, |
| const TStr & | DescNm, | ||
| const int & | MnVal, | ||
| const int & | MxVal, | ||
| const int & | DfVal | ||
| ) | [inline] |
| void TPp::AddPpV | ( | const TPpV & | PpV | ) | [inline] |
| TPpVal TPp::GetCcVal | ( | const int & | CcValN | ) | const [inline] |
| int TPp::GetCcVals | ( | ) | const [inline] |
| void TPp::GetChA | ( | const int & | Lev, |
| const bool & | Brief, | ||
| TChA & | ChA | ||
| ) | const [private] |
Definition at line 118 of file pp.cpp.
References DescNm, GetStr(), TPpVal::GetValStr(), IdNm, TVec< TVal, TSizeTy >::Len(), PpV, ptSel, ptSet, Tag, and Val.
Referenced by GetStr().
{
for (int LevN=0; LevN<Lev; LevN++){ChA+="| ";}
if (!Brief){ChA+=TPpTag::GetStr(Tag);}
ChA+=" '"; ChA+=IdNm; ChA+="' ("; ChA+=DescNm; ChA+=") = ";
ChA+=Val.GetValStr(true); ChA+="\r\n";
if ((int(Tag)==ptSel)||(int(Tag)==ptSet)){
for (int PpN=0; PpN<PpV.Len(); PpN++){
PpV[PpN]->GetChA(Lev+1, Brief, ChA);
}
}
}


| TStr TPp::GetDescNm | ( | ) | const [inline] |
| TPpVal TPp::GetDfVal | ( | ) | const [inline] |
| TStr TPp::GetIdNm | ( | ) | const [inline] |
| TPpVal TPp::GetMnVal | ( | ) | const [inline] |
| TPpVal TPp::GetMxVal | ( | ) | const [inline] |
| PPp TPp::GetPp | ( | const int & | PpN | ) | const [inline] |
Definition at line 158 of file pp.h.
References IAssertSubPp(), and PpV.
Referenced by GetSelPp(), GetValBool(), GetValFlt(), GetValInt(), GetValStr(), GetValValV(), IsPp(), PutValBool(), PutValFlt(), PutValInt(), PutValStr(), and PutValValV().
{IAssertSubPp(); return PpV[PpN];}


| PPp TPp::GetPp | ( | const TStr & | IdPath | ) | const |
Definition at line 161 of file pp.cpp.
References TStr::Empty(), TPt< TRec >::Empty(), GetPpN(), IAssert, IAssertSubPp(), IdNm, PpV, and TStr::SplitOnCh().
{
IAssertSubPp();
TStr IdNm; TStr RestIdPath;
IdPath.SplitOnCh(IdNm, '|', RestIdPath);
PPp Pp=PpV[GetPpN(IdNm)];
while (!RestIdPath.Empty()){
RestIdPath.SplitOnCh(IdNm, '|', RestIdPath);
Pp=Pp->PpV[Pp->GetPpN(IdNm)];
}
IAssert(!Pp.Empty()); return Pp;
}

| int TPp::GetPpN | ( | const TStr & | IdNm | ) | const [private] |
Definition at line 111 of file pp.cpp.
References TStr::GetUc(), TVec< TVal, TSizeTy >::Len(), PpV, and UcIdNm.
Referenced by GetPp(), and IsPp().
{
TStr UcIdNm=IdNm.GetUc();
for (int PpN=0; PpN<PpV.Len(); PpN++){
if (PpV[PpN]->UcIdNm==UcIdNm){return PpN;}}
return -1;
}


| int TPp::GetPps | ( | ) | const [inline] |
Definition at line 154 of file pp.h.
References IAssertSubPp(), TVec< TVal, TSizeTy >::Len(), and PpV.
{IAssertSubPp(); return PpV.Len();}

| PPp TPp::GetSelPp | ( | ) | const [inline] |
| static PPp TPp::GetSetPp | ( | const TStr & | IdNm, |
| const TStr & | DescNm = TStr() |
||
| ) | [inline, static] |
| TStr TPp::GetStr | ( | const bool & | Brief = true | ) | const [inline] |
| int TPp::GetTag | ( | ) | const [inline] |
| TStr TPp::GetUcIdNm | ( | ) | const [inline] |
| TPpVal TPp::GetVal | ( | ) | const [inline] |
Definition at line 129 of file pp.h.
Referenced by GetSelPp(), GetValBool(), GetValFlt(), GetValInt(), GetValStr(), and GetValValV().

| TBool TPp::GetValBool | ( | ) | const [inline] |
| TBool TPp::GetValBool | ( | const TStr & | IdPath | ) | const [inline] |
| TFlt TPp::GetValFlt | ( | ) | const [inline] |
| TFlt TPp::GetValFlt | ( | const TStr & | IdPath | ) | const [inline] |
| TInt TPp::GetValInt | ( | ) | const [inline] |
| TInt TPp::GetValInt | ( | const TStr & | IdPath | ) | const [inline] |
| TStr TPp::GetValStr | ( | ) | const [inline] |
| TStr TPp::GetValStr | ( | const TStr & | IdPath | ) | const [inline] |
| TPpValV TPp::GetValValV | ( | ) | const [inline] |
| TPpValV TPp::GetValValV | ( | const TStr & | IdPath | ) | const [inline] |
| int TPp::GetValVTag | ( | ) | const [inline] |
| void TPp::IAssertSubPp | ( | ) | const [inline, private] |
Definition at line 150 of file pp.h.
References GetPpN(), and IAssertSubPp().
Referenced by PutVal().
{IAssertSubPp(); return GetPpN(IdNm)!=-1;}


Definition at line 151 of file pp.h.
References GetPp(), GetPpN(), and IAssertSubPp().
{
IAssertSubPp(); int PpN=GetPpN(IdNm);
if (PpN==-1){return false;} else {Pp=GetPp(PpN); return true;}}

| static PPp TPp::LoadTxt | ( | const PSIn & | SIn | ) | [inline, static] |
| PPp TPp::LoadTxt | ( | TILx & | Lx | ) | [static] |
Definition at line 173 of file pp.cpp.
References TVec< TVal, TSizeTy >::Add(), CcValV, DescNm, DfVal, TILx::GetIdStr(), TILx::GetQStr(), TILx::GetSym(), TILx::GetVar(), IdNm, TILx::IsVar(), TPpVal::LoadTxt(), LoadTxt(), MnVal, MxVal, TILx::PeekSym(), PpNm, PpV, ptSel, ptSet, ptUndef, ptValV, syColon, syEq, syGtr, syLBrace, syLBracket, syLss, syRBrace, syRBracket, Tag, TPp(), Val, and ValVTag.
{
Lx.GetSym(syLBracket);
TStr IdNm=Lx.GetIdStr();
TStr DescNm;
if (Lx.PeekSym()==syLBracket){
Lx.GetSym(syLBracket); DescNm=Lx.GetQStr(); Lx.GetSym(syRBracket);
}
Lx.GetSym(syColon);
TPpTagVal Tag=TPpTag::LoadTxt(Lx);
TPpTagVal ValVTag=ptUndef;
if (Tag==ptValV){
Lx.GetSym(syLBracket); ValVTag=TPpTag::LoadTxt(Lx); Lx.GetSym(syRBracket);}
TPpVal Val;
if (Lx.PeekSym()==syEq){
Lx.GetSym(syEq); Val=TPpVal::LoadTxt(Lx);}
TPpVal DfVal;
if (Lx.PeekSym()==syLBracket){
Lx.GetSym(syLBracket); DfVal=TPpVal::LoadTxt(Lx); Lx.GetSym(syRBracket);}
bool IsMnMxValDef=false; TPpVal MnVal, MxVal;
if (Lx.PeekSym()==syLss){
Lx.GetSym(syLss);
IsMnMxValDef=true; MnVal=TPpVal::LoadTxt(Lx); MxVal=TPpVal::LoadTxt(Lx);
Lx.GetSym(syGtr);
}
TPpValV CcValV;
if (Lx.PeekSym()==syLBrace){
Lx.GetSym(syLBrace);
while (Lx.PeekSym()!=syRBrace){CcValV.Add(TPpVal::LoadTxt(Lx));}
Lx.GetSym(syRBrace);
}
TPpV PpV;
if ((Tag==ptSel)||(Tag==ptSet)){
while (Lx.IsVar(PpNm)){
Lx.GetVar(PpNm); PpV.Add(LoadTxt(Lx));}
}
Lx.GetSym(syRBracket);
// construct property
PPp Pp=PPp(new TPp(IdNm, DescNm, Tag, ValVTag));
Pp->AddPpV(PpV);
Pp->PutCcValV(CcValV);
if (IsMnMxValDef){Pp->PutMnMxVal(MnVal, MxVal);}
Pp->PutDfVal(DfVal);
Pp->PutVal(Val);
// return property
return Pp;
}

| void TPp::PutCcValV | ( | const TPpValV & | CcValV | ) | [inline] |
Definition at line 143 of file pp.h.
References AddCcVal(), and TVec< TVal, TSizeTy >::Len().

| void TPp::PutDfVal | ( | const TPpVal & | _DfVal | ) | [inline] |
| void TPp::PutMnMxVal | ( | const TPpVal & | _MnVal, |
| const TPpVal & | _MxVal | ||
| ) | [inline] |
| void TPp::PutVal | ( | const TPpVal & | _Val | ) |
Definition at line 130 of file pp.cpp.
References CcValV, Fail, TPpVal::GetInt(), TPpVal::GetStr(), TPpVal::GetTag(), IAssert, IsPp(), TVec< TVal, TSizeTy >::Len(), MnVal, MxVal, PpV, ptBool, ptFlt, ptInt, ptSel, ptSet, ptStr, ptUndef, ptValV, TVec< TVal, TSizeTy >::SearchForw(), Tag, and Val.
Referenced by PutDfVal(), PutValBool(), PutValFlt(), PutValInt(), PutValStr(), and PutValValV().
{
Val=_Val;
if (Val.GetTag()!=ptUndef){
switch (Tag){
case ptUndef: Fail; break;
case ptBool: IAssert(Val.GetTag()==int(Tag)); break;
case ptInt:
case ptFlt:
IAssert(Val.GetTag()==int(Tag));
if (MnVal.GetTag()!=ptUndef){IAssert(MnVal<=Val);}
if (MxVal.GetTag()!=ptUndef){IAssert(Val<=MxVal);}
break;
case ptStr:
if (Val.GetTag()==ptInt){Val=CcValV[Val.GetInt()];}
IAssert(Val.GetTag()==ptStr);
IAssert((CcValV.Len()==0)||(CcValV.SearchForw(Val)!=-1)); break;
case ptValV:{
IAssert(Val.GetTag()==int(Tag));
Fail; //**TPpValV ValV=Val.GetValV();
//**for (int ValN=0; ValN<ValV.Len(); ValN++){
//**IAssert(ValV[ValN].GetTag()==int(ValVTag));}
break;}
case ptSel:
if (Val.GetTag()==ptInt){Val=TPpVal(PpV[Val.GetInt()]->GetIdNm());}
IAssert((Val.GetTag()==ptStr)&&(IsPp(Val.GetStr()))); break;
case ptSet: Fail; break;
default: Fail;
}
}
}


| void TPp::PutValBool | ( | const bool & | Val | ) | [inline] |
| void TPp::PutValBool | ( | const TStr & | IdPath, |
| const bool & | Val | ||
| ) | [inline] |
| void TPp::PutValFlt | ( | const double & | Val | ) | [inline] |
| void TPp::PutValFlt | ( | const TStr & | IdPath, |
| const double & | Val | ||
| ) | [inline] |
| void TPp::PutValInt | ( | const int & | Val | ) | [inline] |
| void TPp::PutValInt | ( | const TStr & | IdPath, |
| const int & | Val | ||
| ) | [inline] |
| void TPp::PutValStr | ( | const TStr & | Val | ) | [inline] |
| void TPp::PutValStr | ( | const TStr & | IdPath, |
| const TStr & | Val | ||
| ) | [inline] |
| void TPp::PutValValV | ( | const TPpValV & | Val | ) | [inline] |
| void TPp::PutValValV | ( | const TStr & | IdPath, |
| const TPpValV & | Val | ||
| ) | [inline] |
Definition at line 108 of file pp.h.
References CcValV, DescNm, DfVal, IdNm, MnVal, MxVal, PpV, TPpVal::Save(), TStr::Save(), TVec< TVal, TSizeTy >::Save(), TInt::Save(), Tag, UcIdNm, Val, and ValVTag.
{
IdNm.Save(SOut); UcIdNm.Save(SOut); DescNm.Save(SOut);
Tag.Save(SOut); ValVTag.Save(SOut);
Val.Save(SOut); DfVal.Save(SOut); MnVal.Save(SOut); MxVal.Save(SOut);
CcValV.Save(SOut); PpV.Save(SOut);}

| void TPp::SaveTxt | ( | const PSOut & | SOut | ) | const [inline] |
| void TPp::SaveTxt | ( | TOLx & | Lx, |
| const int & | Lev = 0 |
||
| ) | const |
Definition at line 220 of file pp.cpp.
References CcValV, DescNm, DfVal, TStr::Empty(), TPpVal::GetTag(), IdNm, TVec< TVal, TSizeTy >::Len(), MnVal, MxVal, PpNm, PpV, ptSel, ptSet, ptUndef, ptValV, TOLx::PutIdStr(), TOLx::PutQStr(), TOLx::PutSym(), TOLx::PutVar(), TPpVal::SaveTxt(), SaveTxt(), syColon, syEq, syGtr, syLBrace, syLBracket, syLss, syRBrace, syRBracket, Tag, Val, and ValVTag.
{
Lx.PutSym(syLBracket);
//Lx.PutIndent(Lev);
Lx.PutIdStr(IdNm);
if (!DescNm.Empty()){
Lx.PutSym(syLBracket); Lx.PutQStr(DescNm); Lx.PutSym(syRBracket);}
Lx.PutSym(syColon);
TPpTag::SaveTxt(Lx, Tag);
if (int(Tag)==ptValV){
Lx.PutSym(syLBracket); TPpTag::SaveTxt(Lx, ValVTag); Lx.PutSym(syRBracket);}
if (Val.GetTag()!=ptUndef){
Lx.PutSym(syEq); Val.SaveTxt(Lx);
}
if (DfVal.GetTag()!=ptUndef){
Lx.PutSym(syLBracket); DfVal.SaveTxt(Lx); Lx.PutSym(syRBracket);}
if ((MnVal.GetTag()!=ptUndef)||(MxVal.GetTag()!=ptUndef)){
Lx.PutSym(syLss); MnVal.SaveTxt(Lx); MxVal.SaveTxt(Lx); Lx.PutSym(syGtr);
}
if (CcValV.Len()>0){
Lx.PutSym(syLBrace);
for (int CcValN=0; CcValN<CcValV.Len(); CcValN++){
CcValV[CcValN].SaveTxt(Lx);}
Lx.PutSym(syRBrace);
}
if ((int(Tag)==ptSel)||(int(Tag)==ptSet)){
for (int PpN=0; PpN<PpV.Len(); PpN++){
Lx.PutVar(PpNm); PpV[PpN]->SaveTxt(Lx, Lev+1);}
}
Lx.PutSym(syRBracket);
}

TPpValV TPp::CcValV [private] |
Definition at line 80 of file pp.h.
Referenced by AddCcVal(), GetCcVal(), GetCcVals(), LoadTxt(), operator=(), PutVal(), Save(), and SaveTxt().
TStr TPp::DescNm [private] |
Definition at line 76 of file pp.h.
Referenced by AddPpFlt(), AddPpInt(), AddPpStr(), GetChA(), GetDescNm(), GetSetPp(), LoadTxt(), operator=(), Save(), and SaveTxt().
TPpVal TPp::DfVal [private] |
Definition at line 78 of file pp.h.
Referenced by AddPpStr(), GetDfVal(), GetVal(), LoadTxt(), operator=(), PutDfVal(), Save(), and SaveTxt().
TPpVal TPp::MnVal [private] |
Definition at line 79 of file pp.h.
Referenced by GetMnVal(), LoadTxt(), operator=(), PutMnMxVal(), PutVal(), Save(), and SaveTxt().
TPpVal TPp::MxVal [private] |
Definition at line 79 of file pp.h.
Referenced by GetMxVal(), LoadTxt(), operator=(), PutMnMxVal(), PutVal(), Save(), and SaveTxt().
Definition at line 77 of file pp.h.
Referenced by AddCcVal(), GetCcVal(), GetCcVals(), GetChA(), GetMnVal(), GetMxVal(), GetSelPp(), GetTag(), IAssertSubPp(), LoadTxt(), operator=(), PutMnMxVal(), PutVal(), Save(), and SaveTxt().
TStr TPp::UcIdNm [private] |
Definition at line 76 of file pp.h.
Referenced by GetPpN(), GetUcIdNm(), operator=(), and Save().
Definition at line 78 of file pp.h.
Referenced by GetChA(), GetVal(), LoadTxt(), operator=(), PutDfVal(), PutVal(), Save(), and SaveTxt().
TInt TPp::ValVTag [private] |
Definition at line 77 of file pp.h.
Referenced by GetValVTag(), LoadTxt(), operator=(), Save(), SaveTxt(), and TPp().