RTI Connext Modern C++ API Version 7.6.0
Foo.hpp

The definition of the C++ types create from Foo.idl

See also
Working with IDL types
/*
WARNING: THIS FILE IS AUTO-GENERATED. DO NOT MODIFY.
This file was generated from Foo.idl
using RTI Code Generator (rtiddsgen) version 4.6.0.
The rtiddsgen tool is part of the RTI Connext DDS distribution.
For more information, type 'rtiddsgen -help' at a command shell
or consult the Code Generator User's Manual.
*/
#ifndef Foo_982570024_hpp
#define Foo_982570024_hpp
#include <iosfwd>
#if defined(NDDS_USER_DLL_EXPORT) && defined(RTI_WIN32)
#undef RTIUSERDllExport
#define RTIUSERDllExport __declspec(dllexport)
#endif
#if !defined(RTI_WIN32) && defined(NDDS_USER_SYMBOL_EXPORT)
#undef RTIUSERDllExport
#define RTIUSERDllExport __attribute__((visibility("default")))
#endif
#include "dds/core/SafeEnumeration.hpp"
#include "dds/core/String.hpp"
#include "dds/core/array.hpp"
#include "dds/core/vector.hpp"
#include "dds/core/External.hpp"
#include "rti/core/LongDouble.hpp"
#include "rti/core/Pointer.hpp"
#include "rti/core/array.hpp"
#include "rti/topic/TopicTraits.hpp"
#include "omg/types/string_view.hpp"
#include "omg/types/sequence.hpp"
#include "omg/types/optional.hpp"
#ifndef NDDS_STANDALONE_TYPE
#include "cdr/cdr_typeCode.h"
#include "dds/domain/DomainParticipant.hpp"
#include "dds/topic/TopicTraits.hpp"
#include "dds/core/xtypes/DynamicType.hpp"
#include "dds/core/xtypes/StructType.hpp"
#include "dds/core/xtypes/UnionType.hpp"
#include "dds/core/xtypes/EnumType.hpp"
#include "dds/core/xtypes/AliasType.hpp"
#include "rti/util/StreamFlagSaver.hpp"
#include "rti/domain/PluginSupport.hpp"
#endif
#if defined(NDDS_USER_DLL_EXPORT) || defined(NDDS_USER_SYMBOL_EXPORT)
#undef RTIUSERDllExport
#define RTIUSERDllExport
#endif
#if defined(NDDS_USER_DLL_EXPORT) && defined(RTI_WIN32)
#undef NDDSUSERDllExport
#define NDDSUSERDllExport __declspec(dllexport)
#endif
#if !defined(RTI_WIN32) && defined(NDDS_USER_SYMBOL_EXPORT)
#undef NDDSUSERDllExport
#define NDDSUSERDllExport __attribute__((visibility("default")))
#endif
struct NDDSUSERDllExport Foo {
int32_t x {};
int32_t y {};
Foo();
Foo(int32_t x_,int32_t y_);
};
NDDSUSERDllExport bool operator == (const Foo& a, const Foo& b);
NDDSUSERDllExport bool operator != (const Foo& a, const Foo& b);
NDDSUSERDllExport void swap(Foo& a, Foo& b) noexcept;
NDDSUSERDllExport std::ostream& operator<<(std::ostream& o, const Foo& sample);
#if (defined(RTI_WIN32) || defined (RTI_WINCE)) && defined(NDDS_USER_DLL_EXPORT)
// On Windows, dll-export template instantiations of standard types used by
// other dll-exported types
template class NDDSUSERDllExport std::allocator< int32_t >;
template class NDDSUSERDllExport std::vector< int32_t >;
#endif
struct NDDSUSERDllExport MyType {
int32_t my_long {};
std::string my_string {};
::Foo my_foo {};
::dds::core::array< ::Foo, 5L> my_array {};
MyType();
MyType(int32_t my_long_,const ::omg::types::string_view& my_string_,const ::Foo& my_foo_,const ::omg::types::bounded_sequence< int32_t, 10L >& my_sequence_,const ::dds::core::array< ::Foo, 5L>& my_array_,const ::omg::types::optional< ::Foo >& my_optional_);
};
NDDSUSERDllExport bool operator == (const MyType& a, const MyType& b);
NDDSUSERDllExport bool operator != (const MyType& a, const MyType& b);
NDDSUSERDllExport void swap(MyType& a, MyType& b) noexcept;
NDDSUSERDllExport std::ostream& operator<<(std::ostream& o, const MyType& sample);
enum class Color {
RED,
GREEN,
BLUE
};
NDDSUSERDllExport std::ostream& operator << (std::ostream& o,const Color& sample);
enum class MyUnionDiscriminator {
USE_LONG,
USE_STRING,
USE_FOO
};
NDDSUSERDllExport std::ostream& operator << (std::ostream& o,const MyUnionDiscriminator& sample);
class NDDSUSERDllExport MyUnion {
public:
MyUnion();
::MyUnionDiscriminator& _d() {
return m_d_;
}
const ::MyUnionDiscriminator& _d() const {
return m_d_;
}
void _d(::MyUnionDiscriminator value) {
m_d_ = value;
}
int32_t& my_long() {
if (_d() != (MyUnionDiscriminator::USE_LONG) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_long not selected by the discriminator" );
}
return m_u_.my_long;
}
const int32_t& my_long() const {
if (_d() != (MyUnionDiscriminator::USE_LONG) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_long not selected by the discriminator" );
}
return m_u_.my_long;
}
void my_long(int32_t value) {
m_u_.my_long = value;
m_d_= (MyUnionDiscriminator::USE_LONG);
}
std::string& my_string() {
if (_d() != (MyUnionDiscriminator::USE_STRING) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_string not selected by the discriminator" );
}
return m_u_.my_string;
}
const std::string& my_string() const {
if (_d() != (MyUnionDiscriminator::USE_STRING) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_string not selected by the discriminator" );
}
return m_u_.my_string;
}
void my_string(const ::omg::types::string_view& value) {
m_u_.my_string = value;
m_d_= (MyUnionDiscriminator::USE_STRING);
}
void my_string(::omg::types::string_view&& value) {
m_u_.my_string = std::move(value);
m_d_= (MyUnionDiscriminator::USE_STRING);
}
::Foo& my_foo() {
if (_d() != (MyUnionDiscriminator::USE_FOO) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_foo not selected by the discriminator" );
}
return m_u_.my_foo;
}
const ::Foo& my_foo() const {
if (_d() != (MyUnionDiscriminator::USE_FOO) ) {
throw ::dds::core::PreconditionNotMetError(
"::MyUnion::my_foo not selected by the discriminator" );
}
return m_u_.my_foo;
}
void my_foo(const ::Foo& value) {
m_u_.my_foo = value;
m_d_= (MyUnionDiscriminator::USE_FOO);
}
void my_foo(::Foo&& value) {
m_u_.my_foo = std::move(value);
m_d_= (MyUnionDiscriminator::USE_FOO);
}
bool operator == (const MyUnion& other_) const;
bool operator != (const MyUnion& other_) const;
static ::MyUnionDiscriminator default_discriminator();
void swap(MyUnion& other_) noexcept ;
private:
::MyUnionDiscriminator m_d_ {};
struct NDDSUSERDllExport Union_ {
int32_t my_long {};
std::string my_string {};
::Foo my_foo {};
Union_();
Union_(int32_t my_long_,const ::omg::types::string_view& my_string_,const ::Foo& my_foo_);
};
Union_ m_u_;
};
inline void swap(MyUnion& a, MyUnion& b) noexcept
{
a.swap(b);
}
NDDSUSERDllExport std::ostream& operator<<(std::ostream& o, const MyUnion& sample);
struct NDDSUSERDllExport MyOtherType {
int32_t m1 {};
double m2 {};
std::string m3 {};
MyOtherType();
MyOtherType(int32_t m1_,double m2_,const ::omg::types::string_view& m3_);
};
NDDSUSERDllExport bool operator == (const MyOtherType& a, const MyOtherType& b);
NDDSUSERDllExport bool operator != (const MyOtherType& a, const MyOtherType& b);
NDDSUSERDllExport void swap(MyOtherType& a, MyOtherType& b) noexcept;
NDDSUSERDllExport std::ostream& operator<<(std::ostream& o, const MyOtherType& sample);
#ifdef NDDS_STANDALONE_TYPE
namespace rti {
namespace topic {
template <>
struct default_enumerator< ::Color>
{
static const ::Color value;
};
template <>
struct default_enumerator< ::MyUnionDiscriminator>
{
static const ::MyUnionDiscriminator value;
};
}
}
#else
namespace rti {
namespace flat {
namespace topic {
}
}
}
namespace dds {
namespace topic {
template<>
struct topic_type_name< ::Foo > {
NDDSUSERDllExport static std::string value() {
return "Foo";
}
};
template<>
struct is_topic_type< ::Foo > : public ::dds::core::true_type {};
template<>
struct topic_type_support< ::Foo > {
NDDSUSERDllExport
static void register_type(
NDDSUSERDllExport
static std::vector<char>& to_cdr_buffer(
std::vector<char>& buffer,
const ::Foo& sample,
NDDSUSERDllExport
static void from_cdr_buffer(::Foo& sample, const std::vector<char>& buffer);
NDDSUSERDllExport
static void reset_sample(::Foo& sample);
NDDSUSERDllExport
static void allocate_sample(::Foo& sample, int, int);
static const ::rti::topic::TypePluginKind::type type_plugin_kind =
::rti::topic::TypePluginKind::STL;
};
template<>
struct topic_type_name< ::MyType > {
NDDSUSERDllExport static std::string value() {
return "MyType";
}
};
template<>
struct is_topic_type< ::MyType > : public ::dds::core::true_type {};
template<>
struct topic_type_support< ::MyType > {
NDDSUSERDllExport
static void register_type(
NDDSUSERDllExport
static std::vector<char>& to_cdr_buffer(
std::vector<char>& buffer,
const ::MyType& sample,
NDDSUSERDllExport
static void from_cdr_buffer(::MyType& sample, const std::vector<char>& buffer);
NDDSUSERDllExport
static void reset_sample(::MyType& sample);
NDDSUSERDllExport
static void allocate_sample(::MyType& sample, int, int);
static const ::rti::topic::TypePluginKind::type type_plugin_kind =
::rti::topic::TypePluginKind::STL;
};
template<>
struct topic_type_name< ::MyUnion > {
NDDSUSERDllExport static std::string value() {
return "MyUnion";
}
};
template<>
struct is_topic_type< ::MyUnion > : public ::dds::core::true_type {};
template<>
struct topic_type_support< ::MyUnion > {
NDDSUSERDllExport
static void register_type(
NDDSUSERDllExport
static std::vector<char>& to_cdr_buffer(
std::vector<char>& buffer,
const ::MyUnion& sample,
NDDSUSERDllExport
static void from_cdr_buffer(::MyUnion& sample, const std::vector<char>& buffer);
NDDSUSERDllExport
static void reset_sample(::MyUnion& sample);
NDDSUSERDllExport
static void allocate_sample(::MyUnion& sample, int, int);
static const ::rti::topic::TypePluginKind::type type_plugin_kind =
::rti::topic::TypePluginKind::STL;
};
template<>
struct topic_type_name< ::MyOtherType > {
NDDSUSERDllExport static std::string value() {
return "MyOtherType";
}
};
template<>
struct is_topic_type< ::MyOtherType > : public ::dds::core::true_type {};
template<>
struct topic_type_support< ::MyOtherType > {
NDDSUSERDllExport
static void register_type(
NDDSUSERDllExport
static std::vector<char>& to_cdr_buffer(
std::vector<char>& buffer,
const ::MyOtherType& sample,
NDDSUSERDllExport
static void from_cdr_buffer(::MyOtherType& sample, const std::vector<char>& buffer);
NDDSUSERDllExport
static void reset_sample(::MyOtherType& sample);
NDDSUSERDllExport
static void allocate_sample(::MyOtherType& sample, int, int);
static const ::rti::topic::TypePluginKind::type type_plugin_kind =
::rti::topic::TypePluginKind::STL;
};
}
}
namespace rti {
namespace topic {
template<>
struct dynamic_type< ::Foo > {
NDDSUSERDllExport static const ::dds::core::xtypes::StructType& get();
};
template <>
struct extensibility< ::Foo > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
template<>
struct dynamic_type< ::MyType > {
NDDSUSERDllExport static const ::dds::core::xtypes::StructType& get();
};
template <>
struct extensibility< ::MyType > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
template <>
struct default_enumerator< ::Color>
{
static const ::Color value;
};
template<>
struct dynamic_type< ::Color > {
NDDSUSERDllExport static const ::dds::core::xtypes::EnumType& get();
};
template <>
struct extensibility< ::Color > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
template <>
struct default_enumerator< ::MyUnionDiscriminator>
{
static const ::MyUnionDiscriminator value;
};
template<>
struct dynamic_type< ::MyUnionDiscriminator > {
NDDSUSERDllExport static const ::dds::core::xtypes::EnumType& get();
};
template <>
struct extensibility< ::MyUnionDiscriminator > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
template<>
struct dynamic_type< ::MyUnion > {
NDDSUSERDllExport static const ::dds::core::xtypes::UnionType& get();
};
template <>
struct extensibility< ::MyUnion > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
template<>
struct dynamic_type< ::MyOtherType > {
NDDSUSERDllExport static const ::dds::core::xtypes::StructType& get();
};
template <>
struct extensibility< ::MyOtherType > {
static const ::dds::core::xtypes::ExtensibilityKind::type kind =
::dds::core::xtypes::ExtensibilityKind::EXTENSIBLE; };
}
}
#endif // NDDS_STANDALONE_TYPE
#if defined(NDDS_USER_DLL_EXPORT) || defined(NDDS_USER_SYMBOL_EXPORT)
#undef NDDSUSERDllExport
#define NDDSUSERDllExport
#endif
#endif // Foo_982570024_hpp
An example topic-type.
Definition: types.dxx:34
void swap(Duration &lhs, Duration &rhs) OMG_NOEXCEPT
Swap the contents of two Duration objects.
std::ostream & operator<<(std::ostream &os, const dds::core::InstanceHandle &h)
Prints an instance handle.
Definition: dds/core/InstanceHandle.hpp:48
<<value-type>> Represents an object that may not contain a valid value
Definition: OptionalImpl.hpp:50
bool operator==(const optional< T > &a, const optional< T > &b)
Compares two optional values.
Definition: OptionalImpl.hpp:653
bool operator!=(const optional< T > &a, const optional< T > &b)
Compares two optional values.
Definition: OptionalImpl.hpp:675
DynamicData & from_cdr_buffer(DynamicData &sample, const std::vector< char > &buffer)
<<extension>> Creates a DynamicData sample by deserializing a CDR buffer'
std::vector< char > & to_cdr_buffer(std::vector< char > &buffer, const DynamicData &sample, dds::core::policy::DataRepresentationId representation_id=dds::core::policy::DataRepresentation::auto_id())
<<extension>> Serializes a DynamicData sample into CDR format
<<value-type>> Represents an IDL enum type
Definition: EnumTypeImpl.hpp:35
<<value-type>> Represents an IDL struct type
Definition: StructTypeImpl.hpp:34
<<value-type>> Represents an IDL union type
Definition: UnionTypeImpl.hpp:34
<<reference-type>> Container for all dds::core::Entity objects.
Definition: TDomainParticipant.hpp:63
void register_type(dds::domain::DomainParticipant &participant, const std::string &name, const dds::core::xtypes::DynamicType &type, const rti::core::xtypes::DynamicDataTypeSerializationProperty &serialization_property=rti::core::xtypes::DynamicDataTypeSerializationProperty::DEFAULT)
<<extension>> Registers a DynamicType with specific serialization properties
DataWriter< T > get(const AnyDataWriter &any_writer)
Same as AnyDataWriter::get()
Definition: AnyDataWriter.hpp:250
const std::string & type_name() const
<<extension>> Get the type name associated with this DataReader
Definition: DataReaderImpl.hpp:856
dds::core::optional< dds::core::xtypes::DynamicType > type() const
<<extension>> Get the type
const dds::core::policy::DataRepresentation & representation() const
Get the publication data representation.
Definition: BuiltinTopicImpl.hpp:691
<<value-type>> A bounded sequence of elements
Definition: BoundedSequence.hpp:105
std::string_view string_view
String view type according to the IDL4-C++ OMG specification. Alias of std::string_view when the comp...
Definition: string_view.hpp:38
basic_string< char, rti::core::memory::OsapiAllocator< char > > string
A string convertible to std::string and with similar functionality.
Definition: String.hpp:262
int16_t DataRepresentationId
The type of the elements that DataRepresentation contains.
Definition: dds/core/types.hpp:80
static DataRepresentationId auto_id()
Representation automatically chosen based on the type.
Definition: TCorePolicy.hpp:1825
The dds namespace. The dds namespace includes all of the standard types, classes, and functions.
Definition: ClientEndpoint.hpp:27
<<extension>> The namespace that contains the extension types and functions to the DDS standard.
Definition: QueueConsumerImpl.hpp:40