// generated from rosidl_typesupport_fastrtps_c/resource/idl__type_support_c.cpp.em
// with input from custom_messages:msg/Mypath.idl
// generated code does not contain a copyright notice
#include "custom_messages/msg/detail/mypath__rosidl_typesupport_fastrtps_c.h"


#include <cassert>
#include <limits>
#include <string>
#include "rosidl_typesupport_fastrtps_c/identifier.h"
#include "rosidl_typesupport_fastrtps_c/wstring_conversion.hpp"
#include "rosidl_typesupport_fastrtps_cpp/message_type_support.h"
#include "custom_messages/msg/rosidl_typesupport_fastrtps_c__visibility_control.h"
#include "custom_messages/msg/detail/mypath__struct.h"
#include "custom_messages/msg/detail/mypath__functions.h"
#include "fastcdr/Cdr.h"

#ifndef _WIN32
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wunused-parameter"
# ifdef __clang__
#  pragma clang diagnostic ignored "-Wdeprecated-register"
#  pragma clang diagnostic ignored "-Wreturn-type-c-linkage"
# endif
#endif
#ifndef _WIN32
# pragma GCC diagnostic pop
#endif

// includes and forward declarations of message dependencies and their conversion functions

#if defined(__cplusplus)
extern "C"
{
#endif

#include "rosidl_runtime_c/primitives_sequence.h"  // mypath
#include "rosidl_runtime_c/primitives_sequence_functions.h"  // mypath

// forward declare type support functions


using _Mypath__ros_msg_type = custom_messages__msg__Mypath;

static bool _Mypath__cdr_serialize(
  const void * untyped_ros_message,
  eprosima::fastcdr::Cdr & cdr)
{
  if (!untyped_ros_message) {
    fprintf(stderr, "ros message handle is null\n");
    return false;
  }
  const _Mypath__ros_msg_type * ros_message = static_cast<const _Mypath__ros_msg_type *>(untyped_ros_message);
  // Field name: mypath
  {
    size_t size = ros_message->mypath.size;
    auto array_ptr = ros_message->mypath.data;
    cdr << static_cast<uint32_t>(size);
    cdr.serializeArray(array_ptr, size);
  }

  return true;
}

static bool _Mypath__cdr_deserialize(
  eprosima::fastcdr::Cdr & cdr,
  void * untyped_ros_message)
{
  if (!untyped_ros_message) {
    fprintf(stderr, "ros message handle is null\n");
    return false;
  }
  _Mypath__ros_msg_type * ros_message = static_cast<_Mypath__ros_msg_type *>(untyped_ros_message);
  // Field name: mypath
  {
    uint32_t cdrSize;
    cdr >> cdrSize;
    size_t size = static_cast<size_t>(cdrSize);
    if (ros_message->mypath.data) {
      rosidl_runtime_c__double__Sequence__fini(&ros_message->mypath);
    }
    if (!rosidl_runtime_c__double__Sequence__init(&ros_message->mypath, size)) {
      return "failed to create array for field 'mypath'";
    }
    auto array_ptr = ros_message->mypath.data;
    cdr.deserializeArray(array_ptr, size);
  }

  return true;
}

ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_custom_messages
size_t get_serialized_size_custom_messages__msg__Mypath(
  const void * untyped_ros_message,
  size_t current_alignment)
{
  const _Mypath__ros_msg_type * ros_message = static_cast<const _Mypath__ros_msg_type *>(untyped_ros_message);
  (void)ros_message;
  size_t initial_alignment = current_alignment;

  const size_t padding = 4;
  const size_t wchar_size = 4;
  (void)padding;
  (void)wchar_size;

  // field.name mypath
  {
    size_t array_size = ros_message->mypath.size;
    auto array_ptr = ros_message->mypath.data;
    current_alignment += padding +
      eprosima::fastcdr::Cdr::alignment(current_alignment, padding);
    (void)array_ptr;
    size_t item_size = sizeof(array_ptr[0]);
    current_alignment += array_size * item_size +
      eprosima::fastcdr::Cdr::alignment(current_alignment, item_size);
  }

  return current_alignment - initial_alignment;
}

static uint32_t _Mypath__get_serialized_size(const void * untyped_ros_message)
{
  return static_cast<uint32_t>(
    get_serialized_size_custom_messages__msg__Mypath(
      untyped_ros_message, 0));
}

ROSIDL_TYPESUPPORT_FASTRTPS_C_PUBLIC_custom_messages
size_t max_serialized_size_custom_messages__msg__Mypath(
  bool & full_bounded,
  size_t current_alignment)
{
  size_t initial_alignment = current_alignment;

  const size_t padding = 4;
  const size_t wchar_size = 4;
  (void)padding;
  (void)wchar_size;
  (void)full_bounded;

  // member: mypath
  {
    size_t array_size = 0;
    full_bounded = false;
    current_alignment += padding +
      eprosima::fastcdr::Cdr::alignment(current_alignment, padding);

    current_alignment += array_size * sizeof(uint64_t) +
      eprosima::fastcdr::Cdr::alignment(current_alignment, sizeof(uint64_t));
  }

  return current_alignment - initial_alignment;
}

static size_t _Mypath__max_serialized_size(bool & full_bounded)
{
  return max_serialized_size_custom_messages__msg__Mypath(
    full_bounded, 0);
}


static message_type_support_callbacks_t __callbacks_Mypath = {
  "custom_messages::msg",
  "Mypath",
  _Mypath__cdr_serialize,
  _Mypath__cdr_deserialize,
  _Mypath__get_serialized_size,
  _Mypath__max_serialized_size
};

static rosidl_message_type_support_t _Mypath__type_support = {
  rosidl_typesupport_fastrtps_c__identifier,
  &__callbacks_Mypath,
  get_message_typesupport_handle_function,
};

const rosidl_message_type_support_t *
ROSIDL_TYPESUPPORT_INTERFACE__MESSAGE_SYMBOL_NAME(rosidl_typesupport_fastrtps_c, custom_messages, msg, Mypath)() {
  return &_Mypath__type_support;
}

#if defined(__cplusplus)
}
#endif
