Program Listing for File ReceiverResource.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastdds/rtps/network/ReceiverResource.h
)
// Copyright 2016 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.
#ifndef _FASTDDS_RTPS_RECEIVER_RESOURCE_H
#define _FASTDDS_RTPS_RECEIVER_RESOURCE_H
#include <condition_variable>
#include <functional>
#include <memory>
#include <vector>
#include <fastdds/rtps/messages/MessageReceiver.h>
#include <fastdds/rtps/transport/TransportInterface.h>
namespace eprosima {
namespace fastrtps {
namespace rtps {
class ReceiverResource : public fastdds::rtps::TransportReceiverInterface
{
friend class NetworkFactory;
public:
virtual void OnDataReceived(
const octet* data,
const uint32_t size,
const Locator_t& localLocator,
const Locator_t& remoteLocator) override;
bool SupportsLocator(
const Locator_t& localLocator);
void RegisterReceiver(
MessageReceiver* receiver);
void UnregisterReceiver(
MessageReceiver* receiver);
void disable();
inline uint32_t max_message_size() const
{
return max_message_size_;
}
ReceiverResource(
ReceiverResource&&);
~ReceiverResource() override;
private:
ReceiverResource() = delete;
ReceiverResource(
const ReceiverResource&) = delete;
ReceiverResource& operator =(
const ReceiverResource&) = delete;
ReceiverResource(
fastdds::rtps::TransportInterface&,
const Locator_t&,
uint32_t);
std::function<void()> Cleanup;
std::function<bool(const Locator_t&)> LocatorMapsToManagedChannel;
bool mValid; // Post-construction validity check for the NetworkFactory
std::mutex mtx;
std::condition_variable cv_;
MessageReceiver* receiver;
uint32_t max_message_size_;
int active_callbacks_;
};
} // namespace rtps
} // namespace fastrtps
} // namespace eprosima
#endif /* _FASTDDS_RTPS_RECEIVER_RESOURCE_H */