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
TExpHelp Class Reference

#include <exp.h>

Collaboration diagram for TExpHelp:

Public Member Functions

 TExpHelp ()
 
 ~TExpHelp ()
 
 TExpHelp (TSIn &SIn)
 
void Save (TSOut &SOut) const
 
TExpHelpoperator= (const TExpHelp &)
 
bool operator== (const TExpHelp &) const
 
void AddObj (const PExpHelpObj &Obj)
 
void GetCatNmV (TStrV &CatNmV) const
 
void GetObjHdNmV (const TStr &CatNm, TStrV &ObjHdNmV) const
 
PExpHelpObj GetObj (const TStr &ObjNm) const
 

Static Public Member Functions

static PExpHelp New ()
 
static PExpHelp Load (TSIn &SIn)
 
static PExpHelp LoadXml (const PSIn &SIn)
 
static PExpHelp LoadXml (const TStr &FNm)
 

Private Attributes

TCRef CRef
 
TExpHelpObjV ObjV
 

Friends

class TPt< TExpHelp >
 

Detailed Description

Definition at line 351 of file exp.h.

Constructor & Destructor Documentation

TExpHelp::TExpHelp ( )
inline

Definition at line 355 of file exp.h.

355 : ObjV(){}
TExpHelpObjV ObjV
Definition: exp.h:353
TExpHelp::~TExpHelp ( )
inline

Definition at line 357 of file exp.h.

357 {}
TExpHelp::TExpHelp ( TSIn SIn)
inline

Definition at line 358 of file exp.h.

358 : ObjV(SIn){}
TExpHelpObjV ObjV
Definition: exp.h:353

Member Function Documentation

void TExpHelp::AddObj ( const PExpHelpObj Obj)
inline

Definition at line 369 of file exp.h.

369 {ObjV.Add(Obj);}
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
TExpHelpObjV ObjV
Definition: exp.h:353
void TExpHelp::GetCatNmV ( TStrV CatNmV) const

Definition at line 1126 of file exp.cpp.

References TVec< TVal, TSizeTy >::AddUnique(), TVec< TVal, TSizeTy >::Clr(), TVec< TVal, TSizeTy >::Ins(), TVec< TVal, TSizeTy >::Len(), and ObjV.

1126  {
1127  CatNmV.Clr();
1128  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
1129  TStr CatNm=ObjV[ObjN]->GetCatNm();
1130  CatNmV.AddUnique(CatNm);
1131  }
1132  CatNmV.Ins(0, "All");
1133 }
TSizeTy AddUnique(const TVal &Val)
Adds element Val to a vector only if the element Val is not already in the vector.
Definition: ds.h:1068
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953
void Ins(const TSizeTy &ValN, const TVal &Val)
Inserts new element Val before the element at position ValN.
Definition: ds.h:1086
Definition: dt.h:412
TExpHelpObjV ObjV
Definition: exp.h:353

Here is the call graph for this function:

PExpHelpObj TExpHelp::GetObj ( const TStr ObjNm) const

Definition at line 1146 of file exp.cpp.

References TStr::GetUc(), TVec< TVal, TSizeTy >::Len(), and ObjV.

1146  {
1147  PExpHelpObj Obj;
1148  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
1149  if (ObjV[ObjN]->GetHdItem()->GetNm().GetUc()==ObjNm.GetUc()){
1150  return ObjV[ObjN];}
1151  }
1152  return NULL;
1153 }
TStr GetUc() const
Definition: dt.h:493
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
Definition: bd.h:196
TExpHelpObjV ObjV
Definition: exp.h:353

Here is the call graph for this function:

void TExpHelp::GetObjHdNmV ( const TStr CatNm,
TStrV ObjHdNmV 
) const

Definition at line 1135 of file exp.cpp.

References TVec< TVal, TSizeTy >::AddUnique(), TVec< TVal, TSizeTy >::Clr(), TStr::Empty(), TVec< TVal, TSizeTy >::Len(), ObjV, and TVec< TVal, TSizeTy >::Sort().

1135  {
1136  ObjHdNmV.Clr();
1137  for (int ObjN=0; ObjN<ObjV.Len(); ObjN++){
1138  TStr ObjCatNm=ObjV[ObjN]->GetCatNm();
1139  TStr ObjHdNm=ObjV[ObjN]->GetHdItem()->GetNm();
1140  if ((CatNm.Empty())||(CatNm=="All")||(CatNm==ObjCatNm)){
1141  ObjHdNmV.AddUnique(ObjHdNm);}
1142  }
1143  ObjHdNmV.Sort();
1144 }
TSizeTy AddUnique(const TVal &Val)
Adds element Val to a vector only if the element Val is not already in the vector.
Definition: ds.h:1068
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
void Clr(const bool &DoDel=true, const TSizeTy &NoDelLim=-1)
Clears the contents of the vector.
Definition: ds.h:953
void Sort(const bool &Asc=true)
Sorts the elements of the vector.
Definition: ds.h:1218
Definition: dt.h:412
bool Empty() const
Definition: dt.h:488
TExpHelpObjV ObjV
Definition: exp.h:353

Here is the call graph for this function:

static PExpHelp TExpHelp::Load ( TSIn SIn)
inlinestatic

Definition at line 359 of file exp.h.

359 {return PExpHelp(new TExpHelp(SIn));}
TExpHelp()
Definition: exp.h:355
TPt< TExpHelp > PExpHelp
Definition: exp.h:351
PExpHelp TExpHelp::LoadXml ( const PSIn SIn)
static

Definition at line 1084 of file exp.cpp.

