From 8e432e4ef9730f07f513bd3e21a13fe77c0196f3 Mon Sep 17 00:00:00 2001 From: Pascal Serrarens Date: Tue, 5 Dec 2023 09:43:36 +0100 Subject: [PATCH] Percpetion constructor without sensorCount --- Perception.cpp | 2 +- Perception.h | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/Perception.cpp b/Perception.cpp index 530937b..67b3a30 100644 --- a/Perception.cpp +++ b/Perception.cpp @@ -6,7 +6,7 @@ Perception::Perception() {} Perception::Perception(Placement* sensors, unsigned int sensorCount) { this->sensorCount = sensorCount; - this->sensorPlacements = sensors; + this->sensorPlacements = (Placement*)sensors; } void Perception::AddSensors(Placement* things, unsigned int thingCount) { diff --git a/Perception.h b/Perception.h index 4f848b3..cf5b7b8 100644 --- a/Perception.h +++ b/Perception.h @@ -10,9 +10,16 @@ class Perception { public: /// @brief Setup perception Perception(); + + /// @brief Template to make it possible to leave out ths sensorCount + /// @tparam sensorCount + /// @param sensors An array of sensor placements + template + inline Perception(Placement (&sensors)[sensorCount]) { + Perception(sensors, sensorCount); + } Perception(Placement* sensors, unsigned int sensorCount); - // void AddSensors(SensorPlacement* sensors, unsigned int sensorCount); void AddSensors(Placement* sensors, unsigned int sensorCount); unsigned int GetSensorCount();