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

#include <dt.h>

Collaboration diagram for TUInt:

List of all members.

Public Member Functions

 TUInt ()
 TUInt (const uint &_Val)
 operator uint () const
 TUInt (TSIn &SIn)
void Load (TSIn &SIn)
void Save (TSOut &SOut) const
void LoadXml (const PXmlTok &XmlTok, const TStr &Nm)
void SaveXml (TSOut &SOut, const TStr &Nm) const
TUIntoperator= (const TUInt &UInt)
TUIntoperator= (const uint &_Val)
TUInt operator++ (int)
TUInt operator-- (int)
uint operator() () const
uintoperator() ()
TUIntoperator~ ()
TUIntoperator&= (const TUInt &UInt)
TUIntoperator|= (const TUInt &UInt)
TUIntoperator^= (const TUInt &UInt)
TUIntoperator>>= (const int &ShiftBits)
TUIntoperator<<= (const int &ShiftBits)
int GetMemUsed () const
int GetPrimHashCd () const
int GetSecHashCd () const
TStr GetStr () const

Static Public Member Functions

static uint GetRnd (const uint &Range=0)
static TStr GetStr (const uint &Val)
static TStr GetStr (const TInt &UInt)
static TStr GetStr (const uint &Val, const char *FmtStr)
static TStr GetStr (const uint &Val, const TStr &FmtStr)
static TStr GetKiloStr (const uint &Val)
static TStr GetMegaStr (const uint &Val)
static uint JavaUIntToCppUInt (const uint &JavaUInt)
static bool IsIpStr (const TStr &IpStr, uint &Ip, const char &SplitCh= '.')
static bool IsIpStr (const TStr &IpStr, const char &SplitCh= '.')
static uint GetUIntFromIpStr (const TStr &IpStr, const char &SplitCh= '.')
static TStr GetStrFromIpUInt (const uint &Ip)

Public Attributes

uint Val

Static Public Attributes

static const uint Mn = 0
static const uint Mx = UINT_MAX
static TRnd Rnd

Detailed Description

Definition at line 1130 of file dt.h.


Constructor & Destructor Documentation

TUInt::TUInt ( ) [inline]

Definition at line 1138 of file dt.h.

Referenced by GetMemUsed().

: Val(0){}

Here is the caller graph for this function:

TUInt::TUInt ( const uint _Val) [inline]

Definition at line 1139 of file dt.h.

: Val(_Val){}
TUInt::TUInt ( TSIn SIn) [inline, explicit]

Definition at line 1141 of file dt.h.

References TSIn::Load(), and Val.

{SIn.Load(Val);}

Here is the call graph for this function:


Member Function Documentation

static TStr TUInt::GetKiloStr ( const uint Val) [inline, static]

Definition at line 1179 of file dt.h.

References GetStr().

Referenced by GetMegaStr().

                                         {
    if (Val>100*1000){return GetStr(Val/1000)+"K";}
    else if (Val>1000){return GetStr(Val/1000)+"."+GetStr((Val%1000)/100)+"K";}
    else {return GetStr(Val);}}

Here is the call graph for this function:

Here is the caller graph for this function:

static TStr TUInt::GetMegaStr ( const uint Val) [inline, static]

Definition at line 1183 of file dt.h.

References GetKiloStr(), and GetStr().

                                         {
    if (Val>100*1000000){return GetStr(Val/1000000)+"M";}
    else if (Val>1000000){
      return GetStr(Val/1000000)+"."+GetStr((Val%1000000)/100000)+"M";}
    else {return GetKiloStr(Val);}}

Here is the call graph for this function:

int TUInt::GetMemUsed ( ) const [inline]

Definition at line 1163 of file dt.h.

References TUInt().

Referenced by TSecTm::GetMemUsed().

{return sizeof(TUInt);}

Here is the call graph for this function:

Here is the caller graph for this function:

int TUInt::GetPrimHashCd ( ) const [inline]

Definition at line 1165 of file dt.h.

References Val.

Referenced by TSecTm::GetPrimHashCd().

