Skip to content

Instantly share code, notes, and snippets.

@allenh1
Last active March 31, 2019 15:52
Show Gist options
  • Select an option

  • Save allenh1/0a855f21a60c329f081efba7b9f76ca9 to your computer and use it in GitHub Desktop.

Select an option

Save allenh1/0a855f21a60c329f081efba7b9f76ca9 to your computer and use it in GitHub Desktop.
// generated from rosidl_generator_cpp/resource/idl__struct.hpp.em
// with input from rosidl_generator_cpp:msg/Various.idl
// generated code does not contain a copyright notice
#ifndef ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
#define ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
#include <rosidl_generator_cpp/bounded_vector.hpp>
#include <rosidl_generator_cpp/message_initialization.hpp>
#include <algorithm>
#include <array>
#include <memory>
#include <string>
#include <vector>
// Protect against ERROR being predefined on Windows, in case somebody defines a
// constant by that name.
#if defined(_WIN32)
#if defined(ERROR)
#undef ERROR
#endif
#if defined(NO_ERROR)
#undef NO_ERROR
#endif
#endif
// Include directives for member types
// Member 'vec3'
// Member 'vec3_fixed'
// Member 'vec3_unbounded'
// Member 'vec3_bounded'
#include "rosidl_generator_cpp/msg/fields_with_same_type_some_defaults__struct.hpp"
#ifndef _WIN32
# define DEPRECATED__rosidl_generator_cpp__msg__Various __attribute__((deprecated))
#else
# define DEPRECATED__rosidl_generator_cpp__msg__Various __declspec(deprecated)
#endif
namespace rosidl_generator_cpp
{
namespace msg
{
// message struct
template<class ContainerAllocator>
struct Various_
{
using Type = Various_<ContainerAllocator>;
explicit Various_(rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
: vec3(_init)
{
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
this->float64_value = 2.4;
this->string_value = "bar";
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float32_value = 0.0f;
this->float64_value = 0.0;
this->uint64_value = 0ull;
this->string_value = "";
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->uint64_value = 0ull;
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_init});
}
}
explicit Various_(const ContainerAllocator & _alloc, rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
: string_value(_alloc),
float32_arr(_alloc),
float64_arr(_alloc),
float64_arr2(_alloc),
string_arr(_alloc),
vec3(_alloc, _init),
vec3_fixed(_alloc)
{
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
this->float64_value = 2.4;
this->string_value = "bar";
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float32_value = 0.0f;
this->float64_value = 0.0;
this->uint64_value = 0ull;
this->string_value = "";
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->uint64_value = 0ull;
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_alloc, _init});
}
}
// field types and members
using _float32_value_type =
float;
_float32_value_type float32_value;
using _float64_value_type =
double;
_float64_value_type float64_value;
using _uint64_value_type =
uint64_t;
_uint64_value_type uint64_value;
using _string_value_type =
std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>;
_string_value_type string_value;
using _float32_arr_type =
std::array<float, 10>;
_float32_arr_type float32_arr;
using _float64_arr_type =
std::array<double, 3>;
_float64_arr_type float64_arr;
using _float64_arr2_type =
std::array<double, 2>;
_float64_arr2_type float64_arr2;
using _string_arr_type =
std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>;
_string_arr_type string_arr;
using _unbounded_type =
std::vector<float, typename ContainerAllocator::template rebind<float>::other>;
_unbounded_type unbounded;
using _bounded_no_def_type =
rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other>;
_bounded_no_def_type bounded_no_def;
using _bounded_def_type =
rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other>;
_bounded_def_type bounded_def;
using _vec3_type =
rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>;
_vec3_type vec3;
using _vec3_fixed_type =
std::array<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2>;
_vec3_fixed_type vec3_fixed;
using _vec3_unbounded_type =
std::vector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other>;
_vec3_unbounded_type vec3_unbounded;
using _vec3_bounded_type =
rosidl_generator_cpp::BoundedVector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other>;
_vec3_bounded_type vec3_bounded;
// setters for named parameter idiom
Type & set__float32_value(
const float & _arg)
{
this->float32_value = _arg;
return *this;
}
Type & set__float64_value(
const double & _arg)
{
this->float64_value = _arg;
return *this;
}
Type & set__uint64_value(
const uint64_t & _arg)
{
this->uint64_value = _arg;
return *this;
}
Type & set__string_value(
const std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other> & _arg)
{
this->string_value = _arg;
return *this;
}
Type & set__float32_arr(
const std::array<float, 10> & _arg)
{
this->float32_arr = _arg;
return *this;
}
Type & set__float64_arr(
const std::array<double, 3> & _arg)
{
this->float64_arr = _arg;
return *this;
}
Type & set__float64_arr2(
const std::array<double, 2> & _arg)
{
this->float64_arr2 = _arg;
return *this;
}
Type & set__string_arr(
const std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3> & _arg)
{
this->string_arr = _arg;
return *this;
}
Type & set__unbounded(
const std::vector<float, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->unbounded = _arg;
return *this;
}
Type & set__bounded_no_def(
const rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->bounded_no_def = _arg;
return *this;
}
Type & set__bounded_def(
const rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->bounded_def = _arg;
return *this;
}
Type & set__vec3(
const rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator> & _arg)
{
this->vec3 = _arg;
return *this;
}
Type & set__vec3_fixed(
const std::array<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2> & _arg)
{
this->vec3_fixed = _arg;
return *this;
}
Type & set__vec3_unbounded(
const std::vector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other> & _arg)
{
this->vec3_unbounded = _arg;
return *this;
}
Type & set__vec3_bounded(
const rosidl_generator_cpp::BoundedVector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other> & _arg)
{
this->vec3_bounded = _arg;
return *this;
}
// constant declarations
// pointer types
using RawPtr =
rosidl_generator_cpp::msg::Various_<ContainerAllocator> *;
using ConstRawPtr =
const rosidl_generator_cpp::msg::Various_<ContainerAllocator> *;
using SharedPtr =
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>;
using ConstSharedPtr =
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>;
template<typename Deleter = std::default_delete<
rosidl_generator_cpp::msg::Various_<ContainerAllocator>>>
using UniquePtrWithDeleter =
std::unique_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>, Deleter>;
using UniquePtr = UniquePtrWithDeleter<>;
template<typename Deleter = std::default_delete<
rosidl_generator_cpp::msg::Various_<ContainerAllocator>>>
using ConstUniquePtrWithDeleter =
std::unique_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const, Deleter>;
using ConstUniquePtr = ConstUniquePtrWithDeleter<>;
using WeakPtr =
std::weak_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>;
using ConstWeakPtr =
std::weak_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>;
// pointer types similar to ROS 1, use SharedPtr / ConstSharedPtr instead
// NOTE: Can't use 'using' here because GNU C++ can't parse attributes properly
typedef DEPRECATED__rosidl_generator_cpp__msg__Various
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>
Ptr;
typedef DEPRECATED__rosidl_generator_cpp__msg__Various
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>
ConstPtr;
// comparison operators
bool operator==(const Various_ & other) const
{
if (this->float32_value != other.float32_value) {
return false;
}
if (this->float64_value != other.float64_value) {
return false;
}
if (this->uint64_value != other.uint64_value) {
return false;
}
if (this->string_value != other.string_value) {
return false;
}
if (this->float32_arr != other.float32_arr) {
return false;
}
if (this->float64_arr != other.float64_arr) {
return false;
}
if (this->float64_arr2 != other.float64_arr2) {
return false;
}
if (this->string_arr != other.string_arr) {
return false;
}
if (this->unbounded != other.unbounded) {
return false;
}
if (this->bounded_no_def != other.bounded_no_def) {
return false;
}
if (this->bounded_def != other.bounded_def) {
return false;
}
if (this->vec3 != other.vec3) {
return false;
}
if (this->vec3_fixed != other.vec3_fixed) {
return false;
}
if (this->vec3_unbounded != other.vec3_unbounded) {
return false;
}
if (this->vec3_bounded != other.vec3_bounded) {
return false;
}
return true;
}
bool operator!=(const Various_ & other) const
{
return !this->operator==(other);
}
}; // struct Various_
// alias to use template instance with default allocator
using Various =
rosidl_generator_cpp::msg::Various_<std::allocator<void>>;
// constant definitions
} // namespace msg
} // namespace rosidl_generator_cpp
#endif // ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
// generated from rosidl_generator_cpp/resource/idl__struct.hpp.em
// with input from rosidl_generator_cpp:msg/Various.idl
// generated code does not contain a copyright notice
#ifndef ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
#define ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
#include <rosidl_generator_cpp/bounded_vector.hpp>
#include <rosidl_generator_cpp/message_initialization.hpp>
#include <algorithm>
#include <array>
#include <memory>
#include <string>
#include <vector>
// Protect against ERROR being predefined on Windows, in case somebody defines a
// constant by that name.
#if defined(_WIN32)
#if defined(ERROR)
#undef ERROR
#endif
#if defined(NO_ERROR)
#undef NO_ERROR
#endif
#endif
// Include directives for member types
// Member 'vec3'
// Member 'vec3_fixed'
// Member 'vec3_unbounded'
// Member 'vec3_bounded'
#include "rosidl_generator_cpp/msg/fields_with_same_type_some_defaults__struct.hpp"
#ifndef _WIN32
# define DEPRECATED__rosidl_generator_cpp__msg__Various __attribute__((deprecated))
#else
# define DEPRECATED__rosidl_generator_cpp__msg__Various __declspec(deprecated)
#endif
namespace rosidl_generator_cpp
{
namespace msg
{
// message struct
template<class ContainerAllocator>
struct Various_
{
using Type = Various_<ContainerAllocator>;
explicit Various_(rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
: vec3(_init)
{
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float32_value = 0.0f;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_value = 2.4;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float64_value = 0.0;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->uint64_value = 0ull;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->string_value = "bar";
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->string_value = "";
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_init});
}
}
explicit Various_(const ContainerAllocator & _alloc, rosidl_generator_cpp::MessageInitialization _init = rosidl_generator_cpp::MessageInitialization::ALL)
: string_value(_alloc),
float32_arr(_alloc),
float64_arr(_alloc),
float64_arr2(_alloc),
string_arr(_alloc),
vec3(_alloc, _init),
vec3_fixed(_alloc)
{
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float32_value = 0.0f;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_value = 2.4;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->float64_value = 0.0;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->uint64_value = 0ull;
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->string_value = "bar";
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
this->string_value = "";
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
} else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_alloc, _init});
}
}
// field types and members
using _float32_value_type =
float;
_float32_value_type float32_value;
using _float64_value_type =
double;
_float64_value_type float64_value;
using _uint64_value_type =
uint64_t;
_uint64_value_type uint64_value;
using _string_value_type =
std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>;
_string_value_type string_value;
using _float32_arr_type =
std::array<float, 10>;
_float32_arr_type float32_arr;
using _float64_arr_type =
std::array<double, 3>;
_float64_arr_type float64_arr;
using _float64_arr2_type =
std::array<double, 2>;
_float64_arr2_type float64_arr2;
using _string_arr_type =
std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>;
_string_arr_type string_arr;
using _unbounded_type =
std::vector<float, typename ContainerAllocator::template rebind<float>::other>;
_unbounded_type unbounded;
using _bounded_no_def_type =
rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other>;
_bounded_no_def_type bounded_no_def;
using _bounded_def_type =
rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other>;
_bounded_def_type bounded_def;
using _vec3_type =
rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>;
_vec3_type vec3;
using _vec3_fixed_type =
std::array<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2>;
_vec3_fixed_type vec3_fixed;
using _vec3_unbounded_type =
std::vector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other>;
_vec3_unbounded_type vec3_unbounded;
using _vec3_bounded_type =
rosidl_generator_cpp::BoundedVector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other>;
_vec3_bounded_type vec3_bounded;
// setters for named parameter idiom
Type & set__float32_value(
const float & _arg)
{
this->float32_value = _arg;
return *this;
}
Type & set__float64_value(
const double & _arg)
{
this->float64_value = _arg;
return *this;
}
Type & set__uint64_value(
const uint64_t & _arg)
{
this->uint64_value = _arg;
return *this;
}
Type & set__string_value(
const std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other> & _arg)
{
this->string_value = _arg;
return *this;
}
Type & set__float32_arr(
const std::array<float, 10> & _arg)
{
this->float32_arr = _arg;
return *this;
}
Type & set__float64_arr(
const std::array<double, 3> & _arg)
{
this->float64_arr = _arg;
return *this;
}
Type & set__float64_arr2(
const std::array<double, 2> & _arg)
{
this->float64_arr2 = _arg;
return *this;
}
Type & set__string_arr(
const std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3> & _arg)
{
this->string_arr = _arg;
return *this;
}
Type & set__unbounded(
const std::vector<float, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->unbounded = _arg;
return *this;
}
Type & set__bounded_no_def(
const rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->bounded_no_def = _arg;
return *this;
}
Type & set__bounded_def(
const rosidl_generator_cpp::BoundedVector<float, 3, typename ContainerAllocator::template rebind<float>::other> & _arg)
{
this->bounded_def = _arg;
return *this;
}
Type & set__vec3(
const rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator> & _arg)
{
this->vec3 = _arg;
return *this;
}
Type & set__vec3_fixed(
const std::array<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2> & _arg)
{
this->vec3_fixed = _arg;
return *this;
}
Type & set__vec3_unbounded(
const std::vector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other> & _arg)
{
this->vec3_unbounded = _arg;
return *this;
}
Type & set__vec3_bounded(
const rosidl_generator_cpp::BoundedVector<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>, 2, typename ContainerAllocator::template rebind<rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>>::other> & _arg)
{
this->vec3_bounded = _arg;
return *this;
}
// constant declarations
// pointer types
using RawPtr =
rosidl_generator_cpp::msg::Various_<ContainerAllocator> *;
using ConstRawPtr =
const rosidl_generator_cpp::msg::Various_<ContainerAllocator> *;
using SharedPtr =
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>;
using ConstSharedPtr =
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>;
template<typename Deleter = std::default_delete<
rosidl_generator_cpp::msg::Various_<ContainerAllocator>>>
using UniquePtrWithDeleter =
std::unique_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>, Deleter>;
using UniquePtr = UniquePtrWithDeleter<>;
template<typename Deleter = std::default_delete<
rosidl_generator_cpp::msg::Various_<ContainerAllocator>>>
using ConstUniquePtrWithDeleter =
std::unique_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const, Deleter>;
using ConstUniquePtr = ConstUniquePtrWithDeleter<>;
using WeakPtr =
std::weak_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>;
using ConstWeakPtr =
std::weak_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>;
// pointer types similar to ROS 1, use SharedPtr / ConstSharedPtr instead
// NOTE: Can't use 'using' here because GNU C++ can't parse attributes properly
typedef DEPRECATED__rosidl_generator_cpp__msg__Various
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator>>
Ptr;
typedef DEPRECATED__rosidl_generator_cpp__msg__Various
std::shared_ptr<rosidl_generator_cpp::msg::Various_<ContainerAllocator> const>
ConstPtr;
// comparison operators
bool operator==(const Various_ & other) const
{
if (this->float32_value != other.float32_value) {
return false;
}
if (this->float64_value != other.float64_value) {
return false;
}
if (this->uint64_value != other.uint64_value) {
return false;
}
if (this->string_value != other.string_value) {
return false;
}
if (this->float32_arr != other.float32_arr) {
return false;
}
if (this->float64_arr != other.float64_arr) {
return false;
}
if (this->float64_arr2 != other.float64_arr2) {
return false;
}
if (this->string_arr != other.string_arr) {
return false;
}
if (this->unbounded != other.unbounded) {
return false;
}
if (this->bounded_no_def != other.bounded_no_def) {
return false;
}
if (this->bounded_def != other.bounded_def) {
return false;
}
if (this->vec3 != other.vec3) {
return false;
}
if (this->vec3_fixed != other.vec3_fixed) {
return false;
}
if (this->vec3_unbounded != other.vec3_unbounded) {
return false;
}
if (this->vec3_bounded != other.vec3_bounded) {
return false;
}
return true;
}
bool operator!=(const Various_ & other) const
{
return !this->operator==(other);
}
}; // struct Various_
// alias to use template instance with default allocator
using Various =
rosidl_generator_cpp::msg::Various_<std::allocator<void>>;
// constant definitions
} // namespace msg
} // namespace rosidl_generator_cpp
#endif // ROSIDL_GENERATOR_CPP__MSG__VARIOUS__STRUCT_HPP_
--- various__struct_old.hpp 2019-03-31 11:47:43.877054223 -0400
+++ various__struct.hpp 2019-03-31 11:40:31.862299775 -0400
@@ -56,70 +56,33 @@
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->float32_value = 0.0f;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_value = 2.4;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->float64_value = 0.0;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- this->uint64_value = 0ull;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->string_value = "bar";
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->string_value = "";
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
+ } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
+ this->float32_value = 0.0f;
+ this->float64_value = 0.0;
+ this->uint64_value = 0ull;
+ this->string_value = "";
+ std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
+ std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
+ std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
+ std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
+ this->uint64_value = 0ull;
+ std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
+ std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_init});
}
}
@@ -137,70 +100,33 @@
rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
{
this->float32_value = 1.125f;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->float32_value = 0.0f;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_value = 2.4;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->float64_value = 0.0;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- this->uint64_value = 0ull;
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->string_value = "bar";
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- this->string_value = "";
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_arr[0] = 8.5;
this->float64_arr[1] = 1.2;
this->float64_arr[2] = 3.4;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->float64_arr2[0] = 99.0;
this->float64_arr2[1] = 2.3;
- } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
- std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::ZERO == _init)
- {
- std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->unbounded.resize(2);
this->unbounded = {{1.0f, 2.0f}};
- }
- if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
- rosidl_generator_cpp::MessageInitialization::DEFAULTS_ONLY == _init)
- {
this->bounded_def.resize(2);
this->bounded_def = {{3.0f, 4.0f}};
+ } else if (rosidl_generator_cpp::MessageInitialization::ZERO == _init) {
+ this->float32_value = 0.0f;
+ this->float64_value = 0.0;
+ this->uint64_value = 0ull;
+ this->string_value = "";
+ std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
+ std::fill<typename std::array<double, 3>::iterator, double>(this->float64_arr.begin(), this->float64_arr.end(), 0.0);
+ std::fill<typename std::array<double, 2>::iterator, double>(this->float64_arr2.begin(), this->float64_arr2.end(), 0.0);
+ std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
}
if (rosidl_generator_cpp::MessageInitialization::ALL == _init ||
rosidl_generator_cpp::MessageInitialization::ZERO == _init)
{
+ this->uint64_value = 0ull;
+ std::fill<typename std::array<float, 10>::iterator, float>(this->float32_arr.begin(), this->float32_arr.end(), 0.0f);
+ std::fill<typename std::array<std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>, 3>::iterator, std::basic_string<char, std::char_traits<char>, typename ContainerAllocator::template rebind<char>::other>>(this->string_arr.begin(), this->string_arr.end(), "");
this->vec3_fixed.fill(rosidl_generator_cpp::msg::FieldsWithSameTypeSomeDefaults_<ContainerAllocator>{_alloc, _init});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment