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

Add API to createRTPSWriter with a custom change pool [14951] #2841

Merged
merged 4 commits into from
Jul 29, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions include/fastdds/rtps/RTPSDomain.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include <fastdds/rtps/attributes/RTPSParticipantAttributes.h>
#include <fastdds/rtps/common/Types.h>
#include <fastdds/rtps/history/IPayloadPool.h>
#include <fastdds/rtps/history/IChangePool.h>

namespace eprosima {
namespace fastrtps {
Expand Down Expand Up @@ -134,6 +135,27 @@ class RTPSDomain
WriterHistory* hist,
WriterListener* listen = nullptr);

/**
* Create a RTPSWriter in a participant using a custom payload pool.
* @param p Pointer to the RTPSParticipant.
* @param watt Writer Attributes.
* @param payload_pool Shared pointer to the IPayloadPool
* @param change_pool Shared pointer to the IChangePool
* @param hist Pointer to the WriterHistory.
juanlofer-eprosima marked this conversation as resolved.
Show resolved Hide resolved
* @param listen Pointer to the WriterListener.
* @return Pointer to the created RTPSWriter.
*
* \warning The returned pointer is invalidated after a call to removeRTPSWriter() or stopAll(),
* so its use may result in undefined behaviour.
*/
RTPS_DllAPI static RTPSWriter* createRTPSWriter(
MiguelCompany marked this conversation as resolved.
Show resolved Hide resolved
RTPSParticipant* p,
WriterAttributes& watt,
const std::shared_ptr<IPayloadPool>& payload_pool,
const std::shared_ptr<IChangePool>& change_pool,
WriterHistory* hist,
WriterListener* listen = nullptr);

/**
* Create a RTPSWriter in a participant.
* @param p Pointer to the RTPSParticipant.
Expand Down
21 changes: 21 additions & 0 deletions src/cpp/rtps/RTPSDomain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,27 @@ RTPSWriter* RTPSDomain::createRTPSWriter(
return nullptr;
}

RTPSWriter* RTPSDomain::createRTPSWriter(
RTPSParticipant* p,
WriterAttributes& watt,
const std::shared_ptr<IPayloadPool>& payload_pool,
const std::shared_ptr<IChangePool>& change_pool,
WriterHistory* hist,
WriterListener* listen)
{
RTPSParticipantImpl* impl = RTPSDomainImpl::find_local_participant(p->getGuid());
if (impl)
{
RTPSWriter* ret_val = nullptr;
if (impl->create_writer(&ret_val, watt, payload_pool, change_pool, hist, listen))
{
return ret_val;
}
}

return nullptr;
}

RTPSWriter* RTPSDomain::createRTPSWriter(
RTPSParticipant* p,
const EntityId_t& entity_id,
Expand Down