#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};


#[link(name = "pal_statistics_msgs__rosidl_typesupport_c")]
extern "C" {
    fn rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__Statistic() -> *const std::ffi::c_void;
}

#[link(name = "pal_statistics_msgs__rosidl_generator_c")]
extern "C" {
    fn pal_statistics_msgs__msg__Statistic__init(msg: *mut Statistic) -> bool;
    fn pal_statistics_msgs__msg__Statistic__Sequence__init(seq: *mut rosidl_runtime_rs::Sequence<Statistic>, size: usize) -> bool;
    fn pal_statistics_msgs__msg__Statistic__Sequence__fini(seq: *mut rosidl_runtime_rs::Sequence<Statistic>);
    fn pal_statistics_msgs__msg__Statistic__Sequence__copy(in_seq: &rosidl_runtime_rs::Sequence<Statistic>, out_seq: *mut rosidl_runtime_rs::Sequence<Statistic>) -> bool;
}

// Corresponds to pal_statistics_msgs__msg__Statistic
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]


// This struct is not documented.
#[allow(missing_docs)]

#[repr(C)]
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Statistic {

    // This member is not documented.
    #[allow(missing_docs)]
    pub name: rosidl_runtime_rs::String,


    // This member is not documented.
    #[allow(missing_docs)]
    pub value: f64,

}



impl Default for Statistic {
  fn default() -> Self {
    unsafe {
      let mut msg = std::mem::zeroed();
      if !pal_statistics_msgs__msg__Statistic__init(&mut msg as *mut _) {
        panic!("Call to pal_statistics_msgs__msg__Statistic__init() failed");
      }
      msg
    }
  }
}

impl rosidl_runtime_rs::SequenceAlloc for Statistic {
  fn sequence_init(seq: &mut rosidl_runtime_rs::Sequence<Self>, size: usize) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistic__Sequence__init(seq as *mut _, size) }
  }
  fn sequence_fini(seq: &mut rosidl_runtime_rs::Sequence<Self>) {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistic__Sequence__fini(seq as *mut _) }
  }
  fn sequence_copy(in_seq: &rosidl_runtime_rs::Sequence<Self>, out_seq: &mut rosidl_runtime_rs::Sequence<Self>) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistic__Sequence__copy(in_seq, out_seq as *mut _) }
  }
}

impl rosidl_runtime_rs::Message for Statistic {
  type RmwMsg = Self;
  fn into_rmw_message(msg_cow: std::borrow::Cow<'_, Self>) -> std::borrow::Cow<'_, Self::RmwMsg> { msg_cow }
  fn from_rmw_message(msg: Self::RmwMsg) -> Self { msg }
}

impl rosidl_runtime_rs::RmwMessage for Statistic where Self: Sized {
  const TYPE_NAME: &'static str = "pal_statistics_msgs/msg/Statistic";
  fn get_type_support() -> *const std::ffi::c_void {
    // SAFETY: No preconditions for this function.
    unsafe { rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__Statistic() }
  }
}


#[link(name = "pal_statistics_msgs__rosidl_typesupport_c")]
extern "C" {
    fn rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__Statistics() -> *const std::ffi::c_void;
}

#[link(name = "pal_statistics_msgs__rosidl_generator_c")]
extern "C" {
    fn pal_statistics_msgs__msg__Statistics__init(msg: *mut Statistics) -> bool;
    fn pal_statistics_msgs__msg__Statistics__Sequence__init(seq: *mut rosidl_runtime_rs::Sequence<Statistics>, size: usize) -> bool;
    fn pal_statistics_msgs__msg__Statistics__Sequence__fini(seq: *mut rosidl_runtime_rs::Sequence<Statistics>);
    fn pal_statistics_msgs__msg__Statistics__Sequence__copy(in_seq: &rosidl_runtime_rs::Sequence<Statistics>, out_seq: *mut rosidl_runtime_rs::Sequence<Statistics>) -> bool;
}

// Corresponds to pal_statistics_msgs__msg__Statistics
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]

/// header

#[repr(C)]
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct Statistics {

    // This member is not documented.
    #[allow(missing_docs)]
    pub header: std_msgs::msg::rmw::Header,

    /// Statistics
    pub statistics: rosidl_runtime_rs::Sequence<super::super::msg::rmw::Statistic>,

}



