// Json Debug Inteface #pragma once #include #include #include #include #include "Spinlock.h" #include "Json.h" namespace JDI { typedef Json::Value* (*CmdDelegate)(std::vector& args); typedef void (*JdiReflector)(); class JdiHub { std::map reflexMap; SpinLock reflexMapLock; std::map nodes; Json::Value* CommandByName(std::string& name); bool CheckParameters(Json::Value* cmd, std::vector& args); void PrintUsage(Json::Value* cmd); uint32_t SimpleHash(std::wstring str); std::vector noArgs; public: JdiHub(); ~JdiHub(); void AddCmd(std::string name, CmdDelegate command); void AddNode(std::wstring filename, JdiReflector reflector); void RemoveNode(std::wstring filename); void Help(); Json::Value* Execute(std::vector& args); Json::Value* ExecuteFast(const char* command); bool ExecuteFastBool(char* command); uint32_t ExecuteFastUInt32(char* command); bool CommandExists(std::vector& args); void Dump(Json::Value * value, int depth=0); }; // External API extern JdiHub Hub; }