mirror of
https://github.com/Telecominfraproject/wlan-cloud-lib-cppkafka.git
synced 2025-11-05 21:18:04 +00:00
Allow checking if an Event is valid
This commit is contained in:
@@ -143,6 +143,13 @@ public:
|
|||||||
* * RD_KAFKA_EVENT_OFFSET_COMMIT
|
* * RD_KAFKA_EVENT_OFFSET_COMMIT
|
||||||
*/
|
*/
|
||||||
TopicPartitionList get_topic_partition_list() const;
|
TopicPartitionList get_topic_partition_list() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Check whether this event is valid
|
||||||
|
*
|
||||||
|
* /return true iff this event has a valid (non-null) handle inside
|
||||||
|
*/
|
||||||
|
operator bool() const;
|
||||||
private:
|
private:
|
||||||
using HandlePtr = std::unique_ptr<rd_kafka_event_t, decltype(&rd_kafka_event_destroy)>;
|
using HandlePtr = std::unique_ptr<rd_kafka_event_t, decltype(&rd_kafka_event_destroy)>;
|
||||||
|
|
||||||
|
|||||||
@@ -90,4 +90,8 @@ TopicPartitionList Event::get_topic_partition_list() const {
|
|||||||
return convert(toppars_handle);
|
return convert(toppars_handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::operator bool() const {
|
||||||
|
return !!handle_;
|
||||||
|
}
|
||||||
|
|
||||||
} // cppkafka
|
} // cppkafka
|
||||||
|
|||||||
Reference in New Issue
Block a user