// $Header: /cvs/gled-1.2/GledCore/Gled/GledTypes.h,v 1.12 2005/03/11 17:50:16 matevz Exp $ // Copyright (C) 1999-2005, Matevz Tadel. All rights reserved. // This file is part of GLED, released under GNU General Public License version 2. // For the licensing terms see $GLEDSYS/LICENSE or http://www.gnu.org/. #ifndef GledCore_GledTypes_H #define GledCore_GledTypes_H #include #include #include #include #include #include #include #include #include #include using namespace std; #include // String type and collections of strings typedef string Str_t; typedef string::iterator Str_i; typedef string::const_iterator Str_ci; typedef list lStr_t; typedef list::iterator lStr_i; typedef list::const_iterator lStr_ci; typedef set sStr_t; typedef set::iterator sStr_i; typedef ULong_t TimeStamp_t; /**************************************************************************/ // Glass typedefs /**************************************************************************/ class ZGlass; typedef list lpZGlass_t; typedef list::iterator lpZGlass_i; typedef list::const_iterator lpZGlass_ci; typedef list::reverse_iterator lpZGlass_ri; typedef list::const_reverse_iterator lpZGlass_cri; typedef list lppZGlass_t; typedef list::iterator lppZGlass_i; typedef UInt_t ID_t; typedef UShort_t LID_t; typedef UShort_t CID_t; typedef UShort_t MID_t; typedef list lID_t; typedef list::iterator lID_i; typedef set sID_t; typedef set::iterator sID_i; #ifndef __CINT__ typedef map mID2pZGlass_t; typedef map::iterator mID2pZGlass_i; typedef hash_map hID2pZGlass_t; typedef hash_map::iterator hID2pZGlass_i; typedef hash_map hpZGlass2Int_t; typedef hash_map::iterator hpZGlass2Int_i; typedef hash_map IdiOm_t; typedef hash_map::iterator IdiOm_i; #endif class An_ID_Demangler { public: virtual ZGlass* DemangleID(ID_t) = 0; }; /**************************************************************************/ // FID_t : Full libset/class ID & FMID_t: Full-method ID /**************************************************************************/ class FID_t { public: LID_t lid; CID_t cid; FID_t(LID_t l=0, CID_t c=0) : lid(l), cid(c) {} bool operator==(FID_t r) const { return (lid == r.lid && cid == r.cid); } bool operator!=(FID_t r) const { return (lid != r.lid || cid != r.cid); } bool is_null() const { return lid == 0 && cid == 0; } bool is_basic() const { return is_null() || (lid == 1 && cid == 1); } void clear() { lid = 0; cid = 0; } }; namespace __gnu_cxx { template<> struct hash { size_t operator()(const FID_t& fid) const { size_t i = fid.lid; i <<= 16; i |= fid.cid; return i; } }; } inline TBuffer &operator>>(TBuffer& b, FID_t& fid) { b >> fid.lid >> fid.cid; return b; } inline TBuffer &operator<<(TBuffer& b, FID_t fid) { b << fid.lid << fid.cid; return b; } class FMID_t : public FID_t { public: MID_t mid; FMID_t(LID_t l=0, CID_t c=0, MID_t m=0) : FID_t(l,c), mid(m) {} bool operator==(FMID_t r) { return FID_t::operator==(r) && mid == r.mid; } bool operator!=(FMID_t r) { return FID_t::operator!=(r) || mid != r.mid; } }; inline TBuffer &operator>>(TBuffer& b, FMID_t& fmid) { b >> (FID_t&)fmid >> fmid.mid; return b; } inline TBuffer &operator<<(TBuffer& b, FMID_t fmid) { b << (FID_t&)fmid << fmid.mid; return b; } /**************************************************************************/ // Defines /**************************************************************************/ #define MAX_ID ((ID_t)(-1)) #define GLED_DEF_PORT 9061 /**************************************************************************/ // Debug, warn, mess Stuff /**************************************************************************/ const char* GForm(const char* fmt, ...); extern int G_DEBUG; enum InfoStream_e { ISoutput, ISmessage, ISwarning, ISerror }; void InfoStream(InfoStream_e, const char* s); void InfoStream(InfoStream_e, const string& s); #define ISout(_str_) { InfoStream(ISoutput, _str_); } #define ISmess(_str_) { InfoStream(ISmessage, _str_); } #define ISwarn(_str_) { InfoStream(ISwarning, _str_); } #define ISerr(_str_) { InfoStream(ISerror, _str_); } #define D_STREAM 4 #define D_THRMUT 2 #ifdef DEBUG #define ISdebug(A,B) { if((A)<=G_DEBUG) ISmess(B) } #else #define ISdebug(A,B) #endif #endif