Skip to content

Commit

Permalink
Add namespaces to prevent nameclashes of equivalent named wrapper types.
Browse files Browse the repository at this point in the history
  • Loading branch information
aentinger committed Feb 4, 2021
1 parent 202c360 commit c7ab9b0
Show file tree
Hide file tree
Showing 9 changed files with 297 additions and 5 deletions.
3 changes: 3 additions & 0 deletions src/ArduinoUAVCANTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
* INCLUDE
**************************************************************************************/

#include "types/reg/drone/physics/electricity/Power_0_1.hpp"
#include "types/reg/drone/physics/electricity/PowerTs_0_1.hpp"
#include "types/reg/drone/physics/electricity/Source_0_1.hpp"
#include "types/reg/drone/physics/electricity/SourceTs_0_1.hpp"

#include "types/reg/drone/service/battery/Parameters_0_1.hpp"
Expand Down
79 changes: 79 additions & 0 deletions src/types/reg/drone/physics/electricity/PowerTs_0_1.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* This software is distributed under the terms of the MIT License.
* Copyright (c) 2020 LXRobotics.
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com>
* Contributors: https://github.com/107-systems/107-Arduino-UAVCAN/graphs/contributors.
*/

#ifndef ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWERTS_0_1_H_
#define ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWERTS_0_1_H_

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <libcanard/canard.h>

