init
This commit is contained in:
@@ -0,0 +1,113 @@
|
||||
/*
|
||||
* 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_TOPIC_ANYTOPICDELEGATE_HPP_
|
||||
#define CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_
|
||||
|
||||
|
||||
#include <dds/core/types.hpp>
|
||||
#include <org/eclipse/cyclonedds/topic/TopicTraits.hpp>
|
||||
#include <org/eclipse/cyclonedds/core/EntityDelegate.hpp>
|
||||
#include <org/eclipse/cyclonedds/topic/TopicDescriptionDelegate.hpp>
|
||||
|
||||
|
||||
namespace dds { namespace topic {
|
||||
template <typename DELEGATE>
|
||||
class TAnyTopic;
|
||||
} }
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
DDSCXX_WARNING_MSVC_OFF(4250)
|
||||
|
||||
class OMG_DDS_API AnyTopicDelegate :
|
||||
public virtual org::eclipse::cyclonedds::core::EntityDelegate,
|
||||
public virtual org::eclipse::cyclonedds::topic::TopicDescriptionDelegate
|
||||
{
|
||||
public:
|
||||
typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::ref_type ref_type;
|
||||
typedef ::dds::core::smart_ptr_traits< AnyTopicDelegate >::weak_ref_type weak_ref_type;
|
||||
|
||||
AnyTopicDelegate(const dds::topic::qos::TopicQos& qos,
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& name,
|
||||
const std::string& type_name,
|
||||
dds_entity_t ddsc_topic);
|
||||
|
||||
virtual ~AnyTopicDelegate();
|
||||
|
||||
public:
|
||||
/* DDS API mirror. */
|
||||
dds::topic::qos::TopicQos qos() const;
|
||||
void qos(const dds::topic::qos::TopicQos& qos);
|
||||
|
||||
::dds::core::status::InconsistentTopicStatus inconsistent_topic_status() const;
|
||||
|
||||
std::string reader_expression() const;
|
||||
|
||||
TEMP_TYPE reader_parameters() const;
|
||||
//@todo c_value *reader_parameters() const;
|
||||
|
||||
public:
|
||||
dds::topic::TAnyTopic<AnyTopicDelegate> wrapper_to_any();
|
||||
|
||||
void init(ObjectDelegate::weak_ref_type weak_ref);
|
||||
|
||||
void listener_notify(ObjectDelegate::ref_type,
|
||||
uint32_t,
|
||||
void *,
|
||||
void *) {}
|
||||
|
||||
static dds::topic::TAnyTopic<AnyTopicDelegate>
|
||||
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::TAnyTopic<AnyTopicDelegate> >& topics,
|
||||
uint32_t max_size);
|
||||
|
||||
void set_sample(void* sample);
|
||||
void* get_sample();
|
||||
|
||||
protected:
|
||||
AnyTopicDelegate(const dds::topic::qos::TopicQos& qos,
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& name,
|
||||
const std::string& type_name);
|
||||
|
||||
dds::topic::qos::TopicQos qos_;
|
||||
void* sample_;
|
||||
};
|
||||
|
||||
DDSCXX_WARNING_MSVC_ON(4250)
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_ANYTOPICDELEGATE_HPP_ */
|
@@ -0,0 +1,47 @@
|
||||
/*
|
||||
* 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_TOPIC_ANY_TOPIC_LISTENER_HPP_
|
||||
#define CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_
|
||||
|
||||
|
||||
#include <dds/topic/AnyTopicListener.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
class OMG_DDS_API AnyTopicListener
|
||||
{
|
||||
public:
|
||||
virtual ~AnyTopicListener() { }
|
||||
};
|
||||
|
||||
|
||||
class OMG_DDS_API NoOpAnyTopicListener : public virtual AnyTopicListener
|
||||
{
|
||||
public:
|
||||
virtual ~NoOpAnyTopicListener() { }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_ANY_TOPIC_LISTENER_HPP_ */
|
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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_TOPIC_BUILTIN_TOPIC_HPP_
|
||||
#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_
|
||||
|
||||
|
||||
#include <org/eclipse/cyclonedds/topic/TBuiltinTopic.hpp>
|
||||
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
typedef TCMParticipantBuiltinTopicData<CMParticipantBuiltinTopicDataDelegate>
|
||||
CMParticipantBuiltinTopicData;
|
||||
|
||||
typedef TCMPublisherBuiltinTopicData<CMPublisherBuiltinTopicDataDelegate>
|
||||
CMPublisherBuiltinTopicData;
|
||||
|
||||
typedef TCMSubscriberBuiltinTopicData<CMSubscriberBuiltinTopicDataDelegate>
|
||||
CMSubscriberBuiltinTopicData;
|
||||
|
||||
typedef TCMDataWriterBuiltinTopicData<CMDataWriterBuiltinTopicDataDelegate>
|
||||
CMDataWriterBuiltinTopicData;
|
||||
|
||||
typedef TCMDataReaderBuiltinTopicData<CMDataReaderBuiltinTopicDataDelegate>
|
||||
CMDataReaderBuiltinTopicData;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_HPP_ */
|
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* 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_TOPIC_BUILTIN_TOPIC_COPY_HPP_
|
||||
#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_
|
||||
|
||||
/* TODO: add builtin topic copyin copyout function declarations. */
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_COPY_HPP_ */
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,71 @@
|
||||
/*
|
||||
* 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_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_
|
||||
#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
class BuiltinTopicKeyDelegate
|
||||
{
|
||||
public:
|
||||
typedef uint32_t VALUE_T;
|
||||
public:
|
||||
BuiltinTopicKeyDelegate() { }
|
||||
BuiltinTopicKeyDelegate(int32_t v[])
|
||||
{
|
||||
key_[0] = v[0];
|
||||
key_[1] = v[1];
|
||||
key_[2] = v[2];
|
||||
}
|
||||
public:
|
||||
const int32_t* value() const
|
||||
{
|
||||
return key_;
|
||||
}
|
||||
|
||||
void value(int32_t v[])
|
||||
{
|
||||
key_[0] = v[0];
|
||||
key_[1] = v[1];
|
||||
key_[2] = v[2];
|
||||
}
|
||||
|
||||
bool operator ==(const BuiltinTopicKeyDelegate& other) const
|
||||
{
|
||||
return other.key_[0] == key_[0]
|
||||
&& other.key_[1] == key_[1]
|
||||
&& other.key_[2] == key_[2];
|
||||
}
|
||||
|
||||
private:
|
||||
int32_t key_[3];
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_KEY_DELEGATE_HPP_ */
|
@@ -0,0 +1,21 @@
|
||||
/*
|
||||
* 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_TOPIC_BUILTIN_TOPIC_TRAITS_HPP
|
||||
#define CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP
|
||||
|
||||
#include <dds/topic/BuiltinTopic.hpp>
|
||||
#include <org/eclipse/cyclonedds/topic/TopicTraits.hpp>
|
||||
#include <org/eclipse/cyclonedds/topic/BuiltinTopicCopy.hpp>
|
||||
|
||||
/* TODO: add builtin topic traits. */
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_BUILTIN_TOPIC_TRAITS_HPP */
|
@@ -0,0 +1,68 @@
|
||||
/*
|
||||
* 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_TOPIC_CDRBLOB_HPP
|
||||
#define CYCLONEDDS_TOPIC_CDRBLOB_HPP
|
||||
|
||||
#include <array>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
enum class BlobKind
|
||||
{
|
||||
Empty,
|
||||
KeyOnly,
|
||||
Data,
|
||||
};
|
||||
|
||||
class CDRBlob
|
||||
{
|
||||
private:
|
||||
std::array<char, 4> encoding_ = { };
|
||||
BlobKind kind_ = BlobKind::Empty;
|
||||
std::vector<uint8_t> payload_;
|
||||
|
||||
public:
|
||||
CDRBlob() = default;
|
||||
|
||||
explicit CDRBlob(
|
||||
const std::array<char, 4>& encoding,
|
||||
BlobKind kind,
|
||||
const std::vector<uint8_t>& payload) :
|
||||
encoding_(encoding),
|
||||
kind_(kind),
|
||||
payload_(payload) {}
|
||||
|
||||
const std::array<char, 4>& encoding() const { return this->encoding_; }
|
||||
std::array<char, 4>& encoding() { return this->encoding_; }
|
||||
void encoding(const std::array<char, 4>& _val_) { this->encoding_ = _val_; }
|
||||
void encoding(std::array<char, 4>&& _val_) { this->encoding_ = _val_; }
|
||||
BlobKind kind() const { return this->kind_; }
|
||||
BlobKind& kind() { return this->kind_; }
|
||||
void kind(BlobKind _val_) { this->kind_ = _val_; }
|
||||
const std::vector<uint8_t>& payload() const { return this->payload_; }
|
||||
std::vector<uint8_t>& payload() { return this->payload_; }
|
||||
void payload(const std::vector<uint8_t>& _val_) { this->payload_ = _val_; }
|
||||
void payload(std::vector<uint8_t>&& _val_) { this->payload_ = _val_; }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_CDRBLOB_HPP */
|
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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_FILTER_HPP_
|
||||
#define CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
// Implementation
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
|
||||
#include <dds/core/detail/inttypes.hpp>
|
||||
#include <dds/core/macros.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
DDSCXX_WARNING_MSVC_OFF(4251)
|
||||
|
||||
class OMG_DDS_API FilterDelegate
|
||||
{
|
||||
public:
|
||||
typedef std::vector<std::string>::iterator iterator;
|
||||
typedef std::vector<std::string>::const_iterator const_iterator;
|
||||
|
||||
public:
|
||||
FilterDelegate();
|
||||
FilterDelegate(const std::string& query_expression);
|
||||
|
||||
|
||||
template <typename FWIterator>
|
||||
FilterDelegate(const std::string& query_expression,
|
||||
const FWIterator& params_begin, const FWIterator& params_end)
|
||||
: myExpression(query_expression)
|
||||
{
|
||||
std::copy(params_begin, params_end, std::back_insert_iterator<std::vector<std::string> >(myParams));
|
||||
}
|
||||
|
||||
const std::string& expression() const;
|
||||
|
||||
/**
|
||||
* @internal Provides the begin iterator to the parameter list.
|
||||
*/
|
||||
const_iterator begin() const;
|
||||
|
||||
/**
|
||||
* @internal The const end iterator to the parameter list.
|
||||
*/
|
||||
const_iterator end() const;
|
||||
|
||||
/**
|
||||
* @internal Provides the begin const iterator to the parameter list.
|
||||
*/
|
||||
iterator begin();
|
||||
|
||||
/**
|
||||
* @internal The end iterator to the parameter list.
|
||||
*/
|
||||
iterator end();
|
||||
|
||||
template <typename FWIterator>
|
||||
void parameters(const FWIterator& begin, const FWIterator end)
|
||||
{
|
||||
myParams.erase(myParams.begin(), myParams.end());
|
||||
std::copy(begin, end, std::back_insert_iterator<std::vector<std::string> >(myParams));
|
||||
}
|
||||
|
||||
void add_parameter(const std::string& param);
|
||||
|
||||
uint32_t parameters_length() const;
|
||||
|
||||
bool operator ==(const FilterDelegate& other) const;
|
||||
|
||||
private:
|
||||
std::string myExpression;
|
||||
std::vector<std::string> myParams;
|
||||
};
|
||||
|
||||
DDSCXX_WARNING_MSVC_ON(4251)
|
||||
|
||||
// End of implementation
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_DDS_TOPIC_DETAIL_FILTER_HPP_ */
|
@@ -0,0 +1,186 @@
|
||||
/*
|
||||
* 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_TOPIC_TBUILTIN_TOPIC_HPP_
|
||||
#define CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_
|
||||
|
||||
|
||||
#include <dds/core/detail/conformance.hpp>
|
||||
#include <dds/core/Value.hpp>
|
||||
#include <dds/core/policy/CorePolicy.hpp>
|
||||
#include <dds/topic/BuiltinTopicKey.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
template <typename D>
|
||||
class TCMParticipantBuiltinTopicData;
|
||||
|
||||
template <typename D>
|
||||
class TCMPublisherBuiltinTopicData;
|
||||
|
||||
template <typename D>
|
||||
class TCMSubscriberBuiltinTopicData;
|
||||
|
||||
template <typename D>
|
||||
class TCMDataWriterBuiltinTopicData;
|
||||
|
||||
template <typename D>
|
||||
class TCMDataReaderBuiltinTopicData;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The CMParticipant topic...
|
||||
*/
|
||||
template <typename D>
|
||||
class org::eclipse::cyclonedds::topic::TCMParticipantBuiltinTopicData : public ::dds::core::Value<D>
|
||||
{
|
||||
public:
|
||||
const dds::topic::BuiltinTopicKey& key() const
|
||||
{
|
||||
return this->delegate().key();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The CMPublisher topic...
|
||||
*/
|
||||
template <typename D>
|
||||
class org::eclipse::cyclonedds::topic::TCMPublisherBuiltinTopicData : public ::dds::core::Value<D>
|
||||
{
|
||||
public:
|
||||
const dds::topic::BuiltinTopicKey& key() const
|
||||
{
|
||||
return this->delegate().key();
|
||||
}
|
||||
const dds::topic::BuiltinTopicKey& participant_key() const
|
||||
{
|
||||
return this->delegate().participant_key();
|
||||
}
|
||||
const std::string& name() const
|
||||
{
|
||||
return this->delegate().name();
|
||||
}
|
||||
const ::dds::core::policy::EntityFactory& entity_factory() const
|
||||
{
|
||||
return this->delegate().entity_factory();
|
||||
}
|
||||
const ::dds::core::policy::Partition& partition() const
|
||||
{
|
||||
return this->delegate().partition();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The CMSubscriber topic...
|
||||
*/
|
||||
template <typename D>
|
||||
class org::eclipse::cyclonedds::topic::TCMSubscriberBuiltinTopicData : public ::dds::core::Value<D>
|
||||
{
|
||||
public:
|
||||
const dds::topic::BuiltinTopicKey& key() const
|
||||
{
|
||||
return this->delegate().key();
|
||||
}
|
||||
const dds::topic::BuiltinTopicKey& participant_key() const
|
||||
{
|
||||
return this->delegate().participant_key();
|
||||
}
|
||||
const std::string& name() const
|
||||
{
|
||||
return this->delegate().name();
|
||||
}
|
||||
const ::dds::core::policy::EntityFactory& entity_factory() const
|
||||
{
|
||||
return this->delegate().entity_factory();
|
||||
}
|
||||
const ::dds::core::policy::Partition& partition() const
|
||||
{
|
||||
return this->delegate().partition();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The CMDataWriter topic...
|
||||
*/
|
||||
template <typename D>
|
||||
class org::eclipse::cyclonedds::topic::TCMDataWriterBuiltinTopicData : public ::dds::core::Value<D>
|
||||
{
|
||||
public:
|
||||
const dds::topic::BuiltinTopicKey& key() const
|
||||
{
|
||||
return this->delegate().key();
|
||||
}
|
||||
const dds::topic::BuiltinTopicKey& publisher_key() const
|
||||
{
|
||||
return this->delegate().publisher_key();
|
||||
}
|
||||
const std::string& name() const
|
||||
{
|
||||
return this->delegate().name();
|
||||
}
|
||||
const ::dds::core::policy::History& history() const
|
||||
{
|
||||
return this->delegate().history();
|
||||
}
|
||||
const ::dds::core::policy::ResourceLimits& resource_limits() const
|
||||
{
|
||||
return this->delegate().resource_limits();
|
||||
}
|
||||
const ::dds::core::policy::WriterDataLifecycle& writer_data_lifecycle() const
|
||||
{
|
||||
return this->delegate().writer_data_lifecycle();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* The CMDataReader topic...
|
||||
*/
|
||||
template <typename D>
|
||||
class org::eclipse::cyclonedds::topic::TCMDataReaderBuiltinTopicData : public ::dds::core::Value<D>
|
||||
{
|
||||
public:
|
||||
const dds::topic::BuiltinTopicKey& key() const
|
||||
{
|
||||
return this->delegate().key();
|
||||
}
|
||||
const dds::topic::BuiltinTopicKey& subscriber_key() const
|
||||
{
|
||||
return this->delegate().subscriber_key();
|
||||
}
|
||||
const std::string& name() const
|
||||
{
|
||||
return this->delegate().name();
|
||||
}
|
||||
const ::dds::core::policy::History& history() const
|
||||
{
|
||||
return this->delegate().history();
|
||||
}
|
||||
const ::dds::core::policy::ResourceLimits& resource_limits() const
|
||||
{
|
||||
return this->delegate().resource_limits();
|
||||
}
|
||||
const ::dds::core::policy::ReaderDataLifecycle& reader_data_lifecycle() const
|
||||
{
|
||||
return this->delegate().reader_data_lifecycle();
|
||||
}
|
||||
};
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_TBUILTIN_TOPIC_HPP_ */
|
@@ -0,0 +1,88 @@
|
||||
/*
|
||||
* 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_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_
|
||||
#define CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_
|
||||
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
#include <org/eclipse/cyclonedds/core/ObjectDelegate.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
class OMG_DDS_API TopicDescriptionDelegate : public virtual org::eclipse::cyclonedds::core::DDScObjectDelegate
|
||||
{
|
||||
public:
|
||||
typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::ref_type ref_type;
|
||||
typedef ::dds::core::smart_ptr_traits< TopicDescriptionDelegate >::weak_ref_type weak_ref_type;
|
||||
|
||||
public:
|
||||
TopicDescriptionDelegate(const dds::domain::DomainParticipant& dp,
|
||||
const std::string& name,
|
||||
const std::string& type_name);
|
||||
virtual ~TopicDescriptionDelegate();
|
||||
|
||||
public:
|
||||
|
||||
/**
|
||||
* @internal Get the name used to create the TopicDescription.
|
||||
*/
|
||||
const std::string& name() const;
|
||||
|
||||
/**
|
||||
* @internal The type_name used to create the TopicDescription.
|
||||
*/
|
||||
const std::string& type_name() const;
|
||||
|
||||
/**
|
||||
* @internal This operation returns the DomainParticipant to which the
|
||||
* TopicDescription belongs.
|
||||
*/
|
||||
const dds::domain::DomainParticipant& domain_participant() const;
|
||||
|
||||
void incrNrDependents();
|
||||
|
||||
void decrNrDependents();
|
||||
|
||||
bool hasDependents() const;
|
||||
|
||||
virtual std::string reader_expression() const = 0;
|
||||
|
||||
//@todo virtual c_value *reader_parameters() const = 0;
|
||||
|
||||
ddsi_sertype *get_ser_type() const;
|
||||
|
||||
protected:
|
||||
dds::domain::DomainParticipant myParticipant;
|
||||
std::string myTopicName;
|
||||
std::string myTypeName;
|
||||
uint32_t nrDependents;
|
||||
ddsi_sertype *ser_type_;
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_TOPICDESCRIPTIONDELEGATE_HPP_ */
|
@@ -0,0 +1,52 @@
|
||||
/*
|
||||
* 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_TOPIC_TOPIC_LISTENER_HPP_
|
||||
#define CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_
|
||||
|
||||
|
||||
#include "dds/topic/TopicListener.hpp"
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
template <typename T>
|
||||
class TopicListener : public dds::topic::TopicListener<T>
|
||||
{
|
||||
public:
|
||||
virtual ~TopicListener() { }
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
class NoOpTopicListener : public virtual TopicListener<T>
|
||||
{
|
||||
public:
|
||||
virtual ~NoOpTopicListener() { }
|
||||
|
||||
public:
|
||||
virtual void on_inconsistent_topic(
|
||||
dds::topic::Topic<T>&,
|
||||
const dds::core::status::InconsistentTopicStatus&) { }
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_TOPIC_LISTENER_HPP_ */
|
@@ -0,0 +1,290 @@
|
||||
/*
|
||||
* 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_TOPIC_TOPICTRAITS_HPP_
|
||||
#define CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_
|
||||
|
||||
#include "dds/ddsrt/heap.h"
|
||||
#include "dds/ddsi/ddsi_serdata.h"
|
||||
#include "org/eclipse/cyclonedds/core/cdr/cdr_enums.hpp"
|
||||
#include "dds/features.hpp"
|
||||
|
||||
//forward declaration of c++ sertype wrapper
|
||||
template <typename T, class S> class ddscxx_sertype;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
|
||||
namespace core
|
||||
{
|
||||
namespace cdr
|
||||
{
|
||||
//forward declarations of streamer types
|
||||
class basic_cdr_stream;
|
||||
class xcdr_v1_stream;
|
||||
class xcdr_v2_stream;
|
||||
}
|
||||
}
|
||||
|
||||
namespace topic
|
||||
{
|
||||
|
||||
using core::cdr::extensibility;
|
||||
using core::cdr::encoding_version;
|
||||
using core::cdr::allowable_encodings_t;
|
||||
using core::cdr::basic_cdr_stream;
|
||||
using core::cdr::xcdr_v1_stream;
|
||||
using core::cdr::xcdr_v2_stream;
|
||||
|
||||
template <class TOPIC> class TopicTraits
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* @brief Returns whether TOPIC contains no key fields.
|
||||
*
|
||||
* Used in creating the CycloneDDS writer and equality comparisons with other topics.
|
||||
* This is one of the traits that is conditionally generated if there are any key fields.
|
||||
*
|
||||
* @return Whether TOPIC does not contain any fields marked as key fields.
|
||||
*/
|
||||
static constexpr bool isKeyless()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the name of the type of TOPIC.
|
||||
*
|
||||
* Used in creating the correct TopicDescription.
|
||||
* This trait is always generated for user-defined types, and this function is just a placeholder.
|
||||
*
|
||||
* @return The name of the type of TOPIC.
|
||||
*/
|
||||
static constexpr const char *getTypeName()
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns an instance of ddsi_sertype for TOPIC.
|
||||
*
|
||||
* Used by CycloneDDS-CXX to get a sertype, which contains the functions used by CycloneDDS which are specific to TOPIC.
|
||||
*
|
||||
* @param[in] kinds The serialization of the of the sertype to create.
|
||||
* @return A pointer to a new dssi_sertype.
|
||||
*/
|
||||
static ddsi_sertype *getSerType(allowable_encodings_t kinds = allowableEncodings())
|
||||
{
|
||||
if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR1)
|
||||
return static_cast<ddsi_sertype*>(new ddscxx_sertype<TOPIC,basic_cdr_stream>());
|
||||
else if (kinds & allowableEncodings() & DDS_DATA_REPRESENTATION_FLAG_XCDR2)
|
||||
return static_cast<ddsi_sertype*>(new ddscxx_sertype<TOPIC,xcdr_v2_stream>());
|
||||
else
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the size of an instance of TOPIC.
|
||||
*
|
||||
* Used by shared memory implementation to determine the size of the block necessary to contain an instance of TOPIC.
|
||||
*
|
||||
* @return The size of an instance of TOPIC.
|
||||
*/
|
||||
static constexpr size_t getSampleSize()
|
||||
{
|
||||
return sizeof(TOPIC);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns whether instances of TOPIC reference memory outside its own declaration.
|
||||
*
|
||||
* Used by shared memory implementation.
|
||||
* This trait will be generated as false if any strings or vectors are found anywhere in TOPIC's member tree.
|
||||
*
|
||||
* @return Whether TOPIC is a selfcontained type.
|
||||
*/
|
||||
static constexpr bool isSelfContained()
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the allowable encodings for this topic.
|
||||
*
|
||||
* Used to determine which encoding type to write in combination with the data representation QoS.
|
||||
*
|
||||
* @return The allowable encodings of TOPIC.
|
||||
*/
|
||||
static constexpr allowable_encodings_t allowableEncodings()
|
||||
{
|
||||
return 0xFFFFFFFFu;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the xtypes extensibility of TOPIC.
|
||||
*
|
||||
* Used to determine which encoding type to write in the CDR header.
|
||||
* This trait will be generated if the extensibility of TOPIC differs from final.
|
||||
*
|
||||
* @return The extensibility of TOPIC.
|
||||
*/
|
||||
static constexpr extensibility getExtensibility()
|
||||
{
|
||||
return extensibility::ext_final;
|
||||
}
|
||||
|
||||
#ifdef DDSCXX_HAS_TYPE_DISCOVERY
|
||||
/**
|
||||
* @brief Returns the typeid for TOPIC.
|
||||
*
|
||||
* Is a simple pass-through for the derivation of the typeid from the type information.
|
||||
* As C++ keeps the topic type as the template parameter, there is no need to look at the
|
||||
* sertype for this topic.
|
||||
*
|
||||
* @param[in] kind The kind of typeid.
|
||||
*
|
||||
* @return A pointer to the typeid of this topic.
|
||||
*/
|
||||
static ddsi_typeid_t* getTypeId(const struct ddsi_sertype *, ddsi_typeid_kind_t kind)
|
||||
{
|
||||
auto ti = getTypeInfo(NULL);
|
||||
if (ti) {
|
||||
auto id = ddsi_typeinfo_typeid(ti, kind);
|
||||
ddsi_typeinfo_fini(ti);
|
||||
ddsrt_free(ti);
|
||||
return id;
|
||||
} else {
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the type map for TOPIC.
|
||||
*
|
||||
* Takes the type map blob for this topic which is part of the generated type traits, and deserializes
|
||||
* the type map from this blob.
|
||||
*
|
||||
* @return A pointer to the typemap for this topic.
|
||||
*/
|
||||
static ddsi_typemap_t* getTypeMap(const struct ddsi_sertype *)
|
||||
{
|
||||
ddsi_sertype_cdr_data_t cdr{type_map_blob_sz(), const_cast<uint8_t*>(type_map_blob())};
|
||||
return ddsi_typemap_deser(&cdr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns the type info for TOPIC.
|
||||
*
|
||||
* Takes the type info blob for this topic which is part of the generated type traits, and deserializes
|
||||
* the type info from this blob.
|
||||
*
|
||||
* @return A pointer to the typeinfo for this topic.
|
||||
*/
|
||||
static ddsi_typeinfo_t* getTypeInfo(const struct ddsi_sertype *)
|
||||
{
|
||||
ddsi_sertype_cdr_data_t cdr{type_info_blob_sz(), const_cast<uint8_t*>(type_info_blob())};
|
||||
return ddsi_typeinfo_deser(&cdr);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns size of the blob of the cdr serialized type map.
|
||||
*
|
||||
* This function is a placeholder, it will be instantiated for all valid topics.
|
||||
*
|
||||
* @return The size of the serialized type map blob.
|
||||
*/
|
||||
static constexpr unsigned int type_map_blob_sz()
|
||||
{
|
||||
return static_cast<unsigned int>(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns size of the blob of the cdr serialized type info.
|
||||
*
|
||||
* This function is a placeholder, it will be instantiated for all valid topics.
|
||||
*
|
||||
* @return The size of the serialized type info blob.
|
||||
*/
|
||||
static constexpr unsigned int type_info_blob_sz()
|
||||
{
|
||||
return static_cast<unsigned int>(-1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns pointer to the blob of the cdr serialized type map.
|
||||
*
|
||||
* This function is a placeholder, it will be instantiated for all valid topics.
|
||||
*
|
||||
* @return Pointer to the serialized type map blob.
|
||||
*/
|
||||
static inline const uint8_t * type_map_blob()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Returns pointer to the blob of the cdr serialized type info.
|
||||
*
|
||||
* This function is a placeholder, it will be instantiated for all valid topics.
|
||||
*
|
||||
* @return Pointer to the serialized type info blob.
|
||||
*/
|
||||
static inline const uint8_t * type_info_blob()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
#endif //DDSCXX_HAS_TYPE_DISCOVERY
|
||||
|
||||
/**
|
||||
* @brief Returns a pointer to the derived sertype.
|
||||
*
|
||||
* Returns a nullptr if no type can be derived succesfully.
|
||||
*
|
||||
* @param[in] data_representation The type of data representation to use.
|
||||
*
|
||||
* @return The pointer to the derived sertype.
|
||||
*/
|
||||
static struct ddsi_sertype* deriveSertype(const struct ddsi_sertype *, dds_data_representation_id_t data_representation, dds_type_consistency_enforcement_qospolicy_t)
|
||||
{
|
||||
struct ddsi_sertype *ptr = nullptr;
|
||||
switch (data_representation) {
|
||||
case DDS_DATA_REPRESENTATION_XCDR1:
|
||||
ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR1);
|
||||
break;
|
||||
case DDS_DATA_REPRESENTATION_XCDR2:
|
||||
ptr = getSerType(DDS_DATA_REPRESENTATION_FLAG_XCDR2);
|
||||
break;
|
||||
}
|
||||
if (ptr) {
|
||||
uint32_t refc = ddsrt_atomic_ld32 (&ptr->flags_refc);
|
||||
ddsrt_atomic_st32 (&ptr->flags_refc, refc & ~DDSI_SERTYPE_REFC_MASK);
|
||||
}
|
||||
return ptr;
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_TOPICTRAITS_HPP_ */
|
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,169 @@
|
||||
/*
|
||||
* 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_TOPIC_DISCOVER_HPP_
|
||||
#define CYCLONEDDS_TOPIC_DISCOVER_HPP_
|
||||
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
#include <dds/topic/TopicDescription.hpp>
|
||||
#include <dds/topic/AnyTopic.hpp>
|
||||
#include <dds/topic/Topic.hpp>
|
||||
#include <dds/topic/ContentFilteredTopic.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
|
||||
template <typename T, typename DELEGATE>
|
||||
struct typed_lookup_topic {
|
||||
template <typename TOPIC>
|
||||
static inline TOPIC discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout);
|
||||
|
||||
template <typename TOPIC>
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<TOPIC>& list,
|
||||
uint32_t max_size);
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct typed_lookup_topic<T, dds::topic::detail::ContentFilteredTopic<T> > {
|
||||
static inline dds::topic::ContentFilteredTopic<T> discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout)
|
||||
{
|
||||
(void)dp;
|
||||
(void)topic_name;
|
||||
(void)timeout;
|
||||
ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported");
|
||||
}
|
||||
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<dds::topic::ContentFilteredTopic<T> >& list,
|
||||
uint32_t max_size)
|
||||
{
|
||||
(void)dp;
|
||||
(void)list;
|
||||
(void)max_size;
|
||||
ISOCPP_THROW_EXCEPTION(ISOCPP_UNSUPPORTED_ERROR, "Function not currently supported");
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct typed_lookup_topic<T, dds::topic::detail::Topic<T> > {
|
||||
static inline dds::topic::Topic<T> discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout)
|
||||
{
|
||||
return dds::topic::detail::Topic<T>::discover_topic(dp, topic_name, timeout);
|
||||
}
|
||||
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<dds::topic::Topic<T> >& list,
|
||||
uint32_t max_size)
|
||||
{
|
||||
dds::topic::detail::Topic<T>::discover_topics(dp, list, max_size);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename TOPIC, typename DELEGATE>
|
||||
struct lookup_topic {
|
||||
static inline TOPIC discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout)
|
||||
{
|
||||
return org::eclipse::cyclonedds::topic::typed_lookup_topic<typename TOPIC::DataType,
|
||||
typename TOPIC::DELEGATE_T>::discover(dp, topic_name, timeout);
|
||||
}
|
||||
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<TOPIC>& list,
|
||||
uint32_t max_size)
|
||||
{
|
||||
org::eclipse::cyclonedds::topic::typed_lookup_topic<typename TOPIC::DataType,
|
||||
typename TOPIC::DELEGATE_T>::discover(dp, list, max_size);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct lookup_topic<dds::topic::TopicDescription, org::eclipse::cyclonedds::topic::TopicDescriptionDelegate> {
|
||||
static inline dds::topic::TopicDescription discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout)
|
||||
{
|
||||
return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout);
|
||||
}
|
||||
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<dds::topic::TopicDescription>& list,
|
||||
uint32_t max_size)
|
||||
{
|
||||
std::vector<dds::topic::AnyTopic> anyTopics;
|
||||
org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, anyTopics, max_size);
|
||||
for (std::vector<dds::topic::AnyTopic>::iterator it = anyTopics.begin(); it != anyTopics.end(); ++it) {
|
||||
list.push_back(*it);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct lookup_topic<dds::topic::AnyTopic, org::eclipse::cyclonedds::topic::AnyTopicDelegate> {
|
||||
static inline dds::topic::AnyTopic discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name,
|
||||
const dds::core::Duration& timeout)
|
||||
{
|
||||
return org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topic(dp, topic_name, timeout);
|
||||
}
|
||||
|
||||
static inline void discover(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
std::vector<dds::topic::AnyTopic>& list,
|
||||
uint32_t max_size)
|
||||
{
|
||||
org::eclipse::cyclonedds::topic::AnyTopicDelegate::discover_topics(dp, list, max_size);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_DISCOVER_HPP_ */
|
133
unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp
Normal file
133
unitree_SDK/include/ddscxx/org/eclipse/cyclonedds/topic/find.hpp
Normal file
@@ -0,0 +1,133 @@
|
||||
/*
|
||||
* 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_TOPIC_FIND_HPP_
|
||||
#define CYCLONEDDS_TOPIC_FIND_HPP_
|
||||
|
||||
#include <dds/domain/DomainParticipant.hpp>
|
||||
#include <dds/topic/TopicDescription.hpp>
|
||||
#include <dds/topic/AnyTopic.hpp>
|
||||
#include <dds/topic/Topic.hpp>
|
||||
#include <dds/topic/ContentFilteredTopic.hpp>
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
|
||||
OMG_DDS_API dds::topic::TopicDescription
|
||||
find_topic_description(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name);
|
||||
|
||||
OMG_DDS_API dds::topic::AnyTopic
|
||||
find_any_topic(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name);
|
||||
|
||||
|
||||
template <typename T, typename DELEGATE>
|
||||
struct typed_finder {
|
||||
template <typename TOPIC>
|
||||
static inline TOPIC find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name);
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct typed_finder<T, dds::topic::detail::ContentFilteredTopic<T> > {
|
||||
static inline dds::topic::ContentFilteredTopic<T> find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name)
|
||||
{
|
||||
dds::topic::ContentFilteredTopic<T> topic = dds::core::null;
|
||||
|
||||
org::eclipse::cyclonedds::core::ObjectDelegate::ref_type entity = dp.delegate()->find_cfTopic(topic_name);
|
||||
|
||||
if (entity) {
|
||||
typename dds::topic::ContentFilteredTopic<T>::DELEGATE_REF_T topic_typed =
|
||||
::std::dynamic_pointer_cast<typename dds::topic::ContentFilteredTopic<T>::DELEGATE_T>(entity);
|
||||
topic = dds::topic::ContentFilteredTopic<T>(topic_typed);
|
||||
}
|
||||
return topic;
|
||||
}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct typed_finder<T, dds::topic::detail::Topic<T> > {
|
||||
static inline dds::topic::Topic<T> find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name)
|
||||
{
|
||||
dds::topic::Topic<T> topic = dds::core::null;
|
||||
|
||||
org::eclipse::cyclonedds::core::EntityDelegate::ref_type entity = dp.delegate()->find_topic(topic_name);
|
||||
|
||||
if (entity) {
|
||||
typename dds::topic::Topic<T>::DELEGATE_REF_T topic_typed =
|
||||
::std::dynamic_pointer_cast<typename dds::topic::Topic<T>::DELEGATE_T>(entity);
|
||||
topic = dds::topic::Topic<T>(topic_typed);
|
||||
}
|
||||
return topic;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
template <typename TOPIC, typename DELEGATE>
|
||||
struct finder {
|
||||
static inline TOPIC find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name)
|
||||
{
|
||||
return org::eclipse::cyclonedds::topic::typed_finder<typename TOPIC::DataType, typename TOPIC::DELEGATE_T>::find(dp, topic_name);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct finder<dds::topic::TopicDescription, org::eclipse::cyclonedds::topic::TopicDescriptionDelegate> {
|
||||
static inline dds::topic::TopicDescription find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name)
|
||||
{
|
||||
return find_topic_description(dp, topic_name);
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct finder<dds::topic::AnyTopic, org::eclipse::cyclonedds::topic::AnyTopicDelegate> {
|
||||
static inline dds::topic::AnyTopic find(
|
||||
const dds::domain::DomainParticipant& dp,
|
||||
const std::string& topic_name)
|
||||
{
|
||||
return find_any_topic(dp, topic_name);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_FIND_HPP_ */
|
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* Copyright(c) 2006 to 2020 ZettaScale Technology and others
|
||||
*
|
||||
* This program and the accompanying materials are made available under the
|
||||
* terms of the Eclipse Public License v. 2.0 which is available at
|
||||
* http://www.eclipse.org/legal/epl-2.0, or the Eclipse Distribution License
|
||||
* v. 1.0 which is available at
|
||||
* http://www.eclipse.org/org/documents/edl-v10.php.
|
||||
*
|
||||
* SPDX-License-Identifier: EPL-2.0 OR BSD-3-Clause
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @file
|
||||
*/
|
||||
|
||||
#ifndef IDLCXX_HASH_HPP_
|
||||
#define IDLCXX_HASH_HPP_
|
||||
|
||||
#include "dds/core/macros.hpp"
|
||||
#include "dds/ddsi/ddsi_keyhash.h"
|
||||
#include <vector>
|
||||
|
||||
namespace org
|
||||
{
|
||||
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
bool OMG_DDS_API simple_key(const std::vector<unsigned char>& in, ddsi_keyhash_t& out);
|
||||
|
||||
bool OMG_DDS_API complex_key(const std::vector<unsigned char>& in, ddsi_keyhash_t& out);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* IDLCXX_HASH_HPP_ */
|
@@ -0,0 +1,289 @@
|
||||
/*
|
||||
* 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_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_
|
||||
#define CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_
|
||||
|
||||
#include <dds/core/detail/conformance.hpp>
|
||||
#include <dds/core/policy/CorePolicy.hpp>
|
||||
|
||||
struct _DDS_NamedTopicQos;
|
||||
|
||||
namespace org
|
||||
{
|
||||
namespace eclipse
|
||||
{
|
||||
namespace cyclonedds
|
||||
{
|
||||
namespace topic
|
||||
{
|
||||
namespace qos
|
||||
{
|
||||
|
||||
class OMG_DDS_API TopicQosDelegate
|
||||
{
|
||||
public:
|
||||
TopicQosDelegate();
|
||||
|
||||
void policy(const dds::core::policy::TopicData& topic_data);
|
||||
void policy(const dds::core::policy::Durability& durability);
|
||||
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
|
||||
void policy(const dds::core::policy::DurabilityService& durability_service);
|
||||
#endif // OMG_DDS_PERSISTENCE_SUPPORT
|
||||
void policy(const dds::core::policy::Deadline& deadline);
|
||||
void policy(const dds::core::policy::LatencyBudget& budget);
|
||||
void policy(const dds::core::policy::Liveliness& liveliness);
|
||||
void policy(const dds::core::policy::Reliability& reliability);
|
||||
void policy(const dds::core::policy::DestinationOrder& order);
|
||||
void policy(const dds::core::policy::History& history);
|
||||
void policy(const dds::core::policy::ResourceLimits& resources);
|
||||
void policy(const dds::core::policy::TransportPriority& priority);
|
||||
void policy(const dds::core::policy::Lifespan& lifespan);
|
||||
void policy(const dds::core::policy::Ownership& ownership);
|
||||
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
void policy(const dds::core::policy::DataRepresentation& datarepresentation);
|
||||
void policy(const dds::core::policy::TypeConsistencyEnforcement& typeconsistencyenforcement);
|
||||
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
|
||||
template <typename POLICY> const POLICY& policy() const;
|
||||
template <typename POLICY> POLICY& policy();
|
||||
|
||||
/* The returned ddsc QoS has to be freed. */
|
||||
dds_qos_t* ddsc_qos() const;
|
||||
void ddsc_qos(const dds_qos_t* qos);
|
||||
|
||||
void named_qos(const struct _DDS_NamedTopicQos &qos);
|
||||
|
||||
void check() const;
|
||||
|
||||
bool operator ==(const TopicQosDelegate& other) const;
|
||||
|
||||
private:
|
||||
dds::core::policy::TopicData topic_data_;
|
||||
dds::core::policy::Durability durability_;
|
||||
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
|
||||
dds::core::policy::DurabilityService durability_service_;
|
||||
#endif // OMG_DDS_PERSISTENCE_SUPPORT
|
||||
dds::core::policy::Deadline deadline_;
|
||||
dds::core::policy::LatencyBudget budget_;
|
||||
dds::core::policy::Liveliness liveliness_;
|
||||
dds::core::policy::Reliability reliability_;
|
||||
dds::core::policy::DestinationOrder order_;
|
||||
dds::core::policy::History history_;
|
||||
dds::core::policy::ResourceLimits resources_;
|
||||
dds::core::policy::TransportPriority priority_;
|
||||
dds::core::policy::Lifespan lifespan_;
|
||||
dds::core::policy::Ownership ownership_;
|
||||
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
dds::core::policy::DataRepresentation datarepresentation_;
|
||||
dds::core::policy::TypeConsistencyEnforcement typeconsistencyenforcement_;
|
||||
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
};
|
||||
|
||||
|
||||
|
||||
//==============================================================================
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::TopicData&
|
||||
TopicQosDelegate::policy<dds::core::policy::TopicData>() const
|
||||
{
|
||||
return topic_data_;
|
||||
}
|
||||
template<> inline dds::core::policy::TopicData&
|
||||
TopicQosDelegate::policy<dds::core::policy::TopicData>()
|
||||
{
|
||||
return topic_data_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Durability&
|
||||
TopicQosDelegate::policy<dds::core::policy::Durability>() const
|
||||
{
|
||||
return durability_;
|
||||
}
|
||||
template<> inline dds::core::policy::Durability&
|
||||
TopicQosDelegate::policy<dds::core::policy::Durability>()
|
||||
{
|
||||
return durability_;
|
||||
}
|
||||
|
||||
|
||||
#ifdef OMG_DDS_PERSISTENCE_SUPPORT
|
||||
template<> inline const dds::core::policy::DurabilityService&
|
||||
TopicQosDelegate::policy<dds::core::policy::DurabilityService>() const
|
||||
{
|
||||
return durability_service_;
|
||||
}
|
||||
template<> inline dds::core::policy::DurabilityService&
|
||||
TopicQosDelegate::policy<dds::core::policy::DurabilityService>()
|
||||
{
|
||||
return durability_service_;
|
||||
}
|
||||
#endif // OMG_DDS_PERSISTENCE_SUPPORT
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Deadline&
|
||||
TopicQosDelegate::policy<dds::core::policy::Deadline>() const
|
||||
{
|
||||
return deadline_;
|
||||
}
|
||||
template<> inline dds::core::policy::Deadline&
|
||||
TopicQosDelegate::policy<dds::core::policy::Deadline>()
|
||||
{
|
||||
return deadline_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::LatencyBudget&
|
||||
TopicQosDelegate::policy<dds::core::policy::LatencyBudget>() const
|
||||
{
|
||||
return budget_;
|
||||
}
|
||||
template<> inline dds::core::policy::LatencyBudget&
|
||||
TopicQosDelegate::policy<dds::core::policy::LatencyBudget>()
|
||||
{
|
||||
return budget_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Liveliness&
|
||||
TopicQosDelegate::policy<dds::core::policy::Liveliness>() const
|
||||
{
|
||||
return liveliness_;
|
||||
}
|
||||
template<> inline dds::core::policy::Liveliness&
|
||||
TopicQosDelegate::policy<dds::core::policy::Liveliness>()
|
||||
{
|
||||
return liveliness_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Reliability&
|
||||
TopicQosDelegate::policy<dds::core::policy::Reliability>() const
|
||||
{
|
||||
return reliability_;
|
||||
}
|
||||
template<> inline dds::core::policy::Reliability&
|
||||
TopicQosDelegate::policy<dds::core::policy::Reliability>()
|
||||
{
|
||||
return reliability_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::DestinationOrder&
|
||||
TopicQosDelegate::policy<dds::core::policy::DestinationOrder>() const
|
||||
{
|
||||
return order_;
|
||||
}
|
||||
template<> inline dds::core::policy::DestinationOrder&
|
||||
TopicQosDelegate::policy<dds::core::policy::DestinationOrder>()
|
||||
{
|
||||
return order_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::History&
|
||||
TopicQosDelegate::policy<dds::core::policy::History>() const
|
||||
{
|
||||
return history_;
|
||||
}
|
||||
template<> inline dds::core::policy::History&
|
||||
TopicQosDelegate::policy<dds::core::policy::History>()
|
||||
{
|
||||
return history_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::ResourceLimits&
|
||||
TopicQosDelegate::policy<dds::core::policy::ResourceLimits>() const
|
||||
{
|
||||
return resources_;
|
||||
}
|
||||
template<> inline dds::core::policy::ResourceLimits&
|
||||
TopicQosDelegate::policy<dds::core::policy::ResourceLimits>()
|
||||
{
|
||||
return resources_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::TransportPriority&
|
||||
TopicQosDelegate::policy<dds::core::policy::TransportPriority>() const
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
template<> inline dds::core::policy::TransportPriority&
|
||||
TopicQosDelegate::policy<dds::core::policy::TransportPriority>()
|
||||
{
|
||||
return priority_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Lifespan&
|
||||
TopicQosDelegate::policy<dds::core::policy::Lifespan>() const
|
||||
{
|
||||
return lifespan_;
|
||||
}
|
||||
template<> inline dds::core::policy::Lifespan&
|
||||
TopicQosDelegate::policy<dds::core::policy::Lifespan>()
|
||||
{
|
||||
return lifespan_;
|
||||
}
|
||||
|
||||
|
||||
template<> inline const dds::core::policy::Ownership&
|
||||
TopicQosDelegate::policy<dds::core::policy::Ownership>() const
|
||||
{
|
||||
return ownership_;
|
||||
}
|
||||
template<> inline dds::core::policy::Ownership&
|
||||
TopicQosDelegate::policy<dds::core::policy::Ownership>()
|
||||
{
|
||||
return ownership_;
|
||||
}
|
||||
|
||||
#ifdef OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
template<> inline const dds::core::policy::DataRepresentation&
|
||||
TopicQosDelegate::policy<dds::core::policy::DataRepresentation>() const
|
||||
{
|
||||
return datarepresentation_;
|
||||
}
|
||||
template<> inline dds::core::policy::DataRepresentation&
|
||||
TopicQosDelegate::policy<dds::core::policy::DataRepresentation>()
|
||||
{
|
||||
return datarepresentation_;
|
||||
}
|
||||
|
||||
template<> inline const dds::core::policy::TypeConsistencyEnforcement&
|
||||
TopicQosDelegate::policy<dds::core::policy::TypeConsistencyEnforcement>() const
|
||||
{
|
||||
return typeconsistencyenforcement_;
|
||||
}
|
||||
template<> inline dds::core::policy::TypeConsistencyEnforcement&
|
||||
TopicQosDelegate::policy<dds::core::policy::TypeConsistencyEnforcement>()
|
||||
{
|
||||
return typeconsistencyenforcement_;
|
||||
}
|
||||
#endif // OMG_DDS_EXTENSIBLE_AND_DYNAMIC_TOPIC_TYPE_SUPPORT
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif /* CYCLONEDDS_TOPIC_QOS_TOPIC_QOS_DELEGATE_HPP_ */
|
Reference in New Issue
Block a user