00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef __YATECLASS_H
00026 #define __YATECLASS_H
00027
00028 #ifndef __cplusplus
00029 #error C++ is required
00030 #endif
00031
00032 #include <sys/types.h>
00033 #include <stddef.h>
00034 #include <unistd.h>
00035 #include <errno.h>
00036
00037 #ifndef _WORDSIZE
00038 #if defined(__arch64__) || defined(__x86_64__) \
00039 || defined(__amd64__) || defined(__ia64__) \
00040 || defined(__alpha__) || defined(__sparcv9)
00041 #define _WORDSIZE 64
00042 #else
00043 #define _WORDSIZE 32
00044 #endif
00045 #endif
00046
00047 #ifndef _WINDOWS
00048 #if defined(WIN32) || defined(_WIN32)
00049 #define _WINDOWS
00050 #endif
00051 #endif
00052
00053 #ifdef _WINDOWS
00054
00055 #include <windows.h>
00056 #include <io.h>
00057 #include <direct.h>
00058
00062 typedef signed __int8 int8_t;
00063 typedef unsigned __int8 u_int8_t;
00064 typedef unsigned __int8 uint8_t;
00065 typedef signed __int16 int16_t;
00066 typedef unsigned __int16 u_int16_t;
00067 typedef unsigned __int16 uint16_t;
00068 typedef signed __int32 int32_t;
00069 typedef unsigned __int32 u_int32_t;
00070 typedef unsigned __int32 uint32_t;
00071 typedef signed __int64 int64_t;
00072 typedef unsigned __int64 u_int64_t;
00073 typedef unsigned __int64 uint64_t;
00074
00075 typedef int pid_t;
00076 typedef int socklen_t;
00077 typedef unsigned long in_addr_t;
00078
00079 #ifndef strcasecmp
00080 #define strcasecmp _stricmp
00081 #endif
00082
00083 #ifndef strncasecmp
00084 #define strncasecmp _strnicmp
00085 #endif
00086
00087 #define vsnprintf _vsnprintf
00088 #define snprintf _snprintf
00089 #define strdup _strdup
00090 #define open _open
00091 #define dup2 _dup2
00092 #define read _read
00093 #define write _write
00094 #define close _close
00095 #define getpid _getpid
00096 #define chdir _chdir
00097 #define mkdir(p,m) _mkdir(p)
00098 #define unlink _unlink
00099
00100 #define O_RDWR _O_RDWR
00101 #define O_RDONLY _O_RDONLY
00102 #define O_WRONLY _O_WRONLY
00103 #define O_APPEND _O_APPEND
00104 #define O_BINARY _O_BINARY
00105 #define O_EXCL _O_EXCL
00106 #define O_CREAT _O_CREAT
00107 #define O_TRUNC _O_TRUNC
00108 #define O_NOCTTY 0
00109
00110 #define S_IRUSR _S_IREAD
00111 #define S_IWUSR _S_IWRITE
00112 #define S_IXUSR 0
00113 #define S_IRWXU (_S_IREAD|_S_IWRITE)
00114
00115 #ifdef LIBYATE_EXPORTS
00116 #define YATE_API __declspec(dllexport)
00117 #else
00118 #ifndef LIBYATE_STATIC
00119 #define YATE_API __declspec(dllimport)
00120 #endif
00121 #endif
00122
00123 #define FMT64 "%I64d"
00124 #define FMT64U "%I64u"
00125
00126 #else
00127
00128 #include <sys/time.h>
00129 #include <sys/socket.h>
00130
00131 #if defined(__FreeBSD__)
00132 #include <netinet/in_systm.h>
00133 #endif
00134
00135 #include <netinet/in.h>
00136 #include <netinet/ip.h>
00137 #include <netinet/tcp.h>
00138 #include <arpa/inet.h>
00139 #include <netdb.h>
00140
00144 #ifndef SOCKET
00145 typedef int SOCKET;
00146 #endif
00147 #ifndef HANDLE
00148 typedef int HANDLE;
00149 #endif
00150
00151 #ifndef O_BINARY
00152 #define O_BINARY 0
00153 #endif
00154
00155 #if _WORDSIZE == 64
00156 #define FMT64 "%ld"
00157 #define FMT64U "%lu"
00158 #else
00159 #define FMT64 "%lld"
00160 #define FMT64U "%llu"
00161 #endif
00162
00163 #endif
00164
00165 #ifndef IPTOS_LOWDELAY
00166 #define IPTOS_LOWDELAY 0x10
00167 #define IPTOS_THROUGHPUT 0x08
00168 #define IPTOS_RELIABILITY 0x04
00169 #define IPTOS_MINCOST 0x02
00170 #endif
00171
00172 #ifndef YATE_API
00173 #define YATE_API
00174 #endif
00175
00176 #ifdef _WINDOWS
00177 #undef RAND_MAX
00178 #define RAND_MAX 2147483647
00179 extern "C" {
00180 YATE_API long int random();
00181 YATE_API void srandom(unsigned int seed);
00182 }
00183 #endif
00184
00188 namespace TelEngine {
00189
00190 #ifdef HAVE_GCC_FORMAT_CHECK
00191 #define FORMAT_CHECK(f) __attribute__((format(printf,(f),(f)+1)))
00192 #else
00193 #define FORMAT_CHECK(f)
00194 #endif
00195
00200 YATE_API void abortOnBug();
00201
00206 YATE_API bool abortOnBug(bool doAbort);
00207
00213 enum DebugLevel {
00214 DebugFail = 0,
00215 DebugGoOn = 2,
00216 DebugStub = 4,
00217 DebugWarn = 5,
00218 DebugMild = 6,
00219 DebugCall = 7,
00220 DebugNote = 8,
00221 DebugInfo = 9,
00222 DebugAll = 10
00223 };
00224
00229 YATE_API int debugLevel();
00230
00236 YATE_API int debugLevel(int level);
00237
00243 YATE_API bool debugAt(int level);
00244
00251 YATE_API const char* debugColor(int level);
00252
00258 class YATE_API DebugEnabler
00259 {
00260 public:
00266 inline DebugEnabler(int level = TelEngine::debugLevel(), bool enabled = true)
00267 : m_level(DebugFail), m_enabled(enabled), m_chain(0), m_name(0)
00268 { debugLevel(level); }
00269
00270 inline ~DebugEnabler()
00271 { m_name = 0; m_chain = 0; }
00272
00277 inline int debugLevel() const
00278 { return m_chain ? m_chain->debugLevel() : m_level; }
00279
00285 int debugLevel(int level);
00286
00291 inline bool debugEnabled() const
00292 { return m_chain ? m_chain->debugEnabled() : m_enabled; }
00293
00298 inline void debugEnabled(bool enable)
00299 { m_enabled = enable; m_chain = 0; }
00300
00305 inline const char* debugName() const
00306 { return m_name; }
00307
00313 bool debugAt(int level) const;
00314
00319 inline bool debugChained() const
00320 { return m_chain != 0; }
00321
00326 inline void debugChain(const DebugEnabler* chain = 0)
00327 { m_chain = (chain != this) ? chain : 0; }
00328
00333 void debugCopy(const DebugEnabler* original = 0);
00334
00335 protected:
00340 inline void debugName(const char* name)
00341 { m_name = name; }
00342
00343 private:
00344 int m_level;
00345 bool m_enabled;
00346 const DebugEnabler* m_chain;
00347 const char* m_name;
00348 };
00349
00350 #if 0
00351
00356 void DDebug(int level, const char* format, ...);
00357
00363 void DDebug(const char* facility, int level, const char* format, ...);
00364
00370 void DDebug(const DebugEnabler* local, int level, const char* format, ...);
00371
00377 void XDebug(int level, const char* format, ...);
00378
00384 void XDebug(const char* facility, int level, const char* format, ...);
00385
00391 void XDebug(const DebugEnabler* local, int level, const char* format, ...);
00392
00398 void NDebug(int level, const char* format, ...);
00399
00405 void NDebug(const char* facility, int level, const char* format, ...);
00406
00412 void NDebug(const DebugEnabler* local, int level, const char* format, ...);
00413 #endif
00414
00415 #ifdef _DEBUG
00416 #undef DEBUG
00417 #define DEBUG
00418 #endif
00419
00420 #ifdef XDEBUG
00421 #undef DEBUG
00422 #define DEBUG
00423 #endif
00424
00425 #ifdef DEBUG
00426 #define DDebug Debug
00427 #else
00428 #ifdef _WINDOWS
00429 #define DDebug
00430 #else
00431 #define DDebug(arg...)
00432 #endif
00433 #endif
00434
00435 #ifdef XDEBUG
00436 #define XDebug Debug
00437 #else
00438 #ifdef _WINDOWS
00439 #define XDebug
00440 #else
00441 #define XDebug(arg...)
00442 #endif
00443 #endif
00444
00445 #ifndef NDEBUG
00446 #define NDebug Debug
00447 #else
00448 #ifdef _WINDOWS
00449 #define NDebug
00450 #else
00451 #define NDebug(arg...)
00452 #endif
00453 #endif
00454
00460 YATE_API void Debug(int level, const char* format, ...) FORMAT_CHECK(2);
00461
00468 YATE_API void Debug(const char* facility, int level, const char* format, ...) FORMAT_CHECK(3);
00469
00476 YATE_API void Debug(const DebugEnabler* local, int level, const char* format, ...) FORMAT_CHECK(3);
00477
00482 YATE_API void Output(const char* format, ...) FORMAT_CHECK(1);
00483
00490 class YATE_API Debugger
00491 {
00492 public:
00496 enum Formatting {
00497 None = 0,
00498 Relative,
00499 Absolute,
00500 Textual,
00501 };
00502
00508 Debugger(const char* name, const char* format = 0, ...);
00509
00516 Debugger(int level, const char* name, const char* format = 0, ...);
00517
00521 ~Debugger();
00522
00527 static void setOutput(void (*outFunc)(const char*,int) = 0);
00528
00533 static void setIntOut(void (*outFunc)(const char*,int) = 0);
00534
00540 static void enableOutput(bool enable = true, bool colorize = false);
00541
00546 static void setFormatting(Formatting format);
00547
00548 private:
00549 const char* m_name;
00550 };
00551
00556 struct TokenDict {
00560 const char* token;
00561
00565 int value;
00566 };
00567
00568 class String;
00569 class Mutex;
00570
00571 #if 0
00572
00577 void YCLASS(class type,class base);
00578
00584 void YCLASSIMP(class type,class base);
00585
00592 class* YOBJECT(class type,GenObject* pntr);
00593 #endif
00594
00595 #define YCLASS(type,base) \
00596 public: virtual void* getObject(const String& name) const \
00597 { return (name == #type) ? const_cast<type*>(this) : base::getObject(name); }
00598
00599 #define YCLASSIMP(type,base) \
00600 void* type::getObject(const String& name) const \
00601 { return (name == #type) ? const_cast<type*>(this) : base::getObject(name); }
00602
00603 #define YOBJECT(type,pntr) (static_cast<type*>((pntr) ? (pntr)->getObject(#type) : 0))
00604
00608 class YATE_API GenObject
00609 {
00610 public:
00614 virtual ~GenObject() { }
00615
00622 virtual bool alive() const;
00623
00627 virtual void destruct();
00628
00635 virtual const String& toString() const;
00636
00642 virtual void* getObject(const String& name) const;
00643 };
00644
00650 inline void destruct(GenObject* obj)
00651 { if (obj) obj->destruct(); }
00652
00659 template <class Obj> void destruct(Obj*& obj)
00660 { if (obj) { obj->destruct(); obj = 0; } }
00661
00666 class YATE_API RefObject : public GenObject
00667 {
00668 public:
00673 RefObject()
00674 : m_refcount(1) { }
00675
00679 virtual ~RefObject();
00680
00687 virtual bool alive() const;
00688
00693 bool ref();
00694
00703 bool deref();
00704
00709 inline int refcount() const
00710 { return m_refcount; }
00711
00716 virtual void destruct();
00717
00722 static Mutex& refMutex();
00723
00724 protected:
00730 virtual void zeroRefs();
00731
00740 virtual bool zeroRefsTest();
00741
00747 bool refInternal();
00748
00754 bool resurrect();
00755
00761 virtual void destroyed();
00762
00763 private:
00764 int m_refcount;
00765 };
00766
00772 class YATE_API RefPointerBase
00773 {
00774 protected:
00778 inline RefPointerBase()
00779 : m_pointer(0) { }
00780
00787 void assign(RefObject* oldptr, RefObject* newptr, void* pointer);
00788
00792 void* m_pointer;
00793 };
00794
00798 template <class Obj = RefObject> class RefPointer : public RefPointerBase
00799 {
00800 protected:
00805 inline Obj* pointer() const
00806 { return static_cast<Obj*>(m_pointer); }
00807
00812 inline void assign(Obj* object = 0)
00813 { RefPointerBase::assign(pointer(),object,object); }
00814
00815 public:
00819 inline RefPointer()
00820 { }
00821
00826 inline RefPointer(const RefPointer<Obj>& value)
00827 { assign(value); }
00828
00833 inline RefPointer(Obj* object)
00834 { assign(object); }
00835
00839 inline ~RefPointer()
00840 { assign(); }
00841
00845 inline RefPointer<Obj>& operator=(const RefPointer<Obj>& value)
00846 { assign(value.pointer()); return *this; }
00847
00851 inline RefPointer<Obj>& operator=(Obj* object)
00852 { assign(object); return *this; }
00853
00858 inline operator Obj*() const
00859 { return pointer(); }
00860
00864 inline Obj* operator->() const
00865 { return pointer(); }
00866
00870 inline Obj& operator*() const
00871 { return *pointer(); }
00872 };
00873
00877 template <class Obj = GenObject> class GenPointer : public GenObject
00878 {
00879 private:
00883 Obj* m_pointer;
00884
00885 public:
00889 inline GenPointer()
00890 : m_pointer(0)
00891 { }
00892
00897 inline GenPointer(const GenPointer<Obj>& value)
00898 : m_pointer(value)
00899 { }
00900
00905 inline GenPointer(Obj* object)
00906 : m_pointer(object)
00907 { }
00908
00912 inline GenPointer<Obj>& operator=(const GenPointer<Obj>& value)
00913 { m_pointer = value; return *this; }
00914
00918 inline GenPointer<Obj>& operator=(Obj* object)
00919 { m_pointer = object; return *this; }
00920
00925 inline operator Obj*() const
00926 { return m_pointer; }
00927
00931 inline Obj* operator->() const
00932 { return m_pointer; }
00933
00937 inline Obj& operator*() const
00938 { return *m_pointer; }
00939 };
00940
00945 class YATE_API ObjList : public GenObject
00946 {
00947 public:
00951 ObjList();
00952
00956 virtual ~ObjList();
00957
00963 virtual void* getObject(const String& name) const;
00964
00969 unsigned int length() const;
00970
00975 unsigned int count() const;
00976
00981 inline GenObject* get() const
00982 { return m_obj; }
00983
00990 GenObject* set(const GenObject* obj, bool delold = true);
00991
00996 inline ObjList* next() const
00997 { return m_next; }
00998
01003 ObjList* last() const;
01004
01009 ObjList* skipNull() const;
01010
01015 ObjList* skipNext() const;
01016
01022 ObjList* operator+(int index) const;
01023
01029 GenObject* operator[](int index) const;
01030
01036 GenObject* operator[](const String& str) const;
01037
01043 ObjList* find(const GenObject* obj) const;
01044
01050 ObjList* find(const String& str) const;
01051
01058 ObjList* insert(const GenObject* obj, bool compact = true);
01059
01066 ObjList* append(const GenObject* obj, bool compact = true);
01067
01073 GenObject* remove(bool delobj = true);
01074
01081 GenObject* remove(GenObject* obj, bool delobj = true);
01082
01086 void clear();
01087
01092 inline bool autoDelete()
01093 { return m_delete; }
01094
01099 inline void setDelete(bool autodelete)
01100 { m_delete = autodelete; }
01101
01102 private:
01103 ObjList* m_next;
01104 GenObject* m_obj;
01105 bool m_delete;
01106 };
01107
01116 class YATE_API Array : public RefObject
01117 {
01118 public:
01124 Array(int columns = 0, int rows = 0);
01125
01129 virtual ~Array();
01130
01136 virtual void* getObject(const String& name) const;
01137
01144 bool addRow(ObjList* row = 0, int index = -1);
01145
01152 bool addColumn(ObjList* column = 0, int index = -1);
01153
01159 bool delRow(int index);
01160
01166 bool delColumn(int index);
01167
01174 GenObject* get(int column, int row) const;
01175
01183 bool set(GenObject* obj, int column, int row);
01184
01189 inline int getRows() const
01190 { return m_rows; }
01191
01196 inline int getColumns() const
01197 { return m_columns; }
01198
01199 private:
01200 int m_rows;
01201 int m_columns;
01202 ObjList m_obj;
01203 };
01204
01205 class Regexp;
01206 class StringMatchPrivate;
01207
01215 class YATE_API String : public GenObject
01216 {
01217 public:
01221 String();
01222
01228 String(const char* value, int len = -1);
01229
01235 String(char value, unsigned int repeat = 1);
01236
01241 String(int value);
01242
01247 String(unsigned int value);
01248
01253 String(bool value);
01254
01259 String(const String& value);
01260
01265 String(const String* value);
01266
01270 virtual ~String();
01271
01277 virtual void* getObject(const String& name) const;
01278
01282 static const String& empty();
01283
01289 inline static const char* boolText(bool value)
01290 { return value ? "true" : "false"; }
01291
01296 inline const char* c_str() const
01297 { return m_string; }
01298
01303 inline const char* safe() const
01304 { return m_string ? m_string : ""; }
01305
01310 inline unsigned int length() const
01311 { return m_length; }
01312
01317 inline bool null() const
01318 { return !m_string; }
01319
01324 unsigned int hash() const;
01325
01330 static unsigned int hash(const char* value);
01331
01335 void clear();
01336
01342 char at(int index) const;
01343
01350 String substr(int offs, int len = -1) const;
01351
01355 String& trimBlanks();
01356
01361 virtual const String& toString() const;
01362
01369 int toInteger(int defvalue = 0, int base = 0) const;
01370
01378 int toInteger(const TokenDict* tokens, int defvalue = 0, int base = 0) const;
01379
01385 double toDouble(double defvalue = 0.0) const;
01386
01392 bool toBoolean(bool defvalue = false) const;
01393
01398 bool isBoolean() const;
01399
01404 String& toUpper();
01405
01410 String& toLower();
01411
01417 inline char operator[](int index) const
01418 { return at(index); }
01419
01424 inline operator const char*() const
01425 { return m_string; };
01426
01433 String& assign(const char* value, int len = -1);
01434
01441 String& assign(char value, unsigned int repeat = 1);
01442
01451 String& hexify(void* data, unsigned int len, char sep = 0, bool upCase = false);
01452
01456 inline String& operator=(const String& value)
01457 { return operator=(value.c_str()); }
01458
01463 inline String& operator=(const String* value)
01464 { return operator=(value ? value->c_str() : ""); }
01465
01470 String& operator=(const char* value);
01471
01475 String& operator=(char value);
01476
01480 String& operator=(int value);
01481
01485 String& operator=(unsigned int value);
01486
01490 inline String& operator=(bool value)
01491 { return operator=(boolText(value)); }
01492
01497 String& operator+=(const char* value);
01498
01502 String& operator+=(char value);
01503
01507 String& operator+=(int value);
01508
01512 String& operator+=(unsigned int value);
01513
01517 inline String& operator+=(bool value)
01518 { return operator+=(boolText(value)); }
01519
01523 bool operator==(const char* value) const;
01524
01528 bool operator!=(const char* value) const;
01529
01533 bool operator==(const String& value) const;
01534
01538 bool operator!=(const String& value) const;
01539
01543 bool operator&=(const char* value) const;
01544
01548 bool operator|=(const char* value) const;
01549
01553 inline String& operator<<(const char* value)
01554 { return operator+=(value); }
01555
01559 inline String& operator<<(char value)
01560 { return operator+=(value); }
01561
01565 inline String& operator<<(int value)
01566 { return operator+=(value); }
01567
01571 inline String& operator<<(unsigned int value)
01572 { return operator+=(value); }
01573
01577 inline String& operator<<(bool value)
01578 { return operator+=(value); }
01579
01584 String& operator>>(const char* skip);
01585
01589 String& operator>>(char& store);
01590
01594 String& operator>>(int& store);
01595
01599 String& operator>>(unsigned int& store);
01600
01604 String& operator>>(bool& store);
01605
01612 String& append(const char* value, const char* separator = 0, bool force = false);
01613
01620 String& append(const ObjList* list, const char* separator = 0, bool force = false);
01621
01628 inline String& append(const ObjList& list, const char* separator = 0, bool force = false)
01629 { return append(&list,separator,force); }
01630
01636 String& append(double value, unsigned int decimals = 3);
01637
01644 int find(char what, unsigned int offs = 0) const;
01645
01652 int find(const char* what, unsigned int offs = 0) const;
01653
01659 int rfind(char what) const;
01660
01668 bool startsWith(const char* what, bool wordBreak = false, bool caseInsensitive = false) const;
01669
01677 bool endsWith(const char* what, bool wordBreak = false, bool caseInsensitive = false) const;
01678
01690 bool startSkip(const char* what, bool wordBreak = true, bool caseInsensitive = false);
01691
01697 virtual bool matches(const String& value) const
01698 { return operator==(value); }
01699
01705 bool matches(Regexp& rexp);
01706
01712 int matchOffset(int index = 0) const;
01713
01719 int matchLength(int index = 0) const;
01720
01726 inline String matchString(int index = 0) const
01727 { return substr(matchOffset(index),matchLength(index)); }
01728
01734 String replaceMatches(const String& templ) const;
01735
01740 int matchCount() const;
01741
01748 ObjList* split(char separator, bool emptyOK = true) const;
01749
01756 static String msgEscape(const char* str, char extraEsc = 0);
01757
01763 inline String msgEscape(char extraEsc = 0) const
01764 { return msgEscape(c_str(),extraEsc); }
01765
01773 static String msgUnescape(const char* str, int* errptr = 0, char extraEsc = 0);
01774
01781 inline String msgUnescape(int* errptr = 0, char extraEsc = 0) const
01782 { return msgUnescape(c_str(),errptr,extraEsc); }
01783
01790 static String sqlEscape(const char* str, char extraEsc = 0);
01791
01797 inline String sqlEscape(char extraEsc = 0) const
01798 { return sqlEscape(c_str(),extraEsc); }
01799
01806 static String uriEscape(const char* str, char extraEsc = 0);
01807
01813 inline String uriEscape(char extraEsc = 0) const
01814 { return uriEscape(c_str(),extraEsc); }
01815
01822 static String uriUnescape(const char* str, int* errptr = 0);
01823
01829 inline String uriUnescape(int* errptr = 0) const
01830 { return uriUnescape(c_str(),errptr); }
01831
01832 protected:
01836 virtual void changed();
01837
01838 private:
01839 void clearMatches();
01840 char* m_string;
01841 unsigned int m_length;
01842
01843 mutable unsigned int m_hash;
01844 StringMatchPrivate* m_matches;
01845 };
01846
01852 inline const char *c_safe(const char* str)
01853 { return str ? str : ""; }
01854
01860 inline bool null(const char* str)
01861 { return !(str && *str); }
01862
01866 YATE_API String operator+(const String& s1, const String& s2);
01867
01871 YATE_API String operator+(const String& s1, const char* s2);
01872
01876 YATE_API String operator+(const char* s1, const String& s2);
01877
01882 inline const char *strcpy(String& dest, const char* src)
01883 { dest = src; return dest.c_str(); }
01884
01889 inline const char *strcat(String& dest, const char* src)
01890 { dest += src; return dest.c_str(); }
01891
01900 YATE_API int lookup(const char* str, const TokenDict* tokens, int defvalue = 0, int base = 0);
01901
01908 YATE_API const char* lookup(int value, const TokenDict* tokens, const char* defvalue = 0);
01909
01910
01915 class YATE_API Regexp : public String
01916 {
01917 friend class String;
01918 public:
01922 Regexp();
01923
01930 Regexp(const char* value, bool extended = false, bool insensitive = false);
01931
01936 Regexp(const Regexp& value);
01937
01941 virtual ~Regexp();
01942
01946 inline Regexp& operator=(const char* value)
01947 { String::operator=(value); return *this; }
01948
01953 bool compile();
01954
01960 bool matches(const char* value) const;
01961
01967 virtual bool matches(const String& value) const
01968 { return Regexp::matches(value.safe()); }
01969
01975 void setFlags(bool extended, bool insensitive);
01976
01981 bool isExtended() const;
01982
01987 bool isCaseInsensitive() const;
01988
01989 protected:
01993 virtual void changed();
01994
01995 private:
01996 void cleanup();
01997 bool matches(const char *value, StringMatchPrivate *matchlist);
01998 void* m_regexp;
01999 int m_flags;
02000 };
02001
02006 class YATE_API NamedString : public String
02007 {
02008 public:
02014 NamedString(const char* name, const char* value = 0);
02015
02020 inline const String& name() const
02021 { return m_name; }
02022
02027 virtual const String& toString() const;
02028
02032 inline NamedString& operator=(const char* value)
02033 { String::operator=(value); return *this; }
02034
02035 private:
02036 NamedString();
02037 String m_name;
02038 };
02039
02047 class YATE_API HashList : public GenObject
02048 {
02049 public:
02054 HashList(unsigned int size = 17);
02055
02059 virtual ~HashList();
02060
02066 virtual void* getObject(const String& name) const;
02067
02072 inline unsigned int length() const
02073 { return m_size; }
02074
02079 unsigned int count() const;
02080
02087 inline ObjList* getList(unsigned int index) const
02088 { return (index < m_size) ? m_lists[index] : 0; }
02089
02095 inline ObjList* getHashList(unsigned int hash) const
02096 { return getList(hash % m_size); }
02097
02103 inline ObjList* getHashList(const String& str) const
02104 { return getHashList(str.hash()); }
02105
02111 GenObject* operator[](const String& str) const;
02112
02118 ObjList* find(const GenObject* obj) const;
02119
02125 ObjList* find(const String& str) const;
02126
02132 ObjList* append(const GenObject* obj);
02133
02140 GenObject* remove(GenObject* obj, bool delobj = true);
02141
02145 void clear();
02146
02153 bool resync(GenObject* obj);
02154
02160 bool resync();
02161
02162 private:
02163 unsigned int m_size;
02164 ObjList** m_lists;
02165 };
02166
02173 class YATE_API ListIterator
02174 {
02175 public:
02181 ListIterator(ObjList& list);
02182
02188 ListIterator(HashList& list);
02189
02193 ~ListIterator();
02194
02199 inline unsigned int length() const
02200 { return m_length; }
02201
02208 GenObject* get(unsigned int index) const;
02209
02222 GenObject* get();
02223
02228 inline bool eof() const
02229 { return m_current >= m_length; }
02230
02234 inline void reset()
02235 { m_current = 0; }
02236
02237 private:
02238 ObjList* m_objList;
02239 HashList* m_hashList;
02240 GenObject** m_objects;
02241 unsigned int m_length;
02242 unsigned int m_current;
02243 };
02244
02249 class YATE_API Time
02250 {
02251 public:
02255 inline Time()
02256 : m_time(now())
02257 { }
02258
02263 inline Time(u_int64_t usec)
02264 : m_time(usec)
02265 { }
02266
02271 inline Time(const struct timeval* tv)
02272 : m_time(fromTimeval(tv))
02273 { }
02274
02279 inline Time(const struct timeval& tv)
02280 : m_time(fromTimeval(tv))
02281 { }
02282
02287 inline ~Time()
02288 { }
02289
02294 inline u_int32_t sec() const
02295 { return (u_int32_t)((m_time+500000) / 1000000); }
02296
02301 inline u_int64_t msec() const
02302 { return (m_time+500) / 1000; }
02303
02308 inline u_int64_t usec() const
02309 { return m_time; }
02310
02314 inline operator u_int64_t() const
02315 { return m_time; }
02316
02320 inline Time& operator=(u_int64_t usec)
02321 { m_time = usec; return *this; }
02322
02326 inline Time& operator+=(int64_t delta)
02327 { m_time += delta; return *this; }
02328
02332 inline Time& operator-=(int64_t delta)
02333 { m_time -= delta; return *this; }
02334
02339 inline void toTimeval(struct timeval* tv) const
02340 { toTimeval(tv, m_time); }
02341
02347 static void toTimeval(struct timeval* tv, u_int64_t usec);
02348
02354 static u_int64_t fromTimeval(const struct timeval* tv);
02355
02361 inline static u_int64_t fromTimeval(const struct timeval& tv)
02362 { return fromTimeval(&tv); }
02363
02368 static u_int64_t now();
02369
02374 static u_int64_t msecNow();
02375
02380 static u_int32_t secNow();
02381
02382 private:
02383 u_int64_t m_time;
02384 };
02385
02390 class YATE_API DataBlock : public GenObject
02391 {
02392 public:
02393
02397 DataBlock();
02398
02402 DataBlock(const DataBlock& value);
02403
02410 DataBlock(void* value, unsigned int len, bool copyData = true);
02411
02415 virtual ~DataBlock();
02416
02422 virtual void* getObject(const String& name) const;
02423
02427 static const DataBlock& empty();
02428
02433 inline void* data() const
02434 { return m_data; }
02435
02440 inline bool null() const
02441 { return !m_data; }
02442
02447 inline unsigned int length() const
02448 { return m_length; }
02449
02454 void clear(bool deleteData = true);
02455
02462 DataBlock& assign(void* value, unsigned int len, bool copyData = true);
02463
02468 void append(const DataBlock& value);
02469
02474 void append(const String& value);
02475
02480 void insert(const DataBlock& value);
02481
02486 void truncate(unsigned int len);
02487
02492 void cut(int len);
02493
02497 DataBlock& operator=(const DataBlock& value);
02498
02502 inline DataBlock& operator+=(const DataBlock& value)
02503 { append(value); return *this; }
02504
02508 inline DataBlock& operator+=(const String& value)
02509 { append(value); return *this; }
02510
02519 bool convert(const DataBlock& src, const String& sFormat,
02520 const String& dFormat, unsigned maxlen = 0);
02521
02522 private:
02523 void* m_data;
02524 unsigned int m_length;
02525 };
02526
02531 class YATE_API MD5
02532 {
02533 public:
02537 MD5();
02538
02543 MD5(const MD5& original);
02544
02550 MD5(const void* buf, unsigned int len);
02551
02556 MD5(const DataBlock& data);
02557
02562 MD5(const String& str);
02563
02567 ~MD5();
02568
02572 MD5& operator=(const MD5& original);
02573
02577 void clear();
02578
02583 void finalize();
02584
02591 bool update(const void* buf, unsigned int len);
02592
02598 inline bool update(const DataBlock& data)
02599 { return update(data.data(), data.length()); }
02600
02606 inline bool update(const String& str)
02607 { return update(str.c_str(), str.length()); }
02608
02612 inline MD5& operator<<(const String& value)
02613 { update(value); return *this; }
02614
02618 inline MD5& operator<<(const DataBlock& data)
02619 { update(data); return *this; }
02620
02624 MD5& operator<<(const char* value);
02625
02631 const unsigned char* rawDigest();
02632
02637 inline static unsigned int rawLength()
02638 { return 16; }
02639
02645 const String& hexDigest();
02646
02647 private:
02648 void init();
02649 void* m_private;
02650 String m_hex;
02651 unsigned char m_bin[16];
02652 };
02653
02658 class YATE_API SHA1
02659 {
02660 public:
02664 SHA1();
02665
02670 SHA1(const SHA1& original);
02671
02677 SHA1(const void* buf, unsigned int len);
02678
02683 SHA1(const DataBlock& data);
02684
02689 SHA1(const String& str);
02690
02694 ~SHA1();
02695
02699 SHA1& operator=(const SHA1& original);
02700
02704 void clear();
02705
02710 void finalize();
02711
02718 bool update(const void* buf, unsigned int len);
02719
02725 inline bool update(const DataBlock& data)
02726 { return update(data.data(), data.length()); }
02727
02733 inline bool update(const String& str)
02734 { return update(str.c_str(), str.length()); }
02735
02739 inline SHA1& operator<<(const String& value)
02740 { update(value); return *this; }
02741
02745 inline SHA1& operator<<(const DataBlock& data)
02746 { update(data); return *this; }
02747
02751 SHA1& operator<<(const char* value);
02752
02758 const unsigned char* rawDigest();
02759
02764 inline static unsigned int rawLength()
02765 { return 20; }
02766
02772 const String& hexDigest();
02773
02774 private:
02775 void init();
02776 void* m_private;
02777 String m_hex;
02778 unsigned char m_bin[20];
02779 };
02780
02785 class YATE_API NamedList : public String
02786 {
02787 public:
02792 NamedList(const char* name);
02793
02798 NamedList(const NamedList& original);
02799
02805 virtual void* getObject(const String& name) const;
02806
02811 inline unsigned int length() const
02812 { return m_params.length(); }
02813
02818 inline unsigned int count() const
02819 { return m_params.count(); }
02820
02825 NamedList& addParam(NamedString* param);
02826
02832 NamedList& addParam(const char* name, const char* value);
02833
02838 NamedList& setParam(NamedString* param);
02839
02845 NamedList& setParam(const char* name, const char* value);
02846
02852 NamedList& clearParam(const String& name, char childSep = 0);
02853
02860 NamedList& copyParam(const NamedList& original, const String& name, char childSep = 0);
02861
02868 NamedList& copyParams(const NamedList& original, ObjList* list, char childSep = 0);
02869
02876 NamedList& copyParams(const NamedList& original, const String& list, char childSep = 0);
02877
02883 int getIndex(const NamedString* param) const;
02884
02890 int getIndex(const String& name) const;
02891
02897 NamedString* getParam(const String& name) const;
02898
02904 NamedString* getParam(unsigned int index) const;
02905
02912 const char* getValue(const String& name, const char* defvalue = 0) const;
02913
02920 int getIntValue(const String& name, int defvalue = 0) const;
02921
02929 int getIntValue(const String& name, const TokenDict* tokens, int defvalue = 0) const;
02930
02937 double getDoubleValue(const String& name, double defvalue = 0.0) const;
02938
02945 bool getBoolValue(const String& name, bool defvalue = false) const;
02946
02954 int replaceParams(String& str, bool sqlEsc = false, char extraEsc = 0) const;
02955
02956 private:
02957 NamedList();
02958 NamedList& operator=(const NamedList& value);
02959 ObjList m_params;
02960 };
02961
02967 class YATE_API URI : public String
02968 {
02969 public:
02973 URI();
02974
02979 URI(const URI& uri);
02980
02985 URI(const String& uri);
02986
02991 URI(const char* uri);
02992
03001 URI(const char* proto, const char* user, const char* host, int port = 0, const char* desc = 0);
03002
03006 void parse() const;
03007
03012 inline URI& operator=(const URI& value)
03013 { String::operator=(value); return *this; }
03014
03019 inline URI& operator=(const String& value)
03020 { String::operator=(value); return *this; }
03021
03026 inline URI& operator=(const char* value)
03027 { String::operator=(value); return *this; }
03028
03033 inline const String& getDescription() const
03034 { parse(); return m_desc; }
03035
03040 inline const String& getProtocol() const
03041 { parse(); return m_proto; }
03042
03047 inline const String& getUser() const
03048 { parse(); return m_user; }
03049
03054 inline const String& getHost() const
03055 { parse(); return m_host; }
03056
03061 inline int getPort() const
03062 { parse(); return m_port; }
03063 protected:
03069 virtual void changed();
03070 mutable bool m_parsed;
03071 mutable String m_desc;
03072 mutable String m_proto;
03073 mutable String m_user;
03074 mutable String m_host;
03075 mutable int m_port;
03076 };
03077
03078 class MutexPrivate;
03079 class ThreadPrivate;
03080
03085 class YATE_API Mutex
03086 {
03087 friend class MutexPrivate;
03088 public:
03092 Mutex();
03093
03099 Mutex(bool recursive);
03100
03105 Mutex(const Mutex& original);
03106
03110 ~Mutex();
03111
03116 Mutex& operator=(const Mutex& original);
03117
03123 bool lock(long maxwait = -1);
03124
03128 void unlock();
03129
03135 bool locked() const;
03136
03142 bool check(long maxwait = -1);
03143
03148 bool recursive() const;
03149
03154 static int count();
03155
03160 static int locks();
03161
03167 static void wait(unsigned long maxwait);
03168
03169 private:
03170 MutexPrivate* privDataCopy() const;
03171 MutexPrivate* m_private;
03172 };
03173
03179 class YATE_API Lock
03180 {
03181 public:
03187 inline Lock(Mutex& mutex, long maxwait = -1)
03188 { m_mutex = mutex.lock(maxwait) ? &mutex : 0; }
03189
03195 inline Lock(Mutex* mutex, long maxwait = -1)
03196 { m_mutex = (mutex && mutex->lock(maxwait)) ? mutex : 0; }
03197
03201 inline ~Lock()
03202 { if (m_mutex) m_mutex->unlock(); }
03203
03208 inline Mutex* mutex() const
03209 { return m_mutex; }
03210
03214 inline void drop()
03215 { if (m_mutex) m_mutex->unlock(); m_mutex = 0; }
03216
03217 private:
03218 Mutex* m_mutex;
03219
03221 inline void* operator new(size_t);
03222
03224 inline void* operator new[](size_t);
03225
03227 inline Lock(const Lock&);
03228 };
03229
03236 class YATE_API Lock2
03237 {
03238 public:
03245 inline Lock2(Mutex* mx1, Mutex* mx2, long maxwait = -1)
03246 : m_mx1(0), m_mx2(0)
03247 { lock(mx1,mx2,maxwait); }
03248
03255 inline Lock2(Mutex& mx1, Mutex& mx2, long maxwait = -1)
03256 : m_mx1(0), m_mx2(0)
03257 { lock(&mx1,&mx2); }
03258
03262 inline ~Lock2()
03263 { drop(); }
03264
03269 inline bool locked() const
03270 { return m_mx1 != 0; }
03271
03279 bool lock(Mutex* mx1, Mutex* mx2, long maxwait = -1);
03280
03288 inline bool lock(Mutex& mx1, Mutex& mx2, long maxwait = -1)
03289 { return lock(&mx1,&mx2); }
03290
03294 void drop();
03295
03296 private:
03297 Mutex* m_mx1;
03298 Mutex* m_mx2;
03299
03301 inline void* operator new(size_t);
03302
03304 inline void* operator new[](size_t);
03305
03307 inline Lock2(const Lock2&);
03308 };
03309
03315 class YATE_API Runnable
03316 {
03317 public:
03322 virtual void run() = 0;
03323
03327 virtual ~Runnable();
03328 };
03329
03336 class YATE_API Thread : public Runnable
03337 {
03338 friend class ThreadPrivate;
03339 friend class MutexPrivate;
03340 public:
03344 enum Priority {
03345 Lowest,
03346 Low,
03347 Normal,
03348 High,
03349 Highest
03350 };
03351
03355 virtual void cleanup();
03356
03361 bool startup();
03362
03367 bool error() const;
03368
03373 bool running() const;
03374
03379 inline int locks() const
03380 { return m_locks; }
03381
03386 inline bool locked() const
03387 { return m_locking || m_locks; }
03388
03393 const char* name() const;
03394
03399 static const char* currentName();
03400
03406 static void yield(bool exitCheck = false);
03407
03413 static void sleep(unsigned int sec, bool exitCheck = false);
03414
03420 static void msleep(unsigned long msec, bool exitCheck = false);
03421
03428 static void usleep(unsigned long usec, bool exitCheck = false);
03429
03435 static Thread* current();
03436
03441 static int count();
03442
03448 static bool check(bool exitNow = true);
03449
03453 static void exit();
03454
03459 void cancel(bool hard = false);
03460
03465 inline bool isCurrent() const
03466 { return current() == this; }
03467
03468
03475 static Priority priority(const char* name, Priority defvalue = Normal);
03476
03482 static const char* priority(Priority prio);
03483
03488 static void killall();
03489
03494 static void preExec();
03495
03496 protected:
03502 Thread(const char *name = 0, Priority prio = Normal);
03503
03509 Thread(const char *name, const char* prio);
03510
03514 virtual ~Thread();
03515
03516 private:
03517 ThreadPrivate* m_private;
03518 int m_locks;
03519 bool m_locking;
03520 };
03521
03522 class Socket;
03523
03528 class YATE_API SocketAddr : public GenObject
03529 {
03530 public:
03534 inline SocketAddr()
03535 : m_address(0), m_length(0)
03536 { }
03537
03542 inline SocketAddr(const SocketAddr& value)
03543 : m_address(0), m_length(0)
03544 { assign(value.address(),value.length()); }
03545
03550 SocketAddr(int family);
03551
03557 SocketAddr(const struct sockaddr* addr, socklen_t len = 0);
03558
03562 virtual ~SocketAddr();
03563
03568 inline SocketAddr& operator=(const SocketAddr& value)
03569 { assign(value.address(),value.length()); return *this; }
03570
03576 bool operator==(const SocketAddr& other) const;
03577
03583 inline bool operator!=(const SocketAddr& other) const
03584 { return !operator==(other); }
03585
03589 void clear();
03590
03596 bool assign(int family);
03597
03603 void assign(const struct sockaddr* addr, socklen_t len = 0);
03604
03610 bool local(const SocketAddr& remote);
03611
03616 inline bool valid() const
03617 { return m_length && m_address; }
03618
03623 inline bool null() const
03624 { return !(m_length && m_address); }
03625
03630 inline int family() const
03631 { return m_address ? m_address->sa_family : 0; }
03632
03637 inline const String& host() const
03638 { return m_host; }
03639
03644 virtual bool host(const String& name);
03645
03650 int port() const;
03651
03657 bool port(int newport);
03658
03663 inline struct sockaddr* address() const
03664 { return m_address; }
03665
03670 inline socklen_t length() const
03671 { return m_length; }
03672
03678 static bool supports(int family);
03679
03680 protected:
03684 virtual void stringify();
03685
03686 struct sockaddr* m_address;
03687 socklen_t m_length;
03688 String m_host;
03689 };
03690
03695 class YATE_API SocketFilter : public GenObject
03696 {
03697 friend class Socket;
03698 public:
03702 SocketFilter();
03703
03707 virtual ~SocketFilter();
03708
03714 virtual void* getObject(const String& name) const;
03715
03720 virtual void timerTick(const Time& when);
03721
03731 virtual bool received(void* buffer, int length, int flags, const struct sockaddr* addr, socklen_t adrlen) = 0;
03732
03737 inline Socket* socket() const
03738 { return m_socket; }
03739
03744 bool valid() const;
03745
03746 private:
03747 Socket* m_socket;
03748 };
03749
03754 class YATE_API Stream
03755 {
03756 public:
03760 virtual ~Stream();
03761
03766 inline int error() const
03767 { return m_error; }
03768
03773 virtual bool terminate() = 0;
03774
03779 virtual bool canRetry() const;
03780
03785 virtual bool valid() const = 0;
03786
03792 virtual bool setBlocking(bool block = true);
03793
03800 virtual int writeData(const void* buffer, int length) = 0;
03801
03807 int writeData(const char* str);
03808
03814 inline int writeData(const String& str)
03815 { return writeData(str.c_str(), str.length()); }
03816
03822 inline int writeData(const DataBlock& buf)
03823 { return writeData(buf.data(), buf.length()); }
03824
03831 virtual int readData(void* buffer, int length) = 0;
03832
03839 static bool allocPipe(Stream*& reader, Stream*& writer);
03840
03847 static bool allocPair(Stream*& str1, Stream*& str2);
03848
03853 static bool supportsPipes();
03854
03859 static bool supportsPairs();
03860
03861 protected:
03865 inline Stream()
03866 : m_error(0)
03867 { }
03868
03872 inline void clearError()
03873 { m_error = 0; }
03874
03875 int m_error;
03876 };
03877
03882 class YATE_API File : public Stream
03883 {
03884 public:
03888 File();
03889
03894 File(HANDLE handle);
03895
03899 virtual ~File();
03900
03911 virtual bool openPath(const char* name, bool canWrite = false, bool canRead = true,
03912 bool create = false, bool append = false, bool binary = false);
03913
03918 virtual bool terminate();
03919
03924 void attach(HANDLE handle);
03925
03930 HANDLE detach();
03931
03936 inline HANDLE handle() const
03937 { return m_handle; }
03938
03943 virtual bool canRetry() const;
03944
03949 virtual bool valid() const;
03950
03955 static HANDLE invalidHandle();
03956
03962 virtual bool setBlocking(bool block = true);
03963
03968 virtual unsigned int length();
03969
03976 virtual int writeData(const void* buffer, int length);
03977
03984 virtual int readData(void* buffer, int length);
03985
03991 static bool remove(const char* name);
03992
03999 static bool createPipe(File& reader, File& writer);
04000
04001 protected:
04002
04006 void copyError();
04007
04008 HANDLE m_handle;
04009 };
04010
04015 class YATE_API Socket : public Stream
04016 {
04017 public:
04021 enum TOS {
04022 LowDelay = IPTOS_LOWDELAY,
04023 MaxThroughput = IPTOS_THROUGHPUT,
04024 MaxReliability = IPTOS_RELIABILITY,
04025 MinCost = IPTOS_MINCOST,
04026 };
04027
04031 Socket();
04032
04037 Socket(SOCKET handle);
04038
04045 Socket(int domain, int type, int protocol = 0);
04046
04050 virtual ~Socket();
04051
04059 bool create(int domain, int type, int protocol = 0);
04060
04065 virtual bool terminate();
04066
04071 void attach(SOCKET handle);
04072
04077 SOCKET detach();
04078
04083 inline SOCKET handle() const
04084 { return m_handle; }
04085
04090 virtual bool canRetry() const;
04091
04096 virtual bool valid() const;
04097
04102 static SOCKET invalidHandle();
04103
04108 static int socketError();
04109
04118 bool setOption(int level, int name, const void* value = 0, socklen_t length = 0);
04119
04128 bool getOption(int level, int name, void* buffer, socklen_t* length);
04129
04135 bool setTOS(int tos);
04136
04142 virtual bool setBlocking(bool block = true);
04143
04151 bool setReuse(bool reuse = true, bool exclusive = false);
04152
04159 bool setLinger(int seconds = -1);
04160
04167 bool bind(struct sockaddr* addr, socklen_t addrlen);
04168
04174 inline bool bind(const SocketAddr& addr)
04175 { return bind(addr.address(), addr.length()); }
04176
04182 bool listen(unsigned int backlog = 0);
04183
04190 Socket* accept(struct sockaddr* addr = 0, socklen_t* addrlen = 0);
04191
04197 Socket* accept(SocketAddr& addr);
04198
04205 SOCKET acceptHandle(struct sockaddr* addr = 0, socklen_t* addrlen = 0);
04206
04212 Socket* peelOff(unsigned int assoc);
04213
04219 SOCKET peelOffHandle(unsigned int assoc);
04220
04227 bool connect(struct sockaddr* addr, socklen_t addrlen);
04228
04234 inline bool connect(const SocketAddr& addr)
04235 { return connect(addr.address(), addr.length()); }
04236
04243 bool shutdown(bool stopReads, bool stopWrites);
04244
04251 bool getSockName(struct sockaddr* addr, socklen_t* addrlen);
04252
04258 bool getSockName(SocketAddr& addr);
04259
04266 bool getPeerName(struct sockaddr* addr, socklen_t* addrlen);
04267
04273 bool getPeerName(SocketAddr& addr);
04274
04284 int sendTo(const void* buffer, int length, const struct sockaddr* addr, socklen_t adrlen, int flags = 0);
04285
04294 inline int sendTo(const void* buffer, int length, const SocketAddr& addr, int flags = 0)
04295 { return sendTo(buffer, length, addr.address(), addr.length(), flags); }
04296
04304 int send(const void* buffer, int length, int flags = 0);
04305
04312 virtual int writeData(const void* buffer, int length);
04313
04323 int recvFrom(void* buffer, int length, struct sockaddr* addr = 0, socklen_t* adrlen = 0, int flags = 0);
04324
04333 int recvFrom(void* buffer, int length, SocketAddr& addr, int flags = 0);
04334
04342 int recv(void* buffer, int length, int flags = 0);
04343
04350 virtual int readData(void* buffer, int length);
04351
04360 bool select(bool* readok, bool* writeok, bool* except, struct timeval* timeout = 0);
04361
04370 bool select(bool* readok, bool* writeok, bool* except, int64_t timeout);
04371
04377 bool installFilter(SocketFilter* filter);
04378
04384 void removeFilter(SocketFilter* filter, bool delobj = false);
04385
04389 void clearFilters();
04390
04397 virtual void timerTick(const Time& when);
04398
04406 static bool createPair(Socket& sock1, Socket& sock2, int domain = AF_UNIX);
04407
04408 protected:
04409
04413 void copyError();
04414
04421 bool checkError(int retcode, bool strict = false);
04422
04432 bool applyFilters(void* buffer, int length, int flags, const struct sockaddr* addr = 0, socklen_t adrlen = 0);
04433
04434 SOCKET m_handle;
04435 ObjList m_filters;
04436 };
04437
04443 class YATE_API SysUsage
04444 {
04445 public:
04449 enum Type {
04450 WallTime,
04451 UserTime,
04452 KernelTime
04453 };
04454
04458 static void init();
04459
04464 static u_int64_t startTime();
04465
04471 static u_int64_t usecRunTime(Type type = WallTime);
04472
04478 static u_int64_t msecRunTime(Type type = WallTime);
04479
04485 static u_int32_t secRunTime(Type type = WallTime);
04486
04492 static double runTime(Type type = WallTime);
04493
04494 };
04495
04496 };
04497
04498 #endif
04499
04500