This commit is contained in:
2025-09-24 10:53:28 +08:00
commit f8e4df77fb
856 changed files with 140098 additions and 0 deletions

View File

@@ -0,0 +1,190 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2020 ADLINK Technology Limited
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,44 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_
#define OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_
#include <dds/core/detail/conformance.hpp>
#include <dds/core/TBuiltinTopicTypes.hpp>
#include <dds/core/detail/BuiltinTopicTypes.hpp>
#if defined (OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT)
namespace dds
{
namespace core
{
/**
* @file
* This file contains the type definitions for BuiltinTopicTypes
*/
typedef TBytesTopicType<detail::BytesTopicType> BytesTopicType;
typedef TStringTopicType<detail::StringTopicType> StringTopicType;
typedef TKeyedBytesTopicType<detail::KeyedBytesTopicType> KeyedBytesTopicType;
typedef TKeyedStringTopicType<detail::KeyedStringTopicType> KeyedStringTopicType;
}
}
#endif
#endif /* OMG_DDS_CORE_BUILTIN_TOPIC_TYPES_HPP_ */

View File

@@ -0,0 +1,275 @@
#ifndef OMG_DDS_CORE_DURATION_HPP_
#define OMG_DDS_CORE_DURATION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/types.hpp>
namespace dds
{
namespace core
{
/**
* @file
* This class represents a time interval.
*/
/**
* Duration represents a time interval and can -
* * Can be incremented by durations expressed as seconds, nanoseconds
* milliseconds, or Duration objects.
*
* * Can be converted to and from Durations expressed in
* milliseconds (or other units) as integer types.
*/
class OMG_DDS_API Duration
{
public:
/**
* Create a Duration elapsing zero seconds.
*/
static const Duration zero(); // {0, 0}
/**
* Create an infinite Duration.
*/
static const Duration infinite(); // {0x7fffffff, 0x7fffffff}
public:
/**
* Create a Duration elapsing the default amount of time (zero seconds).
*/
Duration();
/**
* Create a Duration elapsing a specific amount of time.
*
* @param sec Amount of seconds for the Duration.
* @param nanosec Amount of nanoseconds for the Duration.
*/
explicit Duration(int32_t sec, uint32_t nanosec = 0);
#if __cplusplus >= 199711L
/** @copydoc dds::core::Duration::Duration(int32_t sec, uint32_t nanosec = 0) */
explicit Duration(int64_t sec, uint32_t nanosec = 0);
#endif
public:
/**
* Create a Duration from a number of microseconds
* @param microseconds number of microseconds
*/
static const Duration from_microsecs(int64_t microseconds);
/**
* Create a Duration from a number of milliseconds
* @param milliseconds number of milliseconds
*/
static const Duration from_millisecs(int64_t milliseconds);
/**
* Create a Duration from a number of seconds
* @param seconds number of seconds
*/
static const Duration from_secs(double seconds);
public:
/**
* Get seconds part of the Duration.
* @return number of seconds
*/
int64_t sec() const;
/**
* Set number of seconds
* @param s number of seconds
*/
void sec(int64_t s);
/**
* Get nanoseconds part of the Duration.
* @return number of nanoseconds
*/
uint32_t nanosec() const;
/**
* Set number of nanoseconds
* @param ns number of nanoseconds
*/
void nanosec(uint32_t ns);
public:
/**
* Returns an integer value for a comparison of two Durations:
* 1 if this Duration is greater than the comparator (that)
* -1 if the Duration is less than the comparator (that)
* 0 if the Duration matches the comparator (that)
*
* @param that Duration to compare
*
* @return comparison result
*/
int compare(const Duration& that) const;
/**
* Returns true if the Duration is greater than the comparator
*
* @param that Duration to compare
* @return comparison result
*/
bool operator >(const Duration& that) const;
/**
* Returns true if the Duration is greater than or equal to the comparator
* @param that the Duration to compare
* @return true if that is larger than or equal to this
*/
bool operator >=(const Duration& that) const;
/**
* Returns true if the Duration is not equal to the comparator
*
* @param that Duration to compare
* @return comparison result
*/
bool operator !=(const Duration& that) const;
/**
* Returns true if the Duration is equal to the comparator
*
* @param that Duration to compare
* @return comparison result
*/
bool operator ==(const Duration& that) const;
/**
* Returns true if the Duration is less than or equal to the comparator
*
* @param that Duration to compare
* @return comparison result
*/
bool operator <=(const Duration& that) const;
/**
* Returns true if the Duration is less than the comparator
*
* @param that Duration to compare
* @return comparison result
*/
bool operator <(const Duration& that) const;
public:
/**
* Add a Duration to this Duration
*
* @param a_ti Duration to add
* @return this Duration + a_ti
*/
Duration& operator+=(const Duration& a_ti);
/**
* Subtract a Duration from this Duration
*
* @param a_ti Duration to subtract
* @return this Duration - a_ti
*/
Duration& operator-=(const Duration& a_ti);
/**
* Multiply this Duration by a factor
*
* @param factor the factor to multiply this Duration by
* @return this Duration * factor
*/
Duration& operator*=(uint64_t factor);
/**
* Add a Duration to Duration
*
* @param other a Duration
* @return Duration + other
*/
const Duration operator +(const Duration& other) const;
/**
* Subtract a Duration from Duration
*
* @param other a Duration
* @return the Duration - other
*/
const Duration operator -(const Duration& other) const;
public:
/**
* Returns this Duration in milliseconds.
*
* @return the duration in milliseconds
*/
int64_t to_millisecs() const;
/**
* Returns this Duration in micro-seconds.
*
* @return the duration in micro-seconds
*/
int64_t to_microsecs() const;
/**
* Returns this Duration in seconds.
*
* @return the duration in seconds
*/
double to_secs() const;
private:
int32_t sec_;
uint32_t nsec_;
};
/**
* Multiply Duration by a factor
*
* @param lhs factor by which to multiply
* @param rhs Duration to multiply
*
* @return factor * Duration
*/
const Duration OMG_DDS_API operator *(uint64_t lhs,
const Duration& rhs);
/**
* Multiply Duration by a factor
*
* @param lhs Duration to multiply
* @param rhs factor by which to multiply
*
* @return Duration * factor
*/
const Duration OMG_DDS_API operator *(const Duration& lhs,
uint64_t rhs);
/**
* Divide Duration by a factor
*
* @param lhs Duration to divide
* @param rhs factor by which to divide
*/
const Duration OMG_DDS_API operator /(const Duration& lhs,
uint64_t rhs);
}
} /* namespace dds / namespace core */
#endif /* OMG_DDS_CORE_DURATION_HPP_ */

View File

@@ -0,0 +1,31 @@
#ifndef OMG_DDS_CORE_ENTITY_HPP_
#define OMG_DDS_CORE_ENTITY_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/Entity.hpp>
namespace dds
{
namespace core
{
typedef dds::core::detail::Entity Entity;
}
}
#endif /* OMG_DDS_CORE_ENTITY_HPP_ */

View File

@@ -0,0 +1,372 @@
#ifndef OMG_DDS_CORE_EXCEPTION_HPP_
#define OMG_DDS_CORE_EXCEPTION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <stdexcept>
#include <string>
#include <dds/core/macros.hpp>
#if defined _MSC_VER
# pragma warning (push)
# pragma warning (disable:4275) // non dll-interface class 'std::foo_error' used as base for dll-interface class 'dds::core::BarError'
#endif
namespace dds
{
namespace core
{
/**
* @brief
* %Exception: base class for specified DDS Exceptions.
*
* DDS PIM Return Code | DDS-PSM-CXX Exception Class | std C++ Parent Exception
* ------------------- | --------------------------- | ------------------------
* RETCODE_OK | Normal return; no exception | N/A
* RETCODE_NO_DATA | Normal return with informational state attached | N/A
* RETCODE_ERROR | Error | std::logic_error
* RETCODE_BAD_PARAMETER | InvalidArgumentError | std::invalid_argument
* RETCODE_TIMEOUT | TimeoutError | std::runtime_error
* RETCODE_UNSUPPORTED | UnsupportedError | std::logic_error
* RETCODE_ALREADY_DELETED | AlreadyClosedError | std::logic_error
* RETCODE_ILLEGAL_OPERATION | IllegalOperationError | std::logic_error
* RETCODE_NOT_ENABLED | NotEnabledError | std::logic_error
* RETCODE_PRECONDITION_NOT_MET | PreconditionNotMetError | std::logic_error
* RETCODE_IMMUTABLE_POLICY | ImmutablePolicyError | std::logic_error
* RETCODE_INCONSISTENT_POLICY | InconsistentPolicyError | std::logic_error
* RETCODE_OUT_OF_RESOURCES | OutOfResourcesError | std::runtime_error
*
* The DDS-PSM-Cxx maps error codes to C++ exceptions defined in the dds::core namespace and
* inheriting from a base Exception class and the appropriate standard C++ exception.
* Table 7.3 lists the mapping between error codes as defined in the DDS PIM and C++ exceptions
* as used in this specification. Exceptions have value semantics; this means that they must
* always have deep copy semantics.
* The full list of exceptions is included in the file dds/core/Exceptions.hpp.
*
*/
class OMG_DDS_API Exception
{
protected:
Exception();
public:
/** @cond */
virtual ~Exception() throw();
/** @endcond */
public:
/**
* Retrieve information about the exception that was thrown.
*
* Example
* @code{.cpp}
* try {
* // Do something that will trigger a dds exception, like:
* dds::domain::DomainParticipant participant = dds::core::null;
* participant.domain_id();
* } catch (const dds::core::Exception& e) {
* std::cout << e.what() << std::endl;
* }
* @endcode
* %Exception information (of the NullReferenceError in this case)
* @code
* Null reference: Reference[157] == dds::core::null
* ========================================================================================
* Context : dds::domain::DomainParticipant::domain_id
* Date : Wed Oct 21 19:28:00 CET 2015
* Node : DeLorean
* Process : flux_capacitor <15423>
* Thread : mr_fusion b6f25700
* Internals : ReferenceImpl.hpp/157/V6.6.0
* ----------------------------------------------------------------------------------------
* Report : Null reference: Reference[157] == dds::core::null
* Internals : dds::core::Reference<DELEGATE>::delegate/ReferenceImpl.hpp/157
* @endcode
*
* @return Exception information
*/
virtual const char* what() const throw() = 0;
};
/**
* @brief
* %Exception: Generic, unspecified error.
*/
class OMG_DDS_API Error : public Exception, public std::logic_error
{
/** @cond */
public:
explicit Error(const std::string& msg);
Error(const Error& src);
virtual ~Error() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: The object target of this operation has already been closed.
*/
class OMG_DDS_API AlreadyClosedError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit AlreadyClosedError(const std::string& msg);
AlreadyClosedError(const AlreadyClosedError& src);
virtual ~AlreadyClosedError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: An operation was invoked on an inappropriate object or at an inappropriate time.
*
* This is determined by policies set by the specification or the Service implementation.
*
* There is no precondition that could be changed to make the operation succeed.
*/
class OMG_DDS_API IllegalOperationError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit IllegalOperationError(const std::string& msg);
IllegalOperationError(const IllegalOperationError& src);
virtual ~IllegalOperationError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application attempted to modify an immutable QosPolicy.
*/
class OMG_DDS_API ImmutablePolicyError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit ImmutablePolicyError(const std::string& msg);
ImmutablePolicyError(const ImmutablePolicyError& src);
virtual ~ImmutablePolicyError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application specified a set of policies that are not
* consistent with each other.
*/
class OMG_DDS_API InconsistentPolicyError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit InconsistentPolicyError(const std::string& msg);
InconsistentPolicyError(const InconsistentPolicyError& src);
virtual ~InconsistentPolicyError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application is passing an invalid argument.
*/
class OMG_DDS_API InvalidArgumentError : public Exception, public std::invalid_argument
{
/** @cond */
public:
explicit InvalidArgumentError(const std::string& msg);
InvalidArgumentError(const InvalidArgumentError& src);
virtual ~InvalidArgumentError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Operation invoked on an Entity that is not yet enabled.
*/
class OMG_DDS_API NotEnabledError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit NotEnabledError(const std::string& msg);
NotEnabledError(const NotEnabledError& src);
virtual ~NotEnabledError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Service ran out of the resources needed to complete the
* operation.
*/
class OMG_DDS_API OutOfResourcesError : public Exception, public std::runtime_error
{
/** @cond */
public:
explicit OutOfResourcesError(const std::string& msg);
OutOfResourcesError(const OutOfResourcesError& src);
virtual ~OutOfResourcesError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: A pre-condition for the operation was not met.
*/
class OMG_DDS_API PreconditionNotMetError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit PreconditionNotMetError(const std::string& msg);
PreconditionNotMetError(const PreconditionNotMetError& src);
virtual ~PreconditionNotMetError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: The operation timed out.
*/
class OMG_DDS_API TimeoutError : public Exception, public std::runtime_error
{
/** @cond */
public:
explicit TimeoutError(const std::string& msg);
TimeoutError(const TimeoutError& src);
virtual ~TimeoutError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Unsupported operation.
*
* This can only be thrown by operations that are optional.
*/
class OMG_DDS_API UnsupportedError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit UnsupportedError(const std::string& msg);
UnsupportedError(const UnsupportedError& src);
virtual ~UnsupportedError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application has attempted to cast incompatible types.
*/
class OMG_DDS_API InvalidDowncastError : public Exception, public std::runtime_error
{
/** @cond */
public:
explicit InvalidDowncastError(const std::string& msg);
InvalidDowncastError(const InvalidDowncastError& src);
virtual ~InvalidDowncastError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application used a null reference.
*
* Very likely, the used DDS object is a dds::core::null object.
* @code{.cpp}
* dds::domain::DomainParticipant participant = dds::core::null;
* try {
* participant.domain_id();
* } catch (const dds::core::NullReferenceError& e) {
* std::cout << e.what() << std::endl;
* }
* @endcode
*/
class OMG_DDS_API NullReferenceError : public Exception, public std::runtime_error
{
/** @cond */
public:
explicit NullReferenceError(const std::string& msg);
NullReferenceError(const NullReferenceError& src);
virtual ~NullReferenceError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
/**
* @brief
* %Exception: Application provided invalid data
*/
class OMG_DDS_API InvalidDataError : public Exception, public std::logic_error
{
/** @cond */
public:
explicit InvalidDataError(const std::string& msg);
InvalidDataError(const InvalidDataError& src);
virtual ~InvalidDataError() throw();
public:
virtual const char* what() const throw();
/** @endcond */
};
}
}
#if defined _MSC_VER
# pragma warning (pop)
#endif
#endif /* OMG_DDS_CORE_EXCEPTION_HPP_ */

View File

@@ -0,0 +1,114 @@
#ifndef OMG_DDS_CORE_EXTERNAL_HPP_
#define OMG_DDS_CORE_EXTERNAL_HPP_
/*
* Copyright(c) 2022 ZettaScale Technology and others
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <memory>
#include <dds/core/Exception.hpp>
namespace dds
{
namespace core
{
template <typename T>
class external {
public:
external() = default;
external(T* p, bool locked = false): ptr_(p), locked_(locked) {;}
external(std::shared_ptr<T> p): ptr_(p) {;}
external(const external& other);
~external() = default;
external& operator=(const external& other);
T& operator*();
const T& operator*() const;
T* get() {return ptr_.get();}
const T* get() const {return ptr_.get();}
std::shared_ptr<T> get_shared_ptr() {return ptr_;}
T* operator->() {return get();}
const T* operator->() const {return get();}
bool operator==(const external<T>& other) const {return other.ptr_ == ptr_;}
bool operator!=(const external<T>& other) const {return !(*this == other);}
operator bool() const {return static_cast<bool>(ptr_);}
bool is_locked() const {return locked_;}
void lock();
private:
std::shared_ptr<T> ptr_;
bool locked_ = false;
};
template <typename T>
external<T>::external(const external<T>& other)
{
if (other.is_locked())
ptr_ = std::make_shared<T>(*other); //if other is locked, this implies that it can be dereferenced, and deep copy
else
ptr_ = other.ptr_; //unlocked means shallow copy
}
template <typename T>
external<T>& external<T>::operator=(const external<T>& other)
{
if (is_locked())
throw InvalidDataError("attempting to assign to locked external field"); //assignments to locked externals are not allowed
if (other.is_locked()) {
if (ptr_)
*ptr_ = *other; //copy over existing object
else
ptr_ = std::make_shared<T>(*other); //deep copy into new object
} else {
ptr_ = other.ptr_; //shallow copy
}
return *this;
}
template <typename T>
T& external<T>::operator*()
{
auto p = get();
if (!p)
throw NullReferenceError("attempting to dereference unset external field"); //dereferencing unset externals is not allowed
return *p;
}
template <typename T>
const T& external<T>::operator*() const
{
auto p = get();
if (!p)
throw NullReferenceError("attempting to dereference unset external field"); //dereferencing unset externals is not allowed
return *p;
}
template <typename T>
void external<T>::lock()
{
if (!*this)
throw NullReferenceError("attempting to lock unset external field"); //locking unbound externals is not allowed
locked_ = true;
}
}
}
#endif /* !defined(OMG_DDS_CORE_EXTERNAL_HPP_) */

View File

@@ -0,0 +1,38 @@
#ifndef OMG_DDS_CORE_INSTANCE_HANDLE_HPP_
#define OMG_DDS_CORE_INSTANCE_HANDLE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vector>
#include <dds/core/detail/InstanceHandle.hpp>
namespace dds
{
namespace core
{
typedef dds::core::detail::InstanceHandle InstanceHandle;
typedef std::vector<InstanceHandle> InstanceHandleSeq;
}
}
inline std::ostream& operator << (std::ostream& os, const dds::core::InstanceHandle& h);
#endif /* !defined(OMG_DDS_CORE_INSTANCE_HANDLE_HPP_) */

View File

@@ -0,0 +1,31 @@
#ifndef OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_
#define OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace dds
{
namespace core
{
const int32_t LENGTH_UNLIMITED = -1;
}
}
#endif // !defined(OMG_DDS_CORE_LENGTH_UNLIMITED_HPP_)

View File

@@ -0,0 +1,98 @@
#ifndef OMG_DDS_CORE_OPTIONAL_HPP_
#define OMG_DDS_CORE_OPTIONAL_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace dds
{
namespace core
{
/**
* The optional class is used to wrap attributes annotated in the idl with the
* \@optional annotation. This class provides a simple and safe way of
* accessing, setting and resetting the stored attribute.
*
* IDL:
* @code
* struct RadarTrack {
* string id;
* long x;
* long y;
* long z; //@Optional
* };
* @endcode
*
* C++ Representation:
* @code{.cpp}
* class RadarTrack {
* public:
* RadarTrack();
* RadarTrack(const std::string& id,
* int32_t x,
* int32_t y,
* int32_t z);
* public:
* std::string& id() const;
* void id(const std::string& s);
*
* int32_t x() const;
* void x(int32_t v);
*
* int32_t y() const;
* void y(int32_t v);
*
* dds::core::optional<int32_t>& z() const;
* void z(int32_t v);
* void z(const dds::core::optional<int32_t>& z)
* };
* @endcode
*/
template <typename T, template <typename Q> class DELEGATE>
class optional : public dds::core::Value< DELEGATE<T> >
{
public:
optional(const T& t);
public:
/**
* Returns true only if the attribute is set.
*/
bool is_set() const;
/**
* Reset the attribute.
*/
void reset();
/**
* Get the attribute. An exception is thrown if the attribute is not set.
*/
const T& get() const;
/**
* Get the attribute. An exception is thrown if the attribute is not set.
*/
T& get();
};
}
}
#endif /* OMG_DDS_CORE_OPTIONAL_HPP_ */

View File

@@ -0,0 +1,33 @@
#ifndef OMG_DDS_CORE_QOS_PROVIDER_HPP_
#define OMG_DDS_CORE_QOS_PROVIDER_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/QosProvider.hpp>
namespace dds
{
namespace core
{
typedef dds::core::detail::QosProvider QosProvider;
}
}
#endif /* OMG_DDS_CORE_QOS_PROVIDER_HPP_ */

View File

@@ -0,0 +1,353 @@
#ifndef OMG_DDS_CORE_REFERENCE_HPP_
#define OMG_DDS_CORE_REFERENCE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/types.hpp>
#include <dds/core/refmacros.hpp>
#include <dds/core/Exception.hpp>
namespace dds
{
namespace core
{
/**
* @brief
* Base class for reference-counted objects.
*
* All objects that have a reference-type have an associated shallow (polymorphic)
* assignment operator that simply changes the value of the reference.
* Furthermore, reference-types are safe, meaning that under no circumstances can
* a reference point to an invalid object.
* At any single point in time a reference can either refer to the null object or
* to a valid object.
*
* The semantics for Reference types is defined by the DDS-PSM-Cxx class
* dds::core::Reference. In the context of this specification the semantics implied
* by the ReferenceType is mandatory, yet the implementation supplied as part of
* this standard is provided to show one possible way of implementing this semantics.
*
* List of reference types:
*
* * Entity
* * Condition
* * GuardCondition
* * ReadCondition
* * QueryCondition
* * Waitset
* * DomainParticipant
* * AnyDataWriter
* * Publisher
* * DataWriter
* * AnyDataReader
* * Subscriber
* * DataReader
* * SharedSamples
* * AnyTopic
* * Topic
*
* Instances of reference types are created using C++ constructors.
* The trivial constructor is not defined for reference types; the only
* alternative to properly constructing a reference is to initialize it to a
* null reference by assigning dds::core::null.
*
* Resource management for some reference types might involve relatively
* heavyweight operating-system resources (such as threads, mutexes,
* and network sockets) in addition to memory.
* These objects therefore provide a function close() that shall halt network
* communication (in the case of entities) and dispose of any appropriate
* operating-system resources.
*
* Users of this PSM are recommended to call close on objects of all reference
* types once they are finished using them. In addition, implementations may
* automatically close objects that they deem to be no longer in use,
* subject to the following restrictions:
*
* * Any object to which the application has a direct reference
* (not including a WeakReference) is still in use.
*
* * Any object that has been explicitly retained is still in use.
*
* * The creator of any object that is still in use is itself still in use.
*
*/
template <typename DELEGATE>
class Reference
{
public:
DECLARE_TYPE_TRAITS(DELEGATE)
/**
* Creates a "null" Reference.
*/
explicit Reference(dds::core::null_type&);
public:
/**
* Creates a Reference from another.
*
* @param ref the other reference
*/
explicit Reference(const Reference& ref);
/**
* Creates a Reference from another.
*
* @param ref the other reference
*/
explicit Reference(Reference&& ref);
/**
* Creates a Reference from other Reference type safely.
*
* @param ref the other reference
*/
template <typename D>
explicit Reference(const Reference<D>& ref);
/** @cond
* The following two constructors create a dds Reference from a vendor
* specific delegate.
*
* They are public, because the implementation of other delegates may
* need to be able to create References in that manner.
*
* However, it shouldn't actually be part of the API. So, leave it from
* the doxygen generated API documentation.
*/
explicit Reference(DELEGATE_T* p);
explicit Reference(const DELEGATE_REF_T& p);
/** @endcond */
public:
/**
* Destroys a Reference.
*
* There might be an associated garbage collection activity when
* the current reference is not empty. When the underlaying delegate
* is referenced by another Reference object as well, then that
* delegate will not be destroyed.
*/
~Reference();
public:
/** @cond
* Function possibly needed for delegate implementation, but not recommended
* for application usage: exclude from the API documentation for clarity.
*
* Returns an object to the underlying delegate.
*/
operator DELEGATE_REF_T() const;
/** @endcond */
/**
* Compares two Reference objects and returns true if they are equal.
*
* Equality is based on the referential equality of the object being
* pointed.
*
* @param ref the other Reference object
* @return true when equal
*/
template <typename R>
bool operator==(const R& ref) const;
/**
* Compares two Reference objects and returns true if they are not
* equal.
*
* Inequality is based on the referential inequality of the object
* being pointed to.
*
* @param ref the other Reference object
* @return true when <i>not</i> equal
*/
template <typename R>
bool operator!=(const R& ref) const;
/**
* Assign new referenced object to this dds reference.
*
* There might be an associated garbage collection activity when
* the current reference is not empty.
*
* @return reference pointing to the new object.
*/
template <typename D>
Reference& operator=(const Reference<D>& that);
/** @copydoc dds::core::Reference::operator=(const Reference<D>& that) */
template <typename R>
Reference& operator=(const R& rhs);
/** @copydoc dds::core::Reference::operator=(const Reference<D>& that) */
Reference& operator=(const Reference& other) = default;
/** @copydoc dds::core::Reference::operator=(const Reference<D>& that) */
Reference& operator=(Reference&& other) = default;
/**
* Special assignment operators that takes care of assigning
* <i>dds::core::null</i> to this reference.
*
* When assigning null, there might be an associated garbage collection
* activity.
*
* @return reference pointing to a null object.
*/
Reference&
operator=(const null_type);
/**
* Check if the referenced object is nil.
*
* In other words, check if the reference is pointing to a null object.
*
* @return true if the referenced object is null.
*/
bool is_nil() const;
/**
* Special operator== used to check if this reference object
* equals the <i>dds::core::null</i> reference.
*
* The null-check can be done like this:
* @code{.cpp}
* if (r == dds::core::null) {
* // Do not use the dds reference object r in its current state
* }
* @endcode
*
* @return true if this reference is null.
*/
bool
operator==(const null_type) const;
/**
* Special operator!= used to check if this reference object
* does not equal the <i>dds::core::null</i> reference.
*
* The non-null-check can be done like this:
* @code{.cpp}
* if (r != dds::core::null) {
* // Use the dds reference object r
* }
* @endcode
*
* @return true if this reference is not null.
*/
bool operator!=(const null_type nil) const;
private:
// -- disallow dynamic allocation for reference types
void* operator new(size_t);
public:
/** @cond
* Functions possibly needed for delegate implementation, but not recommended
* for application usage: exclude from the API documentation for clarity.
*
* Returns an object to the underlying delegate.
*/
const DELEGATE_REF_T& delegate() const;
DELEGATE_REF_T& delegate();
/** @endcond */
/**
* The operator->() is provided to be able to directly invoke
* functions on the delegate.
*
* The decision to provide direct access to
* the delegate was motivated by the need for providing a way that
* was not invasive with respect to the CXXDDS API and yet would allow
* for vendor-specific extension.
* Thus vendor-specific extensions can be invoked on the Reference
* and on all its subclasses as follows:
* @code{.cpp}
* my_dds_entity.standard_function();
* my_dds_entity->vendor_specific_extension();
* @endcode
*
* @return a reference to delegate.
*/
DELEGATE* operator->();
/** @copydoc dds::core::Reference::operator->() */
const DELEGATE* operator->() const;
/** @cond
* Functions possibly needed for delegate implementation, but not recommended
* for application usage: exclude from the API documentation for clarity.
*
* Returns an object to the underlying delegate.
*/
operator DELEGATE_REF_T& ();
operator const DELEGATE_REF_T& () const;
/** @endcond */
protected:
Reference() {}
void set_ref(DELEGATE_T* p);
protected:
DELEGATE_REF_T impl_;
};
}
} /* namespace dds / namespace core */
/**
* Special operator== used to check if this reference object
* does not equal the <i>dds::core::null</i> reference.
*
* The non-null-check can be done like this:
* @code{.cpp}
* if (dds::core::null == r) {
* // Do not use the dds reference object r in its current state
* }
* @endcode
*
* @return true if this reference is not null.
*/
template <class D> bool operator == (dds::core::null_type, const dds::core::Reference<D>& r);
/**
* Special operator!= used to check if this reference object
* does not equal the <i>dds::core::null</i> reference.
*
* The non-null-check can be done like this:
* @code{.cpp}
* if (dds::core::null != r) {
* // Use the dds reference object r
* }
* @endcode
*
* @return true if this reference is not null.
*/
template <class D> bool operator != (dds::core::null_type, const dds::core::Reference<D>& r);
#endif /* OMG_DDS_CORE_REFERENCE_HPP_ */

View File

@@ -0,0 +1,79 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_SAFEENUMERATION_HPP_
#define OMG_DDS_CORE_SAFEENUMERATION_HPP_
namespace dds
{
namespace core
{
/**
* safe_enum provides a wrapper for enumerated types in a typesafe
* manner.
*
* safe_enums allow specification of the underlying type,
* do not implictly convert to integers, and resolve scoping issues.
*/
template<typename def, typename inner = typename def::Type>
class safe_enum : public def
{
typedef typename def::Type type;
inner val;
public:
safe_enum(type v) : val(v) {}
inner underlying() const
{
return val;
}
bool operator == (const safe_enum& s) const
{
return this->val == s.val;
}
bool operator != (const safe_enum& s) const
{
return this->val != s.val;
}
bool operator < (const safe_enum& s) const
{
return this->val < s.val;
}
bool operator <= (const safe_enum& s) const
{
return this->val <= s.val;
}
bool operator > (const safe_enum& s) const
{
return this->val > s.val;
}
bool operator >= (const safe_enum& s) const
{
return this->val >= s.val;
}
};
}
}
#endif /* OMG_DDS_CORE_SAFEENUMERATION_HPP_ */

View File

@@ -0,0 +1,112 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_
#define OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_
#if defined (OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT)
namespace dds
{
namespace core
{
template <typename DELEGATE>
class TBytesTopicType;
template <typename DELEGATE>
class TStringTopicType;
template <typename DELEGATE>
class TKeyedBytesTopicType;
template <typename DELEGATE>
class TKeyedStringTopicType;
}
}
template <typename DELEGATE>
class dds::core::TBytesTopicType
{
public:
TBytesTopicType();
TBytesTopicType(const std::vector<uint32_t>& data);
public:
operator std::vector<uint32_t>& ();
public:
const std::vector<uint8_t>& data();
void data(const std::vector<uint8_t>& bytes);
};
template <typename DELEGATE>
class dds::core::TStringTopicType
{
public:
TStringTopicType();
TStringTopicType(const std::string& data);
public:
operator std::string& ();
public:
const std::string& data();
void data(const std::string& bytes);
};
/**
* This class represents a built-in topic type that can be used
* to readily create Topics, DataReaders and DataWriters for this type.
* No code generation is required when using this type.
*/
template <typename DELEGATE>
class dds::core::TKeyedStringTopicType<DELEGATE>
{
public:
TKeyedStringTopicType();
TKeyedStringTopicType(const std::string& key, const std::string& value);
public:
const std::string& key() const;
void key(const std::string& value);
const std::string& value() const;
void value(const std::string& value);
};
/**
* This class represents a built-in topic type that can be used
* to readily create Topics, DataReaders and DataWriters for this type.
* No code generation is required when using this type.
*/
template <typename DELEGATE>
class dds::core::TKeyedBytesTopicType<DELEGATE>
{
public:
TKeyedBytesTopicType();
TKeyedBytesTopicType(const std::string& key, const std::vector<uint8_t>& bytes);
public:
const std::string& key() const;
void key(const std::string& value);
const std::vector<uint8_t>& value() const;
void value(const std::vector<uint8_t>& value);
};
#endif /* OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT */
#endif /* OMG_DDS_CORE_TBUILTIN_TOPIC_TYPES_HPP_ */

View File

@@ -0,0 +1,222 @@
#ifndef OMG_TDDS_CORE_ENTITY_HPP_
#define OMG_TDDS_CORE_ENTITY_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string>
#include <dds/core/Reference.hpp>
#include <dds/core/status/Status.hpp>
namespace dds
{
namespace core
{
template <typename DELEGATE>
class TEntity;
}
}
/**
* @brief This class is the abstract base class for all the DCPS objects.
*
* This class is the abstract base class for all of the DCPS objects
* that support QoS policies a listener and a status condition:
*
* - dds::domain::DomainParticipant
* - dds::sub::Subscriber
* - dds::sub::DataReader
* - dds::pub::Publisher
* - dds::pub::DataWriter
* - dds::topic::Topic
*
* In the ISO C++ PSM each DDS entity behaves like a polymorphic reference
* in that it automatically manages its resource and it can be
* safely assigned up and down the DDS Entity type hierarchy.
*
*/
template <typename DELEGATE>
class dds::core::TEntity : public virtual dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE_PROTECTED_DC(TEntity, dds::core::Reference, DELEGATE)
OMG_DDS_IMPLICIT_REF_BASE(TEntity)
OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TEntity)
public:
/**
* Enable entity.
*
* This operation enables the Entity. Entity objects can be created
* either enabled or disabled. This is controlled by the value of
* the dds::core::policy::EntityFactory QoS policy on the corresponding
* factory for the Entity.
*
* Enabled entities are immediately activated at creation time meaning all their
* immutable QoS settings can no longer be changed. Disabled Entities are not yet
* activated, so it is still possible to change there immutable QoS settings. However,
* once activated the immutable QoS settings can no longer be changed.
*
* Creating disabled entities can make sense when the creator of the Entity does not
* yet know which QoS settings to apply, thus allowing another piece of code to set the
* QoS later on.
*
* The default setting of dds::core::policy::EntityFactory is such that,
* by default, it is not necessary to explicitly call enable on newly-
* created entities.
*
* The enable operation is idempotent. Calling enable on an already-
* enabled Entity does not raise exceptions and has no effect.
*
* If an Entity has not yet been enabled, the only operations that can be invoked on it
* are: the ones to set, get or copy the QosPolicy settings, the ones that set (or get) the
* listener, the ones that get the StatusCondition, the get_status_changes
* operation (although the status of a disabled entity never changes), and the factory
* operations that create, delete or lookup other Entities. Other operations will
* throw the exception dds::core::NotEnabledError.
*
* Entities created from a factory that is disabled are created
* disabled regardless of the setting of the dds::core::policy::EntityFactory
* Qos policy. Calling enable on an Entity whose factory is not
* enabled will fail and throw an dds::core::PreconditionNotMetError
* exception.
*
* If the dds::core::policy::EntityFactory QoS policy has autoenable_created_entities
* set to TRUE, the enable operation on the factory will automatically
* enable all entities created from the factory.
*
* The Listeners associated with an entity are not called until
* the entity is enabled. Conditions associated with an entity that
* is not enabled are inactive; that is, they have a trigger_value==false
* (dds::core::cond::Condition and dds::core::cond::WaitSet).
*
* eg.
* @code{.cpp}
* dds::domain::qos::DomainParticipantQos dpq;
* dpq << dds::core::policy::EntityFactory::ManuallyEnable();
* ...
* dds::sub::DataReader<Foo::Bar> dr(dp, topic, drqos);
* dr.enable();
* @endcode
*
* @throw dds::core::PreconditionNotMetError
* Entities' factory is not enabled.
*/
void enable();
/**
* This operation returns a mask with the communication statuses in the Entity that
* are “triggered”.
*
* This operation retrieves the list of communication statuses in the Entity
* that are triggered. That is the set of communication statuses whose value have changed
* since the last time the application called this operation. This operation shows
* whether a change has occurred even when the status seems unchanged because the
* status changed back to the original status.
*
* When the Entity is first created or if the Entity is not enabled, all
* communication statuses are in the “un-triggered” state so the mask returned by the
* operation is empty.
*
* The result value is a bit mask in which each bit shows which value has changed. The
* relevant bits represent one of the following statuses:
* - dds::core::status::StatusMask::inconsistent_topic()
* - dds::core::status::StatusMask::offered_deadline_missed()
* - dds::core::status::StatusMask::requested_deadline_missed()
* - dds::core::status::StatusMask::offered_incompatible_qos()
* - dds::core::status::StatusMask::requested_incompatible_qos()
* - dds::core::status::StatusMask::sample_lost()
* - dds::core::status::StatusMask::sample_rejected()
* - dds::core::status::StatusMask::data_on_readers()
* - dds::core::status::StatusMask::data_available()
* - dds::core::status::StatusMask::liveliness_lost()
* - dds::core::status::StatusMask::liveliness_changed()
* - dds::core::status::StatusMask::publication_matched()
* - dds::core::status::StatusMask::subscription_matched()
*
* When the entity is first created, or if the entity is not enabled,
* all communication statuses are in the untriggered state so the list
* returned by the status_changes operation will be empty.
*
* Each status bit is declared as a constant and can be used in an AND operation to
* check the status bit against the result of type StatusMask. Not all statuses are
* relevant to all Entity objects. See the respective Listener interfaces for each
* Entity for more information.
*
* The list of statuses returned by the status_changes operation refers
* to the statuses that are triggered on the Entity itself, and does not
* include statuses that apply to contained entities.
*
* @return dds::core::status::StatusMask
* a bit mask in which each bit shows which value has changed.
*/
const dds::core::status::StatusMask status_changes();
/**
* This operation returns the InstanceHandle_t that represents the Entity.
*
* The relevant state of some Entity objects are distributed using built-in topics.
* Each built-in topic sample represents the state of a specific Entity and has a
* unique instance_handle. This operation returns the instance_handle of the
* built-in topic sample that represents the specified Entity.<br>
* Some Entities (dds::pub::Publisher and dds::sub::Subscriber) do not have a corresponding
* built-in topic sample, but they still have an instance_handle that uniquely
* identifies the Entity. The instance_handles obtained this way can also be used
* to check whether a specific Entity is located in a specific DomainParticipant
* (dds::domain::DomainParticipant::contains_entity()).
*
* @return dds::core::InstanceHandle
* Result value is the instance_handle of the built-in topic
* sample that represents the state of this Entity.
*/
const dds::core::InstanceHandle instance_handle() const;
/**
* This function closes the entity and releases related resources.
*
* Resource management for some reference types might involve relatively heavyweight
* operating- system resources — such as e.g., threads, mutexes, and network sockets —
* in addition to memory. These objects therefore provide a method close() that shall
* halt network communication (in the case of entities) and dispose of any appropriate
* operating-system resources.
*
* Users of this PSM are recommended to call close on objects of all reference types once
* they are finished using them. In addition, implementations may automatically close
* objects that they deem to be no longer in use, subject to the following restrictions:
* - Any object to which the application has a direct reference is still in use.
* - Any object that has been explicitly retained is still in use
* - The creator of any object that is still in use is itself still in use.
*/
void close();
/**
* Retain the Entity, even when it goes out of scope.
*
* This function indicates that references to this object may go out of
* scope but that the application expects to look it up again later.
* Therefore the Service must consider this object to be still in use
* and may not close it automatically.
*/
void retain();
};
#endif /* OMG_TDDS_CORE_ENTITY_HPP_ */

View File

@@ -0,0 +1,159 @@
#ifndef OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_
#define OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Value.hpp>
namespace dds
{
namespace core
{
template <typename DELEGATE>
class TEntityQos;
}
}
/**
* @brief
* QoS Container
*
* Acts as a container for Qos policies allowing all the policies of
* an entity to be set and retrieved as a unit.
*
* For more information see \ref DCPS_Modules_Infrastructure "Infrastructure Module"
* and \ref DCPS_QoS "Supported Quality of Service"
*/
template <typename DELEGATE>
class dds::core::TEntityQos : public dds::core::Value<DELEGATE>
{
public:
/**
* Create default QoS.
*/
TEntityQos();
/**
* Create copied QoS.
*
* @param other the QoS to copy.
*/
TEntityQos(const TEntityQos& other);
/**
* Create moved QoS.
*
* @param other the QoS to move.
*/
TEntityQos(TEntityQos&& other);
/**
* Copy to this QoS.
*
* @param other the QoS to copy.
*
* @return reference to the Qos which was copied to.
*/
TEntityQos<DELEGATE>& operator=(const TEntityQos<DELEGATE>& other) = default;
/**
* Move to this QoS.
*
* @param other the QoS to move.
*
* @return reference to the Qos which was moved to.
*/
TEntityQos<DELEGATE>& operator=(TEntityQos<DELEGATE>&& other) = default;
/**
* Create/copy QoS from different QoS type.
*
* @param qos the QoS to copy policies from.
*/
template <typename T>
TEntityQos(const TEntityQos<T>& qos);
public:
/** @cond */
~TEntityQos() = default;
/** @endcond */
public:
/**
* Generic function for setting a policy applicable to this QoS object.
* Available policies depend on the actual instantiation of the template
* class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc.
*
* @param p the policy to be set for this QoS instance.
*/
template <typename POLICY>
TEntityQos& policy(const POLICY& p);
/**
* Generic function for obtaining the value of a specific policy
* belonging to this QoS instance.
*
* @return policy
*/
template <typename POLICY>
const POLICY& policy() const;
/**
* Generic function for obtaining the value of a specific policy
* belonging to this QoS instance.
*
* @return policy
*/
template <typename POLICY>
POLICY& policy();
/**
* Generic function for setting a policy applicable to this QoS object.
* Available policies depend on the actual instantiation of the template
* class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc.
*
* @param p the policy to be set for this QoS instance.
*/
template <typename POLICY>
TEntityQos& operator << (const POLICY& p);
/**
* Generic function for obtaining the value of a specific policy
* belonging to this QoS instance.
*
* @return policy
*/
template <typename POLICY>
const TEntityQos& operator >> (POLICY& p) const;
/**
* Generic function for setting a policy applicable to this QoS object.
* Available policies depend on the actual instantiation of the template
* class, which might be DomainParticipantQos, TopicQos, PublisherQos, etc.
*
* @param other the TEntityQos to set
*/
template <typename T>
TEntityQos<DELEGATE>& operator = (const TEntityQos<T>& other);
};
/* namespace tdds / namespace core / namespace qos */
#endif /* OMG_TDDS_CORE_QOS_ENTITY_QOS_HPP_ */

View File

@@ -0,0 +1,139 @@
#ifndef OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_
#define OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/types.hpp>
#include <dds/core/Value.hpp>
namespace dds
{
namespace core
{
template <typename DELEGATE>
class TInstanceHandle;
}
}
/**
* @brief
* Class to hold the handle associated with in sample instance.
*/
template <typename DELEGATE>
class dds::core::TInstanceHandle : public dds::core::Value<DELEGATE>
{
public:
/**
* Create an nil instance handle.
*/
TInstanceHandle();
/**
* Create an nil instance handle.
*
* @param nullHandle placeholder
*/
TInstanceHandle(const dds::core::null_type& nullHandle);
/**
* Copy an existing InstanceHandle
*
* @param other InstanceHandle to copy
*/
TInstanceHandle(const TInstanceHandle& other);
/**
* Move an existing InstanceHandle
*
* @param other InstanceHandle to move
*/
TInstanceHandle(TInstanceHandle&& other);
/** @cond */
~TInstanceHandle() = default;
/** @endcond */
/**
* @cond
* Parametric constructor for creating an instance-handle
* from some other type. This function is intended for internal
* usage.
*/
template <typename ARG0>
TInstanceHandle(const ARG0& arg0);
/** @endcond */
public:
/**
* Copy-assign an existing InstanceHandle to this InstanceHandle
*
* @param that The TInstanceHandle to assign to this
*/
TInstanceHandle& operator=(const TInstanceHandle& that);
/**
* Move-assign an existing InstanceHandle to this InstanceHandle
*
* @param that The TInstanceHandle to assign to this
*/
TInstanceHandle& operator=(TInstanceHandle&& that);
/**
* Compare this InstanceHandle to another InstanceHandle
*
* @param that The TInstanceHandle to compare
* @return true if they match
*/
bool operator==(const TInstanceHandle& that) const;
/**
* Compare this InstanceHandle to another InstanceHandle
*
* @param that The TInstanceHandle to compare
* @return true if this is less than that
*/
bool operator<(const TInstanceHandle& that) const;
/**
* Compare this InstanceHandle to another InstanceHandle
*
* @param that The TInstanceHandle to compare
* @return true if this is greater than that
*/
bool operator>(const TInstanceHandle& that) const;
public:
/**
* Create an nil instance handle.
*
* @return a nil InstanceHandle
*/
static const TInstanceHandle nil();
/**
* Check if the InstanceHandle is nil.
*
* @return true if the InstanceHandle is nil
*/
bool is_nil() const;
};
#endif // !defined(OMG_TDDS_CORE_INSTANCE_HANDLE_HPP_)

View File

@@ -0,0 +1,342 @@
#ifndef OMG_DDS_CORE_QOS_TPROVIDER_HPP_
#define OMG_DDS_CORE_QOS_TPROVIDER_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Reference.hpp>
#include <dds/domain/qos/DomainParticipantQos.hpp>
#include <dds/topic/qos/TopicQos.hpp>
#include <dds/sub/qos/SubscriberQos.hpp>
#include <dds/sub/qos/DataReaderQos.hpp>
#include <dds/pub/qos/PublisherQos.hpp>
#include <dds/pub/qos/DataWriterQos.hpp>
namespace dds
{
namespace core
{
template <typename DELEGATE>
class TQosProvider;
}
}
/**
* @brief
* The QosProvider API allows users to specify the QoS settings of their DCPS
* entities outside of application code in XML.
*
* The QosProvider is delivered as part of the DCPS API of Vortex OpenSplice.
*
* @see for more information: @ref DCPS_QoS_Provider "QoS Provider extensive information."
*/
template <typename DELEGATE>
class dds::core::TQosProvider : public dds::core::Reference<DELEGATE>
{
public:
/**
* Constructs a new QosProvider based on the provided uri and profile.
*
* A QosProvider instance that is instantiated with all profiles and/or QoSs loaded
* from the location specified by the provided uri.
*
* Initialization of the QosProvider will fail under the following conditions:<br>
* - No uri is provided.
* - The resource pointed to by uri cannot be found.
* - The content of the resource pointed to by uri is malformed (e.g., malformed XML).
* When initialization fails (for example, due to a parse error or when the resource
* identified by uri cannot be found), then PreconditionNotMetError will be thrown.
*
* Look @ref DCPS_QoS_Provider "here" for more information.
*
* @param uri A Uniform Resource Identifier (URI) that points to the location
* where the QoS profile needs to be loaded from. Currently only URIs with a
* file scheme that point to an XML file are supported. If profiles and/or QoS
* settings are not uniquely identifiable by name within the resource pointed to by
* uri, a random one of them will be stored.
* @param profile The name of the QoS profile within the xml file that serves as the default QoS
* profile for the get qos operations.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
explicit TQosProvider(const std::string& uri, const std::string& profile);
/**
* Constructs a new QosProvider based on the provided uri.
*
* A QosProvider instance that is instantiated with all profiles and/or QoSs loaded
* from the location specified by the provided uri.
*
* Initialization of the QosProvider will fail under the following conditions:<br>
* - No uri is provided.
* - The resource pointed to by uri cannot be found.
* - The content of the resource pointed to by uri is malformed (e.g., malformed XML).
* When initialization fails (for example, due to a parse error or when the resource
* identified by uri cannot be found), then PreconditionNotMetError will be thrown.
*
* Look @ref DCPS_QoS_Provider "here" for more information.
*
* @param uri A Uniform Resource Identifier (URI) that points to the location
* where the QoS profile needs to be loaded from. Currently only URIs with a
* file scheme that point to an XML file are supported. If profiles and/or QoS
* settings are not uniquely identifiable by name within the resource pointed to by
* uri, a random one of them will be stored.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
explicit TQosProvider(const std::string& uri);
/**
* Resolves the DomainParticipantQos from the uri this QosProvider is associated with.
*
* @return DomainParticipantQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DomainParticipantQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::domain::qos::DomainParticipantQos participant_qos();
/**
* Resolves the DomainParticipantQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return DomainParticipantQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DomainParticipantQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::domain::qos::DomainParticipantQos participant_qos(const std::string& id);
/**
* Resolves the TopicQos from the uri this QosProvider is associated with.
*
* @return TopicQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no TopicQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::topic::qos::TopicQos topic_qos();
/**
* Resolves the TopicQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return TopicQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no TopicQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::topic::qos::TopicQos topic_qos(const std::string& id);
/**
* Resolves the SubscriberQos from the uri this QosProvider is associated with.
*
* @return SubscriberQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no SubscriberQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::sub::qos::SubscriberQos subscriber_qos();
/**
* Resolves the SubscriberQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return SubscriberQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no SubscriberQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::sub::qos::SubscriberQos subscriber_qos(const std::string& id);
/**
* Resolves the DataReaderQos from the uri this QosProvider is associated with.
*
* @return DataReadertQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DataReaderQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::sub::qos::DataReaderQos datareader_qos();
/**
* Resolves the DataReaderQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return DataReaderQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DataReaderQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::sub::qos::DataReaderQos datareader_qos(const std::string& id);
/**
* Resolves the PublisherQos from the uri this QosProvider is associated with.
*
* @return PublisherQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no PublisherQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::PublisherQos publisher_qos();
/**
* Resolves the PublisherQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return PublisherQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no PublisherQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::PublisherQos publisher_qos(const std::string& id);
/**
* Resolves the DataWriterQos from the uri this QosProvider is associated with.
*
* @return DataWriterQos from the given URI (and profile)
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DataWriterQos can be found within the uri associated
* with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::DataWriterQos datawriter_qos();
/**
* Resolves the DataWriterQos identified by the id from the uri this
* QosProvider is associated with.
*
* @param id The fully-qualified name that identifies a QoS within the uri
* associated with the QosProvider or a name that identifies a QoS within the
* uri associated with the QosProvider instance relative to its default QoS
* profile. Ids starting with :: are interpreted as fully-qualified names and all
* others are interpreted as names relative to the default QoS profile of the
* QosProvider instance. When id is NULL it is interpreted as a non-named QoS
* within the default QoS profile associated with the QosProvider.
* @return DataWriterQos from the given URI (and profile) using the id
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::PreconditionNotMetError
* If no DataWriterQos that matches the provided id can be
* found within the uri associated with the QosProvider.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
dds::pub::qos::DataWriterQos datawriter_qos(const std::string& id);
};
#endif /* OMG_DDS_CORE_QOS_TPROVIDER_HPP_ */

View File

@@ -0,0 +1,212 @@
#ifndef OMG_DDS_CORE_TIME_HPP_
#define OMG_DDS_CORE_TIME_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/types.hpp>
namespace dds
{
namespace core
{
class Duration;
class Time;
}
}
/**
* Time represents a time value and can:
*
* * Be incremented by Duration expressed as seconds,
* nanoseconds, milliseconds, or Duration objects.
*
* * Be converted to and from Times expressed in
* milliseconds (or other units) as integer types.
*/
class OMG_DDS_API dds::core::Time
{
public:
static const Time invalid(); // {-1, 0xffffffff}
public:
/**
* Create a Time from a number of microseconds
*
* @param microseconds number of microseconds
*/
static const Time from_microsecs(int64_t microseconds);
/**
* Create a Time from a number of milliseconds
*
* @param milliseconds number of miliseconds
*/
static const Time from_millisecs(int64_t milliseconds);
/**
* Create a Time from a number of seconds
*
* @param seconds number of seconds
*/
static const Time from_secs(double seconds);
public:
/**
* Create a Time of zero seconds.
*/
Time();
/**
* Create a Time elapsing a specific amount of time.
*/
explicit Time(int64_t sec, uint32_t nanosec = 0);
public:
/**
* @return number of seconds
*/
int64_t sec() const;
/**
* Set number of seconds
* @param s number of seconds
*/
void sec(int64_t s);
/**
* @return number of nanoseconds
*/
uint32_t nanosec() const;
/**
* Set number of nanoseconds
* @param ns number of nanoseconds
*/
void nanosec(uint32_t ns);
public:
/**
* Returns an integer indicating the result of a comparison
* of two Times:
* 1 if this Time is greater than the comparator (that)
* -1 if the Time is less than the comparator (that)
* 0 if the Time matches the comparator (that)
*
* @param that Time to compare
* @return comparison result
*/
int compare(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is greater than the comparator
*/
bool operator >(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is greater than or equal to the comparator
*/
bool operator >=(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is not equal to the comparator
*/
bool operator !=(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is equal to the comparator
*/
bool operator ==(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is less than or equal to the comparator
*/
bool operator <=(const Time& that) const;
/**
* @param that Time to compare
* @return true if the Time is less than the comparator
*/
bool operator <(const Time& that) const;
public:
/**
* @param a_ti Duration to add
* @return Time value + Duration
*/
Time& operator+=(const Duration& a_ti);
/**
* @param a_ti Duration to subtract
* @return Time value - Duration
*/
Time& operator-=(const Duration& a_ti);
public:
/**
* Returns this Time in milliseconds.
*
* @return this Time in milliseconds
*/
int64_t to_millisecs() const;
/**
* Returns this Time in micro-seconds.
*
* @return this Time in micro-seconds
*/
int64_t to_microsecs() const;
/**
* Returns this Time in seconds.
*
* @return this Time in seconds
*/
double to_secs() const;
private:
int64_t sec_;
uint32_t nsec_;
};
// Time arithmetic operators.
/**
* Add a Duration to a Time value
* @param lhs Time
* @param rhs Duration
* @return Time * Duration
*/
const dds::core::Time OMG_DDS_API operator +(const dds::core::Time& lhs, const dds::core::Duration& rhs);
/**
* Add a Duration to a Time value
* @param lhs Duration
* @param rhs Time
* @return Duration + Time
*/
const dds::core::Time OMG_DDS_API operator +(const dds::core::Duration& lhs, const dds::core::Time& rhs);
/**
* Subtract a Duration from a Time value
* @param lhs Time
* @param rhs Duration
* @return Time - Duration
*/
const dds::core::Time OMG_DDS_API operator -(const dds::core::Time& lhs, const dds::core::Duration& rhs);
#endif /* OMG_DDS_CORE_TIME_HPP_ */

View File

@@ -0,0 +1,200 @@
#ifndef OMG_DDS_CORE_VALUE_HPP_
#define OMG_DDS_CORE_VALUE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace dds
{
namespace core
{
template <typename D>
class Value;
}
}
/**
* @brief
* This class is the base for various value-type dds objects.
*
* QoS, Policy, Statuses, and Topic samples are all modeled as value-types.
*
* All objects that have a value-type have a deep-copy assignment and copy
* construction semantics.
* It should also be pointed out that value-types are not 'pure-value-types' in
* the sense that they are immutable (as in functional programming languages).
*
* The DDS-PSM-Cxx makes value-types mutable to limit the number of copies as well
* as to limit the time-overhead necessary to change a value-type
* (note that for immutable value-types the only form of change is to create a new
* value-type).
*/
template <typename D>
class dds::core::Value
{
protected:
Value();
Value(const Value& p) = default; //check on this != &p?
Value(Value&& p) = default; //check on this != &p?
public:
/** @cond
* The following Constructors are not really relevant for the API.
* So, leave them from the doxygen generated API documentation for clarity.
*/
/**
* Create a value-type object of one internal value
*
* @param arg VALUETYPE value
*/
template <typename ARG>
Value(const ARG& arg);
/**
* Create a value-type object of two internal value
*
* @param arg1 VALUETYPES value
* @param arg2 VALUETYPES value
*/
template <typename ARG1, typename ARG2>
Value(const ARG1& arg1, const ARG2& arg2);
/**
* Create a value-type object of three internal value
*
* @param arg1 VALUETYPES value
* @param arg2 VALUETYPES value
* @param arg3 VALUETYPES value
*/
template <typename ARG1, typename ARG2, typename ARG3>
Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3);
/**
* Create a value-type object of four internal value
*
* @param arg1 VALUETYPES value
* @param arg2 VALUETYPES value
* @param arg3 VALUETYPES value
* @param arg4 VALUETYPES value
*/
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4>
Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4);
/**
* Create a value-type object of five internal value
*
* @param arg1 VALUETYPES value
* @param arg2 VALUETYPES value
* @param arg3 VALUETYPES value
* @param arg4 VALUETYPES value
* @param arg5 VALUETYPES value
*/
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5>
Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5);
/**
* Create a value-type object of six internal value
*
* @param arg1 VALUETYPES value
* @param arg2 VALUETYPES value
* @param arg3 VALUETYPES value
* @param arg4 VALUETYPES value
* @param arg5 VALUETYPES value
* @param arg6 VALUETYPES value
*/
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5, typename ARG6>
Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5, const ARG6& arg6);
/** @endcond */
public:
/** @cond */
~Value() = default;
/** @endcond */
public:
/**
* Assigns new delegate to this Value
* @param other Value
*/
Value& operator=(const Value& other);
/**
* Moves delegate to this Value
* @param other Value
*/
Value& operator=(Value&& other);
/**
* Compare this Value with another Value
*
* @param other Value
* @return true if equal
*/
bool operator==(const Value& other) const;
/**
* Compare this Value with another Value
*
* @param other Value
* @return true if not equal
*/
bool operator !=(const Value& other) const;
public:
/**
* The operator->() is provided to be able to directly invoke
* functions on the delegate.
*
* The decision to provide direct access to
* the delegate was motivated by the need for providing a way that
* was not invasive with respect to the CXXDDS API and yet would allow
* for vendor-specific extension.
* Thus vendor-specific extensions can be invoked on the Value
* and on all its subclasses as follows:
* @code{.cpp}
* my_dds_value.standard_function();
* my_dds_value->vendor_specific_extension();
* @endcode
*
* @return a reference to delegate.
*/
D* operator->();
/** @copydoc dds::core::Value::operator->() */
const D* operator->() const;
/** @cond
* Functions possibly needed for delegate implementation, but not recommended
* for application usage: exclude from the API documentation for clarity.
*
* Returns an object to the underlying delegate.
*/
const D& delegate() const;
D& delegate();
operator D& ();
operator const D& () const;
/** @endcond */
protected:
D d_;
};
#endif /* OMG_DDS_CORE_VALUE_HPP_ */

View File

@@ -0,0 +1,79 @@
#ifndef OMG_DDS_CORE_WEAK_REFERENCE_HPP_
#define OMG_DDS_CORE_WEAK_REFERENCE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Reference.hpp>
namespace dds
{
namespace core
{
template <typename T>
class WeakReference;
}
}
/**
* @brief
* The WeakReference class enables you to maintain a weak
* reference to a DDS reference type.
*
* The existence of a weak link will not prevent the garbage
* collection of the reference type.
*/
template <typename T>
class dds::core::WeakReference
{
public:
typedef T ReferenceType;
public:
/**
* Creates a weak reference without an referenced dds object.
*/
WeakReference();
/**
* Creates a weak reference for the reference type passed as argument.
*
* @param t dds object the new weak reference will refer to
*/
WeakReference(const T& t);
/**
* Checks whether the underlying reference has been deleted.
*
* @returns true if the underlying reference has expired, false otherwise
*/
bool expired();
/**
* Gives access to the underlying shared reference.
*
* If the reference has expired the returned object will be referencing 'dds::core::null'.
*
* @return referenced dds object
*/
T lock();
private:
typename T::DELEGATE_WEAK_REF_T impl_;
};
#endif /* OMG_DDS_CORE_WEAK_REFERENCE_HPP_ */

View File

@@ -0,0 +1,31 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef ORG_OMG_DDS_CORE_ARRAY_HPP_
#define ORG_OMG_DDS_CORE_ARRAY_HPP_
#include <dds/core/detail/array.hpp>
namespace dds
{
namespace core
{
using dds::core::detail::array;
}
}
#endif /* ORG_OMG_DDS_CORE_ARRAY_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_CORE_COND_CONDITION_HPP_
#define OMG_DDS_CORE_COND_CONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/cond/detail/Condition.hpp>
namespace dds
{
namespace core
{
namespace cond
{
typedef dds::core::cond::detail::Condition Condition;
}
}
}
#endif /* OMG_DDS_CORE_COND_CONDITION_HPP_ */

View File

@@ -0,0 +1,36 @@
#ifndef OMG_DDS_CORE_COND_GUARDCONDITION_HPP_
#define OMG_DDS_CORE_COND_GUARDCONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/cond/detail/GuardCondition.hpp>
#include <dds/core/cond/detail/TGuardConditionImpl.hpp>
namespace dds
{
namespace core
{
namespace cond
{
typedef dds::core::cond::detail::GuardCondition GuardCondition;
}
}
}
#endif /* OMG_DDS_CORE_COND_GUARDCONDITION_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_CORE_STATUSCONDITION_HPP_
#define OMG_DDS_CORE_STATUSCONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/cond/detail/StatusCondition.hpp>
#include <dds/core/cond/detail/TStatusConditionImpl.hpp>
namespace dds
{
namespace core
{
namespace cond
{
typedef detail::StatusCondition StatusCondition;
}
}
}
#endif /* OMG_DDS_CORE_STATUSCONDITION_HPP_ */

View File

@@ -0,0 +1,117 @@
#ifndef OMG_TDDS_DDS_CORE_COND_CONDITION_HPP_
#define OMG_TDDS_DDS_CORE_COND_CONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Reference.hpp>
#include <dds/core/cond/detail/GuardCondition.hpp>
#include <dds/core/cond/detail/StatusCondition.hpp>
#include <dds/sub/cond/detail/ReadCondition.hpp>
#include <dds/sub/cond/detail/QueryCondition.hpp>
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TCondition;
}
}
}
/**
* @brief
* This class is the base class for all the conditions that may be attached to a dds::core::cond::WaitSet.
*
* This base class is specialized in three classes by the Data Distribution Service:
* - dds::core::cond::GuardCondition
* - dds::core::cond::StatusCondition
* - dds::sub::cond::ReadCondition
* - dds::sub::cond::QueryCondition
*
* Each Condition has a trigger_value that can be TRUE or FALSE and is set by
* the Data Distribution Service (except a GuardCondition) depending on the
* evaluation of the Condition.
*
* @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept"
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
*/
template <typename DELEGATE>
class dds::core::cond::TCondition : public virtual dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE_PROTECTED_DC(TCondition, dds::core::Reference, DELEGATE)
OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::core::cond::detail::StatusCondition)
OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::core::cond::detail::GuardCondition)
OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::sub::cond::detail::ReadCondition)
OMG_DDS_EXPLICIT_REF_BASE_DECL(TCondition, dds::sub::cond::detail::QueryCondition)
OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TCondition)
public:
/**
* Registers a functor as custom handler with this Condition.
*
* The supplied functor will be called when this Condition is triggered
* and either the dds::core::cond::Condition::dispatch() is called or the
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this
* Condition is attached to.
*
* @param func The functor to be called when the StatusCondition triggers.
* @throw dds::core::Exception
*/
template <typename Functor>
void handler(Functor func);
/**
* Resets the handler for this Condition.
*
* After the invocation of this function no handler will be registered with
* this Condition.
*
* @throw dds::core::Exception
*/
void reset_handler();
/**
* Dispatches the functor that have been registered with the Condition.
*
* The Condition has to have been triggered for the functor will be called
* by this function.
*
* @throw dds::core::Exception
*/
void dispatch();
/**
* This operation retrieves the trigger_value of the Condition.
*
* A Condition has a trigger_value that can be TRUE or FALSE and is set by the
* Data Distribution Service (except a GuardCondition). This operation returns the
* trigger_value of the Condition.
*
* @return bool The boolean value to which the Condition is set.
* @throw dds::core::Exception
*/
bool trigger_value() const;
};
#endif /* OMG_TDDS_DDS_CORE_CONDITION_HPP_ */

