Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement DDS Participants #126

Draft
wants to merge 9 commits into
base: feature/discovery_server_participant
Choose a base branch
from
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain
* @brief Create a writer object
*
* Depending on the Topic QoS creates a Basic or Specific Writer.
* If it fails to create the writer it will return a blank one.
*/
DDSPIPE_PARTICIPANTS_DllAPI
std::shared_ptr<core::IWriter> create_writer(
Expand All @@ -103,6 +104,7 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain
* @brief Create a reader object
*
* Depending on the Topic QoS creates a Basic or Specific Reader.
* If it fails to create the reader it will return a blank one.
*/
DDSPIPE_PARTICIPANTS_DllAPI
std::shared_ptr<core::IReader> create_reader(
Expand Down Expand Up @@ -130,6 +132,20 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain
const fastdds::dds::PublicationBuiltinTopicData& info,
bool& /*should_be_ignored*/) override;

//////////////////
// STATIC METHODS
//////////////////

/**
* @brief Create a transport descriptor with given whitelist.
*
* This templated method is specialized for UPDv4, UDPv6, TCPv4 and TCPv6.
*/
template<typename T>
DDSPIPE_PARTICIPANTS_DllAPI
static std::shared_ptr<T> create_descriptor(
std::set<types::IpType> whitelist = {});

protected:

/////////////////////////
Expand All @@ -140,7 +156,9 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain
CommonParticipant(
const std::shared_ptr<SimpleParticipantConfiguration>& participant_configuration,
const std::shared_ptr<core::PayloadPool>& payload_pool,
const std::shared_ptr<core::DiscoveryDatabase>& discovery_database);
const std::shared_ptr<core::DiscoveryDatabase>& discovery_database,
const core::types::DomainId& domain_id,
const fastdds::dds::DomainParticipantQos& participant_attributes);

/////////////////////////
// INTERNAL VIRTUAL METHODS
Expand Down Expand Up @@ -187,13 +205,20 @@ class CommonParticipant : public core::IParticipant, public fastdds::dds::Domain
*/
std::set<std::string> type_names_registered_;

const std::shared_ptr<SimpleParticipantConfiguration> configuration_;
//! Participant configuration
const std::shared_ptr<ParticipantConfiguration> configuration_;

//! DDS Router shared Payload Pool
const std::shared_ptr<core::PayloadPool> payload_pool_;

//! DDS Router shared Discovery Database
const std::shared_ptr<core::DiscoveryDatabase> discovery_database_;

//! Domain Id to create the internal DDS Participant.
core::types::DomainId domain_id_;

//! Participant QoS
fastdds::dds::DomainParticipantQos participant_qos_;
};

} /* namespace dds */
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// 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.

#pragma once

#include <fastdds/rtps/transport/TCPTransportDescriptor.hpp>

#include <ddspipe_participants/configuration/DiscoveryServerParticipantConfiguration.hpp>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>
#include <ddspipe_participants/participant/dds/CommonParticipant.hpp>

namespace eprosima {
namespace ddspipe {
namespace participants {
namespace dds {

/**
* TODO
*/
class DiscoveryServerParticipant
: public CommonParticipant
{
public:

DDSPIPE_PARTICIPANTS_DllAPI
DiscoveryServerParticipant(
const std::shared_ptr<DiscoveryServerParticipantConfiguration>& participant_configuration,
const std::shared_ptr<core::PayloadPool>& payload_pool,
const std::shared_ptr<core::DiscoveryDatabase>& discovery_database);

protected:

/////
// DDS specific methods

/**
* @brief Static method that gives the QoS for a Discovery Server Participant.
*
*/
static fastdds::dds::DomainParticipantQos reckon_participant_qos_(
const DiscoveryServerParticipantConfiguration* participant_configuration);
};

} /* namespace dds */
} /* namespace participants */
} /* namespace ddspipe */
} /* namespace eprosima */
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// 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.

#pragma once

#include <fastdds/rtps/transport/TCPTransportDescriptor.hpp>

#include <ddspipe_participants/configuration/InitialPeersParticipantConfiguration.hpp>
#include <ddspipe_participants/participant/dds/CommonParticipant.hpp>
#include <ddspipe_participants/types/security/tls/TlsConfiguration.hpp>

namespace eprosima {
namespace ddspipe {
namespace participants {
namespace dds {

/**
* TODO
*/
class InitialPeersParticipant
: public CommonParticipant
{
public:

DDSPIPE_PARTICIPANTS_DllAPI
InitialPeersParticipant(
const std::shared_ptr<InitialPeersParticipantConfiguration>& participant_configuration,
const std::shared_ptr<core::PayloadPool>& payload_pool,
const std::shared_ptr<core::DiscoveryDatabase>& discovery_database);

protected:

/////
// DDS specific methods

/**
* @brief Static method that gives the QoS for a Initial Peers Participant.
*
*/
static fastdds::dds::DomainParticipantQos reckon_participant_qos_(
const InitialPeersParticipantConfiguration* participant_configuration);
};

} /* namespace dds */
} /* namespace participants */
} /* namespace ddspipe */
} /* namespace eprosima */
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
// Copyright 2024 Proyectos y Sistemas de Mantenimiento SL (eProsima).
//
// 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.

#pragma once

#include <ddspipe_participants/configuration/SimpleParticipantConfiguration.hpp>
#include <ddspipe_participants/participant/dds/CommonParticipant.hpp>

namespace eprosima {
namespace ddspipe {
namespace participants {
namespace dds {

/**
* Participant with Simple Discovery Protocol.
*
* Standard RTPS Participant with Simple Discovery and default attributes.
*/
class SimpleParticipant : public CommonParticipant
{
public:

/**
* @brief Construct a new Dummy Participant object
*
* It uses the \c BaseParticipant constructor.
* Apart from BaseParticipant, it creates a new RTPSParticipant with default Attributes and domain given
* by configuration.
*
* @throw \c InitializationException in case any internal error has ocurred while creating RTPSParticipant
* @throw \c IConfigurationException in case configuration was incorrectly set
*/
DDSPIPE_PARTICIPANTS_DllAPI
SimpleParticipant(
const std::shared_ptr<SimpleParticipantConfiguration>& participant_configuration,
const std::shared_ptr<core::PayloadPool>& payload_pool,
const std::shared_ptr<core::DiscoveryDatabase>& discovery_database);

protected:

/////
// DDS specific methods

/**
* @brief Static method that gives the QoS for a Simple Participant.
*
*/
static fastdds::dds::DomainParticipantQos reckon_participant_qos_(
const SimpleParticipantConfiguration* participant_configuration);
};

} /* namespace dds */
} /* namespace participants */
} /* namespace ddspipe */
} /* namespace eprosima */
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,15 @@ class XmlParticipant

protected:

/////////////////////////
// INTERNAL METHODS
/////////////////////////
/////
// DDS specific methods

virtual
fastdds::dds::DomainParticipantQos
reckon_participant_qos_() const override;

/////////////////////////
// INTERNAL VARIABLES
/////////////////////////

//! Participant configuration
const XmlParticipantConfiguration& xml_specific_configuration_;
/**
* @brief Static method that gives the QoS for a XML Participant.
*
*/
static fastdds::dds::DomainParticipantQos reckon_participant_qos_(
const XmlParticipantConfiguration* participant_configuration);
};

} /* namespace dds */
Expand Down
Loading
Loading