// Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
// de Barcelona (UAB).
//
// This work is licensed under the terms of the MIT license.
// For a copy, see <https://opensource.org/licenses/MIT>.

#pragma once

#include "carla/Memory.h"
#include "carla/NonCopyable.h"
#include "carla/sensor/RawData.h"

namespace carla {
namespace sensor {

  /// Base class for all the objects containing data generated by a sensor.
  class SensorData
    : public EnableSharedFromThis<SensorData>,
      private NonCopyable {
  protected:

    explicit SensorData(const RawData &data)
      : _frame_number(data.GetFrameNumber()),
        _sensor_transform(data.GetSensorTransform()) {}

  public:

    virtual ~SensorData() = default;

    /// Frame count when the data was generated.
    size_t GetFrameNumber() const {
      return _frame_number;
    }

    /// Sensor's transform when the data was generated.
    const rpc::Transform &GetSensorTransform() const {
      return _sensor_transform;
    }

  private:

    const size_t _frame_number;

    const rpc::Transform _sensor_transform;
  };

} // namespace sensor
} // namespace carla