View File

@@ -0,0 +1,124 @@
#ifndef OMG_TDDS_CORE_COND_GUARD_CONDITION_HPP_
#define OMG_TDDS_CORE_COND_GUARD_CONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/cond/Condition.hpp>
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TGuardCondition;
}
}
}
/**
* @brief
* A GuardCondition object is a specific Condition whose trigger_value is
* completely under the control of the application.
*
* When a GuardCondition is initially created, the trigger_value is FALSE.
*
* The purpose of the GuardCondition is to provide the means for the
* application to manually triggering a WaitSet to stop waiting. This is accomplished by
* attaching the GuardCondition to the WaitSet and then setting the
* trigger_value by means of the set trigger_value operation.
*
* @code{.cpp}
* dds::core::cond::GuardCondition guard;
* dds::core::cond::WaitSet waitset;
* waitset.attach_condition(guard);
* waitset.wait();
* ...
* // To wakeup waitset, do in another thread:
* guard.trigger_value(true);
* @endcode
* See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for more examples.<br>
* Although the WaitSet examples use the StatusCondition, the basic usage of this Condition
* with a WaitSet is the same.
*
* @see dds::core::cond::Condition
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
* @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples"
*/
template <typename DELEGATE>
class dds::core::cond::TGuardCondition : public dds::core::cond::TCondition<DELEGATE>
{
public:
OMG_DDS_REF_TYPE_NO_DC(TGuardCondition, dds::core::cond::TCondition, DELEGATE)
OMG_DDS_EXPLICIT_REF_BASE(TGuardCondition, dds::core::cond::Condition)
public:
/**
* Create a dds::core::cond::GuardCondition.
*
* The GuardCondition can then be added to a dds::core::cond::WaitSet so that the
* application can manually wake up a thread that is blocked on that WaitSet.
*
* @throw dds::core::Exception
*/
TGuardCondition();
/**
* Create a dds::core::cond::GuardCondition.
*
* The GuardCondition can then be added to a dds::core::cond::WaitSet so that the
* application can manually wake up a thread that is blocked on that WaitSet.
*
* The supplied functor will be called when this GuardCondition is triggered
* and either the inherited dds::core::cond::Condition::dispatch() is called or the
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this GuardCondition is
* attached to.
*
* @param functor The functor to be called when the GuardCondition triggers.
* @throw dds::core::Exception
*/
template <typename FUN>
TGuardCondition(FUN functor);
public:
/**
* This operation sets the trigger_value of the GuardCondition.
*
* A GuardCondition object is a specific Condition which trigger_value is
* completely under the control of the application. This operation must be used by the
* application to manually wake-up a WaitSet. This operation sets the
* trigger_value of the GuardCondition to the parameter value. The
* GuardCondition is directly created using the GuardCondition constructor.
* When a GuardCondition is initially created, the trigger_value is FALSE.
*
* @param value The boolean value to which the GuardCondition is set.
* @throw dds::core::Exception
*/
void trigger_value(bool value);
/**
* @copydoc dds::core::cond::TCondition::trigger_value()
*/
bool trigger_value();
};
#endif /* OMG_TDDS_CORE_GUARD_CONDITION_HPP_ */

View File

@@ -0,0 +1,218 @@
#ifndef OMG_DDS_CORE_T_STATUS_CONDITION_HPP_
#define OMG_DDS_CORE_T_STATUS_CONDITION_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/status/State.hpp>
#include <dds/core/cond/Condition.hpp>
#include <dds/core/cond/detail/StatusCondition.hpp>
#include <dds/core/Entity.hpp>
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TStatusCondition;
}
}
}
/**
* @brief
* A StatusCondition object is a specific Condition that is associated with each Entity.
*
* Entity objects that have status attributes also have a StatusCondition, access is
* provided to the application by the get_statuscondition operation.
* The communication statuses whose changes can be communicated to the application
* depend on the Entity. The following table shows the relevant statuses for each
* Entity.
*
* Entity | Status Name
* -------------------- | --------------------
* dds::topic::Topic | dds::core::status::StatusMask::inconsistent_topic()
* dds::sub::Subscriber | dds::core::status::StatusMask::data_on_readers()
* dds::sub::DataReader | dds::core::status::StatusMask::sample_rejected() <br> dds::core::status::StatusMask::liveliness_changed() <br> dds::core::status::StatusMask::requested_deadline_missed() <br> dds::core::status::StatusMask::requested_incompatible_qos() <br> dds::core::status::StatusMask::data_available() <br> dds::core::status::StatusMask::sample_lost() <br> dds::core::status::StatusMask::subscription_matched()
* dds::pub::DataWriter | dds::core::status::StatusMask::liveliness_lost() <br> dds::core::status::StatusMask::offered_deadline_missed() <br> dds::core::status::StatusMask::offered_incompatible_qos() <br> dds::core::status::StatusMask::publication_matched()
*
* The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition
* depends on the communication statuses of that Entity (e.g., missed deadline) and
* also depends on the value of the dds::core::status::StatusMask.
*
* A StatusCondition can be attached to a WaitSet in order to allow an application
* to suspend until the trigger_value has become TRUE.
*
* The trigger_value of a StatusCondition will be TRUE if one of the enabled
* StatusChangedFlags is set. That is, trigger_value==FALSE only if all the
* values of the StatusChangedFlags are FALSE.
*
* The sensitivity of the StatusCondition to a particular communication status is
* controlled by the list of enabled_statuses set on the condition by means of
* dds::core::cond::StatusCondition::enabled_statuses(const ::dds::core::status::StatusMask& status)
* When the enabled_statuses are not changed by that
* operation, all statuses are enabled by default.
*
* See the @ref anchor_dds_core_cond_waitset_examples "WaitSet examples" for examples
* how to use this Condition.
*
* @see dds::core::cond::Condition
* @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept"
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
* @see for more information: @ref anchor_dds_core_cond_waitset_examples "WaitSet examples"
*/
template <typename DELEGATE>
class dds::core::cond::TStatusCondition : public dds::core::cond::TCondition<DELEGATE>
{
public:
OMG_DDS_REF_TYPE_DELEGATE_C(TStatusCondition, dds::core::cond::TCondition, DELEGATE)
OMG_DDS_EXPLICIT_REF_BASE(TStatusCondition, dds::core::cond::Condition)
/**
* Create a dds::core::cond::StatusCondition associated with an Entity.
*
* The StatusCondition can then be added to a dds::core::cond::WaitSet so that the
* application can wait for specific status changes that affect the Entity.
*
* @param e The Entity to associate with the StatusCondition.
* @throw dds::core::Exception
*/
TStatusCondition(const dds::core::Entity& e);
/**
* Create a dds::core::cond::StatusCondition associated with an Entity.
*
* The StatusCondition can then be added to a dds::core::cond::WaitSet so that the
* application can wait for specific status changes that affect the Entity.
*
* The supplied functor will be called when this StatusCondition is triggered
* and either the inherited dds::core::cond::Condition::dispatch() is called or the
* dds::core::cond::WaitSet::dispatch() on the WaitSet to which this StatusCondition is
* attached to.
*
* @param e The Entity to associate with the StatusCondition.
* @param functor The functor to be called when the StatusCondition triggers.
* @throw dds::core::Exception
*/
template <typename FUN>
TStatusCondition(const dds::core::Entity& e, FUN functor);
public:
/**
* This operation sets the list of communication statuses that are taken into account to
* determine the trigger_value of the StatusCondition.
*
* The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition
* depends on the communication status of that Entity (e.g., missed deadline,
* loss of information, etc.), filtered by the set of enabled_statuses on the StatusCondition.
*
* This operation sets the list of communication statuses that are taken into account to
* determine the trigger_value of the StatusCondition. This operation may
* change the trigger_value of the StatusCondition.
*
* dds::core::cond::WaitSet objects behaviour depend on the changes of the trigger_value of
* their attached Conditions. Therefore, any WaitSet to which the StatusCondition
* is attached is potentially affected by this operation.
* If this function is not invoked, the default list of enabled_statuses includes all
* the statuses.
*
* The result value is a bit mask in which each bit shows which value has changed. The
* relevant bits represent one of the following statuses:
* - dds::core::status::StatusMask::inconsistent_topic()
* - dds::core::status::StatusMask::offered_deadline_missed()
* - dds::core::status::StatusMask::requested_deadline_missed()
* - dds::core::status::StatusMask::offered_incompatible_qos()
* - dds::core::status::StatusMask::requested_incompatible_qos()
* - dds::core::status::StatusMask::sample_lost()
* - dds::core::status::StatusMask::sample_rejected()
* - dds::core::status::StatusMask::data_on_readers()
* - dds::core::status::StatusMask::data_available()
* - dds::core::status::StatusMask::liveliness_lost()
* - dds::core::status::StatusMask::liveliness_changed()
* - dds::core::status::StatusMask::publication_matched()
* - dds::core::status::StatusMask::subscription_matched()
*
* Each status bit is declared as a constant and can be used in an AND operation to
* check the status bit against the result of type StatusMask. Not all statuses are
* relevant to all Entity objects. See the respective Listener interfaces for each
* Entity for more information.
*
* @param status A bit mask in which each bit sets the status which is taken
* into account for the StatusCondition.the enabled statuses.
* @throw dds::core::AlreadyClosedError
* @throw dds::core::Error
*/
void
enabled_statuses(const ::dds::core::status::StatusMask& status) const;
/**
* This operation returns the list of enabled communication statuses of the
* StatusCondition.
*
* The inherited dds::core::cond::Condition::trigger_value() of the StatusCondition
* depends on the communication status of that Entity (e.g., missed deadline,
* loss of information, etc.), filtered by the set of enabled_statuses on the StatusCondition.
*
* This operation returns the list of communication statuses that are taken into account
* to determine the trigger_value of the StatusCondition. This operation
* returns the statuses that were explicitly set on the last call to
* dds::core::cond::StatusCondition::enabled_statuses(const ::dds::core::status::StatusMask& status) const
* or, if enabled_statuses(status) was never called, the default list.
*
* The result value is a bit mask in which each bit shows which value has changed. The
* relevant bits represent one of the following statuses:
* - dds::core::status::StatusMask::inconsistent_topic()
* - dds::core::status::StatusMask::offered_deadline_missed()
* - dds::core::status::StatusMask::requested_deadline_missed()
* - dds::core::status::StatusMask::offered_incompatible_qos()
* - dds::core::status::StatusMask::requested_incompatible_qos()
* - dds::core::status::StatusMask::sample_lost()
* - dds::core::status::StatusMask::sample_rejected()
* - dds::core::status::StatusMask::data_on_readers()
* - dds::core::status::StatusMask::data_available()
* - dds::core::status::StatusMask::liveliness_lost()
* - dds::core::status::StatusMask::liveliness_changed()
* - dds::core::status::StatusMask::publication_matched()
* - dds::core::status::StatusMask::subscription_matched()
*
* Each status bit is declared as a constant and can be used in an AND operation to
* check the status bit against the result of type StatusMask. Not all statuses are
* relevant to all Entity objects. See the respective Listener interfaces for each
* Entity for more information.
*
* @return dds::core::status::StatusMask
* A bit mask in which each bit shows which status is taken into
* account for the StatusCondition.
* @throw dds::core::Exception
*/
const ::dds::core::status::StatusMask enabled_statuses() const;
/**
* This operation returns the Entity associated with the StatusCondition
*
* Note that there is exactly one Entity associated with each StatusCondition.
*
* @return dds::core::Entity The Entity associated with the StatusCondition.
* @throw dds::core::AlreadyClosedError
*/
const dds::core::Entity& entity() const;
};
#endif /* OMG_DDS_CORE_T_STATUS_CONDITION_HPP_ */

View File

@@ -0,0 +1,411 @@
#ifndef OMG_TDDS_CORE_WAIT_SET_HPP_
#define OMG_TDDS_CORE_WAIT_SET_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <vector>
#include <dds/core/types.hpp>
#include <dds/core/Duration.hpp>
#include <dds/core/cond/Condition.hpp>
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TWaitSet;
}
}
}
/**
* @brief
* A WaitSet object allows an application to wait until one or more of
* the attached Condition objects has a trigger_value of TRUE or else
* until the timeout expires.
*
* A WaitSet is not necessarily associated with a single DomainParticipant
* and could be used to wait for Condition objects associated with different
* DomainParticipant objects.
*
* @anchor anchor_dds_core_cond_waitset_examples
* <b><i>Example with wait()</i></b><br>
* When using the wait() operation, the triggered Conditions are returned in a list.
* @code{.cpp}
* // Create a Condition to attach to a Waitset
* dds::core::cond::StatusCondition readerSC = dds::core::cond::StatusCondition(reader);
* readerSC.enabled_statuses(dds::core::status::StatusMask::data_available());
*
* // Create WaitSet and attach Condition
* dds::core::cond::WaitSet waitset;
* waitset.attach_condition(readerSC); // or waitset += readerSC;
*
* dds::core::cond::WaitSet::ConditionSeq conditions;
* while(true) {
* // Wait for any Condition to trigger.
* conditions = waitset.wait();
*
* // Loop through the triggered conditions.
* for (int i=0; i < conditions.size(); i++) {
* // Handle data_available when right Condition triggered.
* if (conditions[i] == readerSC) {
* // Read samples from the DataReader
* }
* }
* }
* @endcode
* <b><i>Example with dispatch()</i></b><br>
* When using the dispatch() operation, the Functors of the triggered Conditions
* will be called.
* @code{.cpp}
* // Functor to add to a Condition
* class FunctorStatusCondition {
* public:
* void operator()(const dds::core::cond::StatusCondition& condition) {
* // Possibly get reader from the condition and read some samples.
* }
* };
* FunctorStatusCondition functor;
*
* // Create a Condition with functor to attach to a Waitset
* dds::core::cond::StatusCondition readerSC = dds::core::cond::StatusCondition(reader, functor);
* readerSC.enabled_statuses(dds::core::status::StatusMask::data_available());
*
* // Create WaitSet and attach Condition
* dds::core::cond::WaitSet waitset;
* waitset.attach_condition(readerSC); // or waitset += readerSC;
*
* while(true) {
* // Wait for any Condition to trigger.
* // The functors of the Conditions are automatically called
* // when the Condition triggers.
* waitset.dispatch();
* }
* @endcode
*
* @see for more information: @ref DCPS_Modules_Infrastructure_Waitset "WaitSet concept"
*/
template <typename DELEGATE>
class dds::core::cond::TWaitSet : public dds::core::Reference<DELEGATE>
{
public:
typedef std::vector<dds::core::cond::Condition> ConditionSeq;
public:
OMG_DDS_REF_TYPE_NO_DC(TWaitSet, dds::core::Reference, DELEGATE)
OMG_DDS_IMPLICIT_REF_BASE(TWaitSet)
public:
/**
* Create a WaitSet instance.
*
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
TWaitSet();
public:
/**
* This operation allows an application thread to wait for the occurrence
* of at least one of the conditions that is attached to the WaitSet.
*
* This operation allows an application thread to wait for the occurrence
* of certain Conditions. If none of the Conditions attached to the
* WaitSet have a trigger_value of TRUE, the wait operation will block
* suspending the calling thread.
*
* The wait operation takes a timeout argument that specifies the maximum
* duration for the wait. If this duration is exceeded and none of
* the attached Condition objects is true, a TimeoutError will be thrown.
*
* It is not allowed for more than one application thread to be waiting
* on the same WaitSet. If the wait operation is invoked on a WaitSet that
* already has a thread blocking on it, the operation will immediately
* raise a PreconditionNotMetError exception.
*
* The result of the wait operation is the list of all the attached
* Conditions that have a trigger_value of TRUE (i.e., the Conditions
* that unblocked the wait).
*
* @param timeout The maximum amount of time for which the wait
* should block while waiting for a Condition to be triggered.
* @return ConditionSeq
* A vector containing the triggered Conditions
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::TimeoutError
* The timeout has elapsed without any of the attached
* conditions becoming TRUE.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
const ConditionSeq wait(const dds::core::Duration& timeout);
/**
* This operation allows an application thread to wait for the occurrence
* of at least one of the conditions that is attached to the WaitSet.
*
* This operation allows an application thread to wait for the occurrence
* of certain Conditions. If none of the Conditions attached to the
* WaitSet have a trigger_value of TRUE, the wait operation will block
* suspending the calling thread.
*
* It is not allowed for more than one application thread to be waiting
* on the same WaitSet. If the wait operation is invoked on a WaitSet that
* already has a thread blocking on it, the operation will immediately
* raise a PreconditionNotMetError exception.
*
* The result of the wait operation is the list of all the attached
* Conditions that have a trigger_value of TRUE (i.e., the Conditions
* that unblocked the wait).
*
* @return ConditionSeq
* A vector containing the triggered Conditions
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
const ConditionSeq wait();
/**
* This operation allows an application thread to wait for the occurrence
* of at least one of the conditions that is attached to the WaitSet.
*
* This operation allows an application thread to wait for the occurrence
* of certain Conditions. If none of the Conditions attached to the
* WaitSet have a trigger_value of TRUE, the wait operation will block
* suspending the calling thread.
*
* The wait operation takes a timeout argument that specifies the maximum
* duration for the wait. If this duration is exceeded and none of
* the attached Condition objects is true, a TimeoutError will be thrown.
*
* It is not allowed for more than one application thread to be waiting
* on the same WaitSet. If the wait operation is invoked on a WaitSet that
* already has a thread blocking on it, the operation will immediately
* raise a PreconditionNotMetError exception.
*
* The result of the wait operation is the list of all the attached
* Conditions that have a trigger_value of TRUE (i.e., the Conditions
* that unblocked the wait).
*
* @param triggered A ConditionSeq in which to put Conditions that were
* triggered during the wait.
* @param timeout The maximum amount of time for which the wait should
* block while waiting for a Condition to be triggered.
* @return ConditionSeq
* A vector containing the triggered Conditions
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::TimeoutError
* The timeout has elapsed without any of the attached
* conditions becoming TRUE.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
ConditionSeq& wait(ConditionSeq& triggered,
const dds::core::Duration& timeout);
/**
* This operation allows an application thread to wait for the occurrence
* of at least one of the conditions that is attached to the WaitSet.
*
* This operation allows an application thread to wait for the occurrence
* of certain Conditions. If none of the Conditions attached to the
* WaitSet have a trigger_value of TRUE, the wait operation will block
* suspending the calling thread.
*
* It is not allowed for more than one application thread to be waiting
* on the same WaitSet. If the wait operation is invoked on a WaitSet that
* already has a thread blocking on it, the operation will immediately
* raise a PreconditionNotMetError exception.
*
* The result of the wait operation is the list of all the attached
* Conditions that have a trigger_value of TRUE (i.e., the Conditions
* that unblocked the wait).
*
* @param triggered A ConditionSeq in which to put Conditions that were
* triggered during the wait.
* @return ConditionSeq
* A vector containing the triggered Conditions
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
ConditionSeq& wait(ConditionSeq& triggered);
public:
/**
* Waits for at least one of the attached Conditions to trigger and then
* dispatches the functor associated with the Condition.
*
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
void dispatch();
/**
* Waits for at least one of the attached Conditions to trigger and then
* dispatches the functor associated with the Condition, or, times
* out and throws a TimeoutError.
*
* @param timeout The maximum amount of time for which the dispatch should
* block while waiting for a Condition to be triggered.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
* @throws dds::core::TimeoutError
* The timeout has elapsed without any of the attached
* conditions becoming TRUE.
* @throws dds::core::PreconditionNotMetError
* When multiple thread try to invoke the function concurrently.
*/
void dispatch(const dds::core::Duration& timeout);
public:
/** @copydoc dds::core::cond::TWaitSet::attach_condition(const dds::core::cond::Condition& cond) */
TWaitSet& operator +=(const dds::core::cond::Condition& cond);
/** @copydoc dds::core::cond::TWaitSet::detach_condition(const dds::core::cond::Condition& cond) */
TWaitSet& operator -=(const dds::core::cond::Condition& cond);
/**
* This operation attaches a Condition to the WaitSet.
*
* Attaches a Condition to the WaitSet. It is possible to attach a
* Condition on a WaitSet that is currently being waited upon
* (via the wait operation). In this case, if the Condition has a
* trigger_value of TRUE, then attaching the Condition will unblock
* the WaitSet. Adding a Condition that is already attached to the WaitSet
* has no effect.
*
* @param cond The Condition to be attached to this WaitSet.
* @return WaitSet The WaitSet itself so that attaching Conditions
* can be chained.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
TWaitSet& attach_condition(const dds::core::cond::Condition& cond);
/**
* This operation detaches a Condition to the WaitSet.
*
* Detaches a Condition from the WaitSet. If the Condition was not
* attached to the WaitSet, the operation will return false.
*
* @param cond The Condition to detach from this WaitSet
* @return bool True if the Condition was found and detached, False
* if the Condition was not part of the WaitSet.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
bool detach_condition(const dds::core::cond::Condition& cond);
/**
* This operation retrieves the list of attached Conditions.
*
* The resulting sequence will either be an empty sequence, meaning there were
* no conditions attached, or will contain a list of ReadCondition,
* QueryCondition, StatusCondition and GuardCondition.
*
* @return ConditionSeq
* The list of attached Conditions.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
const ConditionSeq conditions() const;
/**
* This operation retrieves the list of attached Conditions.
*
* The resulting sequence will either be an empty sequence, meaning there were
* no conditions attached, or will contain a list of ReadCondition,
* QueryCondition, StatusCondition and GuardCondition.
*
* @param conds A ConditionSeq in which to put the attached Conditions.
* @return ConditionSeq
* The list of attached Conditions.
* @throws dds::core::Error
* An internal error has occurred.
* @throws dds::core::NullReferenceError
* The WaitSet was not properly created and references to dds::core::null.
* @throws dds::core::OutOfResourcesError
* The Data Distribution Service ran out of resources to
* complete this operation.
*/
ConditionSeq& conditions(ConditionSeq& conds) const;
};
#endif /* OMG_TDDS_CORE_WAIT_SET_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_CORE_WAITSET_HPP_
#define OMG_DDS_CORE_WAITSET_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/cond/detail/WaitSet.hpp>
namespace dds
{
namespace core
{
namespace cond
{
typedef dds::core::cond::detail::WaitSet WaitSet;
}
}
}
#endif /* OMG_DDS_CORE_DETAIL_WAITSET_HPP_ */

