Header.c 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. // Copyright 2016 Proyectos y Sistemas de Mantenimiento SL (eProsima).
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*!
  15. * @file Header.c
  16. * This source file contains the definition of the described types in the IDL file.
  17. *
  18. * This file was generated by the tool gen.
  19. */
  20. #include "Header.h"
  21. #include <ucdr/microcdr.h>
  22. #include <string.h>
  23. bool Header_serialize_topic(ucdrBuffer* writer, const Header* topic)
  24. {
  25. (void) Time_serialize_topic(writer, &topic->stamp);
  26. (void) ucdr_serialize_string(writer, topic->frame_id);
  27. return !writer->error;
  28. }
  29. bool Header_deserialize_topic(ucdrBuffer* reader, Header* topic)
  30. {
  31. (void) Time_deserialize_topic(reader, &topic->stamp);
  32. (void) ucdr_deserialize_string(reader, topic->frame_id, 255);
  33. return !reader->error;
  34. }
  35. uint32_t Header_size_of_topic(const Header* topic, uint32_t size)
  36. {
  37. uint32_t previousSize = size;
  38. size += Time_size_of_topic(&topic->stamp, size);
  39. size += ucdr_alignment(size, 4) + 4 + (uint32_t)strlen(topic->frame_id) + 1;
  40. return size - previousSize;
  41. }