RemoteConsole.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #ifndef CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
  9. #define CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H
  10. #pragma once
  11. #include <CryCommon/IConsole.h>
  12. #include <CryCommon/CryListenerSet.h>
  13. #if (!defined(RELEASE) || defined(RELEASE_LOGGING) || defined(ENABLE_PROFILING_CODE)) && !defined(AZ_LEGACY_CRYSYSTEM_TRAIT_REMOTE_CONSOLE_UNSUPPORTED)
  14. #define USE_REMOTE_CONSOLE
  15. struct SRemoteServer;
  16. #endif
  17. /////////////////////////////////////////////////////////////////////////////////////////////
  18. // CRemoteConsole
  19. //
  20. // IRemoteConsole implementation
  21. //
  22. /////////////////////////////////////////////////////////////////////////////////////////////
  23. class CRemoteConsole
  24. : public IRemoteConsole
  25. {
  26. public:
  27. static CRemoteConsole* GetInst()
  28. {
  29. static CRemoteConsole inst;
  30. return &inst;
  31. }
  32. virtual void RegisterConsoleVariables();
  33. virtual void UnregisterConsoleVariables();
  34. virtual void Start();
  35. virtual void Stop();
  36. virtual bool IsStarted() const { return m_running; }
  37. virtual void AddLogMessage(AZStd::string_view log);
  38. virtual void AddLogWarning(AZStd::string_view log);
  39. virtual void AddLogError(AZStd::string_view log);
  40. virtual void Update();
  41. virtual void RegisterListener(IRemoteConsoleListener* pListener, const char* name);
  42. virtual void UnregisterListener(IRemoteConsoleListener* pListener);
  43. typedef CListenerSet<IRemoteConsoleListener*> TListener;
  44. CRemoteConsole();
  45. virtual ~CRemoteConsole();
  46. TListener m_listener;
  47. int m_lastPortValue = 0;
  48. volatile bool m_running;
  49. #if defined(USE_REMOTE_CONSOLE)
  50. SRemoteServer* m_pServer;
  51. #endif
  52. };
  53. #endif // CRYINCLUDE_CRYSYSTEM_REMOTECONSOLE_REMOTECONSOLE_H