View File

@@ -0,0 +1,41 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_
#define CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_
/**
* @file
*/
// Implementation
#include <dds/core/cond/detail/TConditionImpl.hpp>
#include <org/eclipse/cyclonedds/core/cond/ConditionDelegate.hpp>
namespace dds
{
namespace core
{
namespace cond
{
namespace detail
{
typedef dds::core::cond::TCondition<org::eclipse::cyclonedds::core::cond::ConditionDelegate> Condition;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_CONDITION_HPP_ */

View File

@@ -0,0 +1,58 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_
#define CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_
/**
* @file
*/
// Implementation
namespace org
{
namespace eclipse
{
namespace cyclonedds
{
namespace core
{
namespace cond
{
class GuardConditionDelegate;
}
}
}
}
}
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TGuardCondition;
namespace detail
{
typedef dds::core::cond::TGuardCondition<org::eclipse::cyclonedds::core::cond::GuardConditionDelegate> GuardCondition;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_GUARDCONDITION_HPP_ */

View File

@@ -0,0 +1,57 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_
#define CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_
/**
* @file
*/
// Implementation
namespace org
{
namespace eclipse
{
namespace cyclonedds
{
namespace core
{
namespace cond
{
class StatusConditionDelegate;
}
}
}
}
}
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
class TStatusCondition;
namespace detail
{
typedef dds::core::cond::TStatusCondition<org::eclipse::cyclonedds::core::cond::StatusConditionDelegate> StatusCondition;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_STATUSCONDITION_HPP_ */

View File

@@ -0,0 +1,64 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/detail/ReferenceImpl.hpp>
#include <dds/core/cond/TCondition.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
template <typename Functor>
void TCondition<DELEGATE>::handler(Functor func)
{
this->delegate()->set_handler(func);
}
template <typename DELEGATE>
void TCondition<DELEGATE>::reset_handler()
{
this->delegate()->reset_handler();
}
template <typename DELEGATE>
void TCondition<DELEGATE>::dispatch()
{
this->delegate()->dispatch();
}
template <typename DELEGATE>
bool TCondition<DELEGATE>::trigger_value() const
{
return this->delegate()->trigger_value();
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_TCONDITION_IMPL_HPP_ */

View File

@@ -0,0 +1,103 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/cond/TGuardCondition.hpp>
#include <org/eclipse/cyclonedds/core/cond/GuardConditionDelegate.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
TGuardCondition<DELEGATE>::TGuardCondition()
{
this->set_ref(new DELEGATE);
this->delegate()->init(this->impl_);
}
template <typename DELEGATE>
template <typename FUN>
TGuardCondition<DELEGATE>::TGuardCondition(FUN functor)
{
this->set_ref(new DELEGATE);
this->delegate()->init(this->impl_);
this->delegate()->set_handler(functor);
}
template <typename DELEGATE>
void TGuardCondition<DELEGATE>::trigger_value(bool value)
{
this->delegate()->trigger_value(value);
}
template <typename DELEGATE>
bool TGuardCondition<DELEGATE>::trigger_value()
{
return TCondition<DELEGATE>::trigger_value();
}
template <typename DELEGATE>
TCondition<DELEGATE>::TCondition(const dds::core::cond::TGuardCondition<org::eclipse::cyclonedds::core::cond::GuardConditionDelegate>& h)
{
if (h.is_nil()) {
/* We got a null object and are not really able to do a typecheck here. */
/* So, just set a null object. */
*this = dds::core::null;
} else {
this->::dds::core::Reference<DELEGATE>::impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(h.delegate());
if (h.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name());
}
}
}
template <typename DELEGATE>
TCondition<DELEGATE>&
TCondition<DELEGATE>::operator=(const dds::core::cond::TGuardCondition<org::eclipse::cyclonedds::core::cond::GuardConditionDelegate>& rhs)
{
const TCondition<DELEGATE> &t = rhs;
if (this != &t) {
if (rhs.is_nil()) {
/* We got a null object and are not really able to do a typecheck here. */
/* So, just set a null object. */
*this = dds::core::null;
} else {
TCondition other(rhs);
/* Dont have to copy when the delegate is the same. */
if (other.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
*this = other;
}
}
}
return *this;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_TGUARDCONDITION_IMPL_HPP_ */

View File

@@ -0,0 +1,113 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/cond/TStatusCondition.hpp>
#include <org/eclipse/cyclonedds/core/cond/StatusConditionDelegate.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
TStatusCondition<DELEGATE>::TStatusCondition(const dds::core::Entity& e)
{
dds::core::Reference<DELEGATE>::impl_=
::std::dynamic_pointer_cast<org::eclipse::cyclonedds::core::cond::StatusConditionDelegate>(
e.delegate()->get_statusCondition());
}
template <typename DELEGATE>
template <typename FUN>
TStatusCondition<DELEGATE>::TStatusCondition(const dds::core::Entity& e, FUN functor)
{
dds::core::Reference<DELEGATE>::impl_=
::std::dynamic_pointer_cast<org::eclipse::cyclonedds::core::cond::StatusConditionDelegate>(
e.delegate()->get_statusCondition());
this->delegate()->set_handler(functor);
}
template <typename DELEGATE>
void TStatusCondition<DELEGATE>::enabled_statuses(const dds::core::status::StatusMask& status) const
{
this->delegate()->enabled_statuses(status);
}
template <typename DELEGATE>
const dds::core::status::StatusMask TStatusCondition<DELEGATE>::enabled_statuses() const
{
return this->delegate()->enabled_statuses();
}
template <typename DELEGATE>
const dds::core::Entity& TStatusCondition<DELEGATE>::entity() const
{
return this->delegate()->entity();
}
template <typename DELEGATE>
TCondition<DELEGATE>::TCondition(const dds::core::cond::TStatusCondition<org::eclipse::cyclonedds::core::cond::StatusConditionDelegate>& h)
{
if (h.is_nil()) {
/* We got a null object and are not really able to do a typecheck here. */
/* So, just set a null object. */
*this = dds::core::null;
} else {
this->::dds::core::Reference<DELEGATE>::impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(h.delegate());
if (h.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name());
}
}
}
template <typename DELEGATE>
TCondition<DELEGATE>&
TCondition<DELEGATE>::operator=(const dds::core::cond::TStatusCondition<org::eclipse::cyclonedds::core::cond::StatusConditionDelegate>& rhs)
{
const TCondition<DELEGATE> &t = rhs;
if (this != &t) {
if (rhs.is_nil()) {
/* We got a null object and are not really able to do a typecheck here. */
/* So, just set a null object. */
*this = dds::core::null;
} else {
TCondition other(rhs);
/* Dont have to copy when the delegate is the same. */
if (other.delegate() != this->::dds::core::Reference<DELEGATE>::impl_) {
*this = other;
}
}
}
return *this;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_TSTATUSCONDITION_IMPL_HPP_ */

View File

@@ -0,0 +1,123 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_
#define CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/cond/TWaitSet.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace cond
{
template <typename DELEGATE>
TWaitSet<DELEGATE>::TWaitSet()
{
this->set_ref(new DELEGATE);
this->delegate()->init(this->impl_);
}
template <typename DELEGATE>
const typename TWaitSet<DELEGATE>::ConditionSeq TWaitSet<DELEGATE>::wait(const dds::core::Duration& timeout)
{
ConditionSeq triggered;
return this->wait(triggered, timeout);
}
template <typename DELEGATE>
const typename TWaitSet<DELEGATE>::ConditionSeq TWaitSet<DELEGATE>::wait()
{
ConditionSeq triggered;
return this->wait(triggered, dds::core::Duration::infinite());
}
template <typename DELEGATE>
typename TWaitSet<DELEGATE>::ConditionSeq& TWaitSet<DELEGATE>::wait(ConditionSeq& triggered, const dds::core::Duration& timeout)
{
return this->delegate()->wait(triggered, timeout);
}
template <typename DELEGATE>
typename TWaitSet<DELEGATE>::ConditionSeq& TWaitSet<DELEGATE>::wait(ConditionSeq& triggered)
{
return this->wait(triggered, dds::core::Duration::infinite());
}
template <typename DELEGATE>
void TWaitSet<DELEGATE>::dispatch()
{
this->dispatch(dds::core::Duration::infinite());
}
template <typename DELEGATE>
void TWaitSet<DELEGATE>::dispatch(const dds::core::Duration& timeout)
{
this->delegate()->dispatch(timeout);
}
template <typename DELEGATE>
TWaitSet<DELEGATE>& TWaitSet<DELEGATE>::operator +=(const dds::core::cond::Condition& cond)
{
this->attach_condition(cond);
return *this;
}
template <typename DELEGATE>
TWaitSet<DELEGATE>& TWaitSet<DELEGATE>::operator -=(const dds::core::cond::Condition& cond)
{
this->detach_condition(cond);
return *this;
}
template <typename DELEGATE>
TWaitSet<DELEGATE>& TWaitSet<DELEGATE>::attach_condition(const dds::core::cond::Condition& cond)
{
this->delegate()->attach_condition(cond);
return *this;
}
template <typename DELEGATE>
bool TWaitSet<DELEGATE>::detach_condition(const dds::core::cond::Condition& cond)
{
return this->delegate()->detach_condition(cond.delegate().get());
}
template <typename DELEGATE>
const typename TWaitSet<DELEGATE>::ConditionSeq TWaitSet<DELEGATE>::conditions() const
{
ConditionSeq conds;
return this->conditions(conds);
}
template <typename DELEGATE>
typename TWaitSet<DELEGATE>::ConditionSeq& TWaitSet<DELEGATE>::conditions(ConditionSeq& conds) const
{
return this->delegate()->conditions(conds);
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_TWAITSET_HPP_ */

View File

@@ -0,0 +1,40 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_
#define CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_
/**
* @file
*/
// Implementation
#include <dds/core/cond/detail/TWaitSetImpl.hpp>
#include <org/eclipse/cyclonedds/core/cond/WaitSetDelegate.hpp>
namespace dds
{
namespace core
{
namespace cond
{
namespace detail
{
typedef dds::core::cond::TWaitSet<org::eclipse::cyclonedds::core::cond::WaitSetDelegate> WaitSet;
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_COND_DETAIL_WAITSET_HPP_ */

View File

@@ -0,0 +1,23 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_CONFORMANCE_HPP_
#define OMG_DDS_CORE_CONFORMANCE_HPP_
#include <dds/core/detail/conformance.hpp>
#endif /* OMG_DDS_CORE_CONFORMANCE_HPP_ */

View File

@@ -0,0 +1,35 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_
#define OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_
#include <dds/core/detail/conformance.hpp>
#include <dds/core/types.hpp>
#include <dds/core/Time.hpp>
#include <dds/core/Duration.hpp>
#include <dds/core/InstanceHandle.hpp>
#include <dds/core/array.hpp>
#include <dds/core/Entity.hpp>
#include <dds/core/cond/GuardCondition.hpp>
#include <dds/core/cond/StatusCondition.hpp>
#include <dds/core/cond/WaitSet.hpp>
#include <dds/core/detail/ddscore.hpp>
#endif /* OMG_DDS_CORE_PACKAGE_INCLUDE_HPP_ */

View File

@@ -0,0 +1,29 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_
#define OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_
namespace dds {
namespace core {
namespace detail {
class BytesTopicType { };
class StringTopicType { };
class KeyedBytesTopicType { };
class KeyedStringTopicType { };
}
}
}
#endif /* OMG_DDS_CORE_DELEGATE_BUILTIN_TOPIC_TYPES_HPP_ */

View File

@@ -0,0 +1,29 @@
#ifndef OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_
#define OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/TEntityImpl.hpp>
#include <org/eclipse/cyclonedds/core/EntityDelegate.hpp>
namespace dds { namespace core { namespace detail {
typedef dds::core::TEntity<org::eclipse::cyclonedds::core::EntityDelegate> Entity;
} } }
#endif /* OMG_DDS_CORE_DETAIL_ENTITY_IMPL_HPP_ */

View File

@@ -0,0 +1,29 @@
#ifndef OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_
#define OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/TInstanceHandleImpl.hpp>
#include <org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp>
namespace dds { namespace core { namespace detail {
typedef dds::core::TInstanceHandle<org::eclipse::cyclonedds::core::InstanceHandleDelegate> InstanceHandle;
} } }
#endif /* !defined(OMG_DDS_CORE_DETAIL_INSTANCE_HANDLE_HPP_) */

View File

@@ -0,0 +1,34 @@
#ifndef OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_
#define OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/TQosProviderImpl.hpp>
#include <org/eclipse/cyclonedds/core/QosProviderDelegate.hpp>
namespace dds {
namespace core {
namespace detail {
typedef dds::core::TQosProvider<org::eclipse::cyclonedds::core::QosProviderDelegate> QosProvider;
}
}
}
#endif /* OMG_DDS_CORE_DETAIL_QOS_PROVIDER_HPP_ */

View File

@@ -0,0 +1,221 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/Reference.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::Reference(dds::core::null_type&) : impl_()
{
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::Reference(const Reference& ref) : impl_(ref.impl_)
{
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::Reference(Reference&& ref) : impl_(ref.impl_)
{
}
template <typename DELEGATE>
template <typename D>
dds::core::Reference<DELEGATE>::Reference(const Reference<D>& ref)
{
impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(ref.impl_);
if (impl_ != ref.impl_) {
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(ref).name() + " to " + typeid(*this).name());
}
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::Reference(DELEGATE_T* p) : impl_(p)
{
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::Reference(const DELEGATE_REF_T& p) : impl_(p)
{
//OMG_DDS_LOG("MM", "Reference(DELEGATE_REF_T& p)");
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::~Reference<DELEGATE>()
{
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::operator DELEGATE_REF_T() const
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_;
}
template <typename DELEGATE>
template <typename R>
bool
dds::core::Reference<DELEGATE>::operator==(const R& ref) const
{
bool equal = false;
if (this->is_nil() && ref.is_nil()) {
/* Both delegates are null. */
equal = true;
} else if (!this->is_nil() && !ref.is_nil()) {
/* Check delegates. */
equal = (this->delegate() == ref.delegate());
}
return equal;
}
template <typename DELEGATE>
template <typename R>
bool
dds::core::Reference<DELEGATE>::operator!=(const R& ref) const
{
return !(*this == ref);
}
template <typename DELEGATE>
template <typename D>
dds::core::Reference<DELEGATE>&
dds::core::Reference<DELEGATE>::operator=(const Reference<D>& that)
{
OMG_DDS_STATIC_ASSERT((dds::core::is_base_of<DELEGATE_T, D>::value));
if(this != static_cast<Reference*>(&that))
{
*this = Reference<DELEGATE_T>(that);
}
return *this;
}
template <typename DELEGATE>
template <typename R>
dds::core::Reference<DELEGATE>&
dds::core::Reference<DELEGATE>::operator=(const R& rhs)
{
OMG_DDS_STATIC_ASSERT((dds::core::is_base_of< DELEGATE_T, typename R::DELEGATE_T>::value));
if(this != static_cast<Reference*>(&rhs))
{
*this = Reference<DELEGATE_T>(rhs);
}
return *this;
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>&
dds::core::Reference<DELEGATE>::operator=(const null_type)
{
DELEGATE_REF_T tmp;
impl_ = tmp;
return *this;
}
template <typename DELEGATE>
bool
dds::core::Reference<DELEGATE>::is_nil() const
{
return impl_.get() == 0;
}
template <typename DELEGATE>
bool
dds::core::Reference<DELEGATE>::operator==(const null_type) const
{
return this->is_nil();
}
template <typename DELEGATE>
bool
dds::core::Reference<DELEGATE>::operator!=(const null_type) const
{
return !(this->is_nil());
}
template <typename DELEGATE>
const typename dds::core::Reference<DELEGATE>::DELEGATE_REF_T&
dds::core::Reference<DELEGATE>::delegate() const
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_;
}
template <typename DELEGATE>
typename dds::core::Reference<DELEGATE>::DELEGATE_REF_T&
dds::core::Reference<DELEGATE>::delegate()
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_;
}
template <typename DELEGATE>
DELEGATE*
dds::core::Reference<DELEGATE>::operator->()
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_.get();
}
template <typename DELEGATE>
const DELEGATE*
dds::core::Reference<DELEGATE>::operator->() const
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_.get();
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::operator
const typename dds::core::Reference<DELEGATE>::DELEGATE_REF_T& () const
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_;
}
template <typename DELEGATE>
dds::core::Reference<DELEGATE>::operator
typename dds::core::Reference<DELEGATE>::DELEGATE_REF_T& ()
{
ISOCPP_BOOL_CHECK_AND_THROW(impl_, ISOCPP_NULL_REFERENCE_ERROR, "Reference[%d] == dds::core::null", __LINE__);
return impl_;
}
template <typename DELEGATE>
void dds::core::Reference<DELEGATE>::set_ref(DELEGATE_T* p)
{
impl_.reset(p);
}
template <class D> bool operator == (dds::core::null_type, const dds::core::Reference<D>& r)
{
return r.is_nil();
}
template <class D> bool operator != (dds::core::null_type, const dds::core::Reference<D>& r)
{
return !r.is_nil();
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_REFERENCE_IMPL_HPP_ */

View File

@@ -0,0 +1,65 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/detail/ReferenceImpl.hpp>
#include <dds/core/TEntity.hpp>
#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
// Implementation
template <typename DELEGATE>
void
dds::core::TEntity<DELEGATE>::enable()
{
this->delegate()->enable();
}
template <typename DELEGATE>
const dds::core::status::StatusMask
dds::core::TEntity<DELEGATE>::status_changes()
{
return this->delegate()->status_changes();
}
template <typename DELEGATE>
const dds::core::InstanceHandle
dds::core::TEntity<DELEGATE>::instance_handle() const
{
return this->delegate()->instance_handle();
}
template <typename DELEGATE>
void
dds::core::TEntity<DELEGATE>::close()
{
this->delegate()->close();
}
template <typename DELEGATE>
void
dds::core::TEntity<DELEGATE>::retain()
{
this->delegate()->retain();
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_TENTITY_IMPL_HPP_ */

View File

@@ -0,0 +1,100 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/TEntityQos.hpp>
// Implementation
namespace dds
{
namespace core
{
template <typename DELEGATE>
TEntityQos<DELEGATE>::TEntityQos() : dds::core::Value<DELEGATE>() { }
template <typename DELEGATE>
TEntityQos<DELEGATE>::TEntityQos(const TEntityQos& other)
: dds::core::Value<DELEGATE>(other.delegate()) { }
template <typename DELEGATE>
TEntityQos<DELEGATE>::TEntityQos(TEntityQos&& other)
: dds::core::Value<DELEGATE>(other.delegate()) { }
template <typename DELEGATE>
template <typename T>
TEntityQos<DELEGATE>::TEntityQos(const TEntityQos<T>& qos) :
dds::core::Value<DELEGATE>(qos.delegate()) { }
template <typename DELEGATE>
template <typename POLICY>
TEntityQos<DELEGATE>& TEntityQos<DELEGATE>::policy(const POLICY& p)
{
this->dds::core::Value<DELEGATE>::delegate().policy(p);
return *this;
}
template <typename DELEGATE>
template <typename POLICY>
const POLICY& TEntityQos<DELEGATE>::policy() const
{
return this->delegate().template policy<POLICY>();
}
template <typename DELEGATE>
template <typename POLICY>
POLICY& TEntityQos<DELEGATE>::policy()
{
return this->delegate().template policy<POLICY>();
}
template <typename DELEGATE>
template <typename POLICY>
TEntityQos<DELEGATE>& TEntityQos<DELEGATE>::operator << (const POLICY& p)
{
this->policy(p);
return *this;
}
template <typename DELEGATE>
template <typename POLICY>
const TEntityQos<DELEGATE>& TEntityQos<DELEGATE>::operator >> (POLICY& p) const
{
p = this->policy<POLICY>();
return *this;
}
template <typename DELEGATE>
template <typename T>
TEntityQos<DELEGATE>& TEntityQos<DELEGATE>::operator = (const TEntityQos<T>& other)
{
if(this != reinterpret_cast<const TEntityQos<DELEGATE>*>(&other))
{
this->d_ = other.delegate();
}
return *this;
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_TENTITYQOS_IMPL_HPP_ */

View File

@@ -0,0 +1,110 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_
/**
* @file
*/
#include <dds/core/detail/Value.hpp>
#include <org/eclipse/cyclonedds/core/InstanceHandleDelegate.hpp>
/*
* OMG PSM class declaration
*/
#include <dds/core/TInstanceHandle.hpp>
// Implementation
namespace dds
{
namespace core
{
template <typename DELEGATE>
TInstanceHandle<DELEGATE>::TInstanceHandle() { }
template <typename DELEGATE>
template <typename ARG0>
TInstanceHandle<DELEGATE>::TInstanceHandle(const ARG0& arg0) : dds::core::Value<DELEGATE>(arg0) { }
template <typename DELEGATE>
TInstanceHandle<DELEGATE>::TInstanceHandle(const dds::core::null_type& nullHandle) : dds::core::Value<DELEGATE>(nullHandle) { }
template <typename DELEGATE>
TInstanceHandle<DELEGATE>::TInstanceHandle(const TInstanceHandle& other): dds::core::Value<DELEGATE>(other.delegate()) { }
template <typename DELEGATE>
TInstanceHandle<DELEGATE>::TInstanceHandle(TInstanceHandle&& other): dds::core::Value<DELEGATE>(other.delegate()) { }
template <typename DELEGATE>
TInstanceHandle<DELEGATE>& TInstanceHandle<DELEGATE>::operator=(const TInstanceHandle& that)
{
if(this != &that)
{
this->delegate() = that.delegate();
}
return *this;
}
template <typename DELEGATE>
TInstanceHandle<DELEGATE>& TInstanceHandle<DELEGATE>::operator=(TInstanceHandle&& that)
{
if(this != &that)
{
this->delegate() = that.delegate();
}
return *this;
}
template <typename DELEGATE>
bool TInstanceHandle<DELEGATE>::operator==(const TInstanceHandle& that) const
{
return this->delegate() == that.delegate();
}
template <typename DELEGATE>
bool TInstanceHandle<DELEGATE>::operator<(const TInstanceHandle& that) const
{
return this->delegate() < that.delegate();
}
template <typename DELEGATE>
bool TInstanceHandle<DELEGATE>::operator>(const TInstanceHandle& that) const
{
return this->delegate() > that.delegate();
}
template <typename DELEGATE>
const TInstanceHandle<DELEGATE> TInstanceHandle<DELEGATE>::nil()
{
dds::core::null_type nt;
static TInstanceHandle nil_handle(nt);
return nil_handle;
}
template <typename DELEGATE>
bool TInstanceHandle<DELEGATE>::is_nil() const
{
return this->delegate().is_nil();
}
}
}
inline std::ostream& operator << (std::ostream& os, const dds::core::TInstanceHandle<org::eclipse::cyclonedds::core::InstanceHandleDelegate>& h)
{
os << h.delegate();
return os;
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_TINSTANCEHANDLE_IMPL_HPP_ */

View File

@@ -0,0 +1,126 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/TQosProvider.hpp>
// Implementation
namespace dds
{
namespace core
{
template <typename DELEGATE>
TQosProvider<DELEGATE>::TQosProvider(const std::string& uri, const std::string& profile)
: Reference<DELEGATE>(new DELEGATE(uri, profile)) { }
template <typename DELEGATE>
TQosProvider<DELEGATE>::TQosProvider(const std::string& uri)
: Reference<DELEGATE>(new DELEGATE(uri)) { }
template <typename DELEGATE>
dds::domain::qos::DomainParticipantQos
TQosProvider<DELEGATE>::participant_qos()
{
return this->delegate()->participant_qos(NULL);
}
template <typename DELEGATE>
dds::domain::qos::DomainParticipantQos
TQosProvider<DELEGATE>::participant_qos(const std::string& id)
{
return this->delegate()->participant_qos(id.c_str());
}
template <typename DELEGATE>
dds::topic::qos::TopicQos
TQosProvider<DELEGATE>::topic_qos()
{
return this->delegate()->topic_qos(NULL);
}
template <typename DELEGATE>
dds::topic::qos::TopicQos
TQosProvider<DELEGATE>::topic_qos(const std::string& id)
{
return this->delegate()->topic_qos(id.c_str());
}
template <typename DELEGATE>
dds::sub::qos::SubscriberQos
TQosProvider<DELEGATE>::subscriber_qos()
{
return this->delegate()->subscriber_qos(NULL);
}
template <typename DELEGATE>
dds::sub::qos::SubscriberQos
TQosProvider<DELEGATE>::subscriber_qos(const std::string& id)
{
return this->delegate()->subscriber_qos(id.c_str());
}
template <typename DELEGATE>
dds::sub::qos::DataReaderQos
TQosProvider<DELEGATE>::datareader_qos()
{
return this->delegate()->datareader_qos(NULL);
}
template <typename DELEGATE>
dds::sub::qos::DataReaderQos
TQosProvider<DELEGATE>::datareader_qos(const std::string& id)
{
return this->delegate()->datareader_qos(id.c_str());
}
template <typename DELEGATE>
dds::pub::qos::PublisherQos
TQosProvider<DELEGATE>::publisher_qos()
{
return this->delegate()->publisher_qos(NULL);
}
template <typename DELEGATE>
dds::pub::qos::PublisherQos
TQosProvider<DELEGATE>::publisher_qos(const std::string& id)
{
return this->delegate()->publisher_qos(id.c_str());
}
template <typename DELEGATE>
dds::pub::qos::DataWriterQos
TQosProvider<DELEGATE>::datawriter_qos()
{
return this->delegate()->datawriter_qos(NULL);
}
template <typename DELEGATE>
dds::pub::qos::DataWriterQos
TQosProvider<DELEGATE>::datawriter_qos(const std::string& id)
{
return this->delegate()->datawriter_qos(id.c_str());
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_TQOSPROVIDERIMPL_HPP_ */

View File

@@ -0,0 +1,139 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/Value.hpp>
// Implementation
namespace dds
{
namespace core
{
/**
* @internal @todo We can't assume that the compiler supports variadic templates, yet.
* This code should be refactored to take advantage of compilers that do support variadic
* templates.
*/
template <typename D>
Value<D>::Value() { }
template <typename D>
template <typename ARG>
Value<D>::Value(const ARG& arg) : d_(arg) { }
template <typename D>
template <typename ARG1, typename ARG2>
Value<D>::Value(const ARG1& arg1, const ARG2& arg2) : d_(arg1, arg2) { }
template <typename D>
template <typename ARG1, typename ARG2, typename ARG3>
Value<D>::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3)
: d_(arg1, arg2, arg3) { }
template <typename D>
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4>
Value<D>::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4)
: d_(arg1, arg2, arg3, arg4) { }
template <typename D>
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5>
Value<D>::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5)
: d_(arg1, arg2, arg3, arg4, arg5) { }
template <typename D>
template <typename ARG1, typename ARG2, typename ARG3, typename ARG4, typename ARG5, typename ARG6>
Value<D>::Value(const ARG1& arg1, const ARG2& arg2, const ARG3& arg3, const ARG4& arg4, const ARG5& arg5, const ARG6& arg6)
: d_(arg1, arg2, arg3, arg4, arg5, arg6) { }
template <typename D>
Value<D>& Value<D>::operator=(const Value& other)
{
if(this != &other)
{
d_ = other.d_;
}
return *this;
}
template <typename D>
Value<D>& Value<D>::operator=(Value&& other)
{
if(this != &other)
{
d_ = other.d_;
}
return *this;
}
template <typename D>
bool Value<D>::operator==(const Value& other) const
{
return (d_ == other.d_);
}
template <typename D>
bool Value<D>::operator !=(const Value& other) const
{
return !(d_ == other.d_);
}
template <typename D>
const D* Value<D>::operator->() const
{
return &d_;
}
template <typename D>
D* Value<D>::operator->()
{
return &d_;
}
template <typename D>
const D& Value<D>::delegate() const
{
return d_;
}
template <typename D>
D& Value<D>::delegate()
{
return d_;
}
template <typename D>
Value<D>::operator D& ()
{
return d_;
}
template <typename D>
Value<D>::operator const D& () const
{
return d_;
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_VALUE_HPP_ */

View File

@@ -0,0 +1,58 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/detail/ReferenceImpl.hpp>
#include <dds/core/WeakReference.hpp>
// Implementation
namespace dds
{
namespace core
{
template <typename T>
WeakReference<T>::WeakReference() { }
template <typename T>
WeakReference<T>::WeakReference(const T& t)
{
if (!t.is_nil()) {
impl_ = t.delegate();
}
}
template <typename T>
bool WeakReference<T>::expired()
{
return impl_.expired();
}
template <typename T>
T WeakReference<T>::lock()
{
return T(impl_.lock());
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_WEAK_REFERENCE_IMPL_HPP_ */

View File

@@ -0,0 +1,28 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_
#include <array>
namespace dds
{
namespace core
{
namespace detail
{
using ::std::array;
}
}
}
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_ARRAY_HPP_ */

View File

@@ -0,0 +1,36 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_
// Implementation
/**
* @file
* @internal
* @note Values 'set' in this file should be mirrored in etc/doxygen_isocpp2_common.cfg
* in order to ensure the doxygen documentation includes all supported QoS
* and features and ting.
*/
#define OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT FULL
// #define OMG_DDS_MULTI_TOPIC_SUPPORT FULL
#define OMG_DDS_PERSISTENCE_SUPPORT FULL
#define OMG_DDS_OWNERSHIP_SUPPORT FULL
#define OMG_DDS_OBJECT_MODEL_SUPPORT FULL
#define OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT FULL
// #define OMG_DDS_X_TYPES_BUILTIN_TOPIC_TYPES_SUPPORT FULL
#define OMG_DDS_HAS_PRETTY_PRINT_COUT 1
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_CONFORMANCE_HPP_ */

View File

@@ -0,0 +1,17 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_
#define OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_
/* Nothing to 'post' include. */
#endif /* OMG_DDS_CORE_PACKAGE_DETAIL_INCLUDE_HPP_ */

View File

@@ -0,0 +1,42 @@
#ifndef OMG_DDS_API_DETAIL_H
#define OMG_DDS_API_DETAIL_H
#ifdef OMG_DDS_API_DETAIL_STATIC_DEFINE
# define OMG_DDS_API_DETAIL
# define OMG_DDS_API_DETAIL_NO_EXPORT
#else
# ifndef OMG_DDS_API_DETAIL
# ifdef ddscxx_EXPORTS
/* We are building this library */
# define OMG_DDS_API_DETAIL __attribute__((visibility("default")))
# else
/* We are using this library */
# define OMG_DDS_API_DETAIL __attribute__((visibility("default")))
# endif
# endif
# ifndef OMG_DDS_API_DETAIL_NO_EXPORT
# define OMG_DDS_API_DETAIL_NO_EXPORT __attribute__((visibility("hidden")))
# endif
#endif
#ifndef OMG_DDS_API_DETAIL_DEPRECATED
# define OMG_DDS_API_DETAIL_DEPRECATED __attribute__ ((__deprecated__))
#endif
#ifndef OMG_DDS_API_DETAIL_DEPRECATED_EXPORT
# define OMG_DDS_API_DETAIL_DEPRECATED_EXPORT OMG_DDS_API_DETAIL OMG_DDS_API_DETAIL_DEPRECATED
#endif
#ifndef OMG_DDS_API_DETAIL_DEPRECATED_NO_EXPORT
# define OMG_DDS_API_DETAIL_DEPRECATED_NO_EXPORT OMG_DDS_API_DETAIL_NO_EXPORT OMG_DDS_API_DETAIL_DEPRECATED
#endif
#if 0 /* DEFINE_NO_DEPRECATED */
# ifndef OMG_DDS_API_DETAIL_NO_DEPRECATED
# define OMG_DDS_API_DETAIL_NO_DEPRECATED
# endif
#endif
#endif /* OMG_DDS_API_DETAIL_H */

View File

@@ -0,0 +1,35 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_
/**
* @file
*/
// Implementation
/* (from spec:) This implementation-defined header stands in for the C99 header files
* inttypes.h. Under toolchains that support inttypes.h, this header can
* simply include that one. Under toolchains that do not, this header must
* provide equivalent definitions.
*/
#if defined(__GNUC__) && __GNUC__ < 5
#define __STDC_FORMAT_MACROS
#endif
#include <stdint.h>
#include <inttypes.h>
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_INTTYPES_HPP_ */

View File

@@ -0,0 +1,100 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_
/**
* @file
*/
// Implementation
#include <iostream>
#include <string.h>
// == Constants
#define OMG_DDS_DEFAULT_STATE_BIT_COUNT_DETAIL static_cast<size_t>(32)
#define OMG_DDS_DEFAULT_STATUS_COUNT_DETAIL static_cast<size_t>(32)
// ==========================================================================
#define OSPL_DEFAULT_TO_CXX11
#define OSPL_USE_CXX11
// == Static Assert
#define OMG_DDS_STATIC_ASSERT_DETAIL(condition) static_assert(condition, #condition)
// ==========================================================================
// DLL Export Macros
#include "dds/core/detail/export.hpp"
// ==========================================================================
// Logging Macros
#if 0
#include <dds/core/detail/maplog.hpp>
#define OMG_DDS_LOG_DETAIL(kind, msg) \
if (dds::core::detail::maplog(kind) >= os_reportVerbosity) os_report(dds::core::detail::maplog(kind),"isocpp-OMG_DDS_LOG",__FILE__,__LINE__,0,msg)
// std::cout << "[" << kind << "]: " << msg << std::endl;
// ==========================================================================
#endif
// C++ 11 features
// Slightly pathological - we could (for example) want to use boost traits
// and 'STL' implementations but compile with -std=c++11, so set a macro for
// C++11 compile being on. This way we can always use language features
#define OSPL_DDS_CXX11
#include <cstring>
#if defined (_MSC_VER) && ( _MSC_VER < 1700)
// http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
// 'Visual C++ in Visual Studio 2010 ... "final" was ... supported, but
// under the different spelling "sealed". The Standard spelling and
// semantics of "override" and "final" are now completely supported.'
# define OSPL_DDS_FINAL sealed
#else
# define OSPL_DDS_FINAL final
#endif
#if defined (_MSC_VER) && (_MSC_VER <= 1800)
// See: http://msdn.microsoft.com/en-us/library/vstudio/hh567368.aspx
// "These are now supported, but with this exception: For defaulted functions,
// the use of = default to request member-wise move constructors and move
// assignment operators is not supported."
// ('now' is currently VS 2013 - _MSC_VER == 1800).
# define OSPL_CXX11_NO_FUNCTION_DEFAULTS
#endif
#define OSPL_ENUM enum class
#define OSPL_ENUM_LABEL(_escope,_etype,_elabel) _escope::_etype::_elabel
/**
* @brief Macro to disable unused argument warnings
*/
#define DDSCXX_UNUSED_ARG(a) (void)(a)
/**
* @brief Macro to disable specific compiler warnings
*/
#if defined(_MSC_VER)
#define DDSCXX_WARNING_MSVC_OFF(x) \
__pragma(warning(push)) \
__pragma(warning(disable: ## x))
#define DDSCXX_WARNING_MSVC_ON(x) \
__pragma(warning(pop))
#else
#define DDSCXX_WARNING_MSVC_OFF(x)
#define DDSCXX_WARNING_MSVC_ON(x)
#endif
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_MACROS_HPP_ */

View File

@@ -0,0 +1,177 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_
// Implementation
/**
* @file
* This file exists only to be fed to doxygen. There is quite
* literally nothing else to see here.
*/
/**
* @addtogroup isocpp2_dcps ISO/IEC C++ 2 API for DDS Data-centric Publish-Subscribe (DCPS)
*/
/** @{*/
/** @dir dds */
/** @}*/
/**
* @addtogroup isocpp2_dcps_domain Domain Module - ::dds::domain
* @ingroup isocpp2_dcps */
/** @{*/
/** @dir dds/domain */
/** @}*/
/**
* @addtogroup isocpp2_dcps_topic Topic Module- ::dds::topic
* @ingroup isocpp2_dcps */
/** @{*/
/** @dir dds/topic */
/** @}*/
/**
* @addtogroup isocpp2_dcps_pub Publication Module - ::dds::pub
* @ingroup isocpp2_dcps */
/** @{*/
/** @dir dds/pub */
/** @}*/
/**
* @addtogroup isocpp2_dcps_sub Subscription Module - ::dds::sub
* @ingroup isocpp2_dcps */
/** @{*/
/** @dir dds/sub */
/** @}*/
/**
* @addtogroup isocpp2_dcps_core Core / Common Module - ::dds::core
* @ingroup isocpp2_dcps */
/** @{*/
/** @dir dds/core */
/** @}*/
/**
* @addtogroup examplesdcpsisocpp ISO/IEC C++ DCPS PSM Examples
*/
/** @{*/
/** @dir examples/common */
/** @}*/
/**
* @ingroup isocpp2_dcps
*/
namespace dds
{
/**
* @ingroup isocpp2_dcps_domain
* @ingroup isocpp2_dcps */
namespace domain
{
/** @ingroup isocpp2_dcps_domain
* @ingroup isocpp2_dcps */
namespace qos
{
namespace detail {}
}
namespace detail {}
}
/**
* @ingroup isocpp2_dcps_topic
* @ingroup isocpp2_dcps */
namespace topic
{
/** @ingroup isocpp2_dcps_topic
* @ingroup isocpp2_dcps */
namespace qos
{
namespace detail {}
}
namespace detail {}
}
/**
* @ingroup isocpp2_dcps_pub
* @ingroup isocpp2_dcps */
namespace pub
{
/** @ingroup isocpp2_dcps_pub
* @ingroup isocpp2_dcps */
namespace qos
{
namespace detail {}
}
namespace detail {}
}
/**
* @ingroup isocpp2_dcps_sub
* @ingroup isocpp2_dcps */
namespace sub
{
/** @ingroup isocpp2_dcps_sub
* @ingroup isocpp2_dcps */
namespace cond
{
namespace detail {}
}
/** @ingroup isocpp2_dcps_sub
* @ingroup isocpp2_dcps */
namespace functors
{
namespace detail {}
}
/** @ingroup isocpp2_dcps_sub
* @ingroup isocpp2_dcps */
namespace status {}
/** @ingroup isocpp2_dcps_sub
* @ingroup isocpp2_dcps */
namespace qos
{
namespace detail {}
}
}
/**
* @ingroup isocpp2_dcps_core
* @ingroup isocpp2_dcps */
namespace core
{
/** @ingroup isocpp2_dcps_core
* @ingroup isocpp2_dcps */
namespace policy
{
namespace detail {}
}
/** @ingroup isocpp2_dcps_core
* @ingroup isocpp2_dcps */
namespace cond
{
namespace detail {}
}
/** @ingroup isocpp2_dcps_core
* @ingroup isocpp2_dcps */
namespace status
{
namespace detail {}
}
namespace detail {}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_MODULE_DOCS_HPP_ */

View File

@@ -0,0 +1,247 @@
/**
* @file
* This file provides definitions for stdint header types for versions of
* Windows that didn't have it. It was discovered on the intahwebs at
* http://snipplr.com/view/18199/stdinth/ where it was described thus:
* "A public domain stdint.h. Original code is from a public domain version
* in the MinGW distribution. This one has been modified to fix a couple bugs
* (to make some macros 64-bit aware) and to make it compatible with VC6."
* It was published there on 08/12/09
* @see dds/core/detail/inttypes.h
*/
/* ISO C9x 7.18 Integer types <stdint.h>
* Based on ISO/IEC SC22/WG14 9899 Committee draft (SC22 N2794)
*
* THIS SOFTWARE IS NOT COPYRIGHTED
*
* Contributor: Danny Smith <danny_r_smith_2001@yahoo.co.nz>
*
* This source code is offered for use in the public domain. You may
* use, modify or distribute it freely.
*
* This code is distributed in the hope that it will be useful but
* WITHOUT ANY WARRANTY. ALL WARRANTIES, EXPRESS OR IMPLIED ARE HEREBY
* DISCLAIMED. This includes but is not limited to warranties of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*
* Date: 2000-12-02
*
* mwb: This was modified in the following ways:
*
* - make it compatible with Visual C++ 6 (which uses
* non-standard keywords and suffixes for 64-bit types)
* - some environments need stddef.h included (for wchar stuff?)
* - handle the fact that Microsoft's limits.h header defines
* SIZE_MAX
* - make corrections for SIZE_MAX, INTPTR_MIN, INTPTR_MAX, UINTPTR_MAX,
* PTRDIFF_MIN, PTRDIFF_MAX, SIG_ATOMIC_MIN, and SIG_ATOMIC_MAX
* to be 64-bit aware.
*/
#ifndef _STDINT_H
#define _STDINT_H
#define __need_wint_t
#define __need_wchar_t
#include <wchar.h>
#include <stddef.h>
#if _MSC_VER && (_MSC_VER < 1300)
/* using MSVC 6 or earlier - no "long long" type, but might have _int64 type */
#define __STDINT_LONGLONG __int64
#define __STDINT_LONGLONG_SUFFIX i64
#else
#define __STDINT_LONGLONG long long
#define __STDINT_LONGLONG_SUFFIX LL
#endif
#if !defined( PASTE)
#define PASTE2( x, y) x##y
#define PASTE( x, y) PASTE2( x, y)
#endif /* PASTE */
/* 7.18.1.1 Exact-width integer types */
typedef signed char int8_t;
typedef unsigned char uint8_t;
typedef short int16_t;
typedef unsigned short uint16_t;
typedef int int32_t;
typedef unsigned uint32_t;
typedef __STDINT_LONGLONG int64_t;
typedef unsigned __STDINT_LONGLONG uint64_t;
/* 7.18.1.2 Minimum-width integer types */
typedef signed char int_least8_t;
typedef unsigned char uint_least8_t;
typedef short int_least16_t;
typedef unsigned short uint_least16_t;
typedef int int_least32_t;
typedef unsigned uint_least32_t;
typedef __STDINT_LONGLONG int_least64_t;
typedef unsigned __STDINT_LONGLONG uint_least64_t;
/* 7.18.1.3 Fastest minimum-width integer types
* Not actually guaranteed to be fastest for all purposes
* Here we use the exact-width types for 8 and 16-bit ints.
*/
typedef char int_fast8_t;
typedef unsigned char uint_fast8_t;
typedef short int_fast16_t;
typedef unsigned short uint_fast16_t;
typedef int int_fast32_t;
typedef unsigned int uint_fast32_t;
typedef __STDINT_LONGLONG int_fast64_t;
typedef unsigned __STDINT_LONGLONG uint_fast64_t;
/* 7.18.1.4 Integer types capable of holding object pointers */
#ifndef _INTPTR_T_DEFINED
#define _INTPTR_T_DEFINED
#ifdef _WIN64
typedef __STDINT_LONGLONG intptr_t
#else
typedef int intptr_t;
#endif /* _WIN64 */
#endif /* _INTPTR_T_DEFINED */
#ifndef _UINTPTR_T_DEFINED
#define _UINTPTR_T_DEFINED
#ifdef _WIN64
typedef unsigned __STDINT_LONGLONG uintptr_t
#else
typedef unsigned int uintptr_t;
#endif /* _WIN64 */
#endif /* _UINTPTR_T_DEFINED */
/* 7.18.1.5 Greatest-width integer types */
typedef __STDINT_LONGLONG intmax_t;
typedef unsigned __STDINT_LONGLONG uintmax_t;
/* 7.18.2 Limits of specified-width integer types */
#if !defined ( __cplusplus) || defined (__STDC_LIMIT_MACROS)
/* 7.18.2.1 Limits of exact-width integer types */
#define INT8_MIN (-128)
#define INT16_MIN (-32768)
#define INT32_MIN (-2147483647 - 1)
#define INT64_MIN (PASTE( -9223372036854775807, __STDINT_LONGLONG_SUFFIX) - 1)
#define INT8_MAX 127
#define INT16_MAX 32767
#define INT32_MAX 2147483647
#define INT64_MAX (PASTE( 9223372036854775807, __STDINT_LONGLONG_SUFFIX))
#define UINT8_MAX 0xff /* 255U */
#define UINT16_MAX 0xffff /* 65535U */
#define UINT32_MAX 0xffffffff /* 4294967295U */
#define UINT64_MAX (PASTE( 0xffffffffffffffffU, __STDINT_LONGLONG_SUFFIX)) /* 18446744073709551615ULL */
/* 7.18.2.2 Limits of minimum-width integer types */
#define INT_LEAST8_MIN INT8_MIN
#define INT_LEAST16_MIN INT16_MIN
#define INT_LEAST32_MIN INT32_MIN
#define INT_LEAST64_MIN INT64_MIN
#define INT_LEAST8_MAX INT8_MAX
#define INT_LEAST16_MAX INT16_MAX
#define INT_LEAST32_MAX INT32_MAX
#define INT_LEAST64_MAX INT64_MAX
#define UINT_LEAST8_MAX UINT8_MAX
#define UINT_LEAST16_MAX UINT16_MAX
#define UINT_LEAST32_MAX UINT32_MAX
#define UINT_LEAST64_MAX UINT64_MAX
/* 7.18.2.3 Limits of fastest minimum-width integer types */
#define INT_FAST8_MIN INT8_MIN
#define INT_FAST16_MIN INT16_MIN
#define INT_FAST32_MIN INT32_MIN
#define INT_FAST64_MIN INT64_MIN
#define INT_FAST8_MAX INT8_MAX
#define INT_FAST16_MAX INT16_MAX
#define INT_FAST32_MAX INT32_MAX
#define INT_FAST64_MAX INT64_MAX
#define UINT_FAST8_MAX UINT8_MAX
#define UINT_FAST16_MAX UINT16_MAX
#define UINT_FAST32_MAX UINT32_MAX
#define UINT_FAST64_MAX UINT64_MAX
/* 7.18.2.4 Limits of integer types capable of holding
object pointers */
#ifdef _WIN64
#define INTPTR_MIN INT64_MIN
#define INTPTR_MAX INT64_MAX
#define UINTPTR_MAX UINT64_MAX
#else
#define INTPTR_MIN INT32_MIN
#define INTPTR_MAX INT32_MAX
#define UINTPTR_MAX UINT32_MAX
#endif /* _WIN64 */
/* 7.18.2.5 Limits of greatest-width integer types */
#define INTMAX_MIN INT64_MIN
#define INTMAX_MAX INT64_MAX
#define UINTMAX_MAX UINT64_MAX
/* 7.18.3 Limits of other integer types */
#define PTRDIFF_MIN INTPTR_MIN
#define PTRDIFF_MAX INTPTR_MAX
#define SIG_ATOMIC_MIN INTPTR_MIN
#define SIG_ATOMIC_MAX INTPTR_MAX
/* we need to check for SIZE_MAX already defined because MS defines it in limits.h */
#ifndef SIZE_MAX
#define SIZE_MAX UINTPTR_MAX
#endif
#ifndef WCHAR_MIN /* also in wchar.h */
#define WCHAR_MIN 0
#define WCHAR_MAX ((wchar_t)-1) /* UINT16_MAX */
#endif
/*
* wint_t is unsigned short for compatibility with MS runtime
*/
#define WINT_MIN 0
#define WINT_MAX ((wint_t)-1) /* UINT16_MAX */
#endif /* !defined ( __cplusplus) || defined __STDC_LIMIT_MACROS */
/* 7.18.4 Macros for integer constants */
#if !defined ( __cplusplus) || defined (__STDC_CONSTANT_MACROS)
/* 7.18.4.1 Macros for minimum-width integer constants
Accoding to Douglas Gwyn <gwyn@arl.mil>:
"This spec was changed in ISO/IEC 9899:1999 TC1; in ISO/IEC
9899:1999 as initially published, the expansion was required
to be an integer constant of precisely matching type, which
is impossible to accomplish for the shorter types on most
platforms, because C99 provides no standard way to designate
an integer constant with width less than that of type int.
TC1 changed this to require just an integer constant
*expression* with *promoted* type."
*/
#define INT8_C(val) ((int8_t) + (val))
#define UINT8_C(val) ((uint8_t) + (val##U))
#define INT16_C(val) ((int16_t) + (val))
#define UINT16_C(val) ((uint16_t) + (val##U))
#define INT32_C(val) val##L
#define UINT32_C(val) val##UL
#define INT64_C(val) (PASTE( val, __STDINT_LONGLONG_SUFFIX))
#define UINT64_C(val)(PASTE( PASTE( val, U), __STDINT_LONGLONG_SUFFIX))
/* 7.18.4.2 Macros for greatest-width integer constants */
#define INTMAX_C(val) INT64_C(val)
#define UINTMAX_C(val) UINT64_C(val)
#endif /* !defined ( __cplusplus) || defined __STDC_CONSTANT_MACROS */
#endif

View File

@@ -0,0 +1,56 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_
#define CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_
/**
* @file
*/
// Implementation
#include <memory>
#include <type_traits>
#include <dds/core/types.hpp>
#include <dds/core/Exception.hpp>
template <typename T1, typename T2>
struct dds::core::is_base_of : public ::std::is_base_of<T1, T2> { };
template <typename T1, typename T2>
struct dds::core::is_same : public ::std::is_same<T1, T1> { };
template <typename T>
struct dds::core::smart_ptr_traits
{
typedef ::std::shared_ptr<T> ref_type;
typedef ::std::weak_ptr<T> weak_ref_type;
};
template <typename TO, typename FROM>
TO dds::core::polymorphic_cast(FROM& from)
{
typename TO::DELEGATE_REF_T dr =
::std::dynamic_pointer_cast< typename TO::DELEGATE_T>(from.delegate());
TO to(dr);
if(to == dds::core::null)
{
throw dds::core::InvalidDowncastError("Attempted invalid downcast.");
}
return to;
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_DETAIL_REF_TRAITS_HPP_ */

View File

@@ -0,0 +1,73 @@
#ifndef OMG_DDS_CORE_MACROS_HPP_
#define OMG_DDS_CORE_MACROS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/macros.hpp>
// == Static Assert =========================================================
#define OMG_DDS_STATIC_ASSERT OMG_DDS_STATIC_ASSERT_DETAIL
// ==========================================================================
// == Logging Macros ========================================================
#define OMG_DDS_LOG(kind, msg) OMG_DDS_LOG_DETAIL(kind, msg)
// ==========================================================================
// == State Width Constants =================================================
/* By default, there can be up to 32 unique statuses. However, a
* DDS implementation may extend this number if necessary.
*/
#define OMG_DDS_DEFAULT_STATE_BIT_COUNT OMG_DDS_DEFAULT_STATE_BIT_COUNT_DETAIL
#define OMG_DDS_DEFAULT_STATUS_COUNT OMG_DDS_DEFAULT_STATUS_COUNT_DETAIL
#ifndef OMG_DDS_STATE_BIT_COUNT
#define OMG_DDS_STATE_BIT_COUNT OMG_DDS_DEFAULT_STATE_BIT_COUNT
#endif // !defined(OMG_DDS_STATE_BIT_COUNT)
#ifndef OMG_DDS_STATUS_COUNT
#define OMG_DDS_STATUS_COUNT OMG_DDS_DEFAULT_STATUS_COUNT
#endif // !defined(OMG_DDS_STATUS_COUNT)
// ==========================================================================
// == DLL Export Macros =====================================================
#define OMG_DDS_API OMG_DDS_API_DETAIL
// ==========================================================================
#define TEMP_TYPE void*
#define OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(TYPE) \
public:\
virtual ~TYPE() = default;\
TYPE(const TYPE& tocopy) = default;\
TYPE(TYPE&& tomove) = default;\
virtual TYPE& operator=(const TYPE& tocopy) = default;\
virtual TYPE& operator=(TYPE&& tomove) { if (this != &tomove) *this = tomove; return *this;}
#define OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TYPE) \
public:\
virtual ~TYPE() {}\
TYPE(const TYPE& tocopy): dds::core::Reference<DELEGATE>(dynamic_cast<const dds::core::Reference<DELEGATE>& >(tocopy)) {}\
TYPE(TYPE&& tomove): dds::core::Reference<DELEGATE>(dynamic_cast<dds::core::Reference<DELEGATE>&& >(tomove)) {}\
virtual TYPE& operator=(const TYPE& tocopy) {this->dds::core::Reference<DELEGATE>::operator=(dynamic_cast<const dds::core::Reference<DELEGATE>& >(tocopy)); return *this;}\
virtual TYPE& operator=(TYPE&& tomove) { if (this != &tomove) this->dds::core::Reference<DELEGATE>::operator=(dynamic_cast<dds::core::Reference<DELEGATE>&& >(tomove)); return *this;}
#endif /* OMG_DDS_CORE_MACROS_HPP_*/

View File

@@ -0,0 +1,201 @@
#ifndef OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_
#define OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/policy/PolicyKind.hpp>
#include <dds/core/policy/detail/CorePolicy.hpp>
#include <dds/core/policy/detail/QosPolicyCount.hpp>
//==============================================================================
// MACROS
//
#define OMG_DDS_POLICY_TRAITS(POLICY, ID) \
template <> \
class OMG_DDS_API policy_id<POLICY> { \
public: \
static const dds::core::policy::QosPolicyId value = ID; \
}; \
template <> \
class OMG_DDS_API policy_name<POLICY> { \
public:\
static const std::string& name(); \
};
#define OMG_DDS_DEFINE_POLICY_TRAITS(POLICY, NAME) \
const std::string& dds::core::policy::policy_name<POLICY>::name() { \
static std::string name = #NAME; \
return name; \
}
namespace dds
{
namespace core
{
namespace policy
{
//==============================================================================
// Policy Trait Classes
template <typename Policy>
class policy_id { };
template <typename Policy>
class policy_name { };
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::detail::DataRepresentation
DataRepresentation;
#endif //OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::detail::Deadline
Deadline;
typedef dds::core::policy::detail::DestinationOrder
DestinationOrder;
typedef dds::core::policy::detail::Durability
Durability;
typedef dds::core::policy::detail::EntityFactory
EntityFactory;
typedef dds::core::policy::detail::GroupData
GroupData;
typedef dds::core::policy::detail::History
History;
typedef dds::core::policy::detail::LatencyBudget
LatencyBudget;
typedef dds::core::policy::detail::Lifespan
Lifespan;
typedef dds::core::policy::detail::Liveliness
Liveliness;
typedef dds::core::policy::detail::Ownership
Ownership;
#ifdef OMG_DDS_OWNERSHIP_SUPPORT
typedef dds::core::policy::detail::OwnershipStrength
OwnershipStrength;
#endif // OMG_DDS_OWNERSHIP_SUPPORT
typedef dds::core::policy::detail::Partition
Partition;
template <typename Policy>
class policy_id;
template <typename Policy>
class policy_name;
typedef dds::core::policy::detail::Presentation
Presentation;
typedef ::dds::core::policy::detail::QosPolicyCount QosPolicyCount;
typedef std::vector<QosPolicyCount> QosPolicyCountSeq;
typedef uint32_t QosPolicyId;
typedef dds::core::policy::detail::ReaderDataLifecycle
ReaderDataLifecycle;
typedef dds::core::policy::detail::Reliability
Reliability;
typedef dds::core::policy::detail::ResourceLimits
ResourceLimits;
typedef dds::core::policy::detail::TimeBasedFilter
TimeBasedFilter;
typedef dds::core::policy::detail::TopicData
TopicData;
typedef dds::core::policy::detail::TransportPriority
TransportPriority;
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::detail::TypeConsistencyEnforcement
TypeConsistencyEnforcement;
#endif //OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::detail::UserData
UserData;
typedef dds::core::policy::detail::WriterDataLifecycle
WriterDataLifecycle;
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
typedef ::dds::core::policy::detail::DurabilityService
DurabilityService;
#endif // OMG_DDS_PERSISTENCE_SUPPORT
OMG_DDS_POLICY_TRAITS(UserData, 1)
OMG_DDS_POLICY_TRAITS(Durability, 2)
OMG_DDS_POLICY_TRAITS(Presentation, 3)
OMG_DDS_POLICY_TRAITS(Deadline, 4)
OMG_DDS_POLICY_TRAITS(LatencyBudget, 5)
OMG_DDS_POLICY_TRAITS(Ownership, 6)
#ifdef OMG_DDS_OWNERSHIP_SUPPORT
OMG_DDS_POLICY_TRAITS(OwnershipStrength, 7)
#endif // OMG_DDS_OWNERSHIP_SUPPORT
OMG_DDS_POLICY_TRAITS(Liveliness, 8)
OMG_DDS_POLICY_TRAITS(TimeBasedFilter, 9)
OMG_DDS_POLICY_TRAITS(Partition, 10)
OMG_DDS_POLICY_TRAITS(Reliability, 11)
OMG_DDS_POLICY_TRAITS(DestinationOrder, 12)
OMG_DDS_POLICY_TRAITS(History, 13)
OMG_DDS_POLICY_TRAITS(ResourceLimits, 14)
OMG_DDS_POLICY_TRAITS(EntityFactory, 15)
OMG_DDS_POLICY_TRAITS(WriterDataLifecycle, 16)
OMG_DDS_POLICY_TRAITS(ReaderDataLifecycle, 17)
OMG_DDS_POLICY_TRAITS(TopicData, 18)
OMG_DDS_POLICY_TRAITS(GroupData, 19)
OMG_DDS_POLICY_TRAITS(TransportPriority, 20)
OMG_DDS_POLICY_TRAITS(Lifespan, 21)
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
OMG_DDS_POLICY_TRAITS(DurabilityService, 22)
#endif // OMG_DDS_PERSISTENCE_SUPPORT
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
OMG_DDS_POLICY_TRAITS(DataRepresentation, 23)
OMG_DDS_POLICY_TRAITS(TypeConsistencyEnforcement, 24)
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
}
}
}
#endif /* OMG_DDS_CORE_POLICY_CORE_POLICY_HPP_ */

View File

@@ -0,0 +1,260 @@
#ifndef OMG_DDS_CORE_POLICY_POLICYKIND_HPP_
#define OMG_DDS_CORE_POLICY_POLICYKIND_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/detail/conformance.hpp>
#include <dds/core/SafeEnumeration.hpp>
#include <vector>
#include <cstdint>
namespace dds
{
namespace core
{
namespace policy
{
#if defined (__SUNPRO_CC) && defined(SHARED)
# undef SHARED
#endif
struct OwnershipKind_def
{
enum Type
{
SHARED /**< The same instance can be written by
* multiple DataWriter objects. All updates will be made available to the
* DataReader objects. In other words it does not have a specific owner.
*/
#ifdef OMG_DDS_OWNERSHIP_SUPPORT
,
EXCLUSIVE /**< The instance will only be accepted from one
DataWriter which is the only one whose modifications will be visible to the
DataReader objects.
*/
#endif // OMG_DDS_OWNERSHIP_SUPPORT
};
};
typedef dds::core::safe_enum<OwnershipKind_def> OwnershipKind;
struct DataRepresentationId_def
{
enum Type: std::int16_t
{
XCDR1 = 0, /**< Old style CDR serialization, does NOT support extensible types.*/
XML = 1, /**< XML representation, not supported by writers at this moment.*/
XCDR2 = 2 /**< New style CDR serialization, DOES support extensible types.*/
};
};
typedef dds::core::safe_enum<DataRepresentationId_def> DataRepresentationId;
typedef std::vector<DataRepresentationId> DataRepresentationIdSeq;
struct DurabilityKind_def
{
enum Type
{
VOLATILE, /**< The samples are not available to late-joining
* DataReaders. In other words, only DataReaders, which were present at the
* time of the writing and have subscribed to this Topic, will receive the sample.
* When a DataReader subscribes afterwards (late-joining), it will only be able to
* read the next written sample. This setting is typically used for data, which is
* updated quickly.
*/
TRANSIENT_LOCAL /**< Currently behaves identically to the
* TRANSIENT_DURABILITY_QOS, except for its RxO properties. The desired
* behaviour of TRANSIENT_LOCAL_DURABILITY_QOS can be achieved from the
* TRANSIENT_DURABILITY_QOS with the default (TRUE) setting of the
* autodispose_unregistered_instances flag on the DataWriter and the
* service_cleanup_delay set to 0 on the durability service. This is because for
* TRANSIENT_LOCAL, the data should only remain available for late-joining
* readers during the lifetime of its source writer, so it is not required to survive after
* its source writer has been deleted. Since the deletion of a writer implicitly
* unregisters all its instances, an autodispose_unregistered_instances
* value of TRUE will also dispose the affected data from the durability store, and
* thus prevent it from remaining available to late joining readers.
*/
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
,
TRANSIENT, /**< Some samples are available to late-joining
* DataReaders (stored in memory). This means that the late-joining
* DataReaders are able to read these previously written samples. The
* DataReader does not necessarily have to exist at the time of writing. Not all
* samples are stored (depending on QosPolicy History and QosPolicy
* resource_limits). The storage does not depend on the DataWriter and will
* outlive the DataWriter. This may be used to implement reallocation of
* applications because the data is saved in the Data Distribution Service (not in the
* DataWriter). This setting is typically used for state related information of an
* application. In this case also the DurabilityServiceQosPolicy settings are
* relevant for the behaviour of the Data Distribution Service.
*/
PERSISTENT /**< The data is stored in permanent storage (e.g.
* hard disk). This means that the samples are also available after a system restart.
* The samples not only outlives the DataWriters, but even the Data Distribution
* Service and the system. This setting is typically used for attributes and settings for
* an application or the system. In this case also the
* DurabilityServiceQosPolicy settings are relevant for the behaviour of the
* Data Distribution Service.
*/
#endif // #ifdef OMG_DDS_PERSISTENCE_SUPPORT
};
};
typedef dds::core::safe_enum<DurabilityKind_def> DurabilityKind;
struct PresentationAccessScopeKind_def
{
enum Type
{
INSTANCE, /**< Presentation Access Scope is per instance. */
TOPIC /**< Presentation Access Scope is per topic. */
#ifdef OMG_DDS_OBJECT_MODEL_SUPPORT
,
GROUP /**< Presentation Access Scope is per group. */
#endif // OMG_DDS_OBJECT_MODEL_SUPPORT
};
};
typedef dds::core::safe_enum<PresentationAccessScopeKind_def> PresentationAccessScopeKind;
struct ReliabilityKind_def
{
enum Type
{
BEST_EFFORT, /**< The Data Distribution Service will only
* attempt to deliver the data; no arrival-checks are being performed and any lost
* data is not re-transmitted (non-reliable). Presumably new values for the samples
* are generated often enough by the application so that it is not necessary to resent
* or acknowledge any samples.
*/
RELIABLE /**< The Data Distribution Service will attempt to
* deliver all samples in the DataWriters history; arrival-checks are performed
* and data may get re-transmitted in case of lost data. In the steady-state (no
* modifications communicated via the DataWriter) the Data Distribution Service
* guarantees that all samples in the DataWriter history will eventually be
* delivered to the all DataReader objects. Outside the steady-state the
* HistoryQosPolicy and ResourceLimitsQosPolicy determine how
* samples become part of the history and whether samples can be discarded from it.
* In this case also the max_blocking_time must be set.
*/
};
};
typedef dds::core::safe_enum<ReliabilityKind_def> ReliabilityKind;
struct DestinationOrderKind_def
{
enum Type
{
BY_RECEPTION_TIMESTAMP, /**< The order is based on the timestamp, at the moment the sample was
* received by the DataReader.
*/
BY_SOURCE_TIMESTAMP /**< The order is based on the timestamp, which was set by the
* DataWriter. This means that the system needs some time synchronization.
*/
};
};
typedef dds::core::safe_enum<DestinationOrderKind_def> DestinationOrderKind;
struct HistoryKind_def
{
enum Type
{
KEEP_LAST, /**< The Data Distribution Service will only attempt to
* keep the latest values of the instance and discard the older ones. The attribute
* “depth” determines how many samples in history will be stored. In other words,
* only the most recent samples in history are stored. On the publishing side, the
* Data Distribution Service will only keep the most recent “depth” samples of each
* instance of data (identified by its key) managed by the DataWriter. On the
* subscribing side, the DataReader will only keep the most recent “depth”
* samples received for each instance (identified by its key) until the application
* “takes” them via the DataReader::take operation.
* KEEP_LAST_HISTORY_QOS - is the default kind. The default value of depth is
* 1, indicating that only the most recent value should be delivered. If a depth other
* than 1 is specified, it should be compatible with the settings of the
* ResourcelimitsQosPolicy max_samples_per_instance. For these two
* QosPolicy settings to be compatible, they must verify that depth <=
* max_samples_per_instance, otherwise a
* RETCODE_INCONSISTENT_POLICY is generated on relevant operations.
*/
KEEP_ALL /**< All samples are stored, provided, the resources are
* available. On the publishing side, the Data Distribution Service will attempt to
* keep all samples (representing each value written) of each instance of data
* (identified by its key) managed by the DataWriter until they can be delivered to
* all subscribers. On the subscribing side, the Data Distribution Service will
* attempt to keep all samples of each instance of data (identified by its key)
* managed by the DataReader. These samples are kept until the application
* “takes” them from the Data Distribution Service via the DataReader::take
* operation. The setting of depth has no effect. Its implied value is
* LENGTH_UNLIMITED. The resources that the Data Distribution Service can use to
* keep this history are limited by the settings of the ResourceLimitsQosPolicy.
* If the limit is reached, the behaviour of the Data Distribution Service will depend
* on the ReliabilityQosPolicy. If the ReliabilityQosPolicy is
* BEST_EFFORT_RELIABILITY_QOS, the old values are discarded. If
* ReliabilityQosPolicy is RELIABLE_RELIABILITY_QOS, the Data
* Distribution Service will block the DataWriter until it can deliver the necessary
* old values to all subscribers.
*/
};
};
typedef dds::core::safe_enum<HistoryKind_def> HistoryKind;
struct LivelinessKind_def
{
enum Type
{
AUTOMATIC, /**< The Data Distribution Service will take care of
* reporting the Liveliness automatically with a rate determined by the
* lease_duration.
*/
MANUAL_BY_PARTICIPANT, /**< The application must take care
* of reporting the liveliness before the lease_duration expires. If an Entity
* reports its liveliness, all Entities within the same DomainParticipant that
* have their liveliness kind set to MANUAL_BY_PARTICIPANT_LIVELINESS_QOS,
* can be considered alive by the Data Distribution Service. Liveliness can reported
* explicitly by calling the operation assert_liveliness on the
* DomainParticipant or implicitly by writing some data.
*/
MANUAL_BY_TOPIC /**< The application must take care of
* reporting the liveliness before the lease_duration expires. This can explicitly
* be done by calling the operation assert_liveliness on the DataWriter or
* implicitly by writing some data.
*/
};
};
typedef dds::core::safe_enum<LivelinessKind_def> LivelinessKind;
struct TypeConsistencyKind_def
{
enum Type
{
DISALLOW_TYPE_COERCION,
ALLOW_TYPE_COERCION
};
};
typedef dds::core::safe_enum<TypeConsistencyKind_def> TypeConsistencyKind;
}
}
}
#endif /* OMG_DDS_CORE_POLICY_POLICYKIND_HPP_ */

View File

@@ -0,0 +1,35 @@
#ifndef OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_
#define OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/policy/detail/QosPolicyCount.hpp>
namespace dds
{
namespace core
{
namespace policy
{
typedef dds::core::policy::detail::QosPolicyCount QosPolicyCount;
}
}
}
#endif /* !defined(OMG_DDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_) */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,94 @@
#ifndef OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_
#define OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Value.hpp>
namespace dds
{
namespace core
{
namespace policy
{
#if defined(__GNUC__) && (__GNUC__ >= 10)
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wanalyzer-null-dereference\"")
#endif
/**
* The QosPolicyCount object shows, for a QosPolicy, the total number of
* times that the concerned DataWriter discovered a DataReader for the
* same Topic and a requested DataReaderQos that is incompatible with
* the one offered by the DataWriter.
*/
template <typename D>
class TQosPolicyCount : public dds::core::Value<D>
{
public:
/**
* Creates a QosPolicyCount instance
*
* @param policy_id the policy_id
* @param count the count
*/
TQosPolicyCount(QosPolicyId policy_id, int32_t count);
/**
* Copies a QosPolicyCount instance
*
* @param other the QosPolicyCount instance to copy
*/
TQosPolicyCount(const TQosPolicyCount& other);
/**
* Copies a QosPolicyCount instance
*
* @param other the QosPolicyCount instance to copy
*
* @return a reference to the QosPolicyCount that was copied to
*/
TQosPolicyCount& operator=(const TQosPolicyCount& other) = default;
public:
/**
* Gets the policy_id
*
* @return the policy_id
*/
QosPolicyId policy_id() const;
/**
* Gets the count
*
* @return the count
*/
int32_t count() const;
};
}
}
}
#if defined(__GNUC__) && (__GNUC__ >= 10)
_Pragma("GCC diagnostic pop")
#endif
#endif // !defined(OMG_TDDS_CORE_POLICY_QOS_POLICY_COUNT_HPP_)

View File

@@ -0,0 +1,111 @@
#ifndef OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_
#define OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <org/eclipse/cyclonedds/core/policy/PolicyDelegate.hpp>
#include <dds/core/policy/detail/TCorePolicyImpl.hpp>
#include <org/eclipse/cyclonedds/core/policy/Policy.hpp>
namespace dds { namespace core { namespace policy { namespace detail {
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::TDataRepresentation<org::eclipse::cyclonedds::core::policy::DataRepresentationDelegate>
DataRepresentation;
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::TDeadline<org::eclipse::cyclonedds::core::policy::DeadlineDelegate>
Deadline;
typedef dds::core::policy::TDestinationOrder<org::eclipse::cyclonedds::core::policy::DestinationOrderDelegate>
DestinationOrder;
typedef dds::core::policy::TDurability<org::eclipse::cyclonedds::core::policy::DurabilityDelegate>
Durability;
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
typedef dds::core::policy::TDurabilityService<org::eclipse::cyclonedds::core::policy::DurabilityServiceDelegate>
DurabilityService;
#endif // OMG_DDS_PERSISTENCE_SUPPORT
typedef dds::core::policy::TEntityFactory<org::eclipse::cyclonedds::core::policy::EntityFactoryDelegate>
EntityFactory;
typedef dds::core::policy::TGroupData<org::eclipse::cyclonedds::core::policy::GroupDataDelegate>
GroupData;
typedef dds::core::policy::THistory<org::eclipse::cyclonedds::core::policy::HistoryDelegate>
History;
typedef dds::core::policy::TLatencyBudget<org::eclipse::cyclonedds::core::policy::LatencyBudgetDelegate>
LatencyBudget;
typedef dds::core::policy::TLifespan<org::eclipse::cyclonedds::core::policy::LifespanDelegate>
Lifespan;
typedef dds::core::policy::TLiveliness<org::eclipse::cyclonedds::core::policy::LivelinessDelegate>
Liveliness;
typedef dds::core::policy::TOwnership<org::eclipse::cyclonedds::core::policy::OwnershipDelegate>
Ownership;
#ifdef OMG_DDS_OWNERSHIP_SUPPORT
typedef dds::core::policy::TOwnershipStrength<org::eclipse::cyclonedds::core::policy::OwnershipStrengthDelegate>
OwnershipStrength;
#endif // OMG_DDS_OWNERSHIP_SUPPORT
typedef dds::core::policy::TPartition<org::eclipse::cyclonedds::core::policy::PartitionDelegate>
Partition;
typedef dds::core::policy::TPresentation<org::eclipse::cyclonedds::core::policy::PresentationDelegate>
Presentation;
typedef dds::core::policy::TReaderDataLifecycle<org::eclipse::cyclonedds::core::policy::ReaderDataLifecycleDelegate>
ReaderDataLifecycle;
typedef dds::core::policy::TReliability<org::eclipse::cyclonedds::core::policy::ReliabilityDelegate>
Reliability;
typedef dds::core::policy::TResourceLimits<org::eclipse::cyclonedds::core::policy::ResourceLimitsDelegate>
ResourceLimits;
typedef dds::core::policy::TTimeBasedFilter<org::eclipse::cyclonedds::core::policy::TimeBasedFilterDelegate>
TimeBasedFilter;
typedef dds::core::policy::TTopicData<org::eclipse::cyclonedds::core::policy::TopicDataDelegate>
TopicData;
typedef dds::core::policy::TTransportPriority<org::eclipse::cyclonedds::core::policy::TransportPriorityDelegate>
TransportPriority;
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::TTypeConsistencyEnforcement<org::eclipse::cyclonedds::core::policy::TypeConsistencyEnforcementDelegate>
TypeConsistencyEnforcement;
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
typedef dds::core::policy::TUserData<org::eclipse::cyclonedds::core::policy::UserDataDelegate>
UserData;
typedef dds::core::policy::TWriterDataLifecycle<org::eclipse::cyclonedds::core::policy::WriterDataLifecycleDelegate>
WriterDataLifecycle;
} } } } // namespace dds::core::policy::detail
#endif /* OMG_DDS_CORE_POLICY_DETAIL_CORE_POLICY_HPP_ */

View File

@@ -0,0 +1,29 @@
#ifndef OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_
#define OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/policy/detail/TQosPolicyCountImpl.hpp>
#include <org/eclipse/cyclonedds/core/policy/QosPolicyCountDelegate.hpp>
namespace dds { namespace core { namespace policy { namespace detail {
typedef dds::core::policy::TQosPolicyCount<org::eclipse::cyclonedds::core::policy::QosPolicyCountDelegate> QosPolicyCount;
} } } }
#endif /* !defined(OMG_DDS_CORE_POLICY_DETAIL_QOS_POLICY_COUNT_HPP_) */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,65 @@
/*
* Copyright(c) 2006 to 2021 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/policy/TQosPolicyCount.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace policy
{
template <typename D>
TQosPolicyCount<D>::TQosPolicyCount(QosPolicyId policy_id, int32_t count) : dds::core::Value<D>(policy_id, count) { }
#if defined(__GNUC__) && (__GNUC__ >= 10)
_Pragma("GCC diagnostic push")
_Pragma("GCC diagnostic ignored \"-Wanalyzer-null-dereference\"")
#endif
template <typename D>
TQosPolicyCount<D>::TQosPolicyCount(const TQosPolicyCount& other) : dds::core::Value<D>(other.policy_id(), other.count()) { }
#if defined(__GNUC__) && (__GNUC__ >= 10)
_Pragma("GCC diagnostic pop")
#endif
template <typename D> QosPolicyId TQosPolicyCount<D>::policy_id() const
{
return this->delegate().policy_id();
}
template <typename D>
int32_t TQosPolicyCount<D>::count() const
{
return this->delegate().count();
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_POLICY_TQOSPOLICYCOUNT_IMPL_HPP_ */

View File

@@ -0,0 +1,55 @@
#ifndef OMG_DDS_CORE_REF_TRAITS_H_
#define OMG_DDS_CORE_REF_TRAITS_H_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Inc.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
namespace dds
{
namespace core
{
/** @cond
* These traits must be provided by compliant implementations
* to enable safe polymorphic casts.
*/
template <typename T1, typename T2>
struct is_base_of;
template <typename T1, typename T2>
struct is_same;
template <typename T>
struct smart_ptr_traits;
template <typename TO, typename FROM>
TO polymorphic_cast(FROM& from);
/** @endcond */
}
} /* namespace dds / namespace core */
// This include should stay here as it provides implementations
// for the declaration immediately above.
#include <dds/core/detail/ref_traits.hpp>
#endif /* OMG_DDS_CORE_REF_TRAITS_H_ */

View File

@@ -0,0 +1,190 @@
#ifndef OMG_DDS_CORE_REFMACROS_HPP_
#define OMG_DDS_CORE_REFMACROS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/macros.hpp>
#include <dds/core/ref_traits.hpp>
////////////////////////////////////////////////////////////////////////////////
// Macros
////////////////////////////////////////////////////////////////////////////////
#define DECLARE_TYPE_TRAITS(TYPE) \
typedef TYPE TYPE##_T;\
typedef typename ::dds::core::smart_ptr_traits<TYPE>::ref_type TYPE##_REF_T;\
typedef typename ::dds::core::smart_ptr_traits<TYPE>::weak_ref_type TYPE##_WEAK_REF_T;
/*
* This macro defines all the functions that Reference Types have to implement.
*/
/*
*
*
*/
////////////////////////////////////////////////////////////////////////////////
// Defines all the types, functions and attributes required for a Reference type
// without default ctor.
//
#define OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE) \
public: \
typedef typename ::dds::core::smart_ptr_traits< DELEGATE >::ref_type DELEGATE_REF_T; \
typedef typename ::dds::core::smart_ptr_traits< DELEGATE >::weak_ref_type DELEGATE_WEAK_REF_T; \
\
private:\
const typename ::dds::core::Reference< DELEGATE >::DELEGATE_REF_T& impl() const \
{ return ::dds::core::Reference< DELEGATE >::impl_; }\
typename ::dds::core::Reference< DELEGATE >::DELEGATE_REF_T& impl() \
{ return ::dds::core::Reference< DELEGATE >::impl_; }\
\
public: \
typedef BASE< DELEGATE > BASE_T;\
\
public: \
TYPE(const dds::core::null_type&) : dds::core::Reference< DELEGATE >(static_cast<DELEGATE*>(NULL)) { } \
\
TYPE& operator=(const dds::core::null_type& rhs) {\
(void)rhs; \
*this = TYPE(dds::core::null); \
return *this; \
} \
\
public:\
TYPE(const DELEGATE_REF_T& ref) \
: dds::core::Reference< DELEGATE >(ref)\
{ }
#define OMG_DDS_IMPLICIT_REF_BASE(TYPE) \
public:\
template <typename H__> \
TYPE(const H__& h) \
{ \
if (h.is_nil()) { \
/* We got a null object and are not really able to do a typecheck here. */ \
/* So, just set a null object. */ \
*this = dds::core::null; \
} else { \
this->::dds::core::Reference< DELEGATE_T >::impl_ = ::std::dynamic_pointer_cast< DELEGATE_T >(h.delegate()); \
if (h.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); \
} \
} \
}\
\
template <typename T__> \
TYPE& \
operator=(const T__& rhs) { \
const TYPE &t = rhs; \
if (this != &t) { \
if (rhs.is_nil()) { \
/* We got a null object and are not really able to do a typecheck here. */ \
/* So, just set a null object. */ \
*this = dds::core::null; \
} else { \
TYPE other(rhs); \
/* Dont have to copy when the delegate impl is the same. */ \
if (other.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \
*this = other; \
} \
} \
} \
return *this; \
}
#define OMG_DDS_EXPLICIT_REF_BASE_DECL(TYPE, FROM) \
public:\
TYPE(const FROM& h); \
\
TYPE& \
operator=(const FROM& rhs);
#define OMG_DDS_EXPLICIT_REF_BASE(TYPE, FROM) \
public:\
/* We need to support both const and non-const conversion explicitly, because it could */ \
/* be that the class has a constructor that takes a single non-const template argument. */ \
/* That non-const templated constructor is a closer match than TYPE(const FROM& h); when */ \
/* creating the TYPE class from a non-const FROM object. */ \
TYPE(FROM& h) { this->explicit_conversion(const_cast<const FROM&>(h)); } \
TYPE(const FROM& h) { this->explicit_conversion(h); } \
private:\
void explicit_conversion(const FROM& h) \
{ \
if (h.is_nil()) { \
/* We got a null object and are not really able to do a typecheck here. */ \
/* So, just set a null object. */ \
*this = dds::core::null; \
} else { \
this->::dds::core::Reference<DELEGATE_T>::impl_ = ::std::dynamic_pointer_cast<DELEGATE_T>(h.delegate()); \
if (h.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \
throw dds::core::IllegalOperationError(std::string("Attempted invalid cast: ") + typeid(h).name() + " to " + typeid(*this).name()); \
} \
} \
}\
\
public:\
TYPE& \
operator=(const FROM& rhs) { \
const TYPE &t = rhs; \
if (this != &t) { \
if (rhs.is_nil()) { \
/* We got a null object and are not really able to do a typecheck here. */ \
/* So, just set a null object. */ \
*this = dds::core::null; \
} else { \
TYPE other(rhs); \
/* Dont have to copy when the delegate is the same. */ \
if (other.delegate() != this->::dds::core::Reference< DELEGATE_T >::impl_) { \
*this = other; \
} \
} \
} \
return *this; \
}
////////////////////////////////////////////////////////////////////////////////
// Declares a reference type equipped with a default ctor.
//
#define OMG_DDS_REF_TYPE_PROTECTED_DC(TYPE, BASE, DELEGATE) \
public: \
typedef DELEGATE DELEGATE_T; \
OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T) \
protected: \
TYPE() { }
#define OMG_DDS_REF_TYPE_PROTECTED_DC_T(TYPE, BASE, T_PARAM, DELEGATE) \
public: \
typedef DELEGATE<T_PARAM> DELEGATE_T; \
OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T) \
protected: \
TYPE() { }
#define OMG_DDS_REF_TYPE_NO_DC(TYPE, BASE, DELEGATE) \
public: \
typedef DELEGATE DELEGATE_T; \
OMG_DDS_REF_TYPE_BASE(TYPE, BASE, DELEGATE_T)
#define OMG_DDS_REF_TYPE_DELEGATE_C(TYPE, BASE, DELEGATE) \
OMG_DDS_REF_TYPE_PROTECTED_DC(TYPE, BASE, DELEGATE) \
public: \
TYPE(DELEGATE_T *impl) : dds::core::Reference< DELEGATE_T >(impl) { }
#endif /* OMG_DDS_CORE_REFMACROS_HPP_ */

View File

@@ -0,0 +1,376 @@
#ifndef OMG_DDS_CORE_STATUS_STATE_HPP_
#define OMG_DDS_CORE_STATUS_STATE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <bitset>
#include <dds/core/macros.hpp>
#include <dds/core/types.hpp>
namespace dds
{
namespace core
{
namespace status
{
/**
* @brief
* Class to contain the statistics about samples that have been rejected.
*
* @see for more information: @ref DCPS_Modules_Subscription_SampleInfo "SampleInfo"
*/
class OMG_DDS_API SampleRejectedState : public std::bitset<OMG_DDS_STATE_BIT_COUNT>
{
public:
/**
* Convenience typedef for std::bitset<OMG_DDS_STATE_BIT_COUNT>.
*/
typedef std::bitset<OMG_DDS_STATE_BIT_COUNT> MaskType;
public:
/**
* Construct an empty SampleRejectedState.
*/
SampleRejectedState();
/**
* Copy constructor.
*
* Construct an SampleRejectedState with existing SampleRejectedState.
*
* @param src the SampleRejectedState to copy from
*/
SampleRejectedState(const SampleRejectedState& src);
/**
* Construct a SampleRejectedState with existing MaskType.
*
* @param src the MaskType to copy from
*/
SampleRejectedState(const MaskType& src);
/**
* Copy assignment operator.
*
* Copies the data from src to the current instance.
*
* @param src the SampleRejectedState to copy from
*
* @return reference to the SampleRejectedState that was copied to
*/
SampleRejectedState& operator=(const SampleRejectedState&) = default;
public:
/**
* Get the NOT_REJECTED.
*
*<i>not_rejected</i>
* - No sample has been rejected yet.
*
* @return the not_rejected SampleRejectedState
*/
inline static SampleRejectedState not_rejected()
{
return SampleRejectedState(0u);
}
/**
* Get the REJECTED_BY_SAMPLES_LIMIT.
*
*<i>rejected_by_samples_limit</i>
* - The sample was rejected because it would
* exceed the maximum number of samples set by the ResourceLimits
* QosPolicy.
*
* @return the rejected_by_samples_limit SampleRejectedState
*/
inline static SampleRejectedState rejected_by_samples_limit()
{
return SampleRejectedState(0x0001 << 1u);
}
/**
* Get the REJECTED_BY_INSTANCES_LIMIT.
*
*<i>rejected_by_instances_limit</i>
* - The sample was rejected because it would
* exceed the maximum number of instances set by the
* ResourceLimits QosPolicy.
*
* @return the rejected_by_instances_limit SampleRejectedState
*/
inline static SampleRejectedState rejected_by_instances_limit()
{
return SampleRejectedState(0x0001 << 0u);
}
/**
* Get the REJECTED_BY_SAMPLES_PER_INSTANCE_LIMIT.
*
*<i>rejected_by_samples_per_instance_limit</i>
* - The sample was rejected
* because it would exceed the maximum number of samples per
* instance set by the ResourceLimits QosPolicy.
*
* @return the rejected_by_samples_per_instance_limit SampleRejectedState
*/
inline static SampleRejectedState rejected_by_samples_per_instance_limit()
{
return SampleRejectedState(0x0001 << 2u);
}
private:
SampleRejectedState(uint32_t s);
};
/**
* @brief
* StatusMask is a bitmap or bitset field.
*
* This bitset is used to:
* - determine which listener functions to call
* - set conditions in dds::core::cond::StatusCondition
* - indicate status changes when calling dds::core::Entity::status_changes
*
* @see for more information: @ref DCPS_Modules_Infrastructure_Status "Status concept"
*/
class OMG_DDS_API StatusMask : public std::bitset<OMG_DDS_STATUS_COUNT>
{
public:
/**
* Convenience typedef for std::bitset<OMG_DDS_STATE_BIT_COUNT>.
*/
typedef std::bitset<OMG_DDS_STATUS_COUNT> MaskType;
public:
/**
* Construct an StatusMask with no flags set.
*/
StatusMask();
/**
* Construct an StatusMask with an uint32_t bit mask.
*
* @param mask the bit array to initialize the bitset with
*/
explicit StatusMask(uint32_t mask);
/**
* Copy constructor.
*
* Construct an StatusMask with existing StatusMask.
*
* @param other the StatusMask to copy from
*/
StatusMask(const StatusMask& other);
/**
* Copy assignment operator.
*
* Copies the contents from one StatusMask to another.
*
* @param other the StatusMask to copy from
*
* @return reference to the StatusMask that was copied to
*/
StatusMask& operator=(const StatusMask& other) = default;
/** @cond */
~StatusMask();
/** @endcond */
public:
/**
* Shift (merge) given StatusMask bits into this StatusMask bitset.
*
* @return StatusMask this
*/
inline StatusMask& operator << (const dds::core::status::StatusMask& mask)
{
*this |= mask;
return *this;
}
inline StatusMask operator | (const dds::core::status::StatusMask& mask) const
{
auto res = StatusMask(*this);
res |= mask;
return res;
}
/**
* Get all StatusMasks
*
* @return StatusMask all
*/
inline static StatusMask all()
{
return StatusMask(0x80007fe7u);
}
/**
* Get no StatusMasks
*
* @return StatusMask none
*/
inline static StatusMask none()
{
return StatusMask(0u);
}
public:
/**
* Get the StatusMask associated with dds::core::status::InconsistentTopicStatus
*
* @return StatusMask inconsistent_topic
*/
inline static StatusMask inconsistent_topic()
{
return StatusMask(0x00000001 << 0u);
}
/**
* Get the StatusMask associated with dds::core::status::OfferedDeadlineMissedStatus
*
* @return StatusMask offered_deadline_missed
*/
inline static StatusMask offered_deadline_missed()
{
return StatusMask(0x00000001 << 1u);
}
/**
* Get the StatusMask associated with dds::core::status::RequestedDeadlineMissedStatus
*
* @return StatusMask requested_deadline_missed
*/
inline static StatusMask requested_deadline_missed()
{
return StatusMask(0x00000001 << 2u);
}
/**
* Get the StatusMask associated with dds::core::status::OfferedIncompatibleQosStatus
*
* @return StatusMask offered_incompatible_qos
*/
inline static StatusMask offered_incompatible_qos()
{
return StatusMask(0x00000001 << 5u);
}
/**
* Get the StatusMask associated with dds::core::status::RequestedIncompatibleQosStatus
*
* @return StatusMask requested_incompatible_qos
*/
inline static StatusMask requested_incompatible_qos()
{
return StatusMask(0x00000001 << 6u);
}
/**
* Get the StatusMask associated with dds::core::status::SampleLostStatus
*
* @return StatusMask sample_lost
*/
inline static StatusMask sample_lost()
{
return StatusMask(0x00000001 << 7u);
}
/**
* Get the StatusMask associated with dds::core::status::SampleRejectedStatus
*
* @return StatusMask sample_rejected
*/
inline static StatusMask sample_rejected()
{
return StatusMask(0x00000001 << 8u);
}
/**
* Get the StatusMask associated with dds::core::status::data_on_readers
*
* @return StatusMask data_on_readers
*/
inline static StatusMask data_on_readers()
{
return StatusMask(0x00000001 << 9u);
}
/**
* get the statusmask associated with dds::core::status::data_available
*
* @return statusmask data_available
*/
inline static StatusMask data_available()
{
return StatusMask(0x00000001 << 10u);
}
/**
* Get the StatusMask associated with dds::core::status::LivelinessLostStatus
*
* @return StatusMask liveliness_lost
*/
inline static StatusMask liveliness_lost()
{
return StatusMask(0x00000001 << 11u);
}
/**
* Get the StatusMask associated with dds::core::status::LivelinessChangedStatus
*
* @return StatusMask liveliness_changed
*/
inline static StatusMask liveliness_changed()
{
return StatusMask(0x00000001 << 12u);
}
/**
* Get the statusmask associated with dds::core::status::PublicationMatchedStatus
*
* @return StatusMask publication_matched
*/
inline static StatusMask publication_matched()
{
return StatusMask(0x00000001 << 13u);
}
/**
* Get the statusmask associated with dds::core::status::SubscriptionMatchedStatus
*
* @return StatusMask subscription_matched
*/
inline static StatusMask subscription_matched()
{
return StatusMask(0x00000001 << 14u);
}
};
}
}
} /* namespace dds / core / status*/
#endif /* OMG_DDS_CORE_STATUS_STATE_HPP_ */

View File

@@ -0,0 +1,87 @@
#ifndef OMG_DDS_CORE_STATUS_STATUS_HPP_
#define OMG_DDS_CORE_STATUS_STATUS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/status/detail/Status.hpp>
#include <dds/core/status/State.hpp>
namespace dds
{
namespace core
{
namespace status
{
class DataAvailableStatus
{
// empty
};
class DataOnReadersStatus
{
// empty
};
// This trait is used to get the state associated with each status
template <typename STATUS>
StatusMask get_status();
typedef ::dds::core::status::detail::InconsistentTopicStatus
InconsistentTopicStatus;
typedef ::dds::core::status::detail::LivelinessChangedStatus
LivelinessChangedStatus;
typedef ::dds::core::status::detail::LivelinessLostStatus
LivelinessLostStatus;
typedef ::dds::core::status::detail::OfferedDeadlineMissedStatus
OfferedDeadlineMissedStatus;
typedef ::dds::core::status::detail::OfferedIncompatibleQosStatus
OfferedIncompatibleQosStatus;
typedef ::dds::core::status::detail::PublicationMatchedStatus
PublicationMatchedStatus;
class SampleRejectedState;
typedef ::dds::core::status::detail::SampleRejectedStatus
SampleRejectedStatus;
typedef ::dds::core::status::detail::RequestedDeadlineMissedStatus
RequestedDeadlineMissedStatus;
typedef ::dds::core::status::detail::RequestedIncompatibleQosStatus
RequestedIncompatibleQosStatus;
typedef ::dds::core::status::detail::SampleLostStatus
SampleLostStatus;
class StatusMask;
typedef ::dds::core::status::detail::SubscriptionMatchedStatus
SubscriptionMatchedStatus;
}
}
}
#endif /* OMG_DDS_CORE_STATUS_STATUS_HPP_ */

View File

@@ -0,0 +1,442 @@
#ifndef OMG_TDDS_CORE_STATUS_STATUS_HPP_
#define OMG_TDDS_CORE_STATUS_STATUS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/Value.hpp>
#include <dds/core/InstanceHandle.hpp>
#include <dds/core/policy/CorePolicy.hpp>
#include <dds/core/policy/QosPolicyCount.hpp>
#include <dds/core/status/State.hpp>
namespace dds
{
namespace core
{
namespace status
{
/**
* \copydoc DCPS_Status_InconsistentTopic
*/
template <typename D>
class TInconsistentTopicStatus : public dds::core::Value<D>
{
public:
TInconsistentTopicStatus();
public:
/**
* @return Total cumulative count of all inconsistent topics detected.
*/
int32_t total_count() const;
/**
* @return The incremental number of inconsistent topics since the last time
* the listener was called or the status was read.
*/
int32_t total_count_change() const;
};
/**
* \copydoc DCPS_Status_SampleLost
*/
template <typename D>
class TSampleLostStatus : public dds::core::Value<D>
{
public:
TSampleLostStatus();
public:
/**
* @return Total cumulative count of all samples lost across of instances of data
* published under the Topic.
*/
int32_t total_count() const;
/**
* @return The incremental number of samples lost since the last time the listener
* was called or the status was read.
*/
int32_t total_count_change() const;
};
/**
* \copydoc DCPS_Status_SampleRejected
*/
template <typename D>
class TSampleRejectedStatus : public dds::core::Value<D>
{
public:
TSampleRejectedStatus();
public:
/**
* @return Total cumulative count of samples rejected by the DataReader.
*/
int32_t total_count() const;
/**
* @return The incremental number of samples rejected since the last time the
* listener was called or the status was read.
*/
int32_t total_count_change() const;
/**
* @return Reason for rejecting the last sample rejected. If no samples have been
* rejected, the reason is the special value NOT_REJECTED.
*/
const dds::core::status::SampleRejectedState last_reason() const;
/**
* @return Handle to the instance being updated by the last sample that was
* rejected.
*/
const dds::core::InstanceHandle last_instance_handle() const;
};
/**
* \copydoc DCPS_Status_LivelinessLost
*/
template <typename D>
class TLivelinessLostStatus : public dds::core::Value<D>
{
public:
TLivelinessLostStatus();
public:
/**
* @return Total cumulative number of times that a previously-alive DataWriter
* became 'not alive' due to a failure to actively signal its liveliness within
* its offered liveliness period. This count does not change when an
* already not alive DataWriter simply remains not alive for another
* liveliness period.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
};
/**
* \copydoc DCPS_Status_LivelinessChanged
*/
template <typename D>
class TLivelinessChangedStatus : public dds::core::Value<D>
{
public:
TLivelinessChangedStatus();
public:
/**
* @return The total number of currently active DataWriters that write the Topic
* read by the DataReader. This count increases when a newly-matched
* DataWriter asserts its liveliness for the first time or when a DataWriter
* previously considered to be not alive reasserts its liveliness. The count
* decreases when a DataWriter considered alive fails to assert its
* liveliness and becomes not alive, whether because it was deleted
* normally or for some other reason.
*/
int32_t alive_count() const;
/**
* @return The total count of currently DataWriters that write the Topic read by
* the DataReader that are no longer asserting their liveliness. This count
* increases when a DataWriter considered alive fails to assert its
* liveliness and becomes not alive for some reason other than the normal
* deletion of that DataWriter. It decreases when a previously not alive
* DataWriter either reasserts its liveliness or is deleted normally.
*/
int32_t not_alive_count() const;
/**
* @return The change in the alive_count since the last time the listener was
* called or the status was read.
*/
int32_t alive_count_change() const;
/**
* @return The change in the not_alive_count since the last time the listener was
* called or the status was read.
*/
int32_t not_alive_count_change() const;
/**
* @return Handle to the last DataWriter whose change in liveliness caused this
* status to change.
*/
const dds::core::InstanceHandle last_publication_handle() const;
};
/**
* \copydoc DCPS_Status_OfferedDeadlineMissed
*/
template <typename D>
class TOfferedDeadlineMissedStatus : public dds::core::Value<D>
{
public:
TOfferedDeadlineMissedStatus();
public:
/**
* @return Total cumulative number of offered deadline periods elapsed during
* which a DataWriter failed to provide data. Missed deadlines
* accumulate; that is, each deadline period the total_count will be
* incremented by one.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
/**
* @return Handle to the last instance in the DataWriter for which an offered
* deadline was missed.
*/
const dds::core::InstanceHandle last_instance_handle() const;
};
/**
* \copydoc DCPS_Status_RequestedDeadlineMissed
*/
template <typename D>
class TRequestedDeadlineMissedStatus : public dds::core::Value<D>
{
public:
TRequestedDeadlineMissedStatus();
public:
/**
* @return Total cumulative number of missed deadlines detected for any instance
* read by the DataReader. Missed deadlines accumulate; that is, each
* deadline period the total_count will be incremented by one for each
* instance for which data was not received.
*/
int32_t total_count() const;
/**
* @return The incremental number of deadlines detected since the last time the
* listener was called or the status was read.
*/
int32_t total_count_change() const;
/**
* @return Handle to the last instance in the DataReader for which a deadline was
* detected.
*/
const dds::core::InstanceHandle last_instance_handle() const;
};
/**
* \copydoc DCPS_Status_OfferedIncompatibleQoS
*/
template <typename D>
class TOfferedIncompatibleQosStatus : public dds::core::Value<D>
{
public:
TOfferedIncompatibleQosStatus();
public:
/**
* @return Total cumulative number of times the concerned DataWriter
* discovered a DataReader for the same Topic with a requested QoS that
* is incompatible with that offered by the DataWriter.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
/**
* @return The PolicyId of one of the policies that was found to be
* incompatible the last time an incompatibility was detected.
*/
dds::core::policy::QosPolicyId last_policy_id() const;
/**
* @return A list containing for each policy the total number of times that the
* concerned DataWriter discovered a DataReader for the same Topic
* with a requested QoS that is incompatible with that offered by the
* DataWriter.
*/
const dds::core::policy::QosPolicyCountSeq policies() const;
/**
* @return A list containing for each policy the total number of times that the
* concerned DataWriter discovered a DataReader for the same Topic
* with a requested QoS that is incompatible with that offered by the
* DataWriter.
*
* @param dst The destination QosPolicyCountSeq the policies will be returned to
*/
const dds::core::policy::QosPolicyCountSeq&
policies(dds::core::policy::QosPolicyCountSeq& dst) const;
};
/**
* \copydoc DCPS_Status_RequestedIncompatibleQoS
*/
template <typename D>
class TRequestedIncompatibleQosStatus : public dds::core::Value<D>
{
public:
TRequestedIncompatibleQosStatus();
public:
/**
* @return Total cumulative number of times the concerned DataReader
* discovered a DataWriter for the same Topic with an offered QoS that
* was incompatible with that requested by the DataReader.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
/**
* @return The QosPolicyId of one of the policies that was found to be
* incompatible the last time an incompatibility was detected.
*/
dds::core::policy::QosPolicyId last_policy_id() const;
/**
* @return A list containing for each policy the total number of times that the
* concerned DataReader discovered a DataWriter for the same Topic
* with an offered QoS that is incompatible with that requested by the
* DataReader.
*/
const dds::core::policy::QosPolicyCountSeq policies() const;
/**
* @return A list containing for each policy the total number of times that the
* concerned DataReader discovered a DataWriter for the same Topic
* with an offered QoS that is incompatible with that requested by the
* DataReader.
*
* @param dst The destination QosPolicyCountSeq the policies will be returned to
*/
const dds::core::policy::QosPolicyCountSeq&
policies(dds::core::policy::QosPolicyCountSeq& dst) const;
};
/**
* \copydoc DCPS_Status_PublicationMatched
*/
template <typename D>
class TPublicationMatchedStatus : public dds::core::Value<D>
{
public:
TPublicationMatchedStatus();
public:
/**
* @return Total cumulative count the concerned DataWriter discovered a
* "match" with a DataReader. That is, it found a DataReader for the
* same Topic with a requested QoS that is compatible with that offered
* by the DataWriter.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
/**
* @return The number of DataReaders currently matched to the concerned
* DataWriter.
*/
int32_t current_count() const;
/**
* @return The change in current_count since the last time the listener was called
* or the status was read.
*/
int32_t current_count_change() const;
/**
* @return Handle to the last DataReader that matched the DataWriter causing the
* status to change.
*/
const dds::core::InstanceHandle last_subscription_handle() const;
};
/**
* \copydoc DCPS_Status_SubscriptionMatched
*/
template <typename D>
class TSubscriptionMatchedStatus : public dds::core::Value<D>
{
public:
TSubscriptionMatchedStatus();
public:
/**
* @return Total cumulative count the concerned DataReader discovered a
* "match" with a DataWriter. That is, it found a DataWriter for the same
* Topic with a requested QoS that is compatible with that offered by the
* DataReader.
*/
int32_t total_count() const;
/**
* @return The change in total_count since the last time the listener was called or
* the status was read.
*/
int32_t total_count_change() const;
/**
* @return The number of DataWriters currently matched to the concerned
* DataReader.
*/
int32_t current_count() const;
/**
* @return The change in current_count since the last time the listener was called
* or the status was read.
*/
int32_t current_count_change() const;
/**
* @return Handle to the last DataWriter that matched the DataReader causing the
* status to change.
*/
const dds::core::InstanceHandle last_publication_handle() const;
};
}
}
}/* namespace dds::core::status */
#endif /* OMG_TDDS_CORE_STATUS_STATUS_HPP_ */

View File

@@ -0,0 +1,62 @@
#ifndef OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_
#define OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <dds/core/status/detail/TStatusImpl.hpp>
#include <org/eclipse/cyclonedds/core/status/StatusDelegate.hpp>
namespace dds { namespace core { namespace status { namespace detail {
typedef dds::core::status::TInconsistentTopicStatus< org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate >
InconsistentTopicStatus;
typedef dds::core::status::TLivelinessChangedStatus <org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate>
LivelinessChangedStatus;
typedef dds::core::status::TLivelinessLostStatus<org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate>
LivelinessLostStatus;
typedef dds::core::status::TOfferedDeadlineMissedStatus<org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate>
OfferedDeadlineMissedStatus;
typedef dds::core::status::TOfferedIncompatibleQosStatus<org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate>
OfferedIncompatibleQosStatus;
typedef dds::core::status::TPublicationMatchedStatus<org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate>
PublicationMatchedStatus;
typedef dds::core::status::TSampleRejectedStatus< org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate >
SampleRejectedStatus;
typedef dds::core::status::TRequestedDeadlineMissedStatus<org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate>
RequestedDeadlineMissedStatus;
typedef dds::core::status::TRequestedIncompatibleQosStatus<org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate>
RequestedIncompatibleQosStatus;
typedef dds::core::status::TSampleLostStatus<org::eclipse::cyclonedds::core::SampleLostStatusDelegate>
SampleLostStatus;
typedef dds::core::status::TSubscriptionMatchedStatus<org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate>
SubscriptionMatchedStatus;
} } } } // namespace dds::core::status::detail
#endif /* OMG_DDS_CORE_STATUS_DETAIL_STATUS_HPP_ */

View File

@@ -0,0 +1,337 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_
#define CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_
/**
* @file
*/
/*
* OMG PSM class declaration
*/
#include <dds/core/status/TStatus.hpp>
// Implementation
namespace dds
{
namespace core
{
namespace status
{
//TInconsistentTopicStatus
template <typename D>
TInconsistentTopicStatus<D>::TInconsistentTopicStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TInconsistentTopicStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TInconsistentTopicStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
//TSampleLostStatus
template <typename D>
TSampleLostStatus<D>::TSampleLostStatus() : dds::core::Value<D>() {}
template <typename D>
int32_t TSampleLostStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TSampleLostStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
//TSampleRejectedStatus
template <typename D>
TSampleRejectedStatus<D>::TSampleRejectedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TSampleRejectedStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TSampleRejectedStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
const dds::core::status::SampleRejectedState TSampleRejectedStatus<D>::last_reason() const
{
return this->delegate().last_reason();
}
template <typename D>
const dds::core::InstanceHandle TSampleRejectedStatus<D>::last_instance_handle() const
{
return this->delegate().last_instance_handle();
}
//TLivelinessLostStatus
template <typename D>
TLivelinessLostStatus<D>::TLivelinessLostStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TLivelinessLostStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TLivelinessLostStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
//TLivelinessChangedStatus
template <typename D>
TLivelinessChangedStatus<D>::TLivelinessChangedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TLivelinessChangedStatus<D>::alive_count() const
{
return this->delegate().alive_count();
}
template <typename D>
int32_t TLivelinessChangedStatus<D>::not_alive_count() const
{
return this->delegate().not_alive_count();
}
template <typename D>
int32_t TLivelinessChangedStatus<D>::alive_count_change() const
{
return this->delegate().alive_count_change();
}
template <typename D>
int32_t TLivelinessChangedStatus<D>::not_alive_count_change() const
{
return this->delegate().not_alive_count_change();
}
template <typename D>
const dds::core::InstanceHandle TLivelinessChangedStatus<D>::last_publication_handle() const
{
return this->delegate().last_publication_handle();
}
//TOfferedDeadlineMissedStatus
template <typename D>
TOfferedDeadlineMissedStatus<D>::TOfferedDeadlineMissedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TOfferedDeadlineMissedStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TOfferedDeadlineMissedStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
const dds::core::InstanceHandle TOfferedDeadlineMissedStatus<D>::last_instance_handle() const
{
return this->delegate().last_instance_handle();
}
//TRequestedDeadlineMissedStatus
template <typename D>
TRequestedDeadlineMissedStatus<D>::TRequestedDeadlineMissedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TRequestedDeadlineMissedStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TRequestedDeadlineMissedStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
const dds::core::InstanceHandle TRequestedDeadlineMissedStatus<D>::last_instance_handle() const
{
return this->delegate().last_instance_handle();
}
//TOfferedIncompatibleQosStatus
template <typename D>
TOfferedIncompatibleQosStatus<D>::TOfferedIncompatibleQosStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TOfferedIncompatibleQosStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TOfferedIncompatibleQosStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
dds::core::policy::QosPolicyId TOfferedIncompatibleQosStatus<D>::last_policy_id() const
{
return this->delegate().last_policy_id();
}
template <typename D>
const dds::core::policy::QosPolicyCountSeq TOfferedIncompatibleQosStatus<D>::policies() const
{
return this->delegate().policies();
}
template <typename D>
const dds::core::policy::QosPolicyCountSeq& TOfferedIncompatibleQosStatus<D>::policies(dds::core::policy::QosPolicyCountSeq& dst) const
{
return this->delegate().policies(dst);
}
//TRequestedIncompatibleQosStatus
template <typename D>
TRequestedIncompatibleQosStatus<D>::TRequestedIncompatibleQosStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TRequestedIncompatibleQosStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TRequestedIncompatibleQosStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
dds::core::policy::QosPolicyId TRequestedIncompatibleQosStatus<D>::last_policy_id() const
{
return this->delegate().last_policy_id();
}
template <typename D>
const dds::core::policy::QosPolicyCountSeq TRequestedIncompatibleQosStatus<D>::policies() const
{
return this->delegate().policies();
}
template <typename D>
const dds::core::policy::QosPolicyCountSeq& TRequestedIncompatibleQosStatus<D>::policies(dds::core::policy::QosPolicyCountSeq& dst) const
{
return this->delegate().policies(dst);
}
//TPublicationMatchedStatus
template <typename D>
TPublicationMatchedStatus<D>::TPublicationMatchedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TPublicationMatchedStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TPublicationMatchedStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
int32_t TPublicationMatchedStatus<D>::current_count() const
{
return this->delegate().current_count();
}
template <typename D>
int32_t TPublicationMatchedStatus<D>::current_count_change() const
{
return this->delegate().current_count_change();
}
template <typename D>
const dds::core::InstanceHandle TPublicationMatchedStatus<D>::last_subscription_handle() const
{
return this->delegate().last_subscription_handle();
}
//TSubscriptionMatchedStatus
template <typename D>
TSubscriptionMatchedStatus<D>::TSubscriptionMatchedStatus() : dds::core::Value<D>() { }
template <typename D>
int32_t TSubscriptionMatchedStatus<D>::total_count() const
{
return this->delegate().total_count();
}
template <typename D>
int32_t TSubscriptionMatchedStatus<D>::total_count_change() const
{
return this->delegate().total_count_change();
}
template <typename D>
int32_t TSubscriptionMatchedStatus<D>::current_count() const
{
return this->delegate().current_count();
}
template <typename D>
int32_t TSubscriptionMatchedStatus<D>::current_count_change() const
{
return this->delegate().current_count_change();
}
template <typename D>
const dds::core::InstanceHandle TSubscriptionMatchedStatus<D>::last_publication_handle() const
{
return this->delegate().last_publication_handle();
}
}
}
}
// End of implementation
#endif /* CYCLONEDDS_DDS_CORE_STATUS_TSTATUS_IMPL_HPP_ */

View File

@@ -0,0 +1,75 @@
#ifndef OMG_DDS_CORE_TYPES_HPP_
#define OMG_DDS_CORE_TYPES_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
// ISO C++ Includes
#include <string>
#include <vector>
// DDS Includes
#include <dds/core/detail/inttypes.hpp>
#include <dds/core/macros.hpp>
#include <dds/core/detail/conformance.hpp>
namespace dds
{
namespace core
{
/**
* Use a std::vector<uint8_t> to hold a sequence of bytes.
*/
typedef std::vector<uint8_t> ByteSeq;
/**
* Use a std::vector<std::string> to hold a sequence of bytes.
*/
typedef std::vector<std::string> StringSeq;
// DDS Null-Reference
/**
* @brief This class is used to create dds::core::null objects.
*/
class OMG_DDS_API null_type { };
/**
* This is the DDS Null-Reference.<br>
* A dds reference object that doesn't reference to anything can be compared with this object.
* @code{.cpp}
* dds::domain::DomainParticipant participant = dds::core::null;
* ...
* if (participant == dds::core::null) {
* // The participant is not yet properly created.
* // Using it now will trigger the dds::core::NullReferenceError exception.
* }
* @endcode
*/
extern const null_type OMG_DDS_API null;
/** @cond
* Duplicate in CorePolicy.hpp. Why?
*/
namespace policy
{
typedef uint32_t QosPolicyId;
}
/** @endcond */
}
}
#endif /* OMG_DDS_CORE_TYPES_HPP_ */

View File

@@ -0,0 +1,72 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_
#define OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_
#include <dds/core/xtypes/TAnnotation.hpp>
#include <dds/core/xtypes/detail/Annotation.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TAnnotation<detail::Annotation> Annotation;
typedef TIdAnnotation<detail::IdAnnotation> IdAnnotation;
typedef TKeyAnnotation<detail::KeyAnnotation> KeyAnnotation;
typedef TSharedAnnotation<detail::SharedAnnotation> SharedAnnotation;
typedef TNestedAnnotation<detail::NestedAnnotation> NestedAnnotation;
typedef TExtensibilityAnnotation<detail::ExtensibilityAnnotation> ExtensibilityAnnotation;
typedef TMustUnderstandAnnotation<detail::MustUnderstandAnnotation> MustUnderstandAnnotation;
typedef TVerbatimAnnotation<detail::VerbatimAnnotation> VerbatimAnnotation;
typedef TBitsetAnnotation<detail::BitsetAnnotation> BitsetAnnotation;
typedef TBitBoundAnnotation<detail::BitBoundAnnotation> BitBoundAnnotation;
namespace annotation
{
// These functions can be used to get cached instances,
// to avoid the proliferation of small annotation objects.
dds::core::xtypes::IdAnnotation Id(uint32_t);
dds::core::xtypes::KeyAnnotation Key();
dds::core::xtypes::SharedAnnotation Shared();
dds::core::xtypes::NestedAnnotation Nested();
dds::core::xtypes::ExtensibilityAnnotation Extensibility(dds::core::xtypes::ExtensibilityAnnotation::ExtensibilityKind kind);
dds::core::xtypes::ExtensibilityAnnotation Final();
dds::core::xtypes::ExtensibilityAnnotation Extensible();
dds::core::xtypes::ExtensibilityAnnotation Mutable();
dds::core::xtypes::MustUnderstandAnnotation MustUnderstand();
dds::core::xtypes::VerbatimAnnotation Verbatim(const std::string& text);
dds::core::xtypes::BitsetAnnotation Bitset();
dds::core::xtypes::BitsetAnnotation BitBound(uint32_t bound);
}
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_ANNOTATIONS_HPP_ */

View File

@@ -0,0 +1,42 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_
#define OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_
#include <dds/core/xtypes/TCollectionTypes.hpp>
#include <dds/core/xtypes/detail/CollectionTypes.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TCollectionType<detail::CollectionType> CollectionType;
typedef TMapType<detail::MapType> MapType;
typedef TSequenceType<detail::SequenceType> SequenceType;
template <typename CHAR_T, template <typename C> class DELEGATE = detail::StringType>
class TStringType;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_COLLECTION_TYPES_HPP_ */

View File

@@ -0,0 +1,39 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_
#define OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_
#include <dds/core/xtypes/DynamicData.hpp>
#include <dds/core/xtypes/detail/DynamicData.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TDynamicData<detail::DynamicData> DynamicData;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DYNAMICDATA_HPP_ */

View File

@@ -0,0 +1,38 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_
#define OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_
#include <dds/core/xtypes/TDynamicType.hpp>
#include <dds/core/xtypes/detail/DynamicType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE = detail::DynamicType>
class TDynamicType;
typedef TDynamicType<detail::DynamicType> DynamicType;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DYNAMIC_TYPE_HPP_ */

View File

@@ -0,0 +1,35 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP
#define OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP
#include <dds/core/xtypes/TMemberType.hpp>
#include <dds/core/xtypes/detail/MemberType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TMemberType<detail::MemberType> MemberType;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_MEMBER_TYPE_HPP */

View File

@@ -0,0 +1,71 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_
#define OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_
#include <dds/core/xtypes/DynamicType.hpp>
#include <dds/core/xtypes/TypeKind.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename T>
class TPrimitiveType;
template <typename T>
struct dynamic_type_traits
{
static const TypeKind TYPE_ID = TypeKind::NO_TYPE;
static const std::string NAME;
};
/**
* Primitive type constructor. This function can be used
* as follows:
*
* DynamicType int16Type = PrimitiveType<int16_t>();
*/
template <typename T>
TPrimitiveType<T> PrimitiveType();
}
}
}
template <typename T>
class dds::core::xtypes::TPrimitiveType : public dds::core::xtypes::DynamicType
{
public:
TPrimitiveType() : DynamicType(dynamic_type_traits<T>::TYPE_ID, dynamic_type_traits<T>::NAME) { }
};
template <typename T>
dds::core::xtypes::TPrimitiveType<T>
dds::core::xtypes::PrimitiveType()
{
static dds::core::xtypes::TPrimitiveType<T> t();
return t;
}
// This include should be at the end since it provides
// template specializations.
#include <dds/core/xtypes/detail/PrimitiveTypes.hpp>
#endif /* OMG_DDS_CORE_XTYPES_PRIMITIVE_TYPES_HPP_ */

View File

@@ -0,0 +1,37 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_
#define OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_
#include <dds/core/xtypes/TStructType.hpp>
#include <dds/core/xtypes/detail/StructType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TStructType<detail::StructType> StructType;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_STRUCT_TYPE_HPP_ */

View File

@@ -0,0 +1,177 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_
#define OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_
#include <dds/core/Reference.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
struct AnnotationKind_def
{
enum type
{
ID_ANNOTATION_TYPE,
OPTIONAL_ANNOTATION_TYPE,
KEY_ANNOTATION_TYPE,
SHARED_ANNOTATION_TYPE,
NESTED_ANNOTATION_TYPE,
EXTENSIBILITY_ANNOTATION_TYPE,
MUST_UNDERSTAND_ANNOTATION_TYPE,
VERBATIM_ANNOTATION_TYPE,
BITSET_ANNOTATION_TYPE
};
};
typedef dds::core::safe_enum<AnnotationKind_def> AnnotationKind;
struct ExtensibilityKind_def
{
enum type
{
FINAL,
EXTENSIBLE,
MUTABLE
};
};
typedef dds::core::safe_enum<ExtensibilityKind_def> ExtensibilityKind;
template <typename DELEGATE>
class TAnnotation;
template <typename DELEGATE>
class TIdAnnotation;
template <typename DELEGATE>
class TKeyAnnotation;
template <typename DELEGATE>
class TSharedAnnotation;
template <typename DELEGATE>
class TNestedAnnotation;
template <typename DELEGATE>
class TExtensibilityAnnotation;
template <typename DELEGATE>
class TMustUnderstandAnnotation;
template <typename DELEGATE>
class TVerbatimAnnotation;
template <typename DELEGATE>
class TBitsetAnnotation;
template <typename DELEGATE>
class TBitBoundAnnotation;
}
}
}
template <typename DELEGATE>
class dds::core::xtypes::TAnnotation : public dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE(TAnnotation, dds::core::Reference, DELEGATE)
public:
TAnnotation();
protected:
TAnnotation(const TypeKind& kind);
public:
TypeKind kind() const;
};
template <typename DELEGATE>
class dds::core::xtypes::TIdAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TIdAnnotation(uint32_t id);
public:
uint32_t id() const;
};
template <typename DELEGATE>
class dds::core::xtypes::TKeyAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TKeyAnnotation();
};
template <typename DELEGATE>
class dds::core::xtypes::TSharedAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TSharedAnnotation();
};
template <typename DELEGATE>
class dds::core::xtypes::TNestedAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TNestedAnnotation();
};
template <typename DELEGATE>
class dds::core::xtypes::TExtensibilityAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TExtensibilityAnnotation(ExtensibilityKind xkind);
public:
ExtensibilityKind extensibility_kind() const;
};
template <typename DELEGATE>
class dds::core::xtypes::TMustUnderstandAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TMustUnderstandAnnotation();
};
template <typename DELEGATE>
class dds::core::xtypes::TVerbatimAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TVerbatimAnnotation(const std::string& text);
public:
const std::string& verbatim_text() const;
};
template <typename DELEGATE>
class dds::core::xtypes::TBitsetAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TBitsetAnnotation();
};
template <typename DELEGATE>
class dds::core::xtypes::TBitBoundAnnotation : public dds::core::xtypes::TAnnotation<DELEGATE>
{
public:
TBitBoundAnnotation(uint32_t bound);
};
#endif /* OMG_DDS_CORE_XTYPES_TANNOTATIONS_HPP_ */

View File

@@ -0,0 +1,100 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_
#define OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_
#include <dds/core/xtypes/DynamicType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TCollectionType;
template <typename DELEGATE>
class TMapType;
template <typename DELEGATE>
class TSequenceType;
template <typename CHAR_T, template <typename C> class DELEGATE>
class TStringType;
}
}
}
template <typename DELEGATE>
class dds::core::xtypes::TCollectionType : public dds::core::xtypes::TDynamicType<DELEGATE>
{
public:
const uint32_t UNBOUNDED = 0xFFFFFFFF;
protected:
TCollectionType(const std::string& name, TypeKind kind);
public:
uint32_t bounds() const;
};
template <typename DELEGATE>
class dds::core::xtypes::TMapType : public dds::core::xtypes::TCollectionType<DELEGATE>
{
public:
/**
* Create an unbounded Map with the given key/value type.
*/
TMapType(const DyanmicType& key_type, const DynamicType& value_type);
/**
* Create an bounded Map with the given key/value type.
*/
TMapType(const DyanmicType& key_type, const DynamicType& value_type, uint32_t bounds);
public:
const DyanmicType& key_type();
const DynamicType& value_type();
};
template <typename DELEGATE>
class dds::core::xtypes::TSequenceType : public dds::core::xtypes::TCollectionType<DELEGATE>
{
public:
/**
* Create an unbounded sequence for the given type.
*/
TSequenceType(const DynamicType& type);
/**
* Create a bounded sequence for the given type.
*/
TSequenceType(const DynamicType& type, uint32_t bounds);
public:
const DyanmicType& key_type() const;
};
template <typename CHAR_T, template <typename C> class DELEGATE>
class dds::core::xtypes::TStringType : public dds::core::xtypes::TCollectionType<DELEGATE>
{
public:
TStringType(uint32_t bounds);
};
#endif /* OMG_DDS_CORE_XTYPES_T_COLLECTION_TYPES_HPP_ */

View File

@@ -0,0 +1,86 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_
#define OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_
#include <dds/core/Reference.hpp>
#include <dds/core/xtypes/DynamicType.hpp>
#include <dds/core/xtypes/MemberType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TDynamicData;
template <typename DDT, typename T>
void value(DDT& dd, uint32_t mid, const T& v);
template <typename DDT, typename T>
T value(const DDT& dd, const std::string& mid, const T& v);
template <typename DDT, typename T>
T value(const DDT& dd, uint32_t mid);
template <typename DDT, typename T>
T value(const DDT& dd, const std::string& mid);
}
}
}
/**
* This class is used to read/write data for DynamicTypes. It allows reading and
* writing of samples in a type-safe manner but without any compile-time knowledge
* of the type being read or written.
*/
template <typename DELEGATE>
class dds::core::xtypes::TDynamicData : dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE(TDynamicData, dds::core::Reference, DELEGATE)
public:
TDynamicData(const DynamicType& type);
public:
template <typename T>
void value(uint32_T mid, const T& v) const;
template <typename T>
T value(const std::string& mid, const T& v) const;
template <typename T>
T value(uint32_T mid) const;
template <typename T>
T value(const std::string& mid) const;
DynamicType type() const;
MemberType member_type(uint32_t id) const;
MemberType member_type(const std::string& name) const;
uint32_t member_id(const std::string& name) const;
};
#endif /* OMG_DDS_CORE_XTYPES_TDYNAMICDATA_HPP_ */

View File

@@ -0,0 +1,94 @@
#ifndef OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_
#define OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <string>
#include <vector>
#include <dds/core/conformance.hpp>
#include <dds/core/Reference.hpp>
#include <dds/core/xtypes/Annotations.hpp>
#if defined (OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT)
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TDynamicType;
template <typename T>
bool isPrimitiveType(const TDynamicType<T>& t);
template <typename T>
bool isConstructedType(const TDynamicType<T>& t);
template <typename T>
bool isCollectionType(const TDynamicType<T>& t);
template <typename T>
bool isAggregationType(const TDynamicType<T>& t);
}
}
}
/**
* Base class for all dynamic types.
*/
template <typename DELEGATE>
class dds::core::xtypes::TDynamicType : public dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE(TDynamicType, dds::core::Reference, DELEGATE)
protected:
TDynamicType(const std::string& name, TypeKind kind);
TDynamicType(const std::string& name, TypeKind kind, const Annotation& annotation);
TDynamicType(const std::string& name, TypeKind kind, const std::vector<Annotation>& annotations);
template <typename FWI>
TDynamicType(const std::string& name, TypeKind kind, const FWI& annotation_begin, const FWI& annotation_end);
TDynamicType(const DyamicType& other);
~TDynamicType();
public:
/**
* Get the type kind.
*/
TypeKind kind() const;
/**
* Get the type name.
*/
const std::string& name() const;
const std::vector<Annotation>& annotations() const;
public:
bool operator == (const DynamicType& that) const;
};
#endif // defined(OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT)
#endif // !defined(OMG_DDS_CORE_XTYPES_T_DYNAMIC_TYPE_HPP_)

View File

@@ -0,0 +1,98 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP
#define OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TMemberType;
template <typename T>
bool isOptional(const TMemberType<T>& m);
template <typename T>
bool isShared(const TMemberType<T>& m);
template <typename T>
bool isKey(const TMemberType<T>& m);
template <typename T>
bool isMustUnderstand(const TMemberType<T>& m);
template <typename T>
bool isBitset(const TMemberType<T>& m);
template <typename T>
bool hasBitbound(const TMemberType<T>& m);
template <typename T>
int32_t getBitbound(const TMemberType<T>& m);
template <typename T>
bool hasId(const TMemberType<T>& m);
template <typename T>
int32_t getId(const TMemberType<T>& m);
}
}
}
/**
* This class represents a dynamic type member.
*/
template <typename DELEGATE>
class dds::core::xtypes::TMemberType : public dds::core::Reference<DELEGATE>
{
public:
OMG_DDS_REF_TYPE(TMemberType, dds::core::Reference, DELEGATE)
public:
TMemberType(const std::string& name, const dds::core::xtypes::DynamicType& type);
TMemberType(const std::string& name,
const dds::core::xtypes::DynamicType& type,
const Annotation& annotation
);
template <typename AnnotationIter>
TMemberType(const std::string& name,
const dds::core::xtypes::DynamicType& type,
const AnnotationIter& begin,
const AnnotationIter& end);
TMemberType(const std::string& name,
const dds::core::xtypes::DynamicType& type,
const std::vector<Annotation>& annotations
);
public:
const std::string& name() const;
const dds::core::xtypes::DynamicType& type() const;
public:
TMemberType add_annotation(const Annotation& annotation);
TMemberType remove_annotation(const Annotation& annotation);
};
#endif /* OMG_DDS_CORE_XTYPES_TMEMBER_TYPE_HPP */