impl Default for Statistics {
  fn default() -> Self {
    unsafe {
      let mut msg = std::mem::zeroed();
      if !pal_statistics_msgs__msg__Statistics__init(&mut msg as *mut _) {
        panic!("Call to pal_statistics_msgs__msg__Statistics__init() failed");
      }
      msg
    }
  }
}

impl rosidl_runtime_rs::SequenceAlloc for Statistics {
  fn sequence_init(seq: &mut rosidl_runtime_rs::Sequence<Self>, size: usize) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistics__Sequence__init(seq as *mut _, size) }
  }
  fn sequence_fini(seq: &mut rosidl_runtime_rs::Sequence<Self>) {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistics__Sequence__fini(seq as *mut _) }
  }
  fn sequence_copy(in_seq: &rosidl_runtime_rs::Sequence<Self>, out_seq: &mut rosidl_runtime_rs::Sequence<Self>) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__Statistics__Sequence__copy(in_seq, out_seq as *mut _) }
  }
}

impl rosidl_runtime_rs::Message for Statistics {
  type RmwMsg = Self;
  fn into_rmw_message(msg_cow: std::borrow::Cow<'_, Self>) -> std::borrow::Cow<'_, Self::RmwMsg> { msg_cow }
  fn from_rmw_message(msg: Self::RmwMsg) -> Self { msg }
}

impl rosidl_runtime_rs::RmwMessage for Statistics where Self: Sized {
  const TYPE_NAME: &'static str = "pal_statistics_msgs/msg/Statistics";
  fn get_type_support() -> *const std::ffi::c_void {
    // SAFETY: No preconditions for this function.
    unsafe { rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__Statistics() }
  }
}


#[link(name = "pal_statistics_msgs__rosidl_typesupport_c")]
extern "C" {
    fn rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__StatisticsNames() -> *const std::ffi::c_void;
}

#[link(name = "pal_statistics_msgs__rosidl_generator_c")]
extern "C" {
    fn pal_statistics_msgs__msg__StatisticsNames__init(msg: *mut StatisticsNames) -> bool;
    fn pal_statistics_msgs__msg__StatisticsNames__Sequence__init(seq: *mut rosidl_runtime_rs::Sequence<StatisticsNames>, size: usize) -> bool;
    fn pal_statistics_msgs__msg__StatisticsNames__Sequence__fini(seq: *mut rosidl_runtime_rs::Sequence<StatisticsNames>);
    fn pal_statistics_msgs__msg__StatisticsNames__Sequence__copy(in_seq: &rosidl_runtime_rs::Sequence<StatisticsNames>, out_seq: *mut rosidl_runtime_rs::Sequence<StatisticsNames>) -> bool;
}

// Corresponds to pal_statistics_msgs__msg__StatisticsNames
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]

/// header

#[repr(C)]
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct StatisticsNames {

    // This member is not documented.
    #[allow(missing_docs)]
    pub header: std_msgs::msg::rmw::Header,

    /// Statistics names
    pub names: rosidl_runtime_rs::Sequence<rosidl_runtime_rs::String>,

    /// This is increased each time names change
    pub names_version: u32,

}



impl Default for StatisticsNames {
  fn default() -> Self {
    unsafe {
      let mut msg = std::mem::zeroed();
      if !pal_statistics_msgs__msg__StatisticsNames__init(&mut msg as *mut _) {
        panic!("Call to pal_statistics_msgs__msg__StatisticsNames__init() failed");
      }
      msg
    }
  }
}

impl rosidl_runtime_rs::SequenceAlloc for StatisticsNames {
  fn sequence_init(seq: &mut rosidl_runtime_rs::Sequence<Self>, size: usize) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsNames__Sequence__init(seq as *mut _, size) }
  }
  fn sequence_fini(seq: &mut rosidl_runtime_rs::Sequence<Self>) {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsNames__Sequence__fini(seq as *mut _) }
  }
  fn sequence_copy(in_seq: &rosidl_runtime_rs::Sequence<Self>, out_seq: &mut rosidl_runtime_rs::Sequence<Self>) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsNames__Sequence__copy(in_seq, out_seq as *mut _) }
  }
}

