Skip to content

Commit

Permalink
Add get_first_untaken_info API (eProsima#1104)
Browse files Browse the repository at this point in the history
* Refs #7918. Uncrustify

* Refs #7918. Adding new method get_first_untaken_info.

* Refs #7918. receptionTimestamp added to CacheChange_t.

* Refs #7918. receptionTimestamp added to SampleInfo_t.
  • Loading branch information
MiguelCompany authored Mar 27, 2020
1 parent f5ec7af commit d368993
Show file tree
Hide file tree
Showing 10 changed files with 414 additions and 279 deletions.
2 changes: 2 additions & 0 deletions include/fastdds/rtps/common/CacheChange.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ struct RTPS_DllAPI CacheChange_t
bool isRead = false;
//!Source TimeStamp (only used in Readers)
Time_t sourceTimestamp;
//!Reception TimeStamp (only used in Readers)
Time_t receptionTimestamp;

WriteParams write_params;
bool is_untyped_ = true;
Expand Down
22 changes: 17 additions & 5 deletions include/fastrtps/subscriber/SampleInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,30 @@ namespace fastrtps {
* Class SampleInfo_t with information that is provided along a sample when reading data from a Subscriber.
* @ingroup FASTRTPS_MODULE
*/
class RTPS_DllAPI SampleInfo_t {
class RTPS_DllAPI SampleInfo_t
{
public:
SampleInfo_t():sampleKind(rtps::ALIVE), ownershipStrength(0),
sample_identity(rtps::SampleIdentity::unknown()), related_sample_identity(rtps::SampleIdentity::unknown()) {}

virtual ~SampleInfo_t(){};
SampleInfo_t()
: sampleKind(rtps::ALIVE)
, ownershipStrength(0)
, sample_identity(rtps::SampleIdentity::unknown())
, related_sample_identity(rtps::SampleIdentity::unknown())
{
}

virtual ~SampleInfo_t()
{
}

//!Sample kind.
rtps::ChangeKind_t sampleKind;
//!Ownership Strength of the writer of the sample (0 if the ownership kind is set to SHARED_OWNERSHIP_QOS).
uint32_t ownershipStrength;
//!Source timestamp of the sample.
rtps::Time_t sourceTimestamp;
//!Reception timestamp of the sample.
rtps::Time_t receptionTimestamp;
//!InstanceHandle of the data
rtps::InstanceHandle_t iHandle;

Expand All @@ -54,7 +66,7 @@ class RTPS_DllAPI SampleInfo_t {
rtps::SampleIdentity related_sample_identity;
};

} /* namespace */
} /* namespace fastrtps */
} /* namespace eprosima */

#endif /* SAMPLEINFO_H_ */
32 changes: 26 additions & 6 deletions include/fastrtps/subscriber/Subscriber.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,21 @@ class RTPS_DllAPI Subscriber
{
friend class SubscriberImpl;

virtual ~Subscriber() {}
virtual ~Subscriber()
{
}

public:

/**
* Constructor from a SubscriberImpl pointer
* @param pimpl Actual implementation of the subscriber
*/
Subscriber(SubscriberImpl* pimpl) : mp_impl(pimpl) {}
Subscriber(
SubscriberImpl* pimpl)
: mp_impl(pimpl)
{
}

/**
* Get the associated GUID
Expand All @@ -75,7 +82,8 @@ class RTPS_DllAPI Subscriber
* @return true in case unread samples are available.
* In other case, false.
*/
bool wait_for_unread_samples(const Duration_t& timeout);
bool wait_for_unread_samples(
const Duration_t& timeout);

/**
* @brief Reads next unread sample from the Subscriber.
Expand All @@ -101,12 +109,21 @@ class RTPS_DllAPI Subscriber
void* sample,
SampleInfo_t* info);

/**
* @brief Returns information about the first untaken sample.
* @param [out] info Pointer to a SampleInfo_t structure to store first untaken sample information.
* @return true if sample info was returned. false if there is no sample to take.
*/
bool get_first_untaken_info(
SampleInfo_t* info);

/**
* Update the Attributes of the subscriber;
* @param att Reference to a SubscriberAttributes object to update the parameters;
* @return True if correctly updated, false if ANY of the updated parameters cannot be updated
*/
bool updateAttributes(const SubscriberAttributes& att);
bool updateAttributes(
const SubscriberAttributes& att);

/**
* Get the Attributes of the Subscriber.
Expand Down Expand Up @@ -141,15 +158,18 @@ class RTPS_DllAPI Subscriber
* @brief Get the requested deadline missed status
* @return The deadline missed status
*/
void get_requested_deadline_missed_status(RequestedDeadlineMissedStatus& status);
void get_requested_deadline_missed_status(
RequestedDeadlineMissedStatus& status);

/**
* @brief Returns the liveliness changed status
* @param status Liveliness changed status
*/
void get_liveliness_changed_status(LivelinessChangedStatus& status);
void get_liveliness_changed_status(
LivelinessChangedStatus& status);

private:

SubscriberImpl* mp_impl;
};

Expand Down
Loading

0 comments on commit d368993

Please sign in to comment.