Upload third-party source (skip LFS pointer assets) (part 7)
Browse filesThis view is limited to 50 files because it contains too many changes. See raw diff
Files changed (50)
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TContentFilteredTopic.hppAdded+160
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TFilter.hppAdded+186
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TMultiTopic.hppAdded+74
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopic.hppAdded+429
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopicDescription.hppAdded+85
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Topic.hppAdded+41
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicDescription.hppAdded+33
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicInstance.hppAdded+116
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicListener.hppAdded+144
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicTraits.hppAdded+92
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ddstopic.hppAdded+31
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/AnyTopic.hppAdded+30
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopic.hppAdded+46
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hppAdded+29
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hppAdded+470
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Filter.hppAdded+25
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/MultiTopic.hppAdded+135
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hppAdded+73
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hppAdded+580
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hppAdded+48
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hppAdded+77
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TFilterImpl.hppAdded+105
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hppAdded+54
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicImpl.hppAdded+395
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Topic.hppAdded+131
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicDescription.hppAdded+30
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hppAdded+83
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ddstopic.hppAdded+20
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/discovery.hppAdded+100
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/find.hppAdded+46
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/discovery.hppAdded+153
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/find.hppAdded+53
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/TopicQos.hppAdded+36
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/detail/TopicQos.hppAdded+93
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hppAdded+120
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hppAdded+74
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hppAdded+140
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hppAdded+95
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hppAdded+94
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hppAdded+71
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hppAdded+57
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hppAdded+90
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hppAdded+36
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hppAdded+51
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hppAdded+71
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hppAdded+80
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hppAdded+81
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hppAdded+191
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hppAdded+103
- third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hppAdded+91
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160#ifndef OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_#define OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_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 <vector>
#include <dds/core/detail/conformance.hpp>#include <dds/core/types.hpp>#include <dds/topic/Topic.hpp>#include <dds/topic/Filter.hpp>
#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
namespace dds{namespace topic{template <typename T, template <typename Q> class DELEGATE>class ContentFilteredTopic;}}
/** * @brief * ContentFilteredTopic is a specialization of TopicDescription that allows * for content-based subscriptions. * * ContentFilteredTopic describes a more sophisticated subscription which * indicates that the Subscriber does not necessarily want to see all values of each * instance published under the Topic. Rather, it only wants to see the values whose * contents satisfy certain criteria. Therefore this class must be used to request * content-based subscriptions. * * The selection of the content is done using the SQL based filter with parameters to * adapt the filter clause. * * <b><i>Example</i></b> * @code{.cpp} * // Default creation of a Topic * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); * dds::topic::Topic<Foo::Bar> topic(participant, "TopicName"); * * // Creation of a ContentFilteredTopic (assume Foo::Bar contains long_1 element). * std::vector<std::string> params; * params.push_back("1"); * dds::topic::Filter filter("long_1=%0", params); * dds::topic::ContentFilteredTopic<Foo::Bar> cfTopic(topic, * "ContentFilteredTopicName", * filter); * * // The ContentFilteredTopic can be used to create readers * dds::sub::Subscriber subscriber(participant); * dds::sub::DataReader<Foo::Bar> reader(subscriber, cfTopic); * @endcode * * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" */template <typename T, template <typename Q> class DELEGATE>class dds::topic::ContentFilteredTopic : public dds::topic::TTopicDescription< DELEGATE<T> >{public: OMG_DDS_REF_TYPE_PROTECTED_DC_T(ContentFilteredTopic, dds::topic::TTopicDescription, T, DELEGATE) OMG_DDS_IMPLICIT_REF_BASE(ContentFilteredTopic)
/** * Convenience typedef for the type of the data sample. */ typedef T DataType;
public: /** * Creates a ContentFilteredTopic be used as to perform content-based * subscriptions. * * The ContentFilteredTopic only relates to samples published under that * Topic, filtered according to their content. The filtering is done by * means of evaluating a logical expression that involves the values of * some of the data-fields in the sample. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @param topic the related Topic * @param name the name of the ContentFilteredTopic * @param filter the filter expression * @throw dds::core::Exception */ ContentFilteredTopic(const Topic<T>& topic, const std::string& name, const dds::topic::Filter& filter);
/** @cond */ virtual ~ContentFilteredTopic(); /** @endcond */
public: /** * Get the filter expression. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return the filter expression */ const std::string& filter_expression() const;
/** * Get the filter expression parameters. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return the filter parameters as a sequence */ const dds::core::StringSeq filter_parameters() const;
/** * Sets the query parameters. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @param begin Iterator pointing to the beginning of the parameters to set * @param end Iterator pointing to the end of the parameters to set * @throws dds::core::Error * An internal error has occurred. * @throws dds::core::NullReferenceError * The entity was not properly created and references to dds::core::null. */ template <typename FWDIterator> void filter_parameters(const FWDIterator& begin, const FWDIterator& end);
/** * Return the associated Topic. * * @return the Topic * @throws dds::core::Error * An internal error has occurred. * @throws dds::core::NullReferenceError * The entity was not properly created and references to dds::core::null. */ const dds::topic::Topic<T>& topic() const;};
#endif // OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186#ifndef DDS_TOPIC_TFILTER__HPP_#define DDS_TOPIC_TFILTER__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 topic{template <typename D>class TFilter;}}
/** * @brief * Filter objects contain SQL expressions that allow the application to specify * a filter on the locally available data. * * A Filter is used to create a ContentFilteredTopic. * * @anchor anchor_dds_topic_filter_expression * \par SQL Expression * The SQL query string is set by expression which must be a subset of the * SQL query language. In this query expression, parameters may be used, which must * be set in the sequence of strings defined by the parameter query_parameters. A * parameter is a string which can define an integer, float, string or enumeration. The * number of values in query_parameters must be equal or greater than the highest * referenced %n token in the query_expression (e.g. if %1 and %8 are used as * parameters in the query_expression, the query_parameters should at least * contain n+1 = 9 values).<br> * Look @ref DCPS_Queries_and_Filters "here" for the specific query expression syntax. * * @see dds::topic::ContentFilteredTopic * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" */template <typename D>class dds::topic::TFilter: public dds::core::Value<D>{public: /** * Iterator for the query expression parameters. */ typedef typename D::iterator iterator;
/** * Iterator for the query expression parameters. */ typedef typename D::const_iterator const_iterator;
public: /** * Create a Filter based on a query expression. * * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" * @throw dds::core::Exception */ TFilter(const std::string& query_expression);
/** * Create a Filter based on a query expression and an iterable parameter container. * * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" * @param params_begin Iterator pointing to the beginning of the parameters to set * @param params_end Iterator pointing to the end of the parameters to set * @throw dds::core::Exception */ template <typename FWIterator> TFilter(const std::string& query_expression, const FWIterator& params_begin, const FWIterator& params_end);
/** * Create a Filter based on a query expression and parameter vector. * * @param query_expression an @ref anchor_dds_topic_filter_expression "SQL expression" * @param params Vector containing SQL expression parameters * @throw dds::core::Exception */ TFilter(const std::string& query_expression, const std::vector<std::string>& params);
/** * Get the query expression. * * @return std::string The @ref anchor_dds_topic_filter_expression "SQL expression". * @throw dds::core::Exception */ const std::string& expression() const;
/** * Provides the begin iterator to the SQL expression parameter list. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return dds::topic::Filter::const_iterator * The begin iterator * @throw dds::core::Exception */ const_iterator begin() const;
/** * The end iterator to the SQL expression parameter list. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return dds::topic::Filter::const_iterator * The end iterator * @throw dds::core::Exception */ const_iterator end() const;
/** * Provides the begin iterator to the SQL expression parameter list. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return dds::topic::Filter::iterator * The begin iterator * @throw dds::core::Exception */ iterator begin();
/** * The end iterator to the SQL expression parameter list. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return dds::topic::Filter::iterator * The end iterator * @throw dds::core::Exception */ iterator end();
/** * Sets the query parameters. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @param begin Iterator pointing to the beginning of the parameters to set * @param end Iterator pointing to the end of the parameters to set * @throw dds::core::Exception */ template <typename FWIterator> void parameters(const FWIterator& begin, const FWIterator end);
/** * Adds a parameter to the query. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @param param The parameter to add * @throw dds::core::Exception */ void add_parameter(const std::string& param);
/** * Gets the number of parameters in the query of the filter. * * See @ref anchor_dds_topic_filter_expression "SQL expression info" * * @return uint32_t The number of parameters in the query * @throw dds::core::Exception */ uint32_t parameters_length() const;};
#endif /* DDS_TOPIC_TFILTER__HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374#ifndef OMG_DDS_T_TOPIC_MULTI_TOPIC_HPP_#define OMG_DDS_T_TOPIC_MULTI_TOPIC_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 <vector>
#include <dds/core/detail/conformance.hpp>#include <dds/core/types.hpp>#include <dds/topic/TopicDescription.hpp>
namespace dds{namespace topic{
#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT
/** * <b><i>This operation is not yet implemented. It is scheduled for a future release.</i></b> * * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" */template <typename T, template <typename Q> class DELEGATE>class MultiTopic : public TTopicDescription< DELEGATE<T> >{public: OMG_DDS_REF_TYPE_PROTECTED_DC_T(MultiTopic, dds::topic::TTopicDescription, T, DELEGATE) OMG_DDS_IMPLICIT_REF_BASE(MultiTopic)
public: template <typename FWDIterator> MultiTopic(const dds::domain::DomainParticipant& dp, const std::string& name, const std::string expression, const FWDIterator& params_begin, const FWDIterator& params_end);
virtual ~MultiTopic();
public: const std::string expression() const;
template <typename FWDIterator> void expression_parameters(const FWDIterator& params_begin, const FWDIterator& params_end);
dds::core::StringSeq void expression_parameters() const;
};
#endif // OMG_DDS_MULTI_TOPIC_SUPPORT
}}
#endif /* OMG_DDS_T_TOPIC_CONTENT_FILTERED_TOPIC_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429#ifndef OMG_DDS_TTOPIC_TOPIC_HPP_#define OMG_DDS_TTOPIC_TOPIC_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/conformance.hpp>#include <dds/core/types.hpp>#include <dds/core/ref_traits.hpp>#include <dds/domain/DomainParticipant.hpp>#include <dds/topic/qos/TopicQos.hpp>#include <dds/topic/TopicDescription.hpp>#include <dds/topic/AnyTopic.hpp>
namespace dds{namespace topic{template <typename T, template <typename Q> class DELEGATE>class Topic;
template <typename T>class TopicListener;}}
/** * @brief * Topic is the most basic description of the data to be published and * subscribed. * * A Topic is identified by its name, which must be unique in the whole Domain. * In addition (by virtue of extending TopicDescription) it fully specifies the * type of the data that can be communicated when publishing or subscribing to * the Topic. * * Topic is the only TopicDescription that can be used for publications and * therefore associated with a DataWriter. * * <b><i>Example</i></b> * @code{.cpp} * // Default creation of a Topic * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); * dds::topic::Topic<Foo::Bar> topic(participant, "TopicName"); * * // The Topic can be used to create readers and writers * // DataReader * dds::sub::Subscriber subscriber(participant); * dds::sub::DataReader<Foo::Bar> reader(subscriber, topic); * // DataWriter * dds::pub::Publisher publisher(participant); * dds::pub::DataWriter<Foo::Bar> writer(publisher, topic); * @endcode * * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" */template <typename T, template <typename Q> class DELEGATE>class dds::topic::Topic : public dds::topic::TAnyTopic< DELEGATE<T> >{public: /** * Convenience typedef for the type of the data sample. */ typedef T DataType;
/** * Local convenience typedef for dds::topic::TopicListener. */ typedef TopicListener<T> Listener;
public: OMG_DDS_REF_TYPE_PROTECTED_DC_T(Topic, ::dds::topic::TAnyTopic, T, DELEGATE) OMG_DDS_IMPLICIT_REF_BASE(Topic) OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_DEFAULT(Topic)
public:
/** * Create a new Topic. * * This operation creates a reference to a new or existing Topic under the given name, * for a specific data type. * * <i>QoS</i><br> * The Topic will be created with the QoS values specified on the last * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) * dp.default_topic_qos(qos) @endlink or, if the call was never made, the * @ref anchor_dds_topic_qos_defaults "default" values. * * <i>Existing Topic Name</i><br> * Before creating a new Topic, this operation performs a * lookup_topicdescription for the specified topic_name. When a Topic is * found with the same name in the current domain, the QoS and type_name of the * found Topic are matched against the parameters qos and type_name. When they * are the same, no Topic is created but a new proxy of the existing Topic is returned. * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. * * <i>Local Proxy</i><br> * Since a Topic is a global concept in the system, access is provided through a local * proxy. In other words, the reference returned is actually not a reference to a Topic * but to a locally created proxy. The Data Distribution Service propagates Topics * and makes remotely created Topics locally available through this proxy. The deletion * of a Topic object will not delete the Topic from the domain, just the local proxy is * deleted. * * @param dp the domain participant on which the topic will be defined * @param topic_name the name of the Topic to be created * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name);
/** * Create a new Topic. * * This operation creates a reference to a new or existing Topic under the given name, * for a specific data type and type_name. * * <i>QoS</i><br> * The Topic will be created with the QoS values specified on the last * successful call to @link dds::domain::DomainParticipant::default_topic_qos(const ::dds::topic::qos::TopicQos& qos) * dp.default_topic_qos(qos) @endlink or, if the call was never made, the * @ref anchor_dds_topic_qos_defaults "default" values. * * <i>Existing Topic Name</i><br> * Before creating a new Topic, this operation performs a * lookup_topicdescription for the specified topic_name. When a Topic is * found with the same name in the current domain, the QoS and type_name of the * found Topic are matched against the parameters qos and type_name. When they * are the same, no Topic is created but a new proxy of the existing Topic is returned. * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. * * <i>Local Proxy</i><br> * Since a Topic is a global concept in the system, access is provided through a local * proxy. In other words, the reference returned is actually not a reference to a Topic * but to a locally created proxy. The Data Distribution Service propagates Topics * and makes remotely created Topics locally available through this proxy. The deletion * of a Topic object will not delete the Topic from the domain, just the local proxy is * deleted. * * @param dp the domain participant on which the topic will be defined * @param topic_name the topic's name * @param type_name a local alias of the data type * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const std::string& type_name);
/** * Create a new Topic. * * This operation creates a reference to a new or existing Topic under the given name, * for a specific data type. * * <i>QoS</i><br> * A possible application pattern to construct the TopicQos for the * Topic is to: * @code{.cpp} * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); * // 2) Selectively modify QosPolicy settings as desired. * topicQos << dds::core::policy::Durability::Transient(); * // 3) Use the resulting QoS to construct the DataReader. * dds::topic::Topic<Foo::Bar> topic(participant, "TopicName", topicQos); * @endcode * * <i>Existing Topic Name</i><br> * Before creating a new Topic, this operation performs a * lookup_topicdescription for the specified topic_name. When a Topic is * found with the same name in the current domain, the QoS and type_name of the * found Topic are matched against the parameters qos and type_name. When they * are the same, no Topic is created but a new proxy of the existing Topic is returned. * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. * * <i>Local Proxy</i><br> * Since a Topic is a global concept in the system, access is provided through a local * proxy. In other words, the reference returned is actually not a reference to a Topic * but to a locally created proxy. The Data Distribution Service propagates Topics * and makes remotely created Topics locally available through this proxy. The deletion * of a Topic object will not delete the Topic from the domain, just the local proxy is * deleted. * * <i>Listener</i><br> * The following statuses are applicable to the TopicListener: * - dds::core::status::StatusMask::inconsistent_topic() * * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", * @ref anchor_dds_topic_listener_commstatus "communication status" and * @ref anchor_dds_topic_listener_commpropagation "communication propagation" * for more information. * * @param dp the domain participant on which the topic will be defined * @param topic_name the topic's name * @param qos the topic listener * @param listener the topic listener * @param mask the listener event mask * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener = NULL, const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());
/** * Create a new Topic. * * This operation creates a reference to a new or existing Topic under the given name, * for a specific data type and type_name. * * <i>QoS</i><br> * A possible application pattern to construct the TopicQos for the * Topic is to: * @code{.cpp} * // 1) Retrieve the QosPolicy settings on the associated DomainParticipant * dds::topic::qos::TopicQos topicQos = participant.default_datareader_qos(); * // 2) Selectively modify QosPolicy settings as desired. * topicQos << dds::core::policy::Durability::Transient(); * // 3) Use the resulting QoS to construct the DataReader. * dds::topic::Topic<Foo::Bar> topic(participant, "TopicName", "TypeName", topicQos); * @endcode * * <i>Existing Topic Name</i><br> * Before creating a new Topic, this operation performs a * lookup_topicdescription for the specified topic_name. When a Topic is * found with the same name in the current domain, the QoS and type_name of the * found Topic are matched against the parameters qos and type_name. When they * are the same, no Topic is created but a new proxy of the existing Topic is returned. * When they are not exactly the same, no Topic is created and dds::core::Error is thrown. * * <i>Local Proxy</i><br> * Since a Topic is a global concept in the system, access is provided through a local * proxy. In other words, the reference returned is actually not a reference to a Topic * but to a locally created proxy. The Data Distribution Service propagates Topics * and makes remotely created Topics locally available through this proxy. The deletion * of a Topic object will not delete the Topic from the domain, just the local proxy is * deleted. * * <i>Listener</i><br> * The following statuses are applicable to the TopicListener: * - dds::core::status::StatusMask::inconsistent_topic() * * See @ref DCPS_Modules_Infrastructure_Listener "listener concept", * @ref anchor_dds_topic_listener_commstatus "communication status" and * @ref anchor_dds_topic_listener_commpropagation "communication propagation" * for more information. * * @param dp the domain participant on which the topic will be defined * @param topic_name the topic's name * @param type_name a local alias of the data type * @param qos the topic listener * @param listener the topic listener * @param mask the listener event mask * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener = NULL, const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());
#if defined (OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT) /** * Create a new topic with a dynamic type description. Notice that in this * case the data type has to be DynamicData, so the Topic type will be * Topic<DynamicData>. * * @param dp the domain participant on which the topic will be defined * @param topic_name the topic's name. The QoS will be set to * dp.default_topic_qos(). * @param type the topic type * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const dds::core::xtypes::DynamicType type);
/** * Create a new topic with a dynamic type description. Notice that in this * case the data type has to be DynamicData, so the Topic type will be * Topic<DynamicData>. * * @param dp the domain participant on which the topic will be defined * @param topic_name the topic's name * @param type the topic type * @param qos the topic listener * @param listener the topic listener * @param mask the listener event mask * @throws dds::core::Error * A other Topic with the same name but different type or QoS was * detected in the current domain or another internal error has occurred. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const dds::core::xtypes::DynamicType type const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener = NULL, const dds::core::status::StatusMask& mask = dds::core::status::StatusMask::none());
#endif /* OMG_DDS_X_TYPE_DYNAMIC_TYPES_SUPPORT */
public: /** * Register a listener with the Topic. * * This operation attaches a TopicListener to the Topic. Only one * TopicListener can be attached to each Topic. If a * TopicListener was already attached, the operation will replace it with the * new one. When the listener is the NULL pointer, it represents a listener that is * treated as a NOOP for all statuses activated in the bit mask. * * Listener un-registration is performed by setting the listener to NULL and mask none(). * * @anchor anchor_dds_topic_listener_commstatus * <i>Communication Status</i><br> * For each communication status, the StatusChangedFlag flag is initially set to * FALSE. It becomes TRUE whenever that communication status changes. For each * communication status activated in the mask, the associated TopicListener * operation is invoked and the communication status is reset to FALSE, as the listener * implicitly accesses the status which is passed as a parameter to that operation. The * status is reset prior to calling the listener, so if the application calls the * get_<status_name>_status from inside the listener it will see the status * already reset. An exception to this rule is the NULL listener, which does not reset the * communication statuses for which it is invoked. * * The following statuses are applicable to the TopicListener: * - dds::core::status::StatusMask::inconsistent_topic() * * Status bits are declared as a constant and can be used by the application in an OR * operation to create a tailored mask. The special constant dds::core::status::StatusMask::none() * can be used to indicate that the created entity should not respond to any of its available * statuses. The DDS will therefore attempt to propagate these statuses to its factory. * The special constant dds::core::status::StatusMask::all() can be used to select all applicable * statuses specified in the “Data Distribution Service for Real-time Systems Version * 1.2” specification which are applicable to the PublisherListener. * * @anchor anchor_dds_topic_listener_commpropagation * <i>Status Propagation</i><br> * In case a communication status is not activated in the mask of the * TopicListener, the DomainParticipantListener of the containing DomainParticipant * is invoked (if attached and activated for the status that occurred). This allows the * application to set a default behaviour in the DomainParticipantListener of the containing * DomainParticipant and a Topic specific behaviour when needed. In case the * communication status is not activated in the mask of the DomainParticipantListener as * well, the application is not notified of the change. * * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". * * @param listener the listener * @param event_mask the mask defining the events for which the listener * will be notified. * @throws dds::core::Error * An internal error has occurred. * @throws dds::core::NullReferenceError * The entity was not properly created and references to dds::core::null. * @throws dds::core::AlreadyClosedError * The entity has already been closed. * @throws dds::core::UnsupportedError * A status was selected that cannot be supported because * the infrastructure does not maintain the required connectivity information. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. */ void listener(Listener* listener, const ::dds::core::status::StatusMask& event_mask);
/** * Get the listener of this Topic. * * See also @ref DCPS_Modules_Infrastructure_Listener "listener information". * * @return the listener * @throws dds::core::NullReferenceError * The entity was not properly created and references to dds::core::null. */ Listener* listener() const;
};
#endif /* OMG_DDS_TTOPIC_TOPIC_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485#ifndef OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_#define OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_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/TEntity.hpp>#include <dds/topic/TopicTraits.hpp>#include <dds/domain/DomainParticipant.hpp>
namespace dds{namespace topic{template <typename DELEGATE>class TTopicDescription;}}
/** * @brief * This class is the base for Topic, ContentFilteredTopic and MultiTopic. * * The TopicDescription attribute type_name defines an unique data type that is * made available to the Data Distribution Service when a Topic is created with * that type.<br> * TopicDescription has also a name that allows it to be retrieved locally. * * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" */template <typename DELEGATE>class dds::topic::TTopicDescription : public virtual dds::core::Reference<DELEGATE>{public: OMG_DDS_REF_TYPE_PROTECTED_DC(TTopicDescription, dds::core::Reference, DELEGATE) OMG_DDS_IMPLICIT_REF_BASE(TTopicDescription) OMG_DDS_COMPLETE_RULE_OF_FIVE_VIRTUAL_EXPLICIT(TTopicDescription)
public: /** * This operation returns the name used to create the TopicDescription. * * @return the TopicDescription name */ const std::string& name() const;
/** * This operation returns the registered name of the data type associated * with the TopicDescription. * * @return the type_name */ const std::string& type_name() const;
/** * This operation returns the DomainParticipant associated with the * TopicDescription. * * Note that there is exactly one DomainParticipant associated with * each TopicDescription. * * @return the DomainParticipant */ const dds::domain::DomainParticipant& domain_participant() const;
};
#endif /* OMG_DDS_T_TOPIC_TOPIC_DESCRIPTION_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041/* 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_TOPIC_TOPIC_HPP_#define OMG_DDS_TOPIC_TOPIC_HPP_
#include <dds/topic/detail/Topic.hpp>
namespace dds{namespace topic{template <typename T, template <typename Q> class DELEGATE = dds::topic::detail::Topic>class Topic;}}
/** * @todo RTF Issue - moved include * @note This include was moved here as MSVC appears to ignore any * attempt to 're-declare' a template class with a default argument like: * dds/pub/detail/DataWriter.hpp(54): error C2976: 'dds::topic::Topic' : too few template arguments * dds/topic/TTopic.hpp(50) : see declaration of 'dds::topic::Topic' */#include <dds/topic/TTopic.hpp>
#endif /* OMG_DDS_TOPIC_TOPIC_HPP_ */123456789101112131415161718192021222324252627282930313233#ifndef OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_#define OMG_DDS_TOPIC_TOPIC_DESCRIPTION_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/topic/detail/TopicDescription.hpp>
namespace dds{namespace topic{typedef ::dds::topic::detail::TopicDescription TopicDescription;}}
#endif /* OMG_DDS_TOPIC_TOPIC_DESCRIPTION_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116#ifndef OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_#define OMG_DDS_TOPIC_TOPIC_INSTANCE_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/Time.hpp>#include <dds/core/InstanceHandle.hpp>
namespace dds{namespace topic{template <typename T>class TopicInstance;}}
/** * @brief * A TopicInstance encapsulates a dds::sub::Sample and its associated * dds::core::InstanceHandle. * * @see for more information: @ref DCPS_Modules_TopicDefinition "Topic Definition" * @see for more information: @ref dds::sub::Sample * @see for more information: @ref dds::core::InstanceHandle */template <typename T>class dds::topic::TopicInstance{public: /** * Construct a TopicInstance. */ TopicInstance();
/** * Construct a TopicInstance with an InstanceHandle. * * @param h the InstanceHandle */ explicit TopicInstance(const ::dds::core::InstanceHandle& h);
/** * Construct a TopicInstance with an InstanceHandle and a sample type. * * @param h the InstanceHandle * @param sample the <Type> */ TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample);
public: /** * Conversion operator to get the InstanceHandle. * * @return the InstanceHandle for the TopicInstance */ operator const ::dds::core::InstanceHandle() const;
/** * Get the InstanceHandle. * * @return the InstanceHandle for the TopicInstance */ const ::dds::core::InstanceHandle handle() const;
/** * Set the InstanceHandle. * * @param h the InstanceHandle to set to the TopicInstance */ void handle(const ::dds::core::InstanceHandle& h);
/** * Get the data sample * * @return the sample for the TopicInstance */ const T& sample() const;
/** * Get the data sample * * @return the sample for the TopicInstance */ T& sample();
/** * Set the data sample * * @param sample send a sample for this TopicInstance */ void sample(const T& sample);
private: ::dds::core::InstanceHandle h_; T sample_;};
#endif /* OMG_DDS_TOPIC_TOPIC_INSTANCE_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144#ifndef OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_#define OMG_DDS_TOPIC_TOPIC_LISTENER_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/topic/Topic.hpp"
namespace dds{namespace topic{
/** * @brief * Topic events Listener * * Since a Topic is an Entity, it has the ability to have a Listener * associated with it. In this case, the associated Listener should be of type * TopicListener. This interface must be implemented by the * application. A user-defined class must be provided by the application which must * extend from the TopicListener class. * * <b><i> * All operations for this interface must be implemented in the user-defined class, it is * up to the application whether an operation is empty or contains some functionality. * </i></b> * * The TopicListener provides a generic mechanism (actually a * callback function) for the Data Distribution Service to notify the application of * relevant asynchronous status change events, such as a missed deadline, violation of * a QosPolicy setting, etc. The TopicListener is related to * changes in communication status StatusConditions. * * @code{.cpp} * // Application example listener * class ExampleListener : * public virtual dds::topic::TopicListener<Foo::Bar> * { * public: * virtual void on_inconsistent_topic ( * dds::topic::Topic<Foo::Bar>& topic, * const dds::core::status::InconsistentTopicStatus& status) * { * std::cout << "on_inconsistent_topic" << std::endl; * } * }; * * // Create Topic with the listener * dds::domain::DomainParticipant participant(org::eclipse::cyclonedds::domain::default_id()); * dds::topic::Topic<Foo::Bar> topic(participant, * "TopicName", * participant.default_topic_qos(), * new ExampleListener(), * dds::core::status::StatusMask::all()); * * @endcode * * @see for more information: @ref DCPS_Modules_Topic "Topic" * @see for more information: @ref DCPS_Modules_Infrastructure_Listener "Listener information" */template <typename T>class TopicListener{public: /** @cond */ virtual ~TopicListener() { } /** @endcond */
public: /** * This operation is called by the Data Distribution Service when the * InconsistentTopicStatus changes. * * The implementation may be left empty * when this functionality is not needed. This operation will only be called when the * relevant TopicListener is installed and enabled with the * StatusMask::inconsistent_topic(). The InconsistentTopicStatus will change * when another Topic exists with the same topic_name but different * characteristics. * * @param topic contain a pointer to the Topic on which the conflict * occurred (this is an input to the application). * @param status contain the InconsistentTopicStatus object (this is * an input to the application). */ virtual void on_inconsistent_topic( Topic<T>& topic, const dds::core::status::InconsistentTopicStatus& status) = 0;};
/** * @brief * Topic events Listener * * This listener is just like TopicListener, except * that the application doesn't have to implement all operations. * * @code{.cpp} * class ExampleListener : public virtual dds::topic::NoOpTopicListener<Foo::Bar> * { * // Not necessary to implement any Listener operations. * }; * @endcode * * @see dds::topic::TopicListener */template <typename T>class NoOpTopicListener : public virtual TopicListener<T>{/** @cond * All these functions have already been documented in the non-NoOp listener. * Ignore these functions for the doxygen API documentation for clarity. */public: virtual ~NoOpTopicListener() { }
public: virtual void on_inconsistent_topic( Topic<T>&, const dds::core::status::InconsistentTopicStatus&) { }/** @endcond */};
}}
#endif /* OMG_DDS_TOPIC_TOPIC_LISTENER_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192#ifndef OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_#define OMG_DDS_TOPIC_TOPIC_TRAITS_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>
//==============================================================================namespace dds{namespace topic{template <typename T>struct is_topic_type;
/** @cond */template <typename T>struct topic_type_support;/** @endcond */
/** * @brief * Support functionality to get the default type_name of a Topic type. * * @code{.cpp} * std::string typeName = dds::topic::topic_type_name<Foo::Bar>::value(); * @endcode */template <typename T>struct topic_type_name{ static std::string value() { return "Undefined"; }};
}}
//==============================================================================/** * @brief * Support functionality to check if a given object type is a Topic. * * @code{.cpp} * if (dds::topic::is_topic_type<Foo::Bar>::value) { * // Foo::Bar type is considered a Topic * } else { * // Foo::Bar type is NOT considered a Topic * } * @endcode */template <typename T>struct dds::topic::is_topic_type{ enum {value = 0 };};
/** @cond * IsoCpp doesn't know the TypeSupport concept. The type is automatically * registered when an Topic is created. So, what does this function do? */template <typename T>struct dds::topic::topic_type_support { };/** @endcond */
#define REGISTER_TOPIC_TYPE(TOPIC_TYPE) \ namespace dds { namespace topic { \ template<> struct is_topic_type<TOPIC_TYPE> { \ enum { value = 1 }; \ }; } }
#endif /* OMG_DDS_TOPIC_TOPIC_TRAITS_HPP_ */12345678910111213141516171819202122232425262728293031/* 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_TOPIC_PACKAGE_INCLUDE_HPP_#define OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_
#include <dds/topic/qos/TopicQos.hpp>#include <dds/topic/TopicDescription.hpp>#include <dds/topic/Topic.hpp>#include <dds/topic/AnyTopic.hpp>#include <dds/topic/ContentFilteredTopic.hpp>#include <dds/topic/discovery.hpp>#include <dds/topic/find.hpp>
#include <dds/topic/detail/ddstopic.hpp>
#endif /* OMG_DDS_TOPIC_PACKAGE_INCLUDE_HPP_ */123456789101112131415161718192021222324252627282930/* * 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_TOPIC_DETAIL_ANY_TOPIC_HPP_#define OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_
/** * @file */
// Implementation
#include <dds/topic/detail/TAnyTopicImpl.hpp>#include <org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp>
namespace dds { namespace topic { namespace detail { typedef dds::topic::TAnyTopic<org::eclipse::cyclonedds::topic::AnyTopicDelegate> AnyTopic;} } }
// End of implementation
#endif /* OMG_DDS_TOPIC_DETAIL_ANY_TOPIC_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_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/topic/Topic.hpp>#include <dds/topic/detail/TTopicImpl.hpp>#include <dds/topic/detail/TBuiltinTopicImpl.hpp>#include <org/eclipse/cyclonedds/topic/BuiltinTopicDelegate.hpp>#include <org/eclipse/cyclonedds/topic/BuiltinTopic.hpp>
namespace dds { namespace topic { namespace detail {
typedef dds::topic::TParticipantBuiltinTopicData<org::eclipse::cyclonedds::topic::ParticipantBuiltinTopicDataDelegate> ParticipantBuiltinTopicData;
typedef dds::topic::TTopicBuiltinTopicData<org::eclipse::cyclonedds::topic::TopicBuiltinTopicDataDelegate> TopicBuiltinTopicData;
typedef dds::topic::TPublicationBuiltinTopicData<org::eclipse::cyclonedds::topic::PublicationBuiltinTopicDataDelegate> PublicationBuiltinTopicData;
typedef dds::topic::TSubscriptionBuiltinTopicData<org::eclipse::cyclonedds::topic::SubscriptionBuiltinTopicDataDelegate> SubscriptionBuiltinTopicData;
} } }
#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_HPP_ */1234567891011121314151617181920212223242526272829#ifndef OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_#define OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_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/topic/BuiltinTopicKeyDelegate.hpp>#include <dds/topic/detail/TBuiltinTopicKeyImpl.hpp>
namespace dds { namespace topic { namespace detail { typedef dds::topic::TBuiltinTopicKey<org::eclipse::cyclonedds::topic::BuiltinTopicKeyDelegate> BuiltinTopicKey;} } }
#endif /* OMG_DDS_TOPIC_DETAIL_BUILTIN_TOPIC_KEY_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470#ifndef OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_#define OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_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 <string>#include <vector>
#include <dds/core/detail/conformance.hpp>#include <dds/core/types.hpp>#include <dds/topic/Topic.hpp>#include <dds/topic/Filter.hpp>#include <org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp>#include <org/eclipse/cyclonedds/core/ScopedLock.hpp>#include <org/eclipse/cyclonedds/sub/AnyDataReaderDelegate.hpp>
#ifdef OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT
// Required for C++11#if __cplusplus == 201103L#include <org/eclipse/cyclonedds/core/Missing.hpp>#endif
// meta-programming helpersnamespace detail{template<typename T>struct remove_first_from_tuple;
template<typename T, typename ... Ts>struct remove_first_from_tuple<std::tuple<T, Ts...>>{ using type = std::tuple<Ts...>;};
template<typename T>using remove_first_from_tuple_t = typename remove_first_from_tuple<T>::type;
template<class F>struct callable_traits;
template<class R, class ... Args>struct callable_traits<R(Args...)>{ using return_type = R;
static constexpr std::size_t Arity = sizeof...(Args);
template < std::size_t N, std::enable_if_t<N<Arity> * = nullptr> struct argument { using type = typename std::tuple_element<N, std::tuple<Args...>>::type; };
using argument_tuple = std::tuple<Args...>;};
// function pointertemplate<class R, class ... Args>struct callable_traits<R (*)(Args...)> : public callable_traits<R(Args...)> {};
// member function pointertemplate<class C, class R, class ... Args>struct callable_traits<R (C::*)(Args...)> : public callable_traits<R(C &, Args...)> {};
// const member function pointertemplate<class C, class R, class ... Args>struct callable_traits<R (C::*)(Args...) const> : public callable_traits<R(C &, Args...)> {};
// member object pointertemplate<class C, class R>struct callable_traits<R(C::*)> : public callable_traits<R(C &)> {};
// functortemplate<class F>struct callable_traits{private: using call_type = callable_traits<decltype(&F::operator())>;
public: using return_type = typename call_type::return_type;
static constexpr std::size_t Arity = call_type::Arity - 1;
template < std::size_t N, std::enable_if_t<N<Arity> * = nullptr> struct argument { using type = typename call_type::template argument<N + 1>::type; };
using argument_tuple = remove_first_from_tuple_t<typename call_type::argument_tuple>;};
template<class F>struct callable_traits<F &> : public callable_traits<F> {};
template<class F>struct callable_traits<F &&> : public callable_traits<F> {};
// Concepts of possible callbackstemplate<class F, class T>using sample_only_t = std::enable_if_t<callable_traits<std::decay_t<F>>::Arity == 1 && std::is_same<typename callable_traits<std::decay_t<F>>::template argument<0>::type, const T &>::value && std::is_same<typename callable_traits<std::decay_t<F>>::return_type, bool>::value>;
template<class F>using sample_info_only_t = std::enable_if_t<callable_traits<std::decay_t<F>>::Arity == 1 && std::is_same<typename callable_traits<std::decay_t<F>>::template argument<0>::type, const dds::sub::SampleInfo &>::value && std::is_same<typename callable_traits<std::decay_t<F>>::return_type, bool>::value>;
template<class F, class T>using sample_and_sample_info_t = std::enable_if_t<callable_traits<std::decay_t<F>>::Arity == 2 && std::is_same<typename callable_traits<std::decay_t<F>>::template argument<0>::type, const T &>::value && std::is_same<typename callable_traits<std::decay_t<F>>::template argument<1>::type, const dds::sub::SampleInfo &>::value && std::is_same<typename callable_traits<std::decay_t<F>>::return_type, bool>::value>;
} // namespace detail
namespace dds {namespace topic {namespace detail {
class FunctorHolderBase{public: FunctorHolderBase() = default; virtual ~FunctorHolderBase() = default; FunctorHolderBase(const FunctorHolderBase &) = default; FunctorHolderBase & operator=(const FunctorHolderBase &) = default; FunctorHolderBase(FunctorHolderBase &&) = default; FunctorHolderBase & operator=(FunctorHolderBase &&) = default;
virtual bool check_sample(const void * sample, const dds_sample_info_t * sample_info) = 0;
static bool c99_check_sample(const void *sample, void *arg) { auto funcHolder = static_cast<FunctorHolderBase *>(arg); return funcHolder->check_sample(sample, nullptr); }
static bool c99_check_sample_info(const dds_sample_info_t * sampleinfo, void * arg) { auto funcHolder = static_cast<FunctorHolderBase *>(arg); return funcHolder->check_sample(nullptr, sampleinfo); }
static bool c99_check_sample_and_sample_info( const void * sample, const dds_sample_info_t * sampleinfo, void * arg) { auto funcHolder = static_cast<FunctorHolderBase *>(arg); return funcHolder->check_sample(sample, sampleinfo); }};
template<typename FUN, typename T, class = void>class FunctorHolder;
template <typename FUN, typename T>class FunctorHolder<FUN, T, ::detail::sample_only_t<FUN, T>>: public FunctorHolderBase{public: /* Remove const to be able to call non-const functors. */ FunctorHolder(FUN functor) : myFunctor(std::move(functor)) {}
bool check_sample(const void * sample, const dds_sample_info_t *) override { return myFunctor(*(reinterpret_cast<const T*>(sample))); }
private: FUN myFunctor;};
template<typename FUN, typename T>class FunctorHolder<FUN, T, ::detail::sample_info_only_t<FUN>>: public FunctorHolderBase{public: /* Remove const to be able to call non-const functors. */ FunctorHolder(FUN functor) : myFunctor(std::move(functor)) {}
bool check_sample(const void *, const dds_sample_info_t * sampleinfo) override { dds::sub::SampleInfo cxxSampleInfo; org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos( *sampleinfo, cxxSampleInfo); return myFunctor(cxxSampleInfo); }
private: FUN myFunctor;};
template<typename FUN, typename T>class FunctorHolder<FUN, T, ::detail::sample_and_sample_info_t<FUN, T>>: public FunctorHolderBase{public: /* Remove const to be able to call non-const functors. */ FunctorHolder(FUN functor) : myFunctor(std::move(functor)) {}
bool check_sample(const void * sample, const dds_sample_info_t * sampleinfo) override { dds::sub::SampleInfo cxxSampleInfo; org::eclipse::cyclonedds::sub::AnyDataReaderDelegate::copy_sample_infos(*sampleinfo, cxxSampleInfo); return myFunctor(*(reinterpret_cast<const T*>(sample)), cxxSampleInfo); }
private: FUN myFunctor;};
template <typename T>class ContentFilteredTopic : public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate, public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate{public: ContentFilteredTopic( const dds::topic::Topic<T>& topic, const std::string& name, const dds::topic::Filter& filter) : org::eclipse::cyclonedds::core::DDScObjectDelegate(), org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(topic.domain_participant(), name, topic.type_name()), myTopic(topic), myFilter(filter), myFunctor(nullptr) { topic.delegate()->incrNrDependents(); this->myParticipant.delegate()->add_cfTopic(*this); this->ser_type_ = topic->get_ser_type(); }
virtual ~ContentFilteredTopic() { if (!this->closed) { try { this->close(); } catch (...) { /* Empty: the exception throw should have already traced an error. */ } } // delete the functor delete myFunctor; myFunctor = nullptr; }
virtual void close() { org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
myTopic.delegate()->decrNrDependents();
// Remove the ContentFilteredTopic from the list of topics in its participant. this->myParticipant.delegate()->remove_cfTopic(*this);
org::eclipse::cyclonedds::core::ObjectDelegate::close(); }
void init(org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref) { /* Set weak_ref before passing ourselves to other isocpp objects. */ this->set_weak_ref(weak_ref); /* Register topic at participant. */ this->myParticipant.delegate()->add_cfTopic(*this); }
private:#if 0 void validate_filter() { q_expr expr = NULL; uint32_t length; c_value *params;
length = myFilter.parameters_length(); if (length < 100) { expr = q_parse(myFilter.expression().c_str()); if (!expr ) { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "filter_expression '%s' is invalid", myFilter.expression().c_str()); } } else { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "Invalid number of filter_parameters '%d', maximum is 99", length); }
u_topic uTopic = (u_topic)(myTopic.delegate()->get_user_handle());
params = reader_parameters(); if (!u_topicContentFilterValidate2(uTopic, expr, params)) { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "filter_expression '%s' is invalid.", myFilter.expression().c_str()); } q_dispose(expr); os_free(params); }#endifpublic: std::string reader_expression() const { std::string rExpr;
rExpr += "select * from "; rExpr += myTopic.name(); rExpr += " where "; rExpr += myFilter.expression(); return rExpr; }#if 0 c_value *reader_parameters() const { c_value *params = NULL; uint32_t n, length; org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator;
length = myFilter.parameters_length(); params = (c_value *)os_malloc(length * sizeof(struct c_value)); for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { params[n] = c_stringValue(const_cast<char *>(paramIterator->c_str())); } return params; }#endif /** * @internal Accessor to return the topic filter. * @return The dds::topic::Filter in effect on this topic. */ const dds::topic::Filter& filter() const { return myFilter; }
/** * @internal Sets the filter parameters for this content filtered topic. * @param begin The iterator holding the first string param * @param end The last item in the string iteration */ template <typename FWIterator> void filter_parameters(const FWIterator& begin, const FWIterator& end) { ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Changing of Filter parameters is currently not supported."); myFilter.parameters(begin, end); //@todo validate_filter(); }
const dds::topic::Topic<T>& topic() const { return myTopic; }
const std::string& filter_expression() const { return myFilter.expression(); }
const dds::core::StringSeq filter_parameters() const { return dds::core::StringSeq(myFilter.begin(), myFilter.end()); }#if 0 dds::topic::TTopicDescription<TopicDescriptionDelegate> clone() { org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
typename dds::topic::ContentFilteredTopic<T, ContentFilteredTopic>::DELEGATE_REF_T ref( new ContentFilteredTopic<T>(this->myTopic, this->myTopicName, this->myFilter)); ref->init(ref);
return dds::topic::ContentFilteredTopic<T, ContentFilteredTopic>(ref); }#endif
template<class Functor, ::detail::sample_only_t<Functor, T> * = nullptr> void filter_function(Functor && func) { dds_topic_filter flt; flt.mode = DDS_TOPIC_FILTER_SAMPLE_ARG; flt.f.sample_arg = &FunctorHolderBase::c99_check_sample; filter_function_internal(std::forward<Functor>(func), &flt); }
template<class Functor, ::detail::sample_info_only_t<Functor> * = nullptr> void filter_function(Functor && func) { dds_topic_filter flt; flt.mode = DDS_TOPIC_FILTER_SAMPLEINFO_ARG; flt.f.sampleinfo_arg = &FunctorHolderBase::c99_check_sample_info; filter_function_internal(std::forward<Functor>(func), &flt); }
template<class Functor, ::detail::sample_and_sample_info_t<Functor, T> * = nullptr> void filter_function(Functor && func) { dds_topic_filter flt; flt.mode = DDS_TOPIC_FILTER_SAMPLE_SAMPLEINFO_ARG; flt.f.sample_sampleinfo_arg = &FunctorHolderBase::c99_check_sample_and_sample_info; filter_function_internal(std::forward<Functor>(func), &flt); }
private: template <typename Functor> void filter_function_internal(Functor && func, dds_topic_filter * flt) { /* Make a private copy of the topic so my filter doesn't bother the original topic. */ dds_qos_t* ddsc_qos = myTopic.qos()->ddsc_qos(); ddsi_sertype *st = org::eclipse::cyclonedds::topic::TopicTraits<T>::getSerType(); dds_entity_t cfTopic = dds_create_topic_sertype( myTopic.domain_participant().delegate()->get_ddsc_entity(), myTopic.name().c_str(), &st, ddsc_qos, NULL, NULL); dds_delete_qos(ddsc_qos); this->set_ddsc_entity(cfTopic);
org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); if (this->myFunctor) { delete this->myFunctor; } myFunctor = new FunctorHolder<Functor, T>(std::forward<Functor>(func)); flt->arg = myFunctor; dds_set_topic_filter_extended(cfTopic, flt); }
dds::topic::Topic<T> myTopic; dds::topic::Filter myFilter; FunctorHolderBase *myFunctor;};
}}}
#endif /* OMG_DDS_CONTENT_SUBSCRIPTION_SUPPORT */
#endif /* OMG_DDS_TOPIC_DETAIL_CONTENTFILTEREDTOPIC_HPP_ */12345678910111213141516171819202122232425/* * 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 DDS_TOPIC_DETAIL_QUERY_HPP_#define DDS_TOPIC_DETAIL_QUERY_HPP_
#include <dds/topic/detail/TFilterImpl.hpp>#include <org/eclipse/cyclonedds/topic/FilterDelegate.hpp>
namespace dds {namespace topic {namespace detail {typedef ::dds::topic::TFilter< ::org::eclipse::cyclonedds::topic::FilterDelegate > Filter;}}}#endif /* DDS_TOPIC_DETAIL_QUERY_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135#ifndef OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_#define OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_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 <string>#include <vector>
#include <dds/core/types.hpp>#include <dds/domain/DomainParticipant.hpp>#include <dds/topic/detail/TopicDescription.hpp>#include <dds/core/Query.hpp>
#ifdef OMG_DDS_MULTI_TOPIC_SUPPORT
namespace dds { namespace topic { namespace detail {
template <typename T>class MultiTopic : public org::eclipse::cyclonedds::topic::TopicDescriptionDelegate{public: MultiTopic( const dds::domain::DomainParticipant& dp, const std::string& name, const std::string expression, const FWDIterator& params_begin, const FWDIterator& params_end) : ::dds::core::Reference< DELEGATE<T> >( new dds::topic::detail::MultiTopic<T>(dp, name, expression, params_begin, params_end)) { // Set the correct (IDL) type_name in the TopicDescription. dds::topic::detail::TopicDescription<T>::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeName();
//@todo validate_filter(); }
virtual ~MultiTopic() { // Assume destructor of Filter attribute cleans up itself. }
private:#if 0 void validate_filter() { q_expr expr = NULL; uint32_t length; c_value *params;
length = myFilter.parameters_length(); if (length < 100) { expr = q_parse(myFilter.expression().c_str()); if (!expr ) { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "filter_expression '%s' is invalid", myFilter.expression().c_str()); } } else { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "Invalid number of filter_parameters '%d', maximum is 99", length); }
params = reader_parameters(); /* The function below does not exist yet, but probably a function like it will need to be developed. */ if (!u_topicMultiExprValidate(dp.delegate()->get_user_handle(), myFilter.expression().c_str(), params)) { ISOCPP_THROW_EXCEPTION(ISOCPP_INVALID_ARGUMENT_ERROR, "filter_expression '%s' is invalid.", myFilter.expression().c_str()); } q_dispose(expr); os_free(params); }#endifpublic: std::string reader_expression() const { return myFilter.expression(); }#if 0 c_value *reader_parameters() const { c_value *params = NULL; uint32_t n, length; org::eclipse::cyclonedds::topic::FilterDelegate::const_iterator paramIterator;
length = myFilter.parameters_length(); params = (c_value *)os_malloc(length * sizeof(struct c_value)); for (n = 0, paramIterator = myFilter.begin(); n < length; n++, paramIterator++) { params[n] = c_stringValue(const_cast<char *>(paramIterator->c_str())); } return params; }#endif const std::string expression() const { return myFilter.expression(); }
template <typename FWIterator> void expression_parameters(const FWIterator& params_begin, const FWIterator& params_end) { myFilter.parameters(begin, end); validate_filter(); }
const dds::core::StringSeq expression_parameters() const { return dds::core::StringSeq(myFilter.begin(), myFilter.end()); }
private: dds::topic::Filter myFilter;};
}}}#endif /* OMG_DDS_MULTI_TOPIC_SUPPORT */
#endif /* OMG_DDS_TOPIC_DETAIL_MULTI_TOPIC_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273/* * 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_TOPIC_TANYTOPIC_IMPL_HPP_#define CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TAnyTopic.hpp>
// Implementationnamespace dds{namespace topic{
template <typename DELEGATE>dds::topic::qos::TopicQosTAnyTopic<DELEGATE>::qos() const{ return this->delegate()->qos();}
template <typename DELEGATE>voidTAnyTopic<DELEGATE>::qos(const dds::topic::qos::TopicQos& qos){ this->delegate()->qos(qos);}
template <typename DELEGATE>TAnyTopic<DELEGATE>&TAnyTopic<DELEGATE>::operator << (const dds::topic::qos::TopicQos& qos){ this->delegate()->qos(qos); return *this;}
template <typename DELEGATE>const TAnyTopic<DELEGATE>&TAnyTopic<DELEGATE>::operator >> (dds::topic::qos::TopicQos& qos) const{ qos = this->delegate()->qos(); return *this;}
template <typename DELEGATE>dds::core::status::InconsistentTopicStatusTAnyTopic<DELEGATE>::inconsistent_topic_status() const{ return this->delegate()->inconsistent_topic_status();}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TANYTOPIC_IMPL_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580/* * 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_TOPIC_TBUILTINTOPIC_IMPL_HPP_#define CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TBuiltinTopic.hpp>
// Implementationnamespace dds{namespace topic{
//TParticipantBuiltinTopicDatatemplate <typename D>const dds::topic::BuiltinTopicKey& TParticipantBuiltinTopicData<D>::key() const{ return this->delegate().key();}
template <typename D>const ::dds::core::policy::UserData& TParticipantBuiltinTopicData<D>::user_data() const{ return this->delegate().user_data();}
//TTopicBuiltinTopicDatatemplate <typename D>const dds::topic::BuiltinTopicKey& TTopicBuiltinTopicData<D>::key() const{ return this->delegate().key();}
template <typename D>const std::string& TTopicBuiltinTopicData<D>::name() const{ return this->delegate().name();}
template <typename D>const std::string& TTopicBuiltinTopicData<D>::type_name() const{ return this->delegate().type_name();}
template <typename D>const ::dds::core::policy::Durability& TTopicBuiltinTopicData<D>::durability() const{ return this->delegate().durability();}
#ifdef OMG_DDS_PERSISTENCE_SUPPORTtemplate <typename D>const ::dds::core::policy::DurabilityService& TTopicBuiltinTopicData<D>::durability_service() const{ return this->delegate().durability_service();}
#endif // OMG_DDS_PERSISTENCE_SUPPORT
template <typename D>const ::dds::core::policy::Deadline& TTopicBuiltinTopicData<D>::deadline() const{ return this->delegate().deadline();}
template <typename D>const ::dds::core::policy::LatencyBudget& TTopicBuiltinTopicData<D>::latency_budget() const{ return this->delegate().latency_budget();}
template <typename D>const ::dds::core::policy::Liveliness& TTopicBuiltinTopicData<D>::liveliness() const{ return this->delegate().liveliness();}
template <typename D>const ::dds::core::policy::Reliability& TTopicBuiltinTopicData<D>::reliability() const{ return this->delegate().reliability();}
template <typename D>const ::dds::core::policy::TransportPriority& TTopicBuiltinTopicData<D>::transport_priority() const{ return this->delegate().transport_priority();}
template <typename D>const ::dds::core::policy::Lifespan& TTopicBuiltinTopicData<D>::lifespan() const{ return this->delegate().lifespan();}
template <typename D>const ::dds::core::policy::DestinationOrder& TTopicBuiltinTopicData<D>::destination_order() const{ return this->delegate().destination_order();}
template <typename D>const ::dds::core::policy::History& TTopicBuiltinTopicData<D>::history() const{ return this->delegate().history();}
template <typename D>const ::dds::core::policy::ResourceLimits& TTopicBuiltinTopicData<D>::resource_limits() const{ return this->delegate().resource_limits();}
template <typename D>const ::dds::core::policy::Ownership& TTopicBuiltinTopicData<D>::ownership() const{ return this->delegate().ownership();}
template <typename D>const ::dds::core::policy::TopicData& TTopicBuiltinTopicData<D>::topic_data() const{ return this->delegate().topic_data();}
//TPublicationBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData<D>::key() const{ return this->delegate().key();}
template <typename D>const dds::topic::BuiltinTopicKey& TPublicationBuiltinTopicData<D>::participant_key() const{ return this->delegate().key();}
template <typename D>const std::string& TPublicationBuiltinTopicData<D>::topic_name() const{ return this->delegate().topic_name();}
template <typename D>const std::string& TPublicationBuiltinTopicData<D>::type_name() const{ return this->delegate().type_name();}
template <typename D>const ::dds::core::policy::Durability& TPublicationBuiltinTopicData<D>::durability() const{ return this->delegate().durability();}
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
template <typename D>const ::dds::core::policy::DurabilityService& TPublicationBuiltinTopicData<D>::durability_service() const{ return this->delegate().durability_service();}#endif // OMG_DDS_PERSISTENCE_SUPPORT
template <typename D>const ::dds::core::policy::Deadline& TPublicationBuiltinTopicData<D>::deadline() const{ return this->delegate().deadline();}
template <typename D>const ::dds::core::policy::LatencyBudget& TPublicationBuiltinTopicData<D>::latency_budget() const{ return this->delegate().latency_budget();}
template <typename D>const ::dds::core::policy::Liveliness& TPublicationBuiltinTopicData<D>::liveliness() const{ return this->delegate().liveliness();}
template <typename D>const ::dds::core::policy::Reliability& TPublicationBuiltinTopicData<D>::reliability() const{ return this->delegate().reliability();}
template <typename D>const ::dds::core::policy::Lifespan& TPublicationBuiltinTopicData<D>::lifespan() const{ return this->delegate().lifespan();}
template <typename D>const ::dds::core::policy::UserData& TPublicationBuiltinTopicData<D>::user_data() const{ return this->delegate().user_data();}
template <typename D>const ::dds::core::policy::Ownership& TPublicationBuiltinTopicData<D>::ownership() const{ return this->delegate().ownership();}
#ifdef OMG_DDS_OWNERSHIP_SUPPORT
template <typename D>const ::dds::core::policy::OwnershipStrength& TPublicationBuiltinTopicData<D>::ownership_strength() const{ return this->delegate().ownership_strength();}#endif // OMG_DDS_OWNERSHIP_SUPPORT
template <typename D>const ::dds::core::policy::DestinationOrder& TPublicationBuiltinTopicData<D>::destination_order() const{ return this->delegate().destination_order();}
template <typename D>const ::dds::core::policy::Presentation& TPublicationBuiltinTopicData<D>::presentation() const{ return this->delegate().presentation();}
template <typename D>const ::dds::core::policy::Partition& TPublicationBuiltinTopicData<D>::partition() const{ return this->delegate().partition();}
template <typename D>const ::dds::core::policy::TopicData& TPublicationBuiltinTopicData<D>::topic_data() const{ return this->delegate().topic_data();}
template <typename D>const ::dds::core::policy::GroupData& TPublicationBuiltinTopicData<D>::group_data() const{ return this->delegate().group_data();}
template <typename D>const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData<D>::key() const{ return this->delegate().key();}
template <typename D>const dds::topic::BuiltinTopicKey& TSubscriptionBuiltinTopicData<D>::participant_key() const{ return this->delegate().key();}
template <typename D>const std::string& TSubscriptionBuiltinTopicData<D>::topic_name() const{ return this->delegate().topic_name();}
template <typename D>const std::string& TSubscriptionBuiltinTopicData<D>::type_name() const{ return this->delegate().type_name();}
template <typename D>const ::dds::core::policy::Durability& TSubscriptionBuiltinTopicData<D>::durability() const{ return this->delegate().durability();}
template <typename D>const ::dds::core::policy::Deadline& TSubscriptionBuiltinTopicData<D>::deadline() const{ return this->delegate().deadline();}
template <typename D>const ::dds::core::policy::LatencyBudget& TSubscriptionBuiltinTopicData<D>::latency_budget() const{ return this->delegate().latency_budget();}
template <typename D>const ::dds::core::policy::Liveliness& TSubscriptionBuiltinTopicData<D>::liveliness() const{ return this->delegate().liveliness();}
template <typename D>const ::dds::core::policy::Reliability& TSubscriptionBuiltinTopicData<D>::reliability() const{ return this->delegate().reliability();}
template <typename D>const ::dds::core::policy::Ownership& TSubscriptionBuiltinTopicData<D>::ownership() const{ return this->delegate().ownership();}
template <typename D>const ::dds::core::policy::DestinationOrder& TSubscriptionBuiltinTopicData<D>::destination_order() const{ return this->delegate().destination_order();}
template <typename D>const ::dds::core::policy::UserData& TSubscriptionBuiltinTopicData<D>::user_data() const{ return this->delegate().user_data();}
template <typename D>const ::dds::core::policy::TimeBasedFilter& TSubscriptionBuiltinTopicData<D>::time_based_filter() const{ return this->delegate().time_based_filter();}
template <typename D>const ::dds::core::policy::Presentation& TSubscriptionBuiltinTopicData<D>::presentation() const{ return this->delegate().presentation();}
template <typename D>const ::dds::core::policy::Partition& TSubscriptionBuiltinTopicData<D>::partition() const{ return this->delegate().partition();}
template <typename D>const ::dds::core::policy::TopicData& TSubscriptionBuiltinTopicData<D>::topic_data() const{ return this->delegate().topic_data();}
template <typename D>const ::dds::core::policy::GroupData& TSubscriptionBuiltinTopicData<D>::group_data() const{ return this->delegate().group_data();}
#if 0
//TCMParticipantBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TCMParticipantBuiltinTopicData<D>::key() const{ return ((D)this->delegate()).key();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMParticipantBuiltinTopicData<D>::product() const{ return ((D)this->delegate()).product();}
//TCMPublisherBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData<D>::key() const{ return ((D)this->delegate()).key();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMPublisherBuiltinTopicData<D>::product() const{ return ((D)this->delegate()).product();}
template <typename D>const dds::topic::BuiltinTopicKey& TCMPublisherBuiltinTopicData<D>::participant_key() const{ return ((D)this->delegate()).participant_key();}
template <typename D>const std::string& TCMPublisherBuiltinTopicData<D>::name() const{ return ((D)this->delegate()).name();}
template <typename D>const ::dds::core::policy::EntityFactory& TCMPublisherBuiltinTopicData<D>::entity_factory() const{ return ((D)this->delegate()).entity_factory();}
template <typename D>const ::dds::core::policy::Partition& TCMPublisherBuiltinTopicData<D>::partition() const{ return ((D)this->delegate()).partition();}
//TCMSubscriberBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData<D>::key() const{ return ((D)this->delegate()).key();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMSubscriberBuiltinTopicData<D>::product() const{ return ((D)this->delegate()).product();}
template <typename D>const dds::topic::BuiltinTopicKey& TCMSubscriberBuiltinTopicData<D>::participant_key() const{ return ((D)this->delegate()).participant_key();}
template <typename D>const std::string& TCMSubscriberBuiltinTopicData<D>::name() const{ return ((D)this->delegate()).name();}
template <typename D>const ::dds::core::policy::EntityFactory& TCMSubscriberBuiltinTopicData<D>::entity_factory() const{ return ((D)this->delegate()).entity_factory();}
template <typename D>const ::dds::core::policy::Partition& TCMSubscriberBuiltinTopicData<D>::partition() const{ return ((D)this->delegate()).partition();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::Share& TCMSubscriberBuiltinTopicData<D>::share() const{ return ((D)this->delegate()).share();}
//TCMDataWriterBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData<D>::key() const{ return ((D)this->delegate()).key();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataWriterBuiltinTopicData<D>::product() const{ return ((D)this->delegate()).product();}
template <typename D>const dds::topic::BuiltinTopicKey& TCMDataWriterBuiltinTopicData<D>::publisher_key() const{ return ((D)this->delegate()).publisher_key();}
template <typename D>const std::string& TCMDataWriterBuiltinTopicData<D>::name() const{ return ((D)this->delegate()).name();}
template <typename D>const ::dds::core::policy::History& TCMDataWriterBuiltinTopicData<D>::history() const{ return ((D)this->delegate()).history();}
template <typename D>const ::dds::core::policy::ResourceLimits& TCMDataWriterBuiltinTopicData<D>::resource_limits() const{ return ((D)this->delegate()).resource_limits();}
template <typename D>const ::dds::core::policy::WriterDataLifecycle& TCMDataWriterBuiltinTopicData<D>::writer_data_lifecycle() const{ return ((D)this->delegate()).writer_data_lifecycle();}
//TCMDataReaderBuiltinTopicData
template <typename D>const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData<D>::key() const{ return ((D)this->delegate()).key();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ProductData& TCMDataReaderBuiltinTopicData<D>::product() const{ return ((D)this->delegate()).product();}
template <typename D>const dds::topic::BuiltinTopicKey& TCMDataReaderBuiltinTopicData<D>::subscriber_key() const{ return ((D)this->delegate()).subscriber_key();}
template <typename D>const std::string& TCMDataReaderBuiltinTopicData<D>::name() const{ return ((D)this->delegate()).name();}
template <typename D>const ::dds::core::policy::History& TCMDataReaderBuiltinTopicData<D>::history() const{ return ((D)this->delegate()).history();}
template <typename D>const ::dds::core::policy::ResourceLimits& TCMDataReaderBuiltinTopicData<D>::resource_limits() const{ return ((D)this->delegate()).resource_limits();}
template <typename D>const ::dds::core::policy::ReaderDataLifecycle& TCMDataReaderBuiltinTopicData<D>::reader_data_lifecycle() const{ return ((D)this->delegate()).reader_data_lifecycle();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::SubscriptionKey& TCMDataReaderBuiltinTopicData<D>::subscription_keys() const{ return ((D)this->delegate()).subscription_keys();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::ReaderLifespan& TCMDataReaderBuiltinTopicData<D>::reader_lifespan() const{ return ((D)this->delegate()).reader_lifespan();}
template <typename D>const ::org::eclipse::cyclonedds::core::policy::Share& TCMDataReaderBuiltinTopicData<D>::share() const{ return ((D)this->delegate()).share();}#endif
}}// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TBUILTINTOPIC_IMPL_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748/* * 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_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_#define CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TBuiltinTopicKey.hpp>
// Implementation
namespace dds{namespace topic{
template <typename D>const int32_t* TBuiltinTopicKey<D>::value() const{ return this->delegate().value();}
template <typename D>void TBuiltinTopicKey<D>::value(int32_t v[]){ return this->delegate().value(v);}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TBUILTINTOPICKEY_IMPL_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677/* * 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_TOPIC_TCONTENTFILTEREDTOPIC_HPP_#define CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TContentFilteredTopic.hpp>
// Implementation
namespace dds{namespace topic{template <typename T, template <typename Q> class DELEGATE>ContentFilteredTopic<T, DELEGATE>::ContentFilteredTopic(const Topic<T>& topic, const std::string& name, const dds::topic::Filter& filter) : ::dds::core::Reference< DELEGATE<T> >( new dds::topic::detail::ContentFilteredTopic<T>(topic, name, filter)){ this->delegate()->init(::dds::core::Reference< DELEGATE<T> >::impl_);}
template <typename T, template <typename Q> class DELEGATE>ContentFilteredTopic<T, DELEGATE>::~ContentFilteredTopic(){ // Nothing to be done yet....}
template <typename T, template <typename Q> class DELEGATE>const std::string& ContentFilteredTopic<T, DELEGATE>::filter_expression() const{ return this->delegate()->filter_expression();}
template <typename T, template <typename Q> class DELEGATE>const dds::core::StringSeq ContentFilteredTopic<T, DELEGATE>::filter_parameters() const{ return this->delegate()->filter_parameters();}
template <typename T, template <typename Q> class DELEGATE>template <typename FWDIterator>void ContentFilteredTopic<T, DELEGATE>::filter_parameters(const FWDIterator& begin, const FWDIterator& end){ this->delegate()->filter_parameters(begin, end);}
template <typename T, template <typename Q> class DELEGATE>const dds::topic::Topic<T>& ContentFilteredTopic<T, DELEGATE>::topic() const{ return this->delegate()->topic();}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TCONTENTFILTEREDTOPIC_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105/* * 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_TOPIC_TFILTER_HPP_#define CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TFilter.hpp>
// Implementation
namespace dds{namespace topic{
template<typename D>TFilter<D>::TFilter(const std::string& query_expression) : dds::core::Value<D>(query_expression){}
template<typename D>template<typename FWIterator>TFilter<D>::TFilter(const std::string& query_expression, const FWIterator& params_begin, const FWIterator& params_end) : dds::core::Value<D>(query_expression, params_begin, params_end){ }
template<typename D>TFilter<D>::TFilter(const std::string& query_expression, const std::vector<std::string>& params) : dds::core::Value<D>(query_expression, params.begin(), params.end()){}
template<typename D>const std::string& TFilter<D>::expression() const{ return this->delegate().expression();}
template<typename D>typename TFilter<D>::const_iterator TFilter<D>::begin() const{ return this->delegate().begin();}
template<typename D>typename TFilter<D>::const_iterator TFilter<D>::end() const{ return this->delegate().end();}
template<typename D>typename TFilter<D>::iterator TFilter<D>::begin(){ return this->delegate().begin();}
template<typename D>typename TFilter<D>::iterator TFilter<D>::end(){ return this->delegate().end();}
template<typename D>template<typename FWIterator>void TFilter<D>::parameters(const FWIterator& begin, const FWIterator end){ this->delegate().parameters(begin, end);}
template<typename D>void TFilter<D>::add_parameter(const std::string& param){ this->delegate().add_parameter(param);}
template<typename D>uint32_t TFilter<D>::parameters_length() const{ return this->delegate().parameters_length();}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TFILTER_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354/* * 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_TOPIC_TTOPICDESCRIPTION_HPP_#define CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TTopicDescription.hpp>
// Implementation
namespace dds{namespace topic{
template <typename DELEGATE>const std::string& TTopicDescription<DELEGATE>::name() const{ return this->delegate()->name();}
template <typename DELEGATE>const std::string& TTopicDescription<DELEGATE>::type_name() const{ return this->delegate()->type_name();}
template <typename DELEGATE>const dds::domain::DomainParticipant& TTopicDescription<DELEGATE>::domain_participant() const{ return this->delegate()->domain_participant();}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TTOPICDESCRIPTION_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395/* * 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_TOPIC_TTOPIC_HPP_#define CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TTopic.hpp>#include "org/eclipse/cyclonedds/topic/TopicTraits.hpp"#include "org/eclipse/cyclonedds/topic/TopicListener.hpp"
#include <dds/dds.h>#include <functional>
#define MAX_TOPIC_NAME_LEN 1024
// Implementation
namespace dds{namespace topic{
/*************************************************************************** * * dds/topic/Topic<> WRAPPER implementation. * Declaration can be found in dds/topic/TTopic.hpp * ***************************************************************************/
template <typename T, template <typename Q> class DELEGATE>Topic<T, DELEGATE>::Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name) : ::dds::core::Reference< DELEGATE<T> >(new DELEGATE<T>( dp, topic_name, "", dp.default_topic_qos(), NULL, dds::core::status::StatusMask::none())){ this->delegate()->init(this->impl_);}
template <typename T, template <typename Q> class DELEGATE>Topic<T, DELEGATE>::Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const std::string& type_name) : ::dds::core::Reference< DELEGATE<T> >(new DELEGATE<T>( dp, topic_name, type_name, dp.default_topic_qos(), NULL, dds::core::status::StatusMask::none())), ::dds::topic::TAnyTopic< DELEGATE<T> >(::dds::core::Reference< DELEGATE<T> >::delegate()){ throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); /* this->delegate()->init(this->impl_); */}
template <typename T, template <typename Q> class DELEGATE>Topic<T, DELEGATE>::Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener, const dds::core::status::StatusMask& mask) : ::dds::core::Reference< DELEGATE<T> >(new DELEGATE<T>( dp, topic_name, "", qos, listener, mask)), ::dds::topic::TAnyTopic< DELEGATE<T> >(::dds::core::Reference< DELEGATE<T> >::delegate()){ this->delegate()->init(this->impl_);}
template <typename T, template <typename Q> class DELEGATE>Topic<T, DELEGATE>::Topic(const dds::domain::DomainParticipant& dp, const std::string& topic_name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener, const dds::core::status::StatusMask& mask) : ::dds::core::Reference< DELEGATE<T> >(new DELEGATE<T>( dp, topic_name, type_name, qos, listener, mask)), ::dds::topic::TAnyTopic< DELEGATE<T> >(::dds::core::Reference< DELEGATE<T> >::delegate()){ throw dds::core::UnsupportedError(std::string("Only Topics with default type_names are supported")); /* this->delegate()->init(this->impl_); */}
/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */template <typename T, template <typename Q> class DELEGATE>void Topic<T, DELEGATE>::listener(Listener* listener, const ::dds::core::status::StatusMask& event_mask){ this->delegate()->listener(listener, event_mask);}
/** @internal @todo Relates to OMG_DDS_X_TYPE_DYNAMIC_TYPE_SUPPORT OSPL-1736 no implementation */template <typename T, template <typename Q> class DELEGATE>typename Topic<T, DELEGATE>::Listener* Topic<T, DELEGATE>::listener() const{ return this->delegate()->listener();}
}}
/*************************************************************************** * * dds/topic/detail/Topic<> DELEGATE implementation. * Declaration can be found in dds/topic/detail/Topic.hpp * * Implementation and declaration have been separated because some circular * dependencies, like with TopicListener and AnyTopic. * ***************************************************************************/
#include <dds/topic/detail/Topic.hpp>#include <dds/topic/AnyTopic.hpp>#include <dds/topic/TopicListener.hpp>//#include <dds/domain/DomainParticipantListener.hpp>#include <org/eclipse/cyclonedds/core/ScopedLock.hpp>#include <org/eclipse/cyclonedds/core/ListenerDispatcher.hpp>
#include "dds/ddsi/ddsi_sertype.h"
template <typename T>dds::topic::detail::Topic<T>::Topic(const dds::domain::DomainParticipant& dp, const std::string& name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener, const dds::core::status::StatusMask& mask) : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name){ // Set the correct (IDL) type_name in the TopicDescription. org::eclipse::cyclonedds::topic::TopicDescriptionDelegate::myTypeName = org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeName();
// get and validate the ddsc qos org::eclipse::cyclonedds::topic::qos::TopicQosDelegate tQos = qos.delegate(); tQos.check(); dds_qos_t* ddsc_qos = tQos.ddsc_qos(); dds_entity_t ddsc_par = dp.delegate()->get_ddsc_entity();
ser_type_ = org::eclipse::cyclonedds::topic::TopicTraits<T>::getSerType();
dds_entity_t ddsc_topic = dds_create_topic_sertype( ddsc_par, name.c_str(), &ser_type_, ddsc_qos, NULL, NULL);
dds_delete_qos(ddsc_qos);
if (ddsc_topic < 0) { ddsi_sertype_unref(ser_type_); ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ddsc_topic, "Could not create topic."); }
this->set_ddsc_entity(ddsc_topic);
this->listener(listener, mask);
this->AnyTopicDelegate::set_sample(&this->sample_);}
template <typename T>dds::topic::detail::Topic<T>::Topic(const dds::domain::DomainParticipant& dp, const std::string& name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds_entity_t ddsc_topic) : org::eclipse::cyclonedds::topic::TopicDescriptionDelegate(dp, name, type_name), org::eclipse::cyclonedds::topic::AnyTopicDelegate(qos, dp, name, type_name){ this->set_ddsc_entity(ddsc_topic); this->listener(NULL, dds::core::status::StatusMask::none());
this->AnyTopicDelegate::set_sample(&this->sample_);}
template <typename T>dds::topic::detail::Topic<T>::~Topic/*<T>*/(){ if (!closed) { try { close(); } catch (...) {
} }}
template <typename T>voiddds::topic::detail::Topic<T>::close(){ org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this);
if (this->hasDependents()) { ISOCPP_THROW_EXCEPTION(ISOCPP_PRECONDITION_NOT_MET_ERROR, "Topic still has unclosed dependencies (e.g. Readers/Writers/ContentFilteredTopics)"); }
this->listener_set(NULL, dds::core::status::StatusMask::none());
this->myParticipant.delegate()->remove_topic(*this);
org::eclipse::cyclonedds::core::EntityDelegate::close();}
template <typename T>voiddds::topic::detail::Topic<T>::init(ObjectDelegate::weak_ref_type weak_ref){ /* Set weak_ref before passing ourselves to other isocpp objects. */ this->set_weak_ref(weak_ref); /* Add weak_ref to the map of entities */ this->add_to_entity_map(weak_ref); /* Register topic at participant. */ this->myParticipant.delegate()->add_topic(*this);
/* Enable when needed. */ if (this->myParticipant.delegate()->is_auto_enable()) { this->enable(); }}
template <typename T>voiddds::topic::detail::Topic<T>::listener(TopicListener<T>* listener, const ::dds::core::status::StatusMask& mask){ org::eclipse::cyclonedds::core::ScopedObjectLock scopedLock(*this); this->listener_set(listener, mask); scopedLock.unlock();}
template <typename T>dds::topic::TopicListener<T>*dds::topic::detail::Topic<T>::listener(){ this->check(); return reinterpret_cast<dds::topic::TopicListener<T>*>(this->listener_get());}
template <typename T>dds::topic::Topic<T, dds::topic::detail::Topic>dds::topic::detail::Topic<T>::wrapper(){
typename Topic::ref_type ref = ::std::dynamic_pointer_cast<Topic<T> >(this->get_strong_ref()); dds::topic::Topic<T, dds::topic::detail::Topic> topic(ref);
return topic;}
template <typename T>voiddds::topic::detail::Topic<T>::listener_notify( ObjectDelegate::ref_type source, uint32_t triggerMask, void *eventData, void *l){ (void)source; (void)triggerMask; (void)eventData; (void)l;}
template <typename T>dds::topic::Topic<T, dds::topic::detail::Topic>dds::topic::detail::Topic<T>::discover_topic( const dds::domain::DomainParticipant& dp, const std::string& name, const dds::core::Duration& timeout){ dds::topic::Topic<T> found = dds::core::null; std::unique_ptr<dds_typeinfo_t, std::function<void(dds_typeinfo_t *)> > type_info(org::eclipse::cyclonedds::topic::TopicTraits<T>::getTypeInfo(nullptr), [](dds_typeinfo_t *ti) { static_cast<void>(dds_free_typeinfo(ti)); }); dds_entity_t ddsc_topic = dp.delegate()->lookup_topic(name, type_info.get(), timeout);
if (ddsc_topic <= 0) { return dds::core::null; }
#if 0 /* Add type_name here when non-default ones are supported. */ size_t slen = MAX_TOPIC_NAME_LEN; char *ddsc_type_name; ddsc_type_name = (char *)dds_alloc(slen); dds_get_type_name(ddsc_topic, ddsc_type_name, slen); std::string type_name = ddsc_type_name; dds_free(ddsc_type_name);#endif
dds_return_t ret; dds_qos_t* ddsc_qos = dds_create_qos(); ret = dds_get_qos(ddsc_topic, ddsc_qos); dds::topic::qos::TopicQos qos; if (ret == DDS_RETCODE_OK) { qos.delegate().ddsc_qos(ddsc_qos); } dds_delete_qos(ddsc_qos); ISOCPP_DDSC_RESULT_CHECK_AND_THROW(ret, "Failed to get the qos from discovered topic");
/* * The found topic could be of the wrong type. This will be indicated * with a PreconditionNotMetError when we try to create it. */ try { found = dds::topic::Topic<T>(dp, name, qos); } catch (dds::core::PreconditionNotMetError&) { /* Ignore; just return dds::core::null */ }
return found;}
template <typename T>voiddds::topic::detail::Topic<T>::discover_topics( const dds::domain::DomainParticipant& dp, std::vector<dds::topic::Topic<T, dds::topic::detail::Topic> >& topics, uint32_t max_size){ (void)dp; (void)topics; std::vector<dds_entity_t> ddsc_topics; topics.clear(); /* * Unfortunately, DomainParticipantDelegate::lookup_topics() is not * supported yet and will throw an exception. */ dp.delegate()->lookup_topics(topic_type_name<T>::value(), ddsc_topics, max_size);}
template <typename T>void dds::topic::detail::Topic<T>::on_inconsistent_topic( dds_entity_t topic, org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &sd ){ dds::core::status::InconsistentTopicStatus s ; s.delegate() = sd ; (void)topic; dds::topic::Topic<T, dds::topic::detail::Topic> t = wrapper() ;
dds::topic::TopicListener<T> *l = reinterpret_cast<dds::topic::TopicListener<T> *>(this->listener_get()); if( (l != NULL) && (this->get_listener_mask().to_ulong() & dds::core::status::StatusMask::inconsistent_topic().to_ulong()) ) { l->on_inconsistent_topic( t, s ) ; }}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TTOPIC_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131/* * 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_TOPIC_DETAIL_TOPIC_HPP_#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_
/** * @file */
// Implementation
#include <dds/core/ref_traits.hpp>#include <dds/topic/TopicTraits.hpp>#include <dds/core/status/Status.hpp>#include <dds/core/status/State.hpp>#include <dds/domain/DomainParticipant.hpp>#include <dds/topic/qos/TopicQos.hpp>#include <dds/topic/AnyTopic.hpp>
#include <org/eclipse/cyclonedds/core/config.hpp>#include <org/eclipse/cyclonedds/topic/TopicTraits.hpp>#include <org/eclipse/cyclonedds/topic/AnyTopicDelegate.hpp>#include <org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp>
#include <dds/dds.h>
namespace dds{namespace topic{template <typename T>class TopicListener;
}}
namespace dds{namespace topic{namespace detail{template <typename T>class Topic;}}}
/*************************************************************************** * * dds/topic/detail/Topic<> DELEGATE declaration. * Implementation can be found in dds/topic/detail/TTopicImpl.hpp * ***************************************************************************/template <typename T>class dds::topic::detail::Topic : public org::eclipse::cyclonedds::topic::AnyTopicDelegate{public: typedef typename ::dds::core::smart_ptr_traits< Topic<T> >::ref_type ref_type; typedef typename ::dds::core::smart_ptr_traits< Topic<T> >::weak_ref_type weak_ref_type;
Topic(const dds::domain::DomainParticipant& dp, const std::string& name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds::topic::TopicListener<T>* listener, const dds::core::status::StatusMask& mask);
Topic(const dds::domain::DomainParticipant& dp, const std::string& name, const std::string& type_name, const dds::topic::qos::TopicQos& qos, dds_entity_t ddsc_topic);
virtual ~Topic();
virtual void close();
void init(ObjectDelegate::weak_ref_type weak_ref);
dds::topic::Topic<T, dds::topic::detail::Topic> wrapper();
public:
void listener(dds::topic::TopicListener<T>* listener, const ::dds::core::status::StatusMask& mask);
dds::topic::TopicListener<T>* listener();
virtual void listener_notify(ObjectDelegate::ref_type source, uint32_t triggerMask, void *eventData, void *listener);
dds::topic::TTopicDescription<TopicDescriptionDelegate> clone();
static dds::topic::Topic<T, dds::topic::detail::Topic> discover_topic(const dds::domain::DomainParticipant& dp, const std::string& name, const dds::core::Duration& timeout);
static void discover_topics(const dds::domain::DomainParticipant& dp, std::vector<dds::topic::Topic<T, dds::topic::detail::Topic> >& topics, uint32_t max_size);
//using ::org::eclipse::cyclonedds::topic::AnyTopicDelegate<T>::on_inconsistent_topic;
void on_inconsistent_topic( dds_entity_t topic, org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &s ) ; // !!!
private: T sample_;};
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPIC_HPP_ */123456789101112131415161718192021222324252627282930/* * 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_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_#define CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_
/** * @file */
// Implementation
#include <dds/topic/detail/TTopicDescriptionImpl.hpp>#include <org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp>
namespace dds { namespace topic { namespace detail { typedef dds::topic::TTopicDescription<org::eclipse::cyclonedds::topic::TopicDescriptionDelegate> TopicDescription;} } }
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_TOPICDESCRIPTION_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283/* * 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_TOPIC_TOPICINSTANCE_HPP_#define CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_
/** * @file */
/* * OMG PSM class declaration */#include <dds/topic/TopicInstance.hpp>
// Implementation
namespace dds{namespace topic{
template <typename T>TopicInstance<T>::TopicInstance() : h_(dds::core::null) {}
template <typename T>TopicInstance<T>::TopicInstance(const ::dds::core::InstanceHandle& h) : h_(h), sample_() {}
template <typename T>TopicInstance<T>::TopicInstance(const ::dds::core::InstanceHandle& h, const T& sample) : h_(h), sample_(sample) { }
template <typename T>TopicInstance<T>::operator const ::dds::core::InstanceHandle() const{ return h_;}
template <typename T>const ::dds::core::InstanceHandle TopicInstance<T>::handle() const{ return h_;}
template <typename T>void TopicInstance<T>::handle(const ::dds::core::InstanceHandle& h){ h_ = h;}
template <typename T>const T& TopicInstance<T>::sample() const{ return sample_;}
template <typename T>T& TopicInstance<T>::sample(){ return sample_;}
template <typename T>void TopicInstance<T>::sample(const T& sample){ sample_ = sample;}
}}
// End of implementation
#endif /* CYCLONEDDS_DDS_TOPIC_TOPICINSTANCE_HPP_ */1234567891011121314151617181920/* * 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_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_#define OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_
#include "dds/topic/detail/TTopicDescriptionImpl.hpp"#include "dds/topic/detail/TTopicImpl.hpp"#include "dds/topic/detail/TopicInstanceImpl.hpp"#include "dds/topic/detail/TContentFilteredTopicImpl.hpp"
#endif /* OMG_DDS_TOPIC_PACKAGE_DETAIL_INCLUDE_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_#define CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_
#include <dds/topic/AnyTopic.hpp>#include <dds/topic/Topic.hpp>#include <org/eclipse/cyclonedds/topic/discovery.hpp>
#include <string>
namespace dds{namespace topic{
template <typename TOPIC>TOPICdiscover( const dds::domain::DomainParticipant& dp, const std::string& topic_name, const dds::core::Duration& timeout){ TOPIC t = org::eclipse::cyclonedds::topic::lookup_topic<TOPIC, typename TOPIC::DELEGATE_T>::discover(dp, topic_name, timeout);
return t;}
template <typename ANYTOPIC, typename FwdIterator>uint32_tdiscover( const dds::domain::DomainParticipant& dp, FwdIterator begin, uint32_t max_size){ std::vector<ANYTOPIC> list;
org::eclipse::cyclonedds::topic::lookup_topic<ANYTOPIC, typename ANYTOPIC::DELEGATE_T>::discover(dp, list, max_size);
FwdIterator fit = begin; for (typename std::vector<ANYTOPIC>::const_iterator it = list.begin(); it != list.end(); ++it) { *fit++ = *it; }
return static_cast<uint32_t>(list.size());}
template <typename ANYTOPIC, typename BinIterator>uint32_tdiscover_all( const dds::domain::DomainParticipant& dp, BinIterator begin){ std::vector<ANYTOPIC> list;
org::eclipse::cyclonedds::topic::lookup_topic<ANYTOPIC, typename ANYTOPIC::DELEGATE_T>::discover(dp, list, static_cast<uint32_t>(dds::core::LENGTH_UNLIMITED));
BinIterator bit = begin; for (typename std::vector<ANYTOPIC>::const_iterator it = list.begin(); it != list.end(); ++it) { *bit++ = *it; }
return list.size();}
template <typename FwdIterator>voidignore( const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end){ (void)dp; (void)begin; (void)end; ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported");}
}}
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_DISCOVER_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_#define CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_
#include <org/eclipse/cyclonedds/topic/find.hpp>
#include <string>
namespace dds{namespace topic{
template <typename TOPIC>TOPICfind(const dds::domain::DomainParticipant& dp, const std::string& topic_name){ TOPIC t = org::eclipse::cyclonedds::topic::finder<TOPIC, typename TOPIC::DELEGATE_T>::find(dp, topic_name);
return t;}
}}
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FIND_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153#ifndef OMG_DDS_TOPIC_DISCOVER_HPP_#define OMG_DDS_TOPIC_DISCOVER_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/domain/DomainParticipant.hpp>
namespace dds{namespace topic{
/** * This operation gives access to an specific existing (or ready to exist) enabled * Topic, ContentFilteredTopic, MultiTopic, AnyTopic or TopicDescription based * on its topic_name. * * Topics that the application has indicated should be 'ignored' (by means of the * dds::topic::ignore operation) will not appear in this list (note: the ignore * feature is not yet supported). * * If a Topic of the same topic_name already exists, it gives access to this Topic. * Otherwise it waits (blocks the caller) until another mechanism creates it. This other * mechanism can be another thread, a configuration tool, or some other Data * Distribution Service utility. If after the specified timeout the Topic can still not be * found, the caller gets unblocked and the returned Topic will be dds::core::null. * * A Topic that is obtained by means of find_topic in a specific * DomainParticipant can only be used to create DataReaders and * DataWriters in that DomainParticipant. * * This operation usually results in network look-ups. * * For finding only locally created Topics, look * @link find(const dds::domain::DomainParticipant& dp, const std::string& topic_name) * here.@endlink * * @param dp the DomainParticipant * @param name the topic name to discover * @param timeout the time out * @throws dds::core::Error * An internal error has occurred. * @throws dds::core::NullReferenceError * The DomainParticipant was not properly created and references to dds::core::null. * @throws dds::core::AlreadyClosedError * The DomainParticipant has already been closed. * @throws dds::core::NotEnabledError * The DomainParticipant has not yet been enabled. * @throws dds::core::OutOfResourcesError * The Data Distribution Service ran out of resources to * complete this operation. * @throws dds::core::TimeoutError * No Topics of the given name found within the timeout. */template <typename TOPIC>TOPIC discover(const dds::domain::DomainParticipant& dp, const std::string& name, const dds::core::Duration& timeout = dds::core::Duration::infinite());
/** * This operation retrieves a list of Topics that have been discovered in the domain. * * If the max_size of the given list is large enough, all discovered Topics will be * present in that list. Otherwise, a random sub-set of max_size elements is returned. * * Topics that the application has indicated should be 'ignored' (by means of the * dds::topic::ignore operation) will not appear in this list (note: the ignore * feature is not yet supported). * * Because Topics of various different kinds can be retrieved, the list contains * AnyTopics. * * This operation usually results in network look-ups. * * @param dp the DomainParticipant * @param begin a forward iterator pointing to the beginning of a container * in which to insert the topics * @param max_size the maximum number of topics to return */template <typename ANYTOPIC, typename FwdIterator>uint32_t discover(const dds::domain::DomainParticipant& dp, FwdIterator begin, uint32_t max_size);
/** * This operation retrieves a list of all Topics that have been discovered in the domain. * * Topics that the application has indicated should be 'ignored' (by means of the * dds::topic::ignore operation) will not appear in this list (note: the ignore * feature is not yet supported). * * Because Topics of various different kinds can be retrieved, the list contains * AnyTopics. * * This operation usually results in network look-ups. * * @param dp the DomainParticipant * @param begin a back inserting iterator pointing to the beginning of a container * in which to insert the topics */template <typename ANYTOPIC, typename BinIterator>uint32_t discover_all(const dds::domain::DomainParticipant& dp, BinIterator begin);
/** * This operation allows an application to instruct the Service to locally ignore * a remote domain participant. From that point onwards the Service will locally * behave as if the remote participant did not exist. This means it will ignore any * Topic, publication, or subscription that originates on that domain participant. * * <b><i>This operation is not yet implemented. It is scheduled for a future release.</i></b> * * @param dp the DomainParticipant * @param handle the handle of the DomainParticipant to ignore */void OMG_DDS_API ignore(const dds::domain::DomainParticipant& dp, const dds::core::InstanceHandle& handle);
/** * This operation allows an application to instruct the Service to locally ignore * a remote domain participant. From that point onwards the Service will locally * behave as if the remote participant did not exist. This means it will ignore any * Topic, publication, or subscription that originates on that domain participant. * * <b><i>This operation is not yet implemented. It is scheduled for a future release.</i></b> * * @param dp the DomainParticipant * @param begin a forward iterator pointing to the beginning of a sequence of * InstanceHandles to ignore * @param end a forward iterator pointing to the end of a sequence of * InstanceHandles to ignore */template <typename FwdIterator>void ignore(const dds::domain::DomainParticipant& dp, FwdIterator begin, FwdIterator end);
}}
#include <dds/topic/detail/discovery.hpp>
#endif /* OMG_DDS_TOPIC_DISCOVER_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253#ifndef OMG_DDS_TOPIC_FIND_HPP_#define OMG_DDS_TOPIC_FIND_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 <string>
#include <dds/topic/detail/find.hpp>
namespace dds{namespace topic{
/** * This operation gives access to a locally-created Topic, ContentFilteredTopic, * MultiTopic, AnyTopic and TopicDescription with a matching name. * * dds::topic::find will never create a Topic but returns a reference to an * Topic proxy that already exists locally. When no local proxy exists, the * returned Topic will be a dds::core::null object. The operation never blocks. * * For discovering globally available Topics, look * @link dds::topic::discover(const dds::domain::DomainParticipant&, const std::string&, const dds::core::Duration&) * here.@endlink * * @param dp the DomainParticipant to find the topic on * @param topic_name the topic name to find */template <typename TOPIC>TOPICfind(const dds::domain::DomainParticipant& dp, const std::string& topic_name);
}}
#endif /* OMG_DDS_TOPIC_FIND_HPP_ */123456789101112131415161718192021222324252627282930313233343536#ifndef OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_#define OMG_DDS_TOPIC_QOS_TOPIC_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/topic/qos/detail/TopicQos.hpp>
namespace dds{namespace topic{namespace qos{typedef dds::topic::qos::detail::TopicQos TopicQos;}}}
#endif /* OMG_DDS_TOPIC_QOS_TOPIC_QOS_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293#ifndef OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_#define OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_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/detail/TEntityQosImpl.hpp>#include <org/eclipse/cyclonedds/topic/qos/TopicQosDelegate.hpp>
#ifdef DOXYGEN_FOR_ISOCPP/* The above macro is never (and must never) be defined in normal compilation. * * The class below is just used to create informative API documentation. * The predoxygen.py script will copy this over the QoS API header file. *//** * @brief * This struct provides the basic mechanism for an application to specify Quality of * Service attributes for a Topic. * * @par Attributes * @anchor anchor_dds_topic_qos_defaults * QosPolicy | Desciption | Default Value * ------------------------------------ | -------------------------------------------------------------------------- | -------------------- * dds::core::policy::TopicData | Additional information (@ref DCPS_QoS_TopicData "info") | TopicData::TopicData(empty) * dds::core::policy::Durability | Data storage settings for late joiners (@ref DCPS_QoS_Durability "info") | Durability::Volatile() * dds::core::policy::DurabilityService | Transient/persistent behaviour (@ref DCPS_QoS_DurabilityService "info") | DurabilityService::DurabilityService() * dds::core::policy::Deadline | Period in which new sample is written (@ref DCPS_QoS_Deadline "info") | Deadline::Deadline(infinite) * dds::core::policy::LatencyBudget | Used for optimization (@ref DCPS_QoS_LatencyBudget "info") | LatencyBudget::LatencyBudget(zero) * dds::core::policy::Liveliness | Liveliness assertion mechanism (@ref DCPS_QoS_Liveliness "info") | Liveliness::Automatic() * dds::core::policy::Reliability | Reliability settings (@ref DCPS_QoS_Reliability "info") | Reliability::Reliable() * dds::core::policy::DestinationOrder | DataReader data order settings (@ref DCPS_QoS_DestinationOrder "info") | DestinationOrder::ReceptionTimestamp() * dds::core::policy::History | Data storage settings (@ref DCPS_QoS_History "info") | History::KeepLast(depth 1) * dds::core::policy::ResourceLimits | Maximum resource settings (@ref DCPS_QoS_ResourceLimits "info") | ResourceLimits::ResourceLimits(all unlimited) * dds::core::policy::TransportPriority | Priority hint for transport layer (@ref DCPS_QoS_TransportPriority "info") | TransportPriority::TTransportPriority(0) * dds::core::policy::Lifespan | Maximum duration of validity of data (@ref DCPS_QoS_Lifespan "info") | Lifespan::Lifespan(infinite) * dds::core::policy::Ownership | Exclusive ownership or not (@ref DCPS_QoS_Ownership "info") | Ownership::Shared() * dds::core::policy::DataRepresentation | Supported data representation kinds (@ref DCPS_QoS_DataRepresentation "info") | DataRepresentation::DataRepresentation(dds::core::policy::DataRepresentationId::XCDR1) * dds::core::policy::TypeConsistencyEnforcement | Type consistency enforcement policies (@ref DCPS_QoS_TypeConsistencyEnforcement "info") | dds::core::policy::TypeConsistencyKind::DISALLOW_TYPE_COERCION * * A QosPolicy can be set when the Topic is created or modified with the set * qos operation. * Both operations take the TopicQos object as a parameter. There may be cases * where several policies are in conflict. Consistency checking is performed each time * the policies are modified when they are being created and, in case they are already * enabled, via the set qos operation. * * Some QosPolicy have "immutable" semantics meaning that they can only be * specified either at Topic creation time or prior to calling the enable * operation on the Topic. * * @see for more information: @ref DCPS_QoS */class dds::topic::qos::TopicQos : public ::dds::core::EntityQos<org::eclipse::cyclonedds::topic::qos::TopicQosDelegate>{public: /** * Create @ref anchor_dds_topic_qos_defaults "default" QoS. */ TopicQos() {}
/** * Create copied QoS type. * * @param qos the QoS to copy policies from. */ TopicQos(const TopicQos& qos);};
#else /* DOXYGEN_FOR_ISOCPP */
namespace dds { namespace topic { namespace qos { namespace detail { typedef ::dds::core::TEntityQos< ::org::eclipse::cyclonedds::topic::qos::TopicQosDelegate > TopicQos;} } } }
#endif /* DOXYGEN_FOR_ISOCPP */
#endif /* OMG_DDS_TOPIC_QOS_DETAIL_TOPIC_QOS_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120/* * 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 */
/** * @file */
#ifndef LITE_FORWARD_DECLARATIONS_HPP_#define LITE_FORWARD_DECLARATIONS_HPP_
namespace dds{ namespace domain { class DomainParticipantListener;
template <typename DELEGATE> class TDomainParticipant; }
namespace sub { template <typename T, template <typename Q> class DELEGATE> class DataReader;
template <typename T> class DataReaderListener;
class SubscriberListener;
template <typename DELEGATE> class TSubscriber;
namespace detail { template <typename T> class DataReader;
template <typename T> class LoanedSamplesHolder;
template <typename T, typename SamplesFWIterator> class SamplesFWInteratorHolder;
template <typename T, typename SamplesBIIterator> class SamplesBIIteratorHolder; } }
namespace pub { class PublisherListener;
template <typename DELEGATE> class TPublisher; }
namespace topic { template <typename DELEGATE> class TTopicDescription;
template <typename T> class TopicListener;
template <typename T, template <typename Q> class DELEGATE> class Topic;
template <typename T, template <typename Q> class DELEGATE> class ContentFilteredTopic;
namespace detail { template <typename T> class ContentFilteredTopic; } }}
namespace org{namespace eclipse{namespace cyclonedds{
namespace domain { class DomainParticipantDelegate; }
namespace sub { class SubscriberDelegate; }
namespace pub { class PublisherDelegate; }
namespace topic { template <class TOPIC> class TopicTraits;
class TopicDescriptionDelegate; }}}}
#endif /* LITE_FORWARD_DECLARATIONS_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_#define CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_
#include "dds/core/macros.hpp"#include "dds/core/refmacros.hpp"#include "org/eclipse/cyclonedds/core/Mutex.hpp"#include "org/eclipse/cyclonedds/core/ObjectDelegate.hpp"
#include <unordered_map>
#include "dds/dds.h"
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
DDSCXX_WARNING_MSVC_OFF(4251)
class OMG_DDS_API DDScObjectDelegate : public virtual org::eclipse::cyclonedds::core::ObjectDelegate{public:
typedef std::unordered_map<dds_entity_t,org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type> entity_map_type;
DDScObjectDelegate (); virtual ~DDScObjectDelegate ();
void close (); dds_entity_t get_ddsc_entity (); void set_ddsc_entity (dds_entity_t e); void add_to_entity_map (org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type weak_ref);
public: static ObjectDelegate::ref_type extract_strong_ref(dds_entity_t e);
protected: dds_entity_t ddsc_entity;
private: void delete_from_entity_map(); static org::eclipse::cyclonedds::core::DDScObjectDelegate::entity_map_type entity_map; static Mutex entity_map_mutex;};
DDSCXX_WARNING_MSVC_ON(4251)
}}}}
#endif /* CYCLONEDDS_CORE_USEROBJECT_DELEGATE_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_#define CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_
#include <dds/core/status/State.hpp>#include <dds/core/InstanceHandle.hpp>#include <dds/core/policy/CorePolicy.hpp>#include <org/eclipse/cyclonedds/core/DDScObjectDelegate.hpp>#include <org/eclipse/cyclonedds/ForwardDeclarations.hpp>#include <org/eclipse/cyclonedds/core/status/StatusDelegate.hpp>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
class OMG_DDS_API EntityDelegate : public virtual ::org::eclipse::cyclonedds::core::DDScObjectDelegate{public: typedef ::dds::core::smart_ptr_traits< EntityDelegate >::ref_type ref_type; typedef ::dds::core::smart_ptr_traits< EntityDelegate >::weak_ref_type weak_ref_type;
EntityDelegate(); virtual ~EntityDelegate();
/** * @internal Enables this entity. */ void enable();
::dds::core::status::StatusMask status_changes() const;
::dds::core::InstanceHandle instance_handle() const;
bool contains_entity(const ::dds::core::InstanceHandle& handle);
ObjectDelegate::ref_type get_statusCondition();
virtual void close();
virtual void retain();
void *listener_get() const;
protected: void listener_set(void *listener, const dds::core::status::StatusMask& mask);
public: const dds::core::status::StatusMask get_listener_mask() const ;
bool obtain_callback_lock() ; void release_callback_lock() ;
// Topic callback virtual void on_inconsistent_topic(dds_entity_t topic, org::eclipse::cyclonedds::core::InconsistentTopicStatusDelegate &) ;
// Writer callbacks virtual void on_offered_deadline_missed(dds_entity_t writer, org::eclipse::cyclonedds::core::OfferedDeadlineMissedStatusDelegate &) ;
virtual void on_offered_incompatible_qos(dds_entity_t writer, org::eclipse::cyclonedds::core::OfferedIncompatibleQosStatusDelegate &) ;
virtual void on_liveliness_lost(dds_entity_t writer, org::eclipse::cyclonedds::core::LivelinessLostStatusDelegate &) ;
virtual void on_publication_matched(dds_entity_t writer, org::eclipse::cyclonedds::core::PublicationMatchedStatusDelegate &) ;
// Reader callbacks virtual void on_requested_deadline_missed(dds_entity_t reader, org::eclipse::cyclonedds::core::RequestedDeadlineMissedStatusDelegate &);
virtual void on_requested_incompatible_qos(dds_entity_t reader, org::eclipse::cyclonedds::core::RequestedIncompatibleQosStatusDelegate &);
virtual void on_sample_rejected(dds_entity_t reader, org::eclipse::cyclonedds::core::SampleRejectedStatusDelegate &);
virtual void on_liveliness_changed(dds_entity_t reader, org::eclipse::cyclonedds::core::LivelinessChangedStatusDelegate &);
virtual void on_data_available(dds_entity_t reader);
virtual void on_subscription_matched(dds_entity_t reader, org::eclipse::cyclonedds::core::SubscriptionMatchedStatusDelegate &);
virtual void on_sample_lost(dds_entity_t reader, org::eclipse::cyclonedds::core::SampleLostStatusDelegate &);
// Subscriber callback virtual void on_data_readers(dds_entity_t subscriber);
protected: static volatile unsigned int entityID_; bool enabled_; dds::core::status::StatusMask listener_mask; void prevent_callbacks(); long callback_count; dds_listener_t *listener_callbacks;
private: void *listener; ObjectDelegate::weak_ref_type myStatusCondition; void *callback_mutex; void *callback_cond;};
}}}}
#endif /* CYCLONEDDS_CORE_ENTITY_DELEGATE_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_#define CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_
#include <dds/core/detail/WeakReferenceImpl.hpp>#include <org/eclipse/cyclonedds/core/Mutex.hpp>
#include <map>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
template <typename T, typename U>class EntityRegistry{public: /** * @internal Inserts a EntityDelegate key, dds::core::Entity value pair into the registry. * @param key The org::eclipse::cyclonedds::core::Entity to use as a key * @param val The dds::core::Entity that encapsulates the key */ void insert(T key, U& val) { mutex.lock(); registry[key] = dds::core::WeakReference<U>(val); mutex.unlock(); }
/** * @internal Removes a DDS::Entity from the registry * @param key Entity to remove */ void remove(T key) { mutex.lock(); registry.erase(key); mutex.unlock(); }
/** * @internal Checks the registry for a dds::core::Entity that wraps the supplied DDS::Entity * and returns it. If no match is found dds::core::null is returned. * @param key DDS::Entity to find an encapsulating dds::core:Entity for. * @return dds::core::Entity if a match is found, dds::core::null if not. */ U get(T key) { typename std::map<T, dds::core::WeakReference<U> >::iterator it;
mutex.lock(); it = registry.find(key);
U entity(dds::core::null); if(it != registry.end()) { entity = it->second.lock(); } mutex.unlock();
return entity; }
private: std::map<T, dds::core::WeakReference<U> > registry; org::eclipse::cyclonedds::core::Mutex mutex;};
}}}}
#endif /* CYCLONEDDS_CORE_ENTITY_REGISTRY_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_ENTITY_SET_HPP_#define CYCLONEDDS_CORE_ENTITY_SET_HPP_
#include <dds/core/InstanceHandle.hpp>
#include <org/eclipse/cyclonedds/core/EntityDelegate.hpp>#include <org/eclipse/cyclonedds/core/Mutex.hpp>#include <org/eclipse/cyclonedds/core/WeakReferenceSet.hpp>
#include <vector>#include <memory>#include <set>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
class EntitySet{public: typedef std::vector<org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type>::iterator vectorIterator; typedef std::vector<org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type> vector;
/** * @internal Inserts a EntityDelegate into the set. * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to store */ void insert(org::eclipse::cyclonedds::core::EntityDelegate& entity);
/** * @internal Erases a EntityDelegate from the set. * @param entity The org::eclipse::cyclonedds::core::EntityDelegate to delete */ void erase(org::eclipse::cyclonedds::core::EntityDelegate& entity);
/** * @internal Check if Entity with specific handle is part of the set. * @param handle The dds::core::InstanceHandle to search for */ bool contains(const dds::core::InstanceHandle& handle);
/** * @internal Call close() of all the Entities within the set (outside lock). */ void all_close();
/** * @internal Call retain() of all the Entities within the set (outside lock). */ void all_retain();
/** * @internal Call enable() of all the Entities within the set (outside lock). */ void all_enable();
/** * @internal Copy internal set into a vector. */ vector copy();
private: WeakReferenceSet<ObjectDelegate::weak_ref_type>::wset entities; Mutex mutex;};
}}}}
#endif /* CYCLONEDDS_CORE_ENTITY_SET_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_#define CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_
#include <dds/core/types.hpp>#include <org/eclipse/cyclonedds/core/config.hpp>#include <dds/dds.h>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{class InstanceHandleDelegate;}}}}
class OMG_DDS_API org::eclipse::cyclonedds::core::InstanceHandleDelegate{public: InstanceHandleDelegate(); InstanceHandleDelegate(dds_instance_handle_t h);public: InstanceHandleDelegate(const dds::core::null_type& src);
public: bool operator==(const InstanceHandleDelegate& that) const;
bool operator<(const InstanceHandleDelegate& that) const;
bool operator>(const InstanceHandleDelegate& that) const;
InstanceHandleDelegate& operator=(const dds::core::null_type& src); bool is_nil() const;
public: dds_instance_handle_t handle() const;
private: dds_instance_handle_t handle_;};
inline std::ostream&operator << (std::ostream& os, const org::eclipse::cyclonedds::core::InstanceHandleDelegate& h){ os << h.handle(); return os;}#endif /* CYCLONEDDS_CORE_INSTANCE_HANDLE_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657/* * 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_CORE_LISTENERDISPATCHER_H_#define CYCLONEDDS_CORE_LISTENERDISPATCHER_H_
#include "dds/dds.h"
extern "C"{ extern OMG_DDS_API void callback_on_inconsistent_topic (dds_entity_t topic, dds_inconsistent_topic_status_t status, void* arg);
extern OMG_DDS_API void callback_on_offered_deadline_missed (dds_entity_t writer, dds_offered_deadline_missed_status_t status, void* arg);
extern OMG_DDS_API void callback_on_offered_incompatible_qos (dds_entity_t writer, dds_offered_incompatible_qos_status_t status, void* arg);
extern OMG_DDS_API void callback_on_liveliness_lost (dds_entity_t writer, dds_liveliness_lost_status_t status, void* arg);
extern OMG_DDS_API void callback_on_publication_matched (dds_entity_t writer, dds_publication_matched_status_t status, void* arg);
extern OMG_DDS_API void callback_on_requested_deadline_missed (dds_entity_t reader, dds_requested_deadline_missed_status_t status, void* arg);
extern OMG_DDS_API void callback_on_requested_incompatible_qos (dds_entity_t reader, dds_requested_incompatible_qos_status_t status, void* arg);
extern OMG_DDS_API void callback_on_sample_rejected (dds_entity_t reader, dds_sample_rejected_status_t status, void* arg);
extern OMG_DDS_API void callback_on_liveliness_changed (dds_entity_t reader, dds_liveliness_changed_status_t status, void* arg);
extern OMG_DDS_API void callback_on_data_available (dds_entity_t reader, void* arg);
extern OMG_DDS_API void callback_on_subscription_matched (dds_entity_t reader, dds_subscription_matched_status_t status, void* arg);
extern OMG_DDS_API void callback_on_sample_lost (dds_entity_t reader, dds_sample_lost_status_t status, void* arg);
extern OMG_DDS_API void callback_on_data_readers (dds_entity_t subscriber, void* arg);}
#endif /* CYCLONEDDS_CORE_LISTENERDISPATCHER_H_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_MISC_UTILS_HPP_#define CYCLONEDDS_CORE_MISC_UTILS_HPP_
#include <dds/core/ddscore.hpp>#include <org/eclipse/cyclonedds/core/Mutex.hpp>#include "dds/dds.h"
#define STATUS_MASK_CONTAINS(mask,check) ((mask & check) == check)
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
voidconvertByteSeq( const dds::core::ByteSeq &from, void*& to, int32_t size);
voidconvertByteSeq( const void* from, const int32_t size, dds::core::ByteSeq &to);
voidconvertStringSeq( const dds::core::StringSeq &from, char **&to);
voidconvertStringSeq( char **from, uint32_t size, dds::core::StringSeq &to);
dds::core::DurationconvertDuration( const dds_duration_t &from);
dds_duration_tconvertDuration( const dds::core::Duration &from);
dds::core::TimeconvertTime( const dds_time_t &from);
dds_time_tconvertTime( const dds::core::Time &from);
dds::core::status::StatusMaskconvertStatusMask( const uint32_t from);
uint32_tconvertStatusMask( const dds::core::status::StatusMask &from);
static Mutex gpb_mutex;
}}}}
#endif //CYCLONEDDS_CORE_MISC_UTILS_HPP_123456789101112131415161718192021222324252627282930313233343536/* * Copyright(c) 2006 to 2022 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_MISSING_HPP_#define CYCLONEDDS_CORE_MISSING_HPP_
//since these helpers are only introduced from c++14 onwards
#if __cplusplus < 201402Lnamespace std { template< bool B, class T, class F > using conditional_t = typename std::conditional<B, T, F>::type;
template<bool cond, class T = void> using enable_if_t = typename std::enable_if<cond, T>::type;
template<class T = void> using decay_t = typename std::decay<T>::type;}#endif /* _cplusplus */
#endif /* CYCLONEDDS_CORE_MISSING_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_MUTEX_HPP_#define CYCLONEDDS_CORE_MUTEX_HPP_
#include <dds/core/macros.hpp>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
class OMG_DDS_API Mutex{public: Mutex(); virtual ~Mutex();
void lock() const; bool try_lock() const; void unlock() const;private: void* mtx;};
}}}}
#endif /* CYCLONEDDS_CORE_MUTEX_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_#define CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_
#include "dds/core/macros.hpp"#include "dds/core/refmacros.hpp"#include "org/eclipse/cyclonedds/core/Mutex.hpp"
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
DDSCXX_WARNING_MSVC_OFF(4251)
class OMG_DDS_API ObjectDelegate{public:
typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::ref_type ref_type; typedef ::dds::core::smart_ptr_traits< ObjectDelegate >::weak_ref_type weak_ref_type;
ObjectDelegate (); virtual ~ObjectDelegate ();
virtual void close (); void lock() const; void unlock() const;
virtual void init (ObjectDelegate::weak_ref_type weak_ref) = 0; ObjectDelegate::weak_ref_type get_weak_ref () const; ObjectDelegate::ref_type get_strong_ref () const;
protected:
void check () const; void set_weak_ref (ObjectDelegate::weak_ref_type weak_ref);
Mutex mutex; bool closed; ObjectDelegate::weak_ref_type myself;};
DDSCXX_WARNING_MSVC_ON(4251)
}}}}
#endif /* CYCLONEDDS_CORE_OBJECT_DELEGATE_HPP_ */1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_OBJECT_SET_HPP_#define CYCLONEDDS_CORE_OBJECT_SET_HPP_
#include <dds/core/InstanceHandle.hpp>
#include <org/eclipse/cyclonedds/core/ObjectDelegate.hpp>#include <org/eclipse/cyclonedds/core/Mutex.hpp>#include <org/eclipse/cyclonedds/core/WeakReferenceSet.hpp>
#include <vector>#include <memory>#include <set>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
class ObjectSet{public: typedef std::set<org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type>::iterator setIterator; typedef std::vector<org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type>::iterator vectorIterator; typedef std::vector<org::eclipse::cyclonedds::core::ObjectDelegate::weak_ref_type> vector;
/** * @internal Inserts a EntityDelegate into the set. * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to store */ void insert(org::eclipse::cyclonedds::core::ObjectDelegate& obj);
/** * @internal Erases a EntityDelegate from the set. * @param obj The org::eclipse::cyclonedds::core::ObjectDelegate to delete */ void erase(org::eclipse::cyclonedds::core::ObjectDelegate& obj);
/** * @internal Call close() of all the Objects within the set (outside lock). */ void all_close();
/** * @internal Copy internal set into a vector. */ vector copy();
private: WeakReferenceSet<ObjectDelegate::weak_ref_type>::wset objects; Mutex mutex;};
}}}}
#endif /* CYCLONEDDS_CORE_OBJECT_SET_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_#define CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_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>
#if 0C_CLASS(cmn_qosProvider);C_CLASS(cmn_qosProviderInputAttr);#endif
namespace org{namespace eclipse{namespace cyclonedds{namespace core{class QosProviderDelegate;}}}}
class OMG_DDS_API org::eclipse::cyclonedds::core::QosProviderDelegate{public: QosProviderDelegate(const std::string& uri, const std::string& id = "");
~QosProviderDelegate();
dds::domain::qos::DomainParticipantQos participant_qos(const char* id);
dds::topic::qos::TopicQos topic_qos(const char* id);
dds::sub::qos::SubscriberQos subscriber_qos(const char* id);
dds::sub::qos::DataReaderQos datareader_qos(const char* id);
dds::pub::qos::PublisherQos publisher_qos(const char* id);
dds::pub::qos::DataWriterQos datawriter_qos(const char* id);
private: template <typename FROM, typename TO> static void named_qos__copyOut(void *from, void *to);#if 0 cmn_qosProvider qosProvider; static const C_STRUCT(cmn_qosProviderInputAttr) qosProviderAttr;#endif};
#endif /* CYCLONEDDS_CORE_QOSPROVIDERDELEGATE_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_REPORT_UTILS_HPP_#define CYCLONEDDS_CORE_REPORT_UTILS_HPP_
#include <string>#include <sstream>#include <org/eclipse/cyclonedds/core/config.hpp>#include <dds/core/Exception.hpp>#include <dds/dds.h>#include <ios>#include <stdarg.h>
//#define _OS_WARNING 2//#define _OS_ERROR 4
#define ISOCPP_ERROR org::eclipse::cyclonedds::core::utils::error_code#define ISOCPP_UNSUPPORTED_ERROR org::eclipse::cyclonedds::core::utils::unsupported_error_code#define ISOCPP_INVALID_ARGUMENT_ERROR org::eclipse::cyclonedds::core::utils::invalid_argument_code#define ISOCPP_PRECONDITION_NOT_MET_ERROR org::eclipse::cyclonedds::core::utils::precondition_not_met_error_code#define ISOCPP_OUT_OF_RESOURCES_ERROR org::eclipse::cyclonedds::core::utils::out_of_resources_error_code#define ISOCPP_NOT_ENABLED_ERROR org::eclipse::cyclonedds::core::utils::not_enabled_error_code#define ISOCPP_IMMUTABLE_POLICY_ERROR org::eclipse::cyclonedds::core::utils::immutable_policy_error_code#define ISOCPP_INCONSISTENT_POLICY_ERROR org::eclipse::cyclonedds::core::utils::inconsistent_policy_error_code#define ISOCPP_ALREADY_CLOSED_ERROR org::eclipse::cyclonedds::core::utils::already_closed_error_code#define ISOCPP_TIMEOUT_ERROR org::eclipse::cyclonedds::core::utils::timeout_error_code#define ISOCPP_NO_DATA_ERROR org::eclipse::cyclonedds::core::utils::no_data_error_code#define ISOCPP_ILLEGAL_OPERATION_ERROR org::eclipse::cyclonedds::core::utils::illegal_operation_error_code#define ISOCPP_NULL_REFERENCE_ERROR org::eclipse::cyclonedds::core::utils::null_reference_error_code
/* \brief OS_FUNCTION provides undecorated function name of current function * * Behavior of OS_FUNCTION outside a function is undefined. Note that * implementations differ across compilers and compiler versions. It might be * implemented as either a string literal or a constant variable. */#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)# define OS_FUNCTION __func__#elif defined(__cplusplus) && (__cplusplus >= 201103)# define OS_FUNCTION __func__#elif defined(__GNUC__)# define OS_FUNCTION __FUNCTION__#elif defined(__clang__)# define OS_FUNCTION __FUNCTION__#elif defined(__ghs__)# define OS_FUNCTION __FUNCTION__#elif (defined(__SUNPRO_C) || defined(__SUNPRO_CC))/* Solaris Studio had support for __func__ before it supported __FUNCTION__. Compiler flag -features=extensions is required on older versions. */# define OS_FUNCTION __func__#elif defined(__FUNCTION__)/* Visual Studio */# define OS_FUNCTION __FUNCTION__#elif defined(__vxworks)/* At least versions 2.9.6 and 3.3.4 of the GNU C Preprocessor only define __GNUC__ if the entire GNU C compiler is in use. VxWorks 5.5 targets invoke the preprocessor separately resulting in __GNUC__ not being defined. */# define OS_FUNCTION __FUNCTION__#else# warning "OS_FUNCTION is not supported"#endif
/* \brief OS_PRETTY_FUNCTION provides function signature of current function * * See comments on OS_FUNCTION for details. */#if defined(__GNUC__)# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#elif defined(__clang__)# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#elif defined(__ghs__)# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#elif (defined(__SUNPRO_C) && __SUNPRO_C >= 0x5100)/* Solaris Studio supports __PRETTY_FUNCTION__ in C since version 12.1 */# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#elif (defined(__SUNPRO_CC) && __SUNPRO_CC >= 0x5120)/* Solaris Studio supports __PRETTY_FUNCTION__ in C++ since version 12.3 */# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#elif defined(__FUNCSIG__)/* Visual Studio */# define OS_PRETTY_FUNCTION __FUNCSIG__#elif defined(__vxworks)/* See comments on __vxworks macro above. */# define OS_PRETTY_FUNCTION __PRETTY_FUNCTION__#else/* Do not warn user about OS_PRETTY_FUNCTION falling back to OS_FUNCTION.# warning "OS_PRETTY_FUNCTION is not supported, using OS_FUNCTION"*/# define OS_PRETTY_FUNCTION OS_FUNCTION#endif
#define ISOCPP_DDSC_RESULT_CHECK_AND_THROW(code, ...) \ org::eclipse::cyclonedds::core::utils::check_ddsc_result_and_throw_exception( \ static_cast<dds_return_t>(code), \ __FILE__, \ __LINE__, \ OS_PRETTY_FUNCTION, \ __VA_ARGS__) \
#define ISOCPP_THROW_EXCEPTION(code, ...) \ org::eclipse::cyclonedds::core::utils::throw_exception( \ (code), \ __FILE__, \ __LINE__, \ OS_PRETTY_FUNCTION, \ __VA_ARGS__) \
#define ISOCPP_BOOL_CHECK_AND_THROW(test, code, ...) \ if (!(test)) { \ ISOCPP_THROW_EXCEPTION(code, __VA_ARGS__); \ }
namespace org{namespace eclipse{namespace cyclonedds{namespace core{namespace utils{
const int32_t error_code = 1;const int32_t unsupported_error_code = 2;const int32_t invalid_argument_code = 3;const int32_t precondition_not_met_error_code = 4;const int32_t out_of_resources_error_code = 5;const int32_t not_enabled_error_code = 6;const int32_t immutable_policy_error_code = 7;const int32_t inconsistent_policy_error_code = 8;const int32_t already_closed_error_code = 9;const int32_t timeout_error_code = 10;const int32_t no_data_error_code = 11;const int32_t illegal_operation_error_code = 12;const int32_t null_reference_error_code = 13;
OMG_DDS_API voidreport( int32_t code, int32_t reportType, const char *file, int32_t line, const char *signature, const char *format, ...);
OMG_DDS_API voidthrow_exception( int32_t code, const char *file, int32_t line, const char *signature, const char *format, ...);
OMG_DDS_API voidcheck_ddsc_result_and_throw_exception( dds_return_t code, const char *file, int32_t line, const char *signature, const char *format, ...);
}}}}}
#endif /* CYCLONEDDS_CORE_REPORT_UTILS_HPP_ */123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103/* * 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 */
/** * @file */
#ifndef CYCLONEDDS_CORE_SCOPEDLOCK_HPP_#define CYCLONEDDS_CORE_SCOPEDLOCK_HPP_
#include <org/eclipse/cyclonedds/core/Mutex.hpp>#include <org/eclipse/cyclonedds/core/ObjectDelegate.hpp>
#include <cassert>
namespace org{namespace eclipse{namespace cyclonedds{namespace core{
template <typename LOCKABLE>class OMG_DDS_API ScopedLock{public: ScopedLock(const LOCKABLE& obj, bool lock = true) : lockable(obj), owner(lock) { if (lock) { lockable.lock(); } }
virtual ~ScopedLock() { if (owner) { try { lockable.unlock(); } catch (...) { /* Don't know what to do anymore (it should have never failed)... */ assert(false); } } }
void lock() { assert(!owner); lockable.lock(); owner = true; }
bool try_lock() { bool locked; locked = lockable.try_lock(); if (locked) { owner = true; } return locked; }
void unlock() { assert(owner); owner = false; lockable.unlock(); }
bool own() const { return owner; }
private: const LOCKABLE& lockable; bool owner;};
typedef ScopedLock<Mutex> ScopedMutexLock;typedef ScopedLock<ObjectDelegate> ScopedObjectLock;
}}}}
#endif /* CYCLONEDDS_CORE_SCOPEDLOCK_HPP_ */12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091/* * 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 */
/** * @file * * Unfortunately, we need this because we can not change the Duration.hpp and Time.hpp * and we don't want this piece of code repeated in every function within their * implementation files. */
#ifndef CYCLONEDDS_CORE_TIME_HELPER_HPP_#define CYCLONEDDS_CORE_TIME_HELPER_HPP_
#include <sstream>#include <dds/dds.h>#include <org/eclipse/cyclonedds/core/ReportUtils.hpp>
#define MS 1000#define MiS 1000000#define NS 1000000000
namespace org{namespace eclipse{namespace cyclonedds{namespace core{namespace timehelper{
/*** Check if the TIMEISH value supplied is at all suitable for arithmetic jiggery* pokery. Invalidity encompasses (but is not restricted to) a -1 seconds part* an 'infinity' Duration, an 'invalid' Time (or Duration).* @param t the TIMEISH thing to check* @return true if the argument is not suitable for doing sums with.*/template <typename TIMEISH>bool is_valid_for_arithmetic(const TIMEISH& t){ return (t.sec() != -1 // Invalid && t.sec() != 0x7FFFFFFF // Infinity && t.nanosec() < 1000000000); // Invalid & infinity are > 10^9}
/*** Check a TIMEISH is valid for doing sums with.* @param t the TIMEISH thing to check* @param context Some sort of clue to the receiver about what was* called or what you were trying to do. Must be a literal or c_str.* Defaults to "".* @param function String to be concateneated onto context.* Must be a literal or c_str. Defaults to "".* @throws a dds::core::InvalidDataError if not valid.* @see OSPL_CONTEXT_LITERAL* @see is_valid_for_arithmetic*/template <typename TIMEISH>void validate(const TIMEISH& t, const char* context = "timehelper", const char* function = "validate"){ if(! is_valid_for_arithmetic<TIMEISH>(t)) { std::stringstream message("dds::core::InvalidDataError"); message << "Value invalid for arithmetic operations" << context << function << " seconds=" << t.sec() << " (" << std::hex << t.sec() << ") nanoseconds=" << t.nanosec() << " (" << std::hex << t.nanosec() << ")"; ISOCPP_THROW_EXCEPTION(ISOCPP_ILLEGAL_OPERATION_ERROR, message.str().c_str()); }}
}}}}}
#endif /* CYCLONEDDS_CORE_TIME_HELPER_HPP_ */third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TContentFilteredTopic.hppAdded+160
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TFilter.hppAdded+186
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TMultiTopic.hppAdded+74
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopic.hppAdded+429
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TTopicDescription.hppAdded+85
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/Topic.hppAdded+41
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicDescription.hppAdded+33
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicInstance.hppAdded+116
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicListener.hppAdded+144
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/TopicTraits.hppAdded+92
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/ddstopic.hppAdded+31
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/AnyTopic.hppAdded+30
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopic.hppAdded+46
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/BuiltinTopicKey.hppAdded+29
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ContentFilteredTopic.hppAdded+470
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Filter.hppAdded+25
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/MultiTopic.hppAdded+135
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TAnyTopicImpl.hppAdded+73
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicImpl.hppAdded+580
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TBuiltinTopicKeyImpl.hppAdded+48
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TContentFilteredTopicImpl.hppAdded+77
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TFilterImpl.hppAdded+105
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicDescriptionImpl.hppAdded+54
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TTopicImpl.hppAdded+395
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/Topic.hppAdded+131
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicDescription.hppAdded+30
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/TopicInstanceImpl.hppAdded+83
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/ddstopic.hppAdded+20
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/discovery.hppAdded+100
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/detail/find.hppAdded+46
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/discovery.hppAdded+153
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/find.hppAdded+53
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/TopicQos.hppAdded+36
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/dds/topic/qos/detail/TopicQos.hppAdded+93
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/ForwardDeclarations.hppAdded+120
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/DDScObjectDelegate.hppAdded+74
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityDelegate.hppAdded+140
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntityRegistry.hppAdded+95
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/EntitySet.hppAdded+94
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/InstanceHandleDelegate.hppAdded+71
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ListenerDispatcher.hppAdded+57
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/MiscUtils.hppAdded+90
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Missing.hppAdded+36
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/Mutex.hppAdded+51
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectDelegate.hppAdded+71
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ObjectSet.hppAdded+80
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/QosProviderDelegate.hppAdded+81
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ReportUtils.hppAdded+191
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/ScopedLock.hppAdded+103
third-party/GR00T-WholeBodyControl/gear_sonic_deploy/thirdparty/unitree_sdk2/thirdparty/include/ddscxx/org/eclipse/cyclonedds/core/TimeHelper.hppAdded+91