LUAStackTrackerMessages.h 2.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 LUAEDITOR_LUASTACKTRACKERMESSAGES_H
  9. #define LUAEDITOR_LUASTACKTRACKERMESSAGES_H
  10. #include <AzCore/base.h>
  11. #include <AzCore/EBus/EBus.h>
  12. #include <AzCore/std/string/string.h>
  13. #pragma once
  14. namespace LUAEditor
  15. {
  16. // combined, name+line is a unique stack entry
  17. // this data definition is used by anyone tracking stacks at execution break
  18. struct StackEntry
  19. {
  20. public:
  21. AZ_CLASS_ALLOCATOR(StackEntry, AZ::SystemAllocator);
  22. AZStd::string m_blob; // the name of the debug blob
  23. int m_blobLine; // the line relative to the start of that blob
  24. };
  25. typedef AZStd::list<StackEntry> StackList;
  26. // messages going FROM the lua Context TO anyone interested in stack updates (aka the stack panel)
  27. class LUAStackTrackerMessages
  28. : public AZ::EBusTraits
  29. {
  30. public:
  31. //////////////////////////////////////////////////////////////////////////
  32. // Bus configuration
  33. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; // we have one bus that we always broadcast to
  34. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Multiple; // we can have multiple listeners
  35. //////////////////////////////////////////////////////////////////////////
  36. typedef AZ::EBus<LUAStackTrackerMessages> Bus;
  37. typedef Bus::Handler Handler;
  38. virtual void StackUpdate(const StackList& stackList) = 0;
  39. virtual void StackClear() = 0;
  40. virtual ~LUAStackTrackerMessages() {}
  41. };
  42. // messages going TO the lua Context FROM anyone interested in retrieving breakpoint info
  43. class LUAStackRequestMessages
  44. : public AZ::EBusTraits
  45. {
  46. public:
  47. //////////////////////////////////////////////////////////////////////////
  48. // Bus configuration
  49. static const AZ::EBusAddressPolicy AddressPolicy = AZ::EBusAddressPolicy::Single; // we have one bus that we always broadcast to
  50. static const AZ::EBusHandlerPolicy HandlerPolicy = AZ:: EBusHandlerPolicy::Single; // we only have one listener
  51. //////////////////////////////////////////////////////////////////////////
  52. typedef AZ::EBus<LUAStackRequestMessages> Bus;
  53. typedef Bus::Handler Handler;
  54. virtual void RequestStackClicked(const AZStd::string& blobName, int lineNumber) = 0;
  55. virtual ~LUAStackRequestMessages() {}
  56. };
  57. }
  58. #endif//LUAEDITOR_LUASTACKTRACKERMESSAGES_H