usb_decode_result.h 3.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. // // ******************************************************************
  2. // // /\ /| @File Usb_decode_result.h
  3. // // \ V/ @Brief
  4. // // | "") @Author lijinwen, ghz005@uni-trend.com.cn
  5. // // / | @Creation 2024-05-17
  6. // // / \\ @Modified 2024-06-24
  7. // // *(__\_\
  8. // // ******************************************************************
  9. #pragma once
  10. //#include <utility>
  11. //#include "protocol_Usb_enums.h"
  12. #include "Usb_decode_event.h"
  13. #include "../decode_result.h"
  14. //#include "Usb_packet.h"
  15. //#include "../decode_event.h"
  16. namespace Protocol
  17. {
  18. class UsbDecodeResultCell : DecodeResultCell
  19. {
  20. };
  21. struct UsbDecodeResult //: DecodeResult
  22. {
  23. bool decode_result_need_update = false;
  24. bool decode_event_need_update = false;
  25. UsbDecodeResultCell* decode_result_cells_ptr; //解码数据结果指针
  26. UsbDecodeEvent* decode_events_ptr; //解码结果事件指针
  27. uint64_t decode_result_count; //结果数量
  28. uint64_t decode_event_count; //事件数量
  29. UsbEnums::UsbSpeed usb_speed; //真实速率
  30. intptr_t usb_decoder_ptr;
  31. //std::vector<UsbDecoderesultCell> DecodeResultCells;
  32. //std::vector<UsbDecodeEvent> DecodeEventCells;
  33. UsbDecodeResult() : decode_result_cells_ptr(nullptr), decode_events_ptr(nullptr), decode_result_count(0),
  34. decode_event_count(0),
  35. usb_speed(UsbEnums::UsbSpeed::FULL_SPEED), usb_decoder_ptr(0)
  36. {
  37. //ProtocolType = SerialProtocolType::Usb;
  38. //DecodeResultCells = {};
  39. }
  40. UsbDecodeResult(const UsbDecodeResult& result) : usb_speed(UsbEnums::UsbSpeed::FULL_SPEED), usb_decoder_ptr(0)
  41. {
  42. decode_result_need_update = result.decode_result_need_update;
  43. decode_event_need_update = result.decode_event_need_update;
  44. decode_result_cells_ptr = result.decode_result_cells_ptr;
  45. decode_events_ptr = result.decode_events_ptr;
  46. decode_result_count = result.decode_result_count;
  47. decode_event_count = result.decode_event_count;
  48. }
  49. ~UsbDecodeResult() = default;
  50. UsbDecodeResult(UsbDecodeResult&& other) noexcept
  51. : decode_result_need_update(other.decode_result_need_update),
  52. decode_event_need_update(other.decode_event_need_update),
  53. decode_result_cells_ptr(other.decode_result_cells_ptr),
  54. decode_events_ptr(other.decode_events_ptr),
  55. decode_result_count(other.decode_result_count),
  56. decode_event_count(other.decode_event_count), usb_speed(UsbEnums::UsbSpeed::FULL_SPEED), usb_decoder_ptr(0)
  57. {
  58. }
  59. UsbDecodeResult& operator=(const UsbDecodeResult& other)
  60. {
  61. if (this == &other) return *this;
  62. decode_result_need_update = other.decode_result_need_update;
  63. decode_event_need_update = other.decode_event_need_update;
  64. decode_result_cells_ptr = other.decode_result_cells_ptr;
  65. decode_events_ptr = other.decode_events_ptr;
  66. decode_result_count = other.decode_result_count;
  67. decode_event_count = other.decode_event_count;
  68. return *this;
  69. }
  70. UsbDecodeResult& operator=(UsbDecodeResult&& other) noexcept
  71. {
  72. if (this == &other) return *this;
  73. decode_result_need_update = other.decode_result_need_update;
  74. decode_event_need_update = other.decode_event_need_update;
  75. decode_result_cells_ptr = other.decode_result_cells_ptr;
  76. decode_events_ptr = other.decode_events_ptr;
  77. decode_result_count = other.decode_result_count;
  78. decode_event_count = other.decode_event_count;
  79. return *this;
  80. }
  81. //void Add(const UsbDecoderesultCell* cell);
  82. };
  83. }