View File

@@ -0,0 +1,122 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_
#define OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_
#include <dds/core/xtypes/DynamicType.hpp>
#include <dds/core/xtypes/MemberType.hpp>
#include <dds/core/xtypes/PrimitiveTypes.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TStructType;
template <typename DELEGATE>
class TStructForwardDeclaration;
template <typename T>
bool isFinal(const TStructType<T>& s);
template <typename T>
bool isExtensible(const TStructType<T>& s);
template <typename T>
bool isMutable(const TStructType<T>& s);
template <typename T>
bool isNested(const TStructType<T>& s);
}
}
}
/**
* Declares a forward declaration for a struct type.
*/
template <typename DELEGATE>
class dds::core::xtypes::TStructForwardDeclaration : public dds::core::xtypes::DynamicType<DELEGATE>
{
public:
TStructForwardDeclaration(const std::string& name);
};
/**
* Create a dynamic structure type. If the members don't have Id associated
* explicitly, then their ID will be the same as the ordinal position on the
* members vector.
*/
template <typename DELEGATE>
class dds::core::xtypes::TStructType : public dds::core::xtypes::DynamicType<DELEGATE>
{
public:
TStructType(const std::string& name);
TStructType(
const std::string& name,
const TStructType& parent,
const std::vector<MemberType>& members);
template <typename MemberIter>
TStructType(
const std::string& name,
const TStructType& parent,
const MemberIter& begin,
const MemberIter& end);
TStructType(
const std::string& name,
const TStructType& parent,
const std::vector<MemberType>& members,
const Annotation& annotation);
TStructType(
const std::string& name,
const TStructType& parent,
const std::vector<MemberType>& members,
const std::vector<Annotation>& annotations);
template <typename AnnotationIter, typename MemberIter>
TStructType(
const std::string& name,
const TStructType& parent,
const MemberIter& begin,
const MemberIter& end,
const AnnotationIter& begin,
const AnnotationIter& end);
public:
TStructType parent() const;
const std::vector<MemberType>& members() const;
const MemberType& member(uint32_t id) const;
const MemberType& member(const std::string& name) const;
const std::vector<Annotation>& annotations() const;
TStructType add_member(const MemberType& member) const ;
TStructType remove_member(const MemberType& member) const;
TStructType add_annotation(const Annotation& annotation) const;
TStructType remove_annotation(const Annotation& annotation) const;
};
#endif /* OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ */

