19 #ifndef __REMOTEDEBUG_H__ 20 #define __REMOTEDEBUG_H__ 48 #define RDebug(debugEntity,debugLevel,...) \ 49 { if (debugEntity->IsDebugging()) { debugEntity->Printf(debugLevel, __VA_ARGS__); }} 76 return (highestActiveDebugLevel > 0);
86 return (highestActiveDebugLevel > 0 && debugLevel <= highestActiveDebugLevel);
132 void Printf(
int debugLevel,
const char* msg,...);
143 virtual void RemoteDebugReport(uint32_t clientNum,
const csString& debugString) = 0;
154 DebugClient(uint32_t clientNum,
int debugLevel):clientNum(clientNum),debugLevel(debugLevel) {};
159 bool operator==(
const DebugClient& other)
const {
return clientNum == other.clientNum; }
169 void VPrintf(
int debugLevel,
const char* msg, va_list args);
176 void CalculateHighestActiveDebugLevel();
179 csArray<DebugClient> debugClients;
180 int highestActiveDebugLevel;
virtual ~RemoteDebug()
Destructor.
void AddDebugClient(uint clientNum, int debugLevel)
Add a client to receive debug information.
bool IsDebugging()
Check if debugging is enabled.
void Printf(int debugLevel, const char *msg,...)
Function to generate a debug print.
int GetDebugging() const
Get the local debugging level.
csArray< csString > debugLog
Local debug log of last n print statments.
int nextDebugLogEntry
The next entry to use.
RemoteDebug()
Constructor.
bool IsDebugging(int debugLevel)
Check if this NPC is debugging at the given level.
csString GetRemoteDebugClientsString() const
Utility function to retrive a string with all remote debugging clients for debug outputs.
void SetDebugging(int debugLevel)
Set a new debug level.
void RemoveDebugClient(uint clientNum)
Remove client from list of debug receivers.
virtual void LocalDebugReport(const csString &debugString)=0
Callback function to report local debug.
virtual void RemoteDebugReport(uint32_t clientNum, const csString &debugString)=0
Callback function to report remote debug.
Keep track of remote debugging.
bool operator==(T *p, const scoped_ptr< T > &b)
bool SwitchDebugging()
Switch the local debuging state.