TypeIdentifier.h 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  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 TypeIdentifier.h
  16. * This header file contains the declaration of the described types in the IDL file.
  17. *
  18. * This file was generated by the tool gen.
  19. */
  20. #ifndef _TYPEIDENTIFIER_H_
  21. #define _TYPEIDENTIFIER_H_
  22. #include <fastrtps/types/TypesBase.h>
  23. #include <fastrtps/types/TypeIdentifierTypes.h>
  24. #include <stdint.h>
  25. #include <array>
  26. #include <string>
  27. #include <vector>
  28. namespace eprosima {
  29. namespace fastcdr {
  30. class Cdr;
  31. }
  32. namespace fastdds {
  33. namespace dds {
  34. class TypeConsistencyEnforcementQosPolicy;
  35. }
  36. }
  37. namespace fastrtps {
  38. namespace types {
  39. typedef octet TypeIdentiferKind;
  40. const octet TI_STRING8_SMALL = 0x70;
  41. const octet TI_STRING8_LARGE = 0x71;
  42. const octet TI_STRING16_SMALL = 0x72;
  43. const octet TI_STRING16_LARGE = 0x73;
  44. const octet TI_PLAIN_SEQUENCE_SMALL = 0x80;
  45. const octet TI_PLAIN_SEQUENCE_LARGE = 0x81;
  46. const octet TI_PLAIN_ARRAY_SMALL = 0x90;
  47. const octet TI_PLAIN_ARRAY_LARGE = 0x91;
  48. const octet TI_PLAIN_MAP_SMALL = 0xA0;
  49. const octet TI_PLAIN_MAP_LARGE = 0xA1;
  50. const octet TI_STRONGLY_CONNECTED_COMPONENT = 0xB0;
  51. // The TypeIdentifier uniquely identifies a type (a set of equivalent
  52. // types according to an equivalence relationship: COMPLETE, MNIMAL).
  53. //
  54. // In some cases (primitive types, strings, plain types) the identifier
  55. // is a explicit description of the type.
  56. // In other cases the Identifier is a Hash of the type description
  57. //
  58. // In the case of primitive types and strings the implied equivalence
  59. // relation is the identity.
  60. //
  61. // For Plain Types and Hash-defined TypeIdentifiers there are three
  62. // possibilities: MINIMAL, COMPLETE, and COMMON:
  63. // - MINIMAL indicates the TypeIdentifier identifies equivalent types
  64. // according to the MINIMAL equivalence relation
  65. // - COMPLETE indicates the TypeIdentifier identifies equivalent types
  66. // according to the COMPLETE equivalence relation
  67. // - COMMON indicates the TypeIdentifier identifies equivalent types
  68. // according to both the MINIMAL and the COMMON equivalence relation.
  69. // This means the TypeIdentifier is the same for both relationships
  70. //
  71. class TypeIdentifier
  72. {
  73. public:
  74. /*!
  75. * @brief Default constructor.
  76. */
  77. RTPS_DllAPI TypeIdentifier();
  78. /*!
  79. * @brief Default destructor.
  80. */
  81. RTPS_DllAPI ~TypeIdentifier();
  82. /*!
  83. * @brief Copy constructor.
  84. * @param x Reference to the object TypeIdentifier that will be copied.
  85. */
  86. RTPS_DllAPI TypeIdentifier(
  87. const TypeIdentifier& x);
  88. /*!
  89. * @brief Move constructor.
  90. * @param x Reference to the object TypeIdentifier that will be copied.
  91. */
  92. RTPS_DllAPI TypeIdentifier(
  93. TypeIdentifier&& x);
  94. /*!
  95. * @brief Copy assignment.
  96. * @param x Reference to the object TypeIdentifier that will be copied.
  97. */
  98. RTPS_DllAPI TypeIdentifier& operator=(
  99. const TypeIdentifier& x);
  100. /*!
  101. * @brief Move assignment.
  102. * @param x Reference to the object TypeIdentifier that will be copied.
  103. */
  104. RTPS_DllAPI TypeIdentifier& operator=(
  105. TypeIdentifier&& x);
  106. /*!
  107. * @brief This function sets the discriminator value.
  108. * @param __d New value for the discriminator.
  109. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the new value doesn't correspond to the selected union member.
  110. */
  111. RTPS_DllAPI void _d(
  112. octet __d);
  113. /*!
  114. * @brief This function returns the value of the discriminator.
  115. * @return Value of the discriminator
  116. */
  117. RTPS_DllAPI octet _d() const;
  118. /*!
  119. * @brief This function returns a reference to the discriminator.
  120. * @return Reference to the discriminator.
  121. */
  122. RTPS_DllAPI octet& _d();
  123. /*!
  124. * @brief This function sets a value in member string_sdefn
  125. * @param _string_sdefn New value for member string_sdefn
  126. */
  127. RTPS_DllAPI void string_sdefn(
  128. StringSTypeDefn _string_sdefn);
  129. /*!
  130. * @brief This function returns the value of member string_sdefn
  131. * @return Value of member string_sdefn
  132. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  133. */
  134. RTPS_DllAPI const StringSTypeDefn& string_sdefn() const;
  135. /*!
  136. * @brief This function returns a reference to member string_sdefn
  137. * @return Reference to member string_sdefn
  138. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  139. */
  140. RTPS_DllAPI StringSTypeDefn& string_sdefn();
  141. /*!
  142. * @brief This function sets a value in member string_ldefn
  143. * @param _string_ldefn New value for member string_ldefn
  144. */
  145. RTPS_DllAPI void string_ldefn(
  146. StringLTypeDefn _string_ldefn);
  147. /*!
  148. * @brief This function returns the value of member string_ldefn
  149. * @return Value of member string_ldefn
  150. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  151. */
  152. RTPS_DllAPI const StringLTypeDefn& string_ldefn() const;
  153. /*!
  154. * @brief This function returns a reference to member string_ldefn
  155. * @return Reference to member string_ldefn
  156. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  157. */
  158. RTPS_DllAPI StringLTypeDefn& string_ldefn();
  159. /*!
  160. * @brief This function sets a value in member seq_sdefn
  161. * @param _seq_sdefn New value for member seq_sdefn
  162. */
  163. RTPS_DllAPI void seq_sdefn(
  164. PlainSequenceSElemDefn _seq_sdefn);
  165. /*!
  166. * @brief This function returns the value of member seq_sdefn
  167. * @return Value of member seq_sdefn
  168. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  169. */
  170. RTPS_DllAPI const PlainSequenceSElemDefn& seq_sdefn() const;
  171. /*!
  172. * @brief This function returns a reference to member seq_sdefn
  173. * @return Reference to member seq_sdefn
  174. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  175. */
  176. RTPS_DllAPI PlainSequenceSElemDefn& seq_sdefn();
  177. /*!
  178. * @brief This function sets a value in member seq_ldefn
  179. * @param _seq_ldefn New value for member seq_ldefn
  180. */
  181. RTPS_DllAPI void seq_ldefn(
  182. PlainSequenceLElemDefn _seq_ldefn);
  183. /*!
  184. * @brief This function returns the value of member seq_ldefn
  185. * @return Value of member seq_ldefn
  186. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  187. */
  188. RTPS_DllAPI const PlainSequenceLElemDefn& seq_ldefn() const;
  189. /*!
  190. * @brief This function returns a reference to member seq_ldefn
  191. * @return Reference to member seq_ldefn
  192. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  193. */
  194. RTPS_DllAPI PlainSequenceLElemDefn& seq_ldefn();
  195. /*!
  196. * @brief This function sets a value in member array_sdefn
  197. * @param _array_sdefn New value for member array_sdefn
  198. */
  199. RTPS_DllAPI void array_sdefn(
  200. PlainArraySElemDefn _array_sdefn);
  201. /*!
  202. * @brief This function returns the value of member array_sdefn
  203. * @return Value of member array_sdefn
  204. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  205. */
  206. RTPS_DllAPI const PlainArraySElemDefn& array_sdefn() const;
  207. /*!
  208. * @brief This function returns a reference to member array_sdefn
  209. * @return Reference to member array_sdefn
  210. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  211. */
  212. RTPS_DllAPI PlainArraySElemDefn& array_sdefn();
  213. /*!
  214. * @brief This function sets a value in member array_ldefn
  215. * @param _array_ldefn New value for member array_ldefn
  216. */
  217. RTPS_DllAPI void array_ldefn(
  218. PlainArrayLElemDefn _array_ldefn);
  219. /*!
  220. * @brief This function returns the value of member array_ldefn
  221. * @return Value of member array_ldefn
  222. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  223. */
  224. RTPS_DllAPI const PlainArrayLElemDefn& array_ldefn() const;
  225. /*!
  226. * @brief This function returns a reference to member array_ldefn
  227. * @return Reference to member array_ldefn
  228. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  229. */
  230. RTPS_DllAPI PlainArrayLElemDefn& array_ldefn();
  231. /*!
  232. * @brief This function sets a value in member map_sdefn
  233. * @param _map_sdefn New value for member map_sdefn
  234. */
  235. RTPS_DllAPI void map_sdefn(
  236. PlainMapSTypeDefn _map_sdefn);
  237. /*!
  238. * @brief This function returns the value of member map_sdefn
  239. * @return Value of member map_sdefn
  240. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  241. */
  242. RTPS_DllAPI const PlainMapSTypeDefn& map_sdefn() const;
  243. /*!
  244. * @brief This function returns a reference to member map_sdefn
  245. * @return Reference to member map_sdefn
  246. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  247. */
  248. RTPS_DllAPI PlainMapSTypeDefn& map_sdefn();
  249. /*!
  250. * @brief This function sets a value in member map_ldefn
  251. * @param _map_ldefn New value for member map_ldefn
  252. */
  253. RTPS_DllAPI void map_ldefn(
  254. PlainMapLTypeDefn _map_ldefn);
  255. /*!
  256. * @brief This function returns the value of member map_ldefn
  257. * @return Value of member map_ldefn
  258. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  259. */
  260. RTPS_DllAPI const PlainMapLTypeDefn& map_ldefn() const;
  261. /*!
  262. * @brief This function returns a reference to member map_ldefn
  263. * @return Reference to member map_ldefn
  264. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  265. */
  266. RTPS_DllAPI PlainMapLTypeDefn& map_ldefn();
  267. /*!
  268. * @brief This function sets a value in member sc_component_id
  269. * @param _sc_component_id New value for member sc_component_id
  270. */
  271. RTPS_DllAPI void sc_component_id(
  272. StronglyConnectedComponentId _sc_component_id);
  273. /*!
  274. * @brief This function returns the value of member sc_component_id
  275. * @return Value of member sc_component_id
  276. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  277. */
  278. RTPS_DllAPI StronglyConnectedComponentId sc_component_id() const;
  279. /*!
  280. * @brief This function returns a reference to member sc_component_id
  281. * @return Reference to member sc_component_id
  282. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  283. */
  284. RTPS_DllAPI StronglyConnectedComponentId& sc_component_id();
  285. /*!
  286. * @brief This function sets a value in member equivalence_hash
  287. * @param _equivalence_hash New value for member equivalence_hash
  288. */
  289. RTPS_DllAPI void equivalence_hash(
  290. EquivalenceHash _equivalence_hash);
  291. /*!
  292. * @brief This function returns the value of member equivalence_hash
  293. * @return Value of member equivalence_hash
  294. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  295. */
  296. RTPS_DllAPI const octet* equivalence_hash() const;
  297. /*!
  298. * @brief This function returns a reference to member equivalence_hash
  299. * @return Reference to member equivalence_hash
  300. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  301. */
  302. RTPS_DllAPI octet* equivalence_hash();
  303. /*!
  304. * @brief This function sets a value in member extended_defn
  305. * @param _extended_defn New value for member extended_defn
  306. */
  307. RTPS_DllAPI void extended_defn(
  308. ExtendedTypeDefn _extended_defn);
  309. /*!
  310. * @brief This function returns the value of member extended_defn
  311. * @return Value of member extended_defn
  312. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  313. */
  314. RTPS_DllAPI const ExtendedTypeDefn& extended_defn() const;
  315. /*!
  316. * @brief This function returns a reference to member extended_defn
  317. * @return Reference to member extended_defn
  318. * @exception eprosima::fastcdr::BadParamException This exception is thrown if the requested union member is not the current selection.
  319. */
  320. RTPS_DllAPI ExtendedTypeDefn& extended_defn();
  321. /*!
  322. * @brief This function returns the serialized size of a data depending on the buffer alignment.
  323. * @param data Data which is calculated its serialized size.
  324. * @param current_alignment Buffer alignment.
  325. * @return Serialized size.
  326. */
  327. RTPS_DllAPI static size_t getCdrSerializedSize(
  328. const TypeIdentifier& data,
  329. size_t current_alignment = 0);
  330. /*!
  331. * @brief This function serializes an object using CDR serialization.
  332. * @param cdr CDR serialization object.
  333. */
  334. RTPS_DllAPI void serialize(
  335. eprosima::fastcdr::Cdr& cdr) const;
  336. /*!
  337. * @brief This function deserializes an object using CDR serialization.
  338. * @param cdr CDR serialization object.
  339. */
  340. RTPS_DllAPI void deserialize(
  341. eprosima::fastcdr::Cdr& cdr);
  342. /**
  343. * Equals
  344. * */
  345. bool operator==(
  346. const TypeIdentifier& other) const;
  347. RTPS_DllAPI bool consistent(
  348. const TypeIdentifier& x,
  349. const fastdds::dds::TypeConsistencyEnforcementQosPolicy& consistency) const;
  350. /**
  351. * @brief equivalence_hash_to_string
  352. * @return string representation of the equivalence hash
  353. */
  354. RTPS_DllAPI std::string equivalence_hash_to_string() const;
  355. private:
  356. octet m__d;
  357. StringSTypeDefn m_string_sdefn;
  358. StringLTypeDefn m_string_ldefn;
  359. PlainSequenceSElemDefn m_seq_sdefn;
  360. PlainSequenceLElemDefn m_seq_ldefn;
  361. PlainArraySElemDefn m_array_sdefn;
  362. PlainArrayLElemDefn m_array_ldefn;
  363. PlainMapSTypeDefn m_map_sdefn;
  364. PlainMapLTypeDefn m_map_ldefn;
  365. StronglyConnectedComponentId m_sc_component_id;
  366. EquivalenceHash m_equivalence_hash;
  367. ExtendedTypeDefn m_extended_defn;
  368. };
  369. typedef std::vector<TypeIdentifier> TypeIdentifierSeq;
  370. } // namespace types
  371. } // namespace fastrtps
  372. } // namespace eprosima
  373. #endif // _TYPEIDENTIFIER_H_