Skip to content

Commit

Permalink
Refs 11001. Uncrustify ReceiverResource.cpp
Browse files Browse the repository at this point in the history
Signed-off-by: Miguel Company <MiguelCompany@eprosima.com>
  • Loading branch information
MiguelCompany committed Mar 26, 2021
1 parent 6e51861 commit 07b867b
Showing 1 changed file with 37 additions and 21 deletions.
58 changes: 37 additions & 21 deletions src/cpp/rtps/network/ReceiverResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,25 @@
#include <cassert>
#include <fastdds/dds/log/Log.hpp>

#define IDSTRING "(ID:" << std::this_thread::get_id() <<") "<<
#define IDSTRING "(ID:" << std::this_thread::get_id() << ") " <<

using namespace std;
using namespace eprosima::fastdds::rtps;

namespace eprosima{
namespace fastrtps{
namespace rtps{
namespace eprosima {
namespace fastrtps {
namespace rtps {

ReceiverResource::ReceiverResource(
TransportInterface& transport,
const Locator_t& locator,
uint32_t max_recv_buffer_size)
: Cleanup(nullptr)
, LocatorMapsToManagedChannel(nullptr)
, mValid(false)
, mtx()
, receiver(nullptr)
, max_message_size_(max_recv_buffer_size)
TransportInterface& transport,
const Locator_t& locator,
uint32_t max_recv_buffer_size)
: Cleanup(nullptr)
, LocatorMapsToManagedChannel(nullptr)
, mValid(false)
, mtx()
, receiver(nullptr)
, max_message_size_(max_recv_buffer_size)
{
// Internal channel is opened and assigned to this resource.
mValid = transport.OpenInputChannel(locator, this, max_message_size_);
Expand All @@ -45,12 +45,18 @@ ReceiverResource::ReceiverResource(
}

// Implementation functions are bound to the right transport parameters
Cleanup = [&transport, locator]() { transport.CloseInputChannel(locator); };
Cleanup = [&transport, locator]()
{
transport.CloseInputChannel(locator);
};
LocatorMapsToManagedChannel = [&transport, locator](const Locator_t& locatorToCheck) -> bool
{ return transport.DoInputLocatorsMatch(locator, locatorToCheck); };
{
return transport.DoInputLocatorsMatch(locator, locatorToCheck);
};
}

ReceiverResource::ReceiverResource(ReceiverResource&& rValueResource)
ReceiverResource::ReceiverResource(
ReceiverResource&& rValueResource)
{
Cleanup.swap(rValueResource.Cleanup);
LocatorMapsToManagedChannel.swap(rValueResource.LocatorMapsToManagedChannel);
Expand All @@ -61,7 +67,8 @@ ReceiverResource::ReceiverResource(ReceiverResource&& rValueResource)
max_message_size_ = rValueResource.max_message_size_;
}

bool ReceiverResource::SupportsLocator(const Locator_t& localLocator)
bool ReceiverResource::SupportsLocator(
const Locator_t& localLocator)
{
if (LocatorMapsToManagedChannel)
{
Expand All @@ -70,22 +77,31 @@ bool ReceiverResource::SupportsLocator(const Locator_t& localLocator)
return false;
}

void ReceiverResource::RegisterReceiver(MessageReceiver* rcv)
void ReceiverResource::RegisterReceiver(
MessageReceiver* rcv)
{
std::unique_lock<std::mutex> lock(mtx);
if (receiver == nullptr)
{
receiver = rcv;
}
}

void ReceiverResource::UnregisterReceiver(MessageReceiver* rcv)
void ReceiverResource::UnregisterReceiver(
MessageReceiver* rcv)
{
std::unique_lock<std::mutex> lock(mtx);
if (receiver == rcv)
{
receiver = nullptr;
}
}

void ReceiverResource::OnDataReceived(const octet * data, const uint32_t size,
const Locator_t & localLocator, const Locator_t & remoteLocator)
void ReceiverResource::OnDataReceived(
const octet* data,
const uint32_t size,
const Locator_t& localLocator,
const Locator_t& remoteLocator)
{
(void)localLocator;

Expand Down

0 comments on commit 07b867b

Please sign in to comment.