#include "PowerTs_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace physics {
namespace electricity {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/

template <CanardPortID ID>
class PowerTs_0_1
{

public:

reg_drone_physics_electricity_PowerTs_0_1 data;

static constexpr CanardPortID PORT_ID = ID;
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_physics_electricity_PowerTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


PowerTs_0_1()
{
reg_drone_physics_electricity_PowerTs_0_1_initialize_(&data);
}

PowerTs_0_1(PowerTs_0_1 const & other)
{
memcpy(&data, &other.data, sizeof(data));
}

static PowerTs_0_1 deserialize(CanardTransfer const & transfer)
{
PowerTs_0_1 b;
size_t inout_buffer_size_bytes = transfer.payload_size;
reg_drone_physics_electricity_PowerTs_0_1_deserialize_(&b.data, (uint8_t *)(transfer.payload), &inout_buffer_size_bytes);
return b;
}

size_t serialize(uint8_t * payload) const
{
size_t inout_buffer_size_bytes = PowerTs_0_1::MAX_PAYLOAD_SIZE;
return (reg_drone_physics_electricity_PowerTs_0_1_serialize_(&data, payload, &inout_buffer_size_bytes) < NUNAVUT_SUCCESS) ? 0 : inout_buffer_size_bytes;
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* physics */
} /* electricity */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWERTS_0_1_H_ */
79 changes: 79 additions & 0 deletions src/types/reg/drone/physics/electricity/Power_0_1.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* This software is distributed under the terms of the MIT License.
* Copyright (c) 2020 LXRobotics.
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com>
* Contributors: https://github.com/107-systems/107-Arduino-UAVCAN/graphs/contributors.
*/

#ifndef ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWER_0_1_H_
#define ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWER_0_1_H_

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <libcanard/canard.h>

#include "Power_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace physics {
namespace electricity {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/

template <CanardPortID ID>
class Power_0_1
{

public:

reg_drone_physics_electricity_Power_0_1 data;

static constexpr CanardPortID PORT_ID = ID;
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_physics_electricity_Power_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


Power_0_1()
{
reg_drone_physics_electricity_Power_0_1_initialize_(&data);
}

Power_0_1(Power_0_1 const & other)
{
memcpy(&data, &other.data, sizeof(data));
}

static Power_0_1 deserialize(CanardTransfer const & transfer)
{
Power_0_1 b;
size_t inout_buffer_size_bytes = transfer.payload_size;
reg_drone_physics_electricity_Power_0_1_deserialize_(&b.data, (uint8_t *)(transfer.payload), &inout_buffer_size_bytes);
return b;
}

size_t serialize(uint8_t * payload) const
{
size_t inout_buffer_size_bytes = Power_0_1::MAX_PAYLOAD_SIZE;
return (reg_drone_physics_electricity_Power_0_1_serialize_(&data, payload, &inout_buffer_size_bytes) < NUNAVUT_SUCCESS) ? 0 : inout_buffer_size_bytes;
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* physics */
} /* electricity */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_POWER_0_1_H_ */
20 changes: 19 additions & 1 deletion src/types/reg/drone/physics/electricity/SourceTs_0_1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

#include "SourceTs_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace physics {
namespace electricity {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
Expand All @@ -32,7 +41,7 @@ class SourceTs_0_1
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_physics_electricity_SourceTs_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


SourceTs_0_1()
{
reg_drone_physics_electricity_SourceTs_0_1_initialize_(&data);
Expand All @@ -58,4 +67,13 @@ class SourceTs_0_1
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* physics */
} /* electricity */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_SOURCETS_0_1_H_ */
79 changes: 79 additions & 0 deletions src/types/reg/drone/physics/electricity/Source_0_1.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/**
* This software is distributed under the terms of the MIT License.
* Copyright (c) 2020 LXRobotics.
* Author: Alexander Entinger <alexander.entinger@lxrobotics.com>
* Contributors: https://github.com/107-systems/107-Arduino-UAVCAN/graphs/contributors.
*/

#ifndef ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_SOURCE_0_1_H_
#define ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_SOURCE_0_1_H_

/**************************************************************************************
* INCLUDE
**************************************************************************************/

#include <libcanard/canard.h>

#include "Source_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace physics {
namespace electricity {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/

template <CanardPortID ID>
class Source_0_1
{

public:

reg_drone_physics_electricity_Source_0_1 data;

static constexpr CanardPortID PORT_ID = ID;
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_physics_electricity_Source_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


Source_0_1()
{
reg_drone_physics_electricity_Source_0_1_initialize_(&data);
}

Source_0_1(Source_0_1 const & other)
{
memcpy(&data, &other.data, sizeof(data));
}

static Source_0_1 deserialize(CanardTransfer const & transfer)
{
Source_0_1 b;
size_t inout_buffer_size_bytes = transfer.payload_size;
reg_drone_physics_electricity_Source_0_1_deserialize_(&b.data, (uint8_t *)(transfer.payload), &inout_buffer_size_bytes);
return b;
}

size_t serialize(uint8_t * payload) const
{
size_t inout_buffer_size_bytes = Source_0_1::MAX_PAYLOAD_SIZE;
return (reg_drone_physics_electricity_Source_0_1_serialize_(&data, payload, &inout_buffer_size_bytes) < NUNAVUT_SUCCESS) ? 0 : inout_buffer_size_bytes;
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* physics */
} /* electricity */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_PHYSICS_ELECTRICITY_SOURCE_0_1_H_ */
1 change: 0 additions & 1 deletion src/types/reg/drone/service/battery/Parameters_0_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -862,4 +862,3 @@ static inline void reg_drone_service_battery_Parameters_0_1_initialize_(reg_dron
}
#endif
#endif // REG_DRONE_SERVICE_BATTERY_PARAMETERS_0_1_INCLUDED_

20 changes: 19 additions & 1 deletion src/types/reg/drone/service/battery/Parameters_0_1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

#include "Parameters_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace service {
namespace battery {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
Expand All @@ -32,7 +41,7 @@ class Parameters_0_1
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_service_battery_Parameters_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


Parameters_0_1()
{
reg_drone_service_battery_Parameters_0_1_initialize_(&data);
Expand All @@ -58,4 +67,13 @@ class Parameters_0_1
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* service */
} /* battery */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_SERVICE_BATTERY_PARAMETERS_0_1_HPP_ */
1 change: 0 additions & 1 deletion src/types/reg/drone/service/battery/Status_0_1.h
Original file line number Diff line number Diff line change
Expand Up @@ -520,4 +520,3 @@ static inline void reg_drone_service_battery_Status_0_1_initialize_(reg_drone_se
}
#endif
#endif // REG_DRONE_SERVICE_BATTERY_STATUS_0_1_INCLUDED_

20 changes: 19 additions & 1 deletion src/types/reg/drone/service/battery/Status_0_1.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@

#include "Status_0_1.h"

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

namespace reg {
namespace drone {
namespace service {
namespace battery {

/**************************************************************************************
* CLASS DECLARATION
**************************************************************************************/
Expand All @@ -32,7 +41,7 @@ class Status_0_1
static constexpr size_t MAX_PAYLOAD_SIZE = reg_drone_service_battery_Status_0_1_SERIALIZATION_BUFFER_SIZE_BYTES_;
static constexpr CanardTransferKind TRANSFER_KIND = CanardTransferKindMessage;


Status_0_1()
{
reg_drone_service_battery_Status_0_1_initialize_(&data);
Expand All @@ -58,4 +67,13 @@ class Status_0_1
}
};

/**************************************************************************************
* NAMESPACE
**************************************************************************************/

} /* reg */
} /* drone */
} /* service */
} /* battery */

#endif /* ARDUINO_UAVCAN_TYPES_REG_DRONE_SERVICE_BATTERY_STATUS_0_1_HPP_ */

0 comments on commit c7ab9b0

Please sign in to comment.