Program Listing for File Subscriber.h
↰ Return to documentation for file (/tmp/ws/src/fastrtps/include/fastrtps/subscriber/Subscriber.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 SUBSCRIBER_H_
#define SUBSCRIBER_H_
#include <fastdds/rtps/common/Guid.h>
#include <fastdds/rtps/common/Time_t.h>
#include <fastdds/rtps/common/Locator.h>
#include <fastrtps/attributes/SubscriberAttributes.h>
#include <fastrtps/qos/DeadlineMissedStatus.h>
#include <fastrtps/qos/LivelinessChangedStatus.h>
namespace eprosima {
namespace fastrtps {
class SubscriberImpl;
class SampleInfo_t;
class RTPS_DllAPI Subscriber
{
friend class SubscriberImpl;
virtual ~Subscriber()
{
}
public:
Subscriber(
SubscriberImpl* pimpl)
: mp_impl(pimpl)
{
}
const rtps::GUID_t& getGuid();
inline void waitForUnreadMessage()
{
const Duration_t one_day{ 24 * 3600, 0 };
while (!wait_for_unread_samples(one_day))
{
}
}
bool wait_for_unread_samples(
const Duration_t& timeout);
bool readNextData(
void* sample,
SampleInfo_t* info);
bool takeNextData(
void* sample,
SampleInfo_t* info);
bool get_first_untaken_info(
SampleInfo_t* info);
bool updateAttributes(
const SubscriberAttributes& att);
const SubscriberAttributes& getAttributes() const;
bool isInCleanState() const;
inline uint64_t getUnreadCount() const
{
return get_unread_count();
}
uint64_t get_unread_count() const;
void get_requested_deadline_missed_status(
RequestedDeadlineMissedStatus& status);
void get_liveliness_changed_status(
LivelinessChangedStatus& status);
void get_listening_locators(
rtps::LocatorList_t& locators) const;
private:
SubscriberImpl* mp_impl;
};
} /* namespace pubsub */
} /* namespace eprosima */
#endif /* SUBSCRIBER_H_ */