View File

@@ -0,0 +1,63 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_
#define OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_
#include <dds/core/xtypes/DynamicType.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TTypeProvider;
}
}
}
/**
* TypeProvider that allows creation of types from external representations.
*/
template <typename DELEGATE>
class dds::core::xtypes::TTypeProvider
{
public:
/**
* Load a type from the specified URI. If multiple types are defined
* only the first one is returned.
*/
static DynamicType load_type(const std::string& uri);
/**
* Load a type from the specified URI. If multiple types are defined
* only the first one is returned.
*/
static std::vector<DynamicType> load_types(const std::string& uri);
/**
* Load a named type from the specified URI.
*/
static DynamicType load_type(const std::string& uri, const std::string& name);
};
#endif /* OMG_DDS_CORE_XTYPES_T_TYPE_PROVIDER_HPP_ */

View File

@@ -0,0 +1,88 @@
#ifndef OMG_DDS_XTYPE_
#define OMG_DDS_TYPE_OBJECT_HPP_
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#include <bitset>
#include <dds/core/SafeEnumeration.hpp>
#include <dds/core/detail/conformance.hpp>
#if defined(OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT)
// --- Shared meta-data: -------------------------------------------------
namespace dds
{
namespace core
{
namespace xtypes
{
struct TypeKind_def
{
enum type
{
NO_TYPE = 0, // sentinel indicating "null" value
PRIMITIVE_TYPE = 0x4000,
CONSTRUCTED_TYPE = 0x8000,
COLLECTION_TYPE = 0x0200,
AGGREGATION_TYPE = 0x0100,
ANNOTATION_TYPE = 0x0080,
BOOLEAN_TYPE = PRIMITIVE_TYPE | 0x0001,
UINT_8_TYPE = PRIMITIVE_TYPE | 0x0002,
INT_16_TYPE = PRIMITIVE_TYPE | 0x0003,
UINT_16_TYPE = PRIMITIVE_TYPE | 0x0004,
INT_32_TYPE = PRIMITIVE_TYPE | 0x0005,
UINT_32_TYPE = PRIMITIVE_TYPE | 0x0006,
INT_64_TYPE = PRIMITIVE_TYPE | 0x0007,
UINT_64_TYPE = PRIMITIVE_TYPE | 0x0008,
FLOAT_32_TYPE = PRIMITIVE_TYPE | 0x0009,
FLOAT_64_TYPE = PRIMITIVE_TYPE | 0x000A,
FLOAT_128_TYPE = PRIMITIVE_TYPE | 0x000B,
CHAR_8_TYPE = PRIMITIVE_TYPE | 0x000C,
CHAR_32_TYPE = PRIMITIVE_TYPE | 0x000D,
ENUMERATION_TYPE = CONSTRUCTED_TYPE | 0x0001,
BITSET_TYPE = CONSTRUCTED_TYPE | 0x0002,
ALIAS_TYPE = CONSTRUCTED_TYPE | 0x0003,
ARRAY_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0004,
SEQUENCE_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0005,
STRING_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0006,
MAP_TYPE = CONSTRUCTED_TYPE | COLLECTION_TYPE | 0x0007,
UNION_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x0008,
STRUCTURE_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x0009,
UNION_FWD_DECL_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x000A,
STRUCTURE_FWD_DECL_TYPE = CONSTRUCTED_TYPE | AGGREGATION_TYPE | 0x000B
};
};
typedef dds::core::safe_enum<TypeKind_def> TypeKind;
}
}
}
#endif // OMG_DDS_X_TYPES_DYNANIC_TYPE_SUPPORT
#endif // !defined(OMG_DDS_TYPE_OBJECT_HPP_)

