SNAP Library , User Reference
2013-01-07 14:03:36
SNAP, a general purpose, high performance system for analysis and manipulation of large networks
|
Go to the source code of this file.
Classes | |
class | TOnExeStop |
struct | TStaticAssert< true > |
struct | TStaticAssertTest< IntVal > |
class | TEq< T > |
class | TNEq< T > |
class | TLss< T > |
class | TLEq< T > |
class | TGtr< T > |
class | TGEq< T > |
class | TCmp< T > |
class | TCRef |
class | TPt< TRec > |
class | TSStr |
class | TConv_Pt64Ints32 |
Defines | |
#define | forever for(;;) |
#define | TSizeMx SIZE_MAX |
#define | ClassT(TNm) class TNm{ |
#define | ClassTV(TNm, TNmV) |
#define | ClassTVQ(TNm, TNmV, TNmQ) |
#define | ClassTP(TNm, PNm) |
#define | ClassHdTP(TNm, PNm) |
#define | ClassTPE(TNm, PNm, ENm) |
#define | ClassTPEE(TNm, PNm, ENm1, ENm2) |
#define | ClassTE(TNm, ENm) |
#define | ClassTPV(TNm, PNm, TNmV) |
#define | ClassHdTPV(TNm, PNm, TNmV) |
#define | ClassTPVL(TNm, PNm, TNmV, TNmL, TNmLN) |
#define | UndefDefaultCopyAssign(TNm) |
#define | UndefCopyAssign(TNm) |
#define | UndefCopy(TNm) |
#define | UndefAssign(TNm) |
#define | Fail ExeStop(NULL, NULL, "Fail", __FILE__, __LINE__) |
#define | FailR(Reason) ExeStop((Reason), NULL, "Fail", __FILE__, __LINE__) |
#define | FailRA(Reason, ArgStr) ExeStop((TStr(Reason)+" ("+ArgStr+")").CStr(), NULL, "Fail", __FILE__, __LINE__) |
#define | EFail TExcept::ThrowFull("", TStr("[")+ TStr(__FILE__) + " line " + TInt::GetStr(__LINE__) + "]") |
#define | EFailR(Reason) TExcept::ThrowFull(Reason, TStr("[")+TStr(__FILE__)+" line "+TInt::GetStr(__LINE__)+"]") |
#define | Assert(Cond) ((Cond) ? static_cast<void>(0) : ExeStop(NULL, NULL, #Cond, __FILE__, __LINE__)) |
#define | AssertR(Cond, Reason) |
#define | IAssert(Cond) ((Cond) ? static_cast<void>(0) : ExeStop(NULL, NULL, #Cond, __FILE__, __LINE__)) |
#define | IAssertR(Cond, Reason) ((Cond) ? static_cast<void>(0) : ExeStop(NULL, TStr(Reason).CStr(), #Cond, __FILE__, __LINE__)) |
#define | WAssert(Cond, MsgCStr) ((Cond) ? static_cast<void>(0) : WarnNotify(MsgCStr)) |
#define | SAssert(Cond) ((Cond) ? static_cast<void>(0) : ExeStop(TSysStr::GetLastMsgCStr(), NULL, #Cond, __FILE__, __LINE__)) |
#define | FAssert(Cond, MsgCStr) ((Cond) ? static_cast<void>(0) : ExeStop(TStr(MsgCStr).CStr(), NULL, NULL, __FILE__, __LINE__)) |
#define | FSAssert(Cond) ((Cond) ? static_cast<void>(0) : ExeStop(TSysStr::GetLastMsgCStr(), NULL, NULL, __FILE__, __LINE__)) |
#define | EAssert(Cond) ((Cond) ? static_cast<void>(0) : TExcept::ThrowFull(#Cond, TStr(__FILE__) + " line " + TInt::GetStr(__LINE__) +": "+ TStr(#Cond))) |
#define | EAssertR(Cond, MsgStr) ((Cond) ? static_cast<void>(0) : TExcept::ThrowFull(MsgStr, TStr(__FILE__)+" line "+TInt::GetStr(__LINE__)+": "+TStr(#Cond))) |
#define | EAssertRA(Cond, MsgStr, ArgStr) ((Cond) ? static_cast<void>(0) : TExcept::Throw(MsgStr, ArgStr)) |
#define | EAssertRAA(Cond, MsgStr, ArgStr1, ArgStr2) ((Cond) ? static_cast<void>(0) : TExcept::Throw(MsgStr, ArgStr1, ArgStr2)) |
#define | ESAssert(Cond) |
#define | CAssert(Cond) { typedef TStaticAssertTest<sizeof(TStaticAssert<(Cond)==0?false:true>)> TestStaticAssert; } |
#define | XLoadHd(Nm) |
#define | XLoad(Nm) Nm.LoadXml(XmlTok->GetTagTok(#Nm), #Nm); |
#define | XSaveHd(Nm) |
#define | XSaveHdArg(Nm, ArgNm, ArgVal) |
#define | XSaveBETag(Nm) |
#define | XSaveBETagArg(Nm, ArgNm, ArgVal) |
#define | XSaveBETagArg4(Nm, ArgNm1, ArgVal1, ArgNm2, ArgVal2, ArgNm3, ArgVal3, ArgNm4, ArgVal4) |
#define | XSave(Nm) Nm.SaveXml(SOut, #Nm) |
#define | XSaveToFile(Nm, FNm) {TFOut SOut(FNm); Nm.SaveXml(SOut, #Nm);} |
#define | min(a, b) ((a)<(b)?(a):(b)) |
#define | max(a, b) ((a)>(b)?(a):(b)) |
Typedefs | |
typedef unsigned char | uchar |
typedef unsigned int | uint |
typedef unsigned long | ulong |
typedef unsigned short | ushort |
typedef float | sdouble |
typedef long double | ldouble |
typedef FILE * | TFileId |
typedef char | int8 |
typedef short | int16 |
typedef int | int32 |
typedef long long | int64 |
typedef unsigned char | uint8 |
typedef unsigned short | uint16 |
typedef unsigned int | uint32 |
typedef unsigned long long | uint64 |
typedef ptrdiff_t | ssize_t |
typedef size_t | TSize |
typedef TPt< TXmlTok > | PXmlTok |
typedef TPt< TExcept > | PExcept |
typedef TPt< TXmlDoc > | PXmlDoc |
Enumerations | |
enum | TLoc { lUndef, lUs, lSi } |
enum | TLogOp { loUndef, loNot, loAnd, loOr } |
enum | TRelOp { roUndef, roLs, roLEq, roEq, roNEq, roGEq, roGt } |
Functions | |
void | WrNotify (const char *CaptionCStr, const char *NotifyCStr) |
void | SaveToErrLog (const char *MsgCStr) |
void | InfoNotify (const char *NotifyCStr) |
void | WarnNotify (const char *NotifyCStr) |
void | ErrNotify (const char *NotifyCStr) |
void | StatNotify (const char *NotifyCStr) |
void | ExeStop (const char *MsgStr, const char *ReasonStr, const char *CondStr, const char *FNm, const int &LnN) |
template<class TRec > | |
bool | IsXLoadFromFileOk (const TStr &FNm, const TStr &Nm, TRec &Rec, TStr &MsgStr) |
template<class TRec > | |
void | XLoadFromFile (const TStr &FNm, const TStr &Nm, TRec &Rec) |
template<class TRec > | |
bool | operator!= (const TRec &Rec1, const TRec &Rec2) |
template<class TRec > | |
bool | operator> (const TRec &Rec1, const TRec &Rec2) |
template<class TRec > | |
bool | operator<= (const TRec &Rec1, const TRec &Rec2) |
template<class TRec > | |
bool | operator>= (const TRec &Rec1, const TRec &Rec2) |
template<class TRec > | |
bool | Cmp (const int &RelOp, const TRec &Rec1, const TRec &Rec2) |
template<class TRec > | |
void | Swap (TRec &Rec1, TRec &Rec2) |
#define AssertR | ( | Cond, | |
Reason | |||
) |
#define CAssert | ( | Cond | ) | { typedef TStaticAssertTest<sizeof(TStaticAssert<(Cond)==0?false:true>)> TestStaticAssert; } |
#define ClassHdTP | ( | TNm, | |
PNm | |||
) |
#define ClassHdTPV | ( | TNm, | |
PNm, | |||
TNmV | |||
) |
#define ClassTE | ( | TNm, | |
ENm | |||
) |
#define ClassTP | ( | TNm, | |
PNm | |||
) |
#define ClassTPE | ( | TNm, | |
PNm, | |||
ENm | |||
) |
#define ClassTPEE | ( | TNm, | |
PNm, | |||
ENm1, | |||
ENm2 | |||
) |
#define ClassTPV | ( | TNm, | |
PNm, | |||
TNmV | |||
) |
#define ClassTPVL | ( | TNm, | |
PNm, | |||
TNmV, | |||
TNmL, | |||
TNmLN | |||
) |
#define ClassTV | ( | TNm, | |
TNmV | |||
) |
#define ClassTVQ | ( | TNm, | |
TNmV, | |||
TNmQ | |||
) |
class TNm; \ typedef TVec<TNm> TNmV; \ typedef TQQueue<TNm> TNmQ; \ class TNm{
#define EAssert | ( | Cond | ) | ((Cond) ? static_cast<void>(0) : TExcept::ThrowFull(#Cond, TStr(__FILE__) + " line " + TInt::GetStr(__LINE__) +": "+ TStr(#Cond))) |
#define EAssertR | ( | Cond, | |
MsgStr | |||
) | ((Cond) ? static_cast<void>(0) : TExcept::ThrowFull(MsgStr, TStr(__FILE__)+" line "+TInt::GetStr(__LINE__)+": "+TStr(#Cond))) |
#define EAssertRA | ( | Cond, | |
MsgStr, | |||
ArgStr | |||
) | ((Cond) ? static_cast<void>(0) : TExcept::Throw(MsgStr, ArgStr)) |
#define EAssertRAA | ( | Cond, | |
MsgStr, | |||
ArgStr1, | |||
ArgStr2 | |||
) | ((Cond) ? static_cast<void>(0) : TExcept::Throw(MsgStr, ArgStr1, ArgStr2)) |
#define EFail TExcept::ThrowFull("", TStr("[")+ TStr(__FILE__) + " line " + TInt::GetStr(__LINE__) + "]") |
#define EFailR | ( | Reason | ) | TExcept::ThrowFull(Reason, TStr("[")+TStr(__FILE__)+" line "+TInt::GetStr(__LINE__)+"]") |
#define ESAssert | ( | Cond | ) |
((Cond) ? static_cast<void>(0) : TExcept::Throw(TSysStr::GetLastMsgCStr(), \ TStr(__FILE__) + " line " + TInt::GetStr(__LINE__) +": "+ TStr(#Cond)))
#define UndefAssign | ( | TNm | ) |
#define UndefCopyAssign | ( | TNm | ) |
#define UndefDefaultCopyAssign | ( | TNm | ) |
#define WAssert | ( | Cond, | |
MsgCStr | |||
) | ((Cond) ? static_cast<void>(0) : WarnNotify(MsgCStr)) |
#define XLoadHd | ( | Nm | ) |
{TStr TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSer::AssertXmlHd(XmlTok, Nm, TypeNm);}
#define XSaveBETag | ( | Nm | ) |
TStr _TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSerTagNm XmlObjSerTagNm(SOut, true, Nm, _TypeNm);
#define XSaveBETagArg | ( | Nm, | |
ArgNm, | |||
ArgVal | |||
) |
TStr _TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSerTagNm XmlObjSerTagNm(SOut, true, Nm, _TypeNm, ArgNm, ArgVal);
#define XSaveBETagArg4 | ( | Nm, | |
ArgNm1, | |||
ArgVal1, | |||
ArgNm2, | |||
ArgVal2, | |||
ArgNm3, | |||
ArgVal3, | |||
ArgNm4, | |||
ArgVal4 | |||
) |
TStr _TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSerTagNm XmlObjSerTagNm(SOut, true, Nm, _TypeNm, ArgNm1, ArgVal1, ArgNm2, ArgVal2, ArgNm3, ArgVal3, ArgNm4, ArgVal4);
#define XSaveHd | ( | Nm | ) |
TStr _TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSerTagNm XmlObjSerTagNm(SOut, false, Nm, _TypeNm);
#define XSaveHdArg | ( | Nm, | |
ArgNm, | |||
ArgVal | |||
) |
TStr _TypeNm=TXmlObjSer::GetTagNm(TStr(typeid(*this).name())); \ TXmlObjSerTagNm XmlObjSerTagNm(SOut, false, Nm, _TypeNm, ArgNm, ArgVal);
#define XSaveToFile | ( | Nm, | |
FNm | |||
) | {TFOut SOut(FNm); Nm.SaveXml(SOut, #Nm);} |
enum TLogOp |
enum TRelOp |
bool Cmp | ( | const int & | RelOp, |
const TRec & | Rec1, | ||
const TRec & | Rec2 | ||
) |
void ErrNotify | ( | const char * | NotifyCStr | ) | [inline] |
void ExeStop | ( | const char * | MsgStr, |
const char * | ReasonStr, | ||
const char * | CondStr, | ||
const char * | FNm, | ||
const int & | LnN | ||
) |
Definition at line 65 of file bd.cpp.
{ char ReasonMsgCStr[1000]; // stack dump, works for g++ //void *array[20]; //size_t size; // get the trace and print it out //size = backtrace(array, 20); //backtrace_symbols_fd(array, size, 2); // construct reason message if (ReasonCStr==NULL){ReasonMsgCStr[0]=0;} else {sprintf(ReasonMsgCStr, " [Reason:'%s']", ReasonCStr);} // construct full message char FullMsgCStr[1000]; if (MsgCStr==NULL){ if (CondCStr==NULL){ sprintf(FullMsgCStr, "Execution stopped%s!", ReasonMsgCStr); } else { sprintf(FullMsgCStr, "Execution stopped: %s%s, file %s, line %d", CondCStr, ReasonMsgCStr, FNm, LnN); } } else { if (CondCStr==NULL){ sprintf(FullMsgCStr, "%s\nExecution stopped!", MsgCStr); } else { sprintf(FullMsgCStr, "Message: %s%s\nExecution stopped: %s, file %s, line %d", MsgCStr, ReasonMsgCStr, CondCStr, FNm, LnN); } } // report full message to log file SaveToErrLog(FullMsgCStr); // report to screen & stop execution bool Continue=false; // call handler if (TOnExeStop::IsOnExeStopF()){ Continue=!((*TOnExeStop::GetOnExeStopF())(FullMsgCStr));} if (!Continue){ ErrNotify(FullMsgCStr); #ifdef GLib_WIN32 abort(); //ExitProcess(1); #else exit(1); #endif } }
void InfoNotify | ( | const char * | NotifyCStr | ) | [inline] |
bool IsXLoadFromFileOk | ( | const TStr & | FNm, |
const TStr & | Nm, | ||
TRec & | Rec, | ||
TStr & | MsgStr | ||
) |
Definition at line 45 of file xmlser.h.
{ bool Ok=true; try { PXmlDoc XmlDoc=TXmlDoc::LoadTxt(FNm); if (XmlDoc->IsOk()){ PXmlTok XmlTok=XmlDoc->GetTok(); Rec.LoadXml(XmlTok, Nm); } else { Ok=false; MsgStr=XmlDoc->GetMsgStr(); } } catch (PExcept Except){ Ok=false; MsgStr=Except->GetMsgStr(); } return Ok; }
bool operator!= | ( | const TRec & | Rec1, |
const TRec & | Rec2 | ||
) |
bool operator<= | ( | const TRec & | Rec1, |
const TRec & | Rec2 | ||
) |
bool operator> | ( | const TRec & | Rec1, |
const TRec & | Rec2 | ||
) |
bool operator>= | ( | const TRec & | Rec1, |
const TRec & | Rec2 | ||
) |
void SaveToErrLog | ( | const char * | MsgCStr | ) |
Definition at line 47 of file bd.cpp.
{ int MxFNmLen=1000; char* FNm=new char[MxFNmLen]; if (FNm==NULL){return;} int FNmLen=GetModuleFileName(NULL, FNm, MxFNmLen); if (FNmLen==0){return;} FNm[FNmLen++]='.'; FNm[FNmLen++]='E'; FNm[FNmLen++]='r'; FNm[FNmLen++]='r'; FNm[FNmLen++]=char(0); time_t Time=time(NULL); FILE* fOut=fopen(FNm, "a+b"); if (fOut==NULL){return;} fprintf(fOut, "--------\r\n%s\r\n%s%s\r\n--------\r\n", FNm, ctime(&Time), MsgCStr); fclose(fOut); delete[] FNm; }
void StatNotify | ( | const char * | NotifyCStr | ) | [inline] |
void Swap | ( | TRec & | Rec1, |
TRec & | Rec2 | ||
) |
void WarnNotify | ( | const char * | NotifyCStr | ) | [inline] |
void WrNotify | ( | const char * | CaptionCStr, |
const char * | NotifyCStr | ||
) |
void XLoadFromFile | ( | const TStr & | FNm, |
const TStr & | Nm, | ||
TRec & | Rec | ||
) |
Definition at line 63 of file xmlser.h.
{ TStr MsgStr; if (!IsXLoadFromFileOk(FNm, Nm, Rec, MsgStr)){ TExcept::Throw(MsgStr); } }