ObjectData.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //
  2. // Created by wrede on 19.04.16.
  3. //
  4. #ifndef GBMOT_NODEDATA_H
  5. #define GBMOT_NODEDATA_H
  6. #include <string>
  7. #include <unordered_map>
  8. #include <iostream>
  9. namespace core
  10. {
  11. //TODO RENAME
  12. //TODO ObjectDataBase / ObjectBase / DataBase / AObject ...
  13. /**
  14. * Base class for all detected objects.
  15. * Stores the corresponding frame index.
  16. */
  17. class ObjectData
  18. {
  19. private:
  20. /**
  21. * If this node is considered virtual
  22. */
  23. bool is_virtual_;
  24. protected:
  25. /**
  26. * The frame the object was detected in
  27. */
  28. std::size_t frame_index_;
  29. /**
  30. * Used in the << operator
  31. * @param os The stream to write to
  32. */
  33. virtual void Print(std::ostream& os) const;
  34. public:
  35. /**
  36. * Creates a new empty ObjectData (e.g. for virtual objects)
  37. */
  38. ObjectData();
  39. /**
  40. * Creates a new ObjectData with the given frame index
  41. * @param frame_index the index in which the object was detected
  42. */
  43. ObjectData(std::size_t frame_index);
  44. /**
  45. * Getter for the frame index
  46. * @return The frame index
  47. */
  48. std::size_t GetFrameIndex() const;
  49. /**
  50. * Is this node considered a virtual node
  51. * @return Whether this node is virtual
  52. */
  53. bool IsVirtual() const;
  54. //TODO RENAME
  55. //TODO ObjectDataComparable / IComparable ...
  56. /**
  57. * Compares this object with the given object.
  58. * @param obj A pointer to the object to compare this object to
  59. * @return A double value indicating the comparison result
  60. */
  61. virtual double CompareTo(ObjectData *obj);
  62. /**
  63. * Overrides the << operator for easy output.
  64. * Calls the print method.
  65. * @param os The stream to write to
  66. * @param obj The object to write into the stream
  67. * @return The stream written to
  68. */
  69. friend std::ostream& operator<<(std::ostream& os, const ObjectData& obj);
  70. };
  71. }
  72. #endif //GBMOT_NODEDATA_H