View File

@@ -0,0 +1,35 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_
#define OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_
#include <dds/core/xtypes/TTypeProvider.hpp>
#include <dds/core/xtypes/detail/TypeProvider.hpp>
namespace dds
{
namespace core
{
namespace xtypes
{
typedef TTypeProvider<detail::TypeProvider> TypeProvider;
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_TYPE_PROVIDER_HPP_ */

View File

@@ -0,0 +1,59 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/*
* TUnionCase.hpp
*
* Created on: Oct 24, 2012
* Author: angelo
*/
#ifndef OMG_DDS_CORE_XTYPES_UNION_CASE_HPP_
#define OMG_DDS_CORE_XTYPES_UNION_CASE_HPP_
#include <dds/core/Reference.hpp>
#include <dds/core/xtypes/MemberType.hpp>
#include <dds/core/xtypes/detail/UnionCase.hpp>
/** @cond */
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename T, template <typename Q> class DELEGATE = detail::UnionCase>
class UnionCase;
}
}
}
/** @endcond */
template <typename T, template <typename Q> class DELEGATE>
class dds::core::xtypes::UnionCase : public dds::core::Reference< DELEGATE<T> >
{
public:
// Nil case
UnionCase();
public:
UnionCase(T discriminator, const MemberType& member);
public:
T discriminator();
const MemberType& member();
};
#endif /* OMG_DDS_CORE_XTYPES_T_UNION_CASE_HPP_ */