References TVec< TVal, TSizeTy >::Add(), TExpHelpObj::GetObjTypeFromStr(), TXmlTok::GetTagTok(), TXmlTok::GetTagTokV(), TXmlTok::GetTokStr(), TVec< TVal, TSizeTy >::Len(), TXmlDoc::LoadTxt(), TExpHelpItem::New(), TExpHelpObj::New(), and New().

1084  {
1085  // create expression help
1086  PExpHelp ExpHelp=TExpHelp::New();
1087  // load xml with expression help
1088  PXmlDoc Doc=TXmlDoc::LoadTxt(SIn);
1089  // retrieve objects
1090  TXmlTokV ObjTokV; Doc->GetTagTokV("ExpHelp|Obj", ObjTokV);
1091  for (int ObjTokN=0; ObjTokN<ObjTokV.Len(); ObjTokN++){
1092  PXmlTok ObjTok=ObjTokV[ObjTokN];
1093  // type
1094  TStr TypeStr=ObjTok->GetTagTok("Type")->GetTokStr(false);
1095  // category
1096  TStr CatNm=ObjTok->GetTagTok("Cat")->GetTokStr(false);
1097  // header
1098  TStr HdNm=ObjTok->GetTagTok("Head|Name")->GetTokStr(false);
1099  TStr HdTypeStr=ObjTok->GetTagTok("Head|Type")->GetTokStr(false);
1100  TStr HdDescStr=ObjTok->GetTagTok("Head|Desc")->GetTokStr(false);
1101  PExpHelpItem HdItem=
1102  TExpHelpItem::New(HdNm, HdTypeStr, HdDescStr, "");
1103  // arguments
1104  TXmlTokV ArgTokV; ObjTok->GetTagTokV("Args|Arg", ArgTokV);
1105  TExpHelpItemV ArgItemV;
1106  for (int ArgTokN=0; ArgTokN<ArgTokV.Len(); ArgTokN++){
1107  PXmlTok ArgTok=ArgTokV[ArgTokN];
1108  // argument
1109  TStr ArgNm=ArgTok->GetTagTok("Name")->GetTokStr(false);
1110  TStr ArgTypeStr=ArgTok->GetTagTok("Type")->GetTokStr(false);
1111  TStr ArgDescStr=ArgTok->GetTagTok("Desc")->GetTokStr(false);
1112  TStr ArgDfValStr=ArgTok->GetTagTok("Default")->GetTokStr(false);
1113  PExpHelpItem ArgItem=
1114  TExpHelpItem::New(ArgNm, ArgTypeStr, ArgDescStr, ArgDfValStr);
1115  ArgItemV.Add(ArgItem);
1116  }
1117  // create & add object
1119  PExpHelpObj Obj=TExpHelpObj::New(Type, CatNm, HdItem, ArgItemV);
1120  ExpHelp->AddObj(Obj);
1121  }
1122  // return result
1123  return ExpHelp;
1124 }
TSizeTy Len() const
Returns the number of elements in the vector.
Definition: ds.h:535
static PExpHelpObj New(const TExpHelpObjType &Type, const TStr &CatNm, const PExpHelpItem &HdItem, const TExpHelpItemV &ArgItemV=TExpHelpItemV())
Definition: exp.h:320
static TExpHelpObjType GetObjTypeFromStr(const TStr &TypeStr)
Definition: exp.cpp:1074
static PExpHelp New()
Definition: exp.h:356
Definition: dt.h:412
static PXmlDoc LoadTxt(TXmlLx &Lx)
Definition: xml.cpp:1401
Definition: bd.h:196
static PExpHelpItem New(const TStr &Nm, const TStr &TypeStr, const TStr &DescStr, const TStr &DfValStr)
Definition: exp.h:284
TSizeTy Add()
Adds a new element at the end of the vector, after its current last element.
Definition: ds.h:559
TExpHelpObjType
Definition: exp.h:307

Here is the call graph for this function:

static PExpHelp TExpHelp::LoadXml ( const TStr FNm)
inlinestatic

Definition at line 366 of file exp.h.

References TFIn::New().

366  {
367  PSIn SIn=TFIn::New(FNm); return LoadXml(SIn);}
static PExpHelp LoadXml(const PSIn &SIn)
Definition: exp.cpp:1084
static PSIn New(const TStr &FNm)
Definition: fl.cpp:290
Definition: bd.h:196

Here is the call graph for this function:

static PExpHelp TExpHelp::New ( )
inlinestatic

Definition at line 356 of file exp.h.

Referenced by LoadXml().

356 {return PExpHelp(new TExpHelp());}
TExpHelp()
Definition: exp.h:355
TPt< TExpHelp > PExpHelp
Definition: exp.h:351

Here is the caller graph for this function:

TExpHelp& TExpHelp::operator= ( const TExpHelp )
inline

Definition at line 362 of file exp.h.

References Fail.

362 {Fail; return *this;}
#define Fail
Definition: bd.h:238
bool TExpHelp::operator== ( const TExpHelp ) const
inline

Definition at line 363 of file exp.h.

References Fail.

363 {Fail; return false;}
#define Fail
Definition: bd.h:238
void TExpHelp::Save ( TSOut SOut) const
inline

Definition at line 360 of file exp.h.

360 {ObjV.Save(SOut);}
void Save(TSOut &SOut) const
Definition: ds.h:885
TExpHelpObjV ObjV
Definition: exp.h:353

Friends And Related Function Documentation

friend class TPt< TExpHelp >
friend

Definition at line 351 of file exp.h.

Member Data Documentation

TCRef TExpHelp::CRef
private

Definition at line 351 of file exp.h.

TExpHelpObjV TExpHelp::ObjV
private

Definition at line 353 of file exp.h.

Referenced by GetCatNmV(), GetObj(), and GetObjHdNmV().


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