summaryrefslogtreecommitdiff
path: root/qpid/cpp/src/qpid/amqp_0_10/Holder.h
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp/src/qpid/amqp_0_10/Holder.h')
-rw-r--r--qpid/cpp/src/qpid/amqp_0_10/Holder.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/qpid/cpp/src/qpid/amqp_0_10/Holder.h b/qpid/cpp/src/qpid/amqp_0_10/Holder.h
index 1664afcc8f..3c734d967f 100644
--- a/qpid/cpp/src/qpid/amqp_0_10/Holder.h
+++ b/qpid/cpp/src/qpid/amqp_0_10/Holder.h
@@ -73,6 +73,14 @@ class Holder : public framing::Blob<Size, BaseHeld> {
apply(s, *this->get());
}
+ template <class T> T* getIf() {
+ return (getClassCode()==T::CLASS_CODE && getCode()==T::CODE) ? static_cast<T*>(this->get()) : 0;
+ }
+
+ template <class T> const T* getIf() const {
+ return (getClassCode()==T::CLASS_CODE && getCode()==T::CODE) ? static_cast<T*>(this->get()) : 0;
+ }
+
private:
struct Assign : public ApplyFunctor<void> {
Holder& holder;