CARLA
LibCarla/source/carla/client/Sensor.h
Go to the documentation of this file.
1 // Copyright (c) 2017 Computer Vision Center (CVC) at the Universitat Autonoma
2 // de Barcelona (UAB).
3 //
4 // This work is licensed under the terms of the MIT license.
5 // For a copy, see <https://opensource.org/licenses/MIT>.
6 
7 #pragma once
8 
9 #include "carla/client/Actor.h"
10 
11 #include <functional>
12 
13 namespace carla {
14 namespace sensor { class SensorData; }
15 namespace client {
16 
17  class Sensor : public Actor {
18  public:
19 
20  using CallbackFunctionType = std::function<void(SharedPtr<sensor::SensorData>)>;
21 
22  using Actor::Actor;
23 
24  /// Register a @a callback to be executed each time a new measurement is
25  /// received.
26  virtual void Listen(CallbackFunctionType callback) = 0;
27 
28  /// Stop listening for new measurements.
29  virtual void Stop() = 0;
30 
31  /// Return whether this Sensor instance is currently listening to new data.
32  virtual bool IsListening() const = 0;
33  };
34 
35 } // namespace client
36 } // namespace carla
This file contains definitions of common data structures used in traffic manager. ...
Definition: Carla.cpp:133
carla::SharedPtr< cc::Actor > Actor
std::function< void(SharedPtr< sensor::SensorData >)> CallbackFunctionType
Represents an actor in the simulation.
Definition: client/Actor.h:18