impl rosidl_runtime_rs::Message for StatisticsNames {
  type RmwMsg = Self;
  fn into_rmw_message(msg_cow: std::borrow::Cow<'_, Self>) -> std::borrow::Cow<'_, Self::RmwMsg> { msg_cow }
  fn from_rmw_message(msg: Self::RmwMsg) -> Self { msg }
}

impl rosidl_runtime_rs::RmwMessage for StatisticsNames where Self: Sized {
  const TYPE_NAME: &'static str = "pal_statistics_msgs/msg/StatisticsNames";
  fn get_type_support() -> *const std::ffi::c_void {
    // SAFETY: No preconditions for this function.
    unsafe { rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__StatisticsNames() }
  }
}


#[link(name = "pal_statistics_msgs__rosidl_typesupport_c")]
extern "C" {
    fn rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__StatisticsValues() -> *const std::ffi::c_void;
}

#[link(name = "pal_statistics_msgs__rosidl_generator_c")]
extern "C" {
    fn pal_statistics_msgs__msg__StatisticsValues__init(msg: *mut StatisticsValues) -> bool;
    fn pal_statistics_msgs__msg__StatisticsValues__Sequence__init(seq: *mut rosidl_runtime_rs::Sequence<StatisticsValues>, size: usize) -> bool;
    fn pal_statistics_msgs__msg__StatisticsValues__Sequence__fini(seq: *mut rosidl_runtime_rs::Sequence<StatisticsValues>);
    fn pal_statistics_msgs__msg__StatisticsValues__Sequence__copy(in_seq: &rosidl_runtime_rs::Sequence<StatisticsValues>, out_seq: *mut rosidl_runtime_rs::Sequence<StatisticsValues>) -> bool;
}

// Corresponds to pal_statistics_msgs__msg__StatisticsValues
#[cfg_attr(feature = "serde", derive(Deserialize, Serialize))]

/// header

#[repr(C)]
#[derive(Clone, Debug, PartialEq, PartialOrd)]
pub struct StatisticsValues {

    // This member is not documented.
    #[allow(missing_docs)]
    pub header: std_msgs::msg::rmw::Header,

    /// Statistics
    pub values: rosidl_runtime_rs::Sequence<f64>,

    /// The values vector corresponds to the name vector with the same name
    pub names_version: u32,

}



impl Default for StatisticsValues {
  fn default() -> Self {
    unsafe {
      let mut msg = std::mem::zeroed();
      if !pal_statistics_msgs__msg__StatisticsValues__init(&mut msg as *mut _) {
        panic!("Call to pal_statistics_msgs__msg__StatisticsValues__init() failed");
      }
      msg
    }
  }
}

impl rosidl_runtime_rs::SequenceAlloc for StatisticsValues {
  fn sequence_init(seq: &mut rosidl_runtime_rs::Sequence<Self>, size: usize) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsValues__Sequence__init(seq as *mut _, size) }
  }
  fn sequence_fini(seq: &mut rosidl_runtime_rs::Sequence<Self>) {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsValues__Sequence__fini(seq as *mut _) }
  }
  fn sequence_copy(in_seq: &rosidl_runtime_rs::Sequence<Self>, out_seq: &mut rosidl_runtime_rs::Sequence<Self>) -> bool {
    // SAFETY: This is safe since the pointer is guaranteed to be valid/initialized.
    unsafe { pal_statistics_msgs__msg__StatisticsValues__Sequence__copy(in_seq, out_seq as *mut _) }
  }
}

impl rosidl_runtime_rs::Message for StatisticsValues {
  type RmwMsg = Self;
  fn into_rmw_message(msg_cow: std::borrow::Cow<'_, Self>) -> std::borrow::Cow<'_, Self::RmwMsg> { msg_cow }
  fn from_rmw_message(msg: Self::RmwMsg) -> Self { msg }
}

impl rosidl_runtime_rs::RmwMessage for StatisticsValues where Self: Sized {
  const TYPE_NAME: &'static str = "pal_statistics_msgs/msg/StatisticsValues";
  fn get_type_support() -> *const std::ffi::c_void {
    // SAFETY: No preconditions for this function.
    unsafe { rosidl_typesupport_c__get_message_type_support_handle__pal_statistics_msgs__msg__StatisticsValues() }
  }
}