{return int(Val);}

Here is the caller graph for this function:

static uint TUInt::GetRnd ( const uint Range = 0) [inline, static]

Definition at line 1168 of file dt.h.

References TRnd::GetUniDevUInt(), and Rnd.

{return Rnd.GetUniDevUInt(Range);}

Here is the call graph for this function:

int TUInt::GetSecHashCd ( ) const [inline]

Definition at line 1166 of file dt.h.

References Val.

Referenced by TSecTm::GetSecHashCd().

{return Val/0x10;}

Here is the caller graph for this function:

static TStr TUInt::GetStr ( const uint Val) [inline, static]

Definition at line 1171 of file dt.h.

                                     {
    char Bf[255]; sprintf(Bf, "%u", Val); return TStr(Bf);}
static TStr TUInt::GetStr ( const TInt UInt) [inline, static]

Definition at line 1173 of file dt.h.

References GetStr(), and TInt::Val.

                                      {
    return GetStr(UInt.Val);}

Here is the call graph for this function:

TStr TUInt::GetStr ( const uint Val,
const char *  FmtStr 
) [static]

Definition at line 2055 of file dt.cpp.

References GetStr().

                                                     {
  if (FmtStr==NULL){
    return GetStr(Val);
  } else {
    char Bf[255];
    sprintf(Bf, FmtStr, Val);
    return TStr(Bf);
  }
}

Here is the call graph for this function:

static TStr TUInt::GetStr ( const uint Val,
const TStr FmtStr 
) [inline, static]

Definition at line 1176 of file dt.h.

References TStr::CStr(), and GetStr().

                                                         {
    return GetStr(Val, FmtStr.CStr());}

Here is the call graph for this function:

TStr TUInt::GetStrFromIpUInt ( const uint Ip) [static]

Definition at line 2085 of file dt.cpp.

References TStr::Fmt().

                                           {
  return TStr::Fmt("%d.%d.%d.%d", ((Ip>>24) & 0xFF),
   ((Ip>>16) & 0xFF), ((Ip>>8) & 0xFF), (Ip & 0xFF));
}

Here is the call graph for this function:

uint TUInt::GetUIntFromIpStr ( const TStr IpStr,
const char &  SplitCh = '.' 
) [static]

Definition at line 2075 of file dt.cpp.

References TStr::CStr(), EAssertR, TStr::Fmt(), and TStr::SplitOnAllCh().

                                                                   {
        TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV);
    uint Ip = 0; int Byte = 0;
        EAssertR(IpStrV[0].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (uint)Byte;
        EAssertR(IpStrV[1].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte;
        EAssertR(IpStrV[2].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte;
        EAssertR(IpStrV[3].IsInt(true, 0, 255, Byte), TStr::Fmt("Bad IP: '%s;", IpStr.CStr())); Ip = (Ip << 8) | (uint)Byte;
        return Ip;
}

Here is the call graph for this function:

bool TUInt::IsIpStr ( const TStr IpStr,
uint Ip,
const char &  SplitCh = '.' 
) [static]

Definition at line 2065 of file dt.cpp.

References TStr::SplitOnAllCh().

                                                                    {
        TStrV IpStrV; IpStr.SplitOnAllCh(SplitCh, IpStrV);
    Ip = 0; int Byte = 0;
        if (!IpStrV[0].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (uint)Byte;
        if (!IpStrV[1].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte;
        if (!IpStrV[2].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte;
        if (!IpStrV[3].IsInt(true, 0, 255, Byte)) { return false; }; Ip = (Ip << 8) | (uint)Byte;
        return true;
}

Here is the call graph for this function:

static bool TUInt::IsIpStr ( const TStr IpStr,
const char &  SplitCh = '.' 
) [inline, static]

Definition at line 1198 of file dt.h.

References IsIpStr().

Referenced by IsIpStr().

{ uint Ip; return IsIpStr(IpStr, Ip, SplitCh); }

Here is the call graph for this function:

Here is the caller graph for this function:

static uint TUInt::JavaUIntToCppUInt ( const uint JavaUInt) [inline, static]

Definition at line 1189 of file dt.h.

                                                     {
    uint B1=(JavaUInt & 0xFF000000) >> 24;
    uint B2=(JavaUInt & 0x00FF0000) >> 16;
    uint B3=(JavaUInt & 0x0000FF00) >> 8;
    uint B4=(JavaUInt & 0x000000FF) >> 0;
    uint CppUInt=(B4<<24)+(B3<<16)+(B2<<8)+(B1<<0);
    return CppUInt;}
void TUInt::Load ( TSIn SIn) [inline]

Definition at line 1142 of file dt.h.

References TSIn::Load(), and Val.

Referenced by TSecTm::Load().

{SIn.Load(Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TUInt::LoadXml ( const PXmlTok XmlTok,
const TStr Nm 
)

Definition at line 2046 of file dt.cpp.

References TXmlObjSer::GetIntArg(), Val, and XLoadHd.

                                                        {
  XLoadHd(Nm);
  Val=TXmlObjSer::GetIntArg(XmlTok, "Val");
}

Here is the call graph for this function:

TUInt::operator uint ( ) const [inline]

Definition at line 1140 of file dt.h.

References Val.

{return Val;}
TUInt& TUInt::operator&= ( const TUInt UInt) [inline]

Definition at line 1158 of file dt.h.

References Val.

{Val&=UInt.Val; return *this;}
uint TUInt::operator() ( ) const [inline]

Definition at line 1155 of file dt.h.

References Val.

{return Val;}
uint& TUInt::operator() ( ) [inline]

Definition at line 1156 of file dt.h.

References Val.

{return Val;}
TUInt TUInt::operator++ ( int  ) [inline]

Definition at line 1149 of file dt.h.

References Val.

{Val++; return *this;}
TUInt TUInt::operator-- ( int  ) [inline]

Definition at line 1150 of file dt.h.

References Val.

{Val--; return *this;}
TUInt& TUInt::operator<<= ( const int &  ShiftBits) [inline]

Definition at line 1162 of file dt.h.

References Val.

{Val<<=ShiftBits; return *this;}
TUInt& TUInt::operator= ( const TUInt UInt) [inline]

Definition at line 1147 of file dt.h.

References Val.

{Val=UInt.Val; return *this;}
TUInt& TUInt::operator= ( const uint _Val) [inline]

Definition at line 1148 of file dt.h.

References Val.

{Val=_Val; return *this;}
TUInt& TUInt::operator>>= ( const int &  ShiftBits) [inline]

Definition at line 1161 of file dt.h.

References Val.

{Val>>=ShiftBits; return *this;}
TUInt& TUInt::operator^= ( const TUInt UInt) [inline]

Definition at line 1160 of file dt.h.

References Val.

{Val^=UInt.Val; return *this;}
TUInt& TUInt::operator|= ( const TUInt UInt) [inline]

Definition at line 1159 of file dt.h.

References Val.

{Val|=UInt.Val; return *this;}
TUInt& TUInt::operator~ ( ) [inline]

Definition at line 1157 of file dt.h.

References Val.

{Val=~Val; return *this;}
void TUInt::Save ( TSOut SOut) const [inline]

Definition at line 1143 of file dt.h.

References TSOut::Save(), and Val.

Referenced by TSecTm::Save().

{SOut.Save(Val);}

Here is the call graph for this function:

Here is the caller graph for this function:

void TUInt::SaveXml ( TSOut SOut,
const TStr Nm 
) const

Definition at line 2051 of file dt.cpp.

References TInt::GetStr(), Val, and XSaveBETagArg.

                                                     {
  XSaveBETagArg(Nm, "Val", TInt::GetStr(Val));
}

Here is the call graph for this function:


Member Data Documentation

const uint TUInt::Mn = 0 [static]

Definition at line 1134 of file dt.h.

Referenced by TUniCodec::GetRndUint().

TRnd TUInt::Rnd [static]

Definition at line 1136 of file dt.h.

Referenced by GetRnd().


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