View File

@@ -0,0 +1,90 @@
/* Copyright 2010, Object Management Group, Inc.
* Copyright 2010, PrismTech, Corp.
* Copyright 2010, Real-Time Innovations, Inc.
* All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_
#define OMG_DDS_CORE_XTYPES_T_UNION_TYPE_HPP_
#include <dds/core/xtypes/DynamicType.hpp>
#include <dds/core/xtypes/UnionCase.hpp>
#include <dds/core/xtypes/PrimitiveTypes.hpp>
#include <dds/core/xtypes/detail/UnionType.hpp>
#include <vector>
namespace dds
{
namespace core
{
namespace xtypes
{
template <typename DELEGATE>
class TUnionForwardDeclaration;
template <typename T, template <typename Q> class DELEGATE = detail::UnionType >
class UnionType;
}
}
}
/**
* Declares a forward declaration for a union type.
*/
template <typename DELEGATE>
class dds::core::xtypes::TUnionForwardDeclaration : public dds::core::xtypes::DynamicType<DELEGATE>
{
public:
TUnionForwardDeclaration(const std::string& name);
};
template <typename T, typename DELEGATE>
class dds::core::xtypes::UnionType : public dds::core::xtypes::DynamicType<DELEGATE<T> >
{
public:
UnionType(
const std::string& name,
const TPrimitiveType<T>& discriminator_type,
const std::vector<UnionCase<T> >& cases);
UnionType(
const std::string& name,
const TPrimitiveType<T>& discriminator_type,
const std::vector<UnionCase<T> >& cases,
const Annotation& annotation);
UnionType(
const std::string& name,
const TPrimitiveType<T>& discriminator_type,
const std::vector<UnionCase<T> >& cases,
const std::vector<Annotation>& annotations);
public:
const std::vector<UnionCase<T> >& members() const;
const MemberType& member(uint32_t id) const;
const MemberType& member(const std::string& name) const;
const std::vector<Annotation>& annotations() const;
UnionType add_member(const UnionCase<T>& member) const;
UnionType remove_member(const UnionCase<T>& member) const;
UnionType add_annotation(const Annotation& annotation) const;
UnionType remove_annotation(const Annotation& annotation) const;
};
#endif /* OMG_DDS_CORE_XTYPES_T_STRUCT_TYPE_HPP_ */

View File

@@ -0,0 +1,42 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_
#define OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_
namespace dds {
namespace core {
namespace xtypes {
namespace detail {
class Annotation { };
class IdAnnotation : public Annotation { };
class KeyAnnotation : public Annotation { };
class SharedAnnotation : public Annotation { };
class NestedAnnotation : public Annotation { };
class ExtensibilityAnnotation : public Annotation { };
class MustUnderstandAnnotation : public Annotation { };
class VerbatimAnnotation : public Annotation { };
class BitsetAnnotation : public Annotation { };
class BitBoundAnnotation : public Annotation { };
}
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DETAIL_ANNOTATIONS_HPP_ */

View File

@@ -0,0 +1,34 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_
#define OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_
namespace dds {
namespace core {
namespace xtypes {
namespace detail {
class CollectionType { };
class MapType { };
class SequenceType { };
template <typename CHAR_T>
class StringType { };
}
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DETAIL_COLLECTION_TYPES_HPP_ */

View File

@@ -0,0 +1,26 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_
#define OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_
namespace dds {
namespace code {
namespace xtypes {
namespace detail {
class DynamicData;
}
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DETAIL_TDYNAMICDATA_HPP_ */

View File

@@ -0,0 +1,24 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_
#define OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_
namespace dds {
namespace core {
namespace xtypes {
namespace detail {
class DynamicType { };
}
}
}
}
#endif /* OMG_DDS_CORE_DETAIL_XTYPES_DYNAMIC_TYPE_HPP_ */

View File

@@ -0,0 +1,25 @@
/*
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License v. 2.0 which is available at
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
* v. 1.0 which is available at
* http://www.eclipse.org/org/documents/edl-v10.php.
*
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
*/
#ifndef OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP
#define OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP
namespace dds {
namespace core {
namespace xtypes {
namespace detail {
class MemberType;
}
}
}
}
#endif /* OMG_DDS_CORE_XTYPES_DETAIL_TMEMBER_TYPE_HPP */

Some files were not shown because too many files have changed in this diff Show More