Skip to content

Commit

Permalink
Refs #20352: Fix Windows build
Browse files Browse the repository at this point in the history
Signed-off-by: cferreiragonz <[email protected]>
  • Loading branch information
cferreiragonz committed Mar 22, 2024
1 parent 3d18ba8 commit 3ff583d
Show file tree
Hide file tree
Showing 7 changed files with 21 additions and 12 deletions.
19 changes: 10 additions & 9 deletions include/fastdds/rtps/network/NetworkBuffer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,12 @@
#ifndef _FASTDDS_RTPS_NETWORK_NETWORKBUFFER_HPP
#define _FASTDDS_RTPS_NETWORK_NETWORKBUFFER_HPP

#include <cstdint> // uint32_t
#include <cstdlib> // size_t
#include <asio.hpp>
#include <cstdint>

namespace asio {
// Forward declaration of asio::const_buffer
class const_buffer;
} // namespace asio

namespace eprosima {
namespace fastdds {
Expand All @@ -36,11 +39,11 @@ struct NetworkBuffer final
//! Pointer to the buffer where the data is stored.
const void* buffer;
//! Number of bytes to use starting at @c buffer.
size_t size;
uint32_t size;

NetworkBuffer(
const void* ptr,
size_t s)
uint32_t s)
: buffer(ptr)
, size(s)
{
Expand All @@ -54,7 +57,7 @@ struct NetworkBuffer final

NetworkBuffer(
const fastrtps::rtps::octet* ptr,
size_t s)
uint32_t s)
: buffer(ptr)
, size(s)
{
Expand All @@ -79,9 +82,7 @@ struct NetworkBuffer final
}

//! Conversion operator to asio::const_buffer.
operator asio::const_buffer() const {
return asio::const_buffer(buffer, size);
}
operator asio::const_buffer() const;
};

} // namespace rtps
Expand Down
1 change: 0 additions & 1 deletion include/fastdds/rtps/transport/TransportInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <fastdds/rtps/transport/SenderResource.h>
#include <fastdds/rtps/transport/TransportDescriptorInterface.h>
#include <fastdds/rtps/transport/TransportReceiverInterface.h>
#include <fastdds/rtps/network/NetworkBuffer.hpp>

namespace eprosima {
namespace fastdds {
Expand Down
1 change: 0 additions & 1 deletion src/cpp/rtps/transport/ChannelResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <fastdds/dds/log/Log.hpp>
#include <fastdds/rtps/common/CDRMessage_t.h>
#include <fastdds/rtps/network/NetworkBuffer.hpp>

#include <utils/thread.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/cpp/rtps/transport/TCPChannelResource.h
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ class TCPChannelResource : public ChannelResource
const fastrtps::rtps::octet* header,
size_t header_size,
const fastrtps::rtps::octet* data,
size_t data_size,
uint32_t data_size,
asio::error_code& ec)
{
NetworkBuffer buffers(data, data_size);
Expand Down
6 changes: 6 additions & 0 deletions src/cpp/rtps/transport/UDPTransportInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,12 @@ bool UDPTransportInterface::send(
return success;
}

//! NetworkBuffer conversion operator to asio::const_buffer.
NetworkBuffer::operator asio::const_buffer() const
{
return asio::const_buffer(buffer, size);
}

/**
* Invalidate all selector entries containing certain multicast locator.
*
Expand Down
1 change: 1 addition & 0 deletions src/cpp/rtps/transport/test_UDPv4Transport.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,7 @@ bool test_UDPv4Transport::log_drop(
const std::list<NetworkBuffer>& buffers,
uint32_t size)
{
static_cast<void>(size);
if (test_UDPv4Transport_DropLog.size() < test_UDPv4Transport_DropLogLength)
{
vector<octet> message;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,13 @@
#ifndef _FASTDDS_RTPS_READER_STATEFULREADER_H_
#define _FASTDDS_RTPS_READER_STATEFULREADER_H_

#include <list>

#include <fastdds/rtps/attributes/ReaderAttributes.h>
#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/reader/RTPSReader.h>
#include <fastdds/rtps/resources/ResourceEvent.h>
#include <fastdds/rtps/network/NetworkBuffer.hpp>

namespace eprosima {
namespace fastrtps {
Expand Down

0 comments on commit 3ff583d

Please sign in to comment.