PcapPlusPlus  22.11
pcpp::DnsResourceDataPtr Class Reference

#include <DnsResourceData.h>

Inheritance diagram for pcpp::DnsResourceDataPtr:

Public Member Functions

 DnsResourceDataPtr (IDnsResourceData *ptr)
 
template<class IDnsResourceDataType >
bool isTypeOf () const
 
template<class IDnsResourceDataType >
IDnsResourceDataType * castAs ()
 

Detailed Description

A smart pointer class that holds pointers of type IDnsResourceData. This object is used in DnsResource::getData()

Constructor & Destructor Documentation

◆ DnsResourceDataPtr()

pcpp::DnsResourceDataPtr::DnsResourceDataPtr ( IDnsResourceData ptr)
inline

A c'tor to this class

Parameters
[in]ptrA pointer to IDnsResourceData

Member Function Documentation

◆ castAs()

template<class IDnsResourceDataType >
IDnsResourceDataType* pcpp::DnsResourceDataPtr::castAs ( )
inline

A templated method which take a class that derives from IDnsResourceData as the template argument and tries to cast the pointer stored in this object as that type

Returns
A pointer to the stored pointer casted as the requested type or NULL if it isn't of this type

◆ isTypeOf()

template<class IDnsResourceDataType >
bool pcpp::DnsResourceDataPtr::isTypeOf ( ) const
inline

A templated method which takes a class that derives from IDnsResourceData as the template argument and checks whether the pointer stored in this object is of this type

Returns
True if the stored pointer is of the requested type, false otherwise