Async 1.8.0
Async::DnsResourceRecordCRTP< Derived > Class Template Referenceabstract

A CRTP class for adding some type dependent functions. More...

#include <AsyncDnsResourceRecord.h>

Inheritance diagram for Async::DnsResourceRecordCRTP< Derived >:
Async::DnsResourceRecord

Public Types

using List = std::vector<std::unique_ptr<Derived>>
 The type for a list of resource records.
 
- Public Types inherited from Async::DnsResourceRecord
enum class  Type {
  ANY , A , PTR , CNAME ,
  SRV , A , PTR , CNAME ,
  SRV
}
 The record type. More...
 
enum class  Class { IN , IN }
 The record class. More...
 
enum class  Type {
  ANY , A , PTR , CNAME ,
  SRV , A , PTR , CNAME ,
  SRV
}
 
enum class  Class { IN , IN }
 
using Name = std::string
 
using Ttl = uint32_t
 
using List = std::vector<std::unique_ptr<DnsResourceRecord>>
 The type for a list of resource records.
 

Public Member Functions

 DnsResourceRecordCRTP (const Name &name, Ttl ttl)
 Constructor.
 
virtual DnsResourceRecordclone (void) const
 Clone this class.
 
virtual bool operator== (const DnsResourceRecord &other) const
 Equality comparison operator.
 
virtual bool operator== (const Derived &other) const =0
 
virtual const Type type (void) const override
 The type of record.
 
- Public Member Functions inherited from Async::DnsResourceRecord
 DnsResourceRecord (const Name &name, Ttl ttl)
 Constructor.
 
virtual ~DnsResourceRecord (void)
 Destructor.
 
Class classId (void) const
 The DNS class for the record.
 
const char * classStr (void) const
 The DNS class for the record as a string.
 
const std::string & typeStr (void) const
 The type of record as a string.
 
virtual std::string toString (void) const
 The string representation of this record.
 
void setName (const Name &name)
 Set the name for this record.
 
const Namename (void) const
 The name of this record.
 
void setTtl (Ttl ttl)
 Set the TTL for this record.
 
Ttl ttl (void) const
 The TTL for this record.
 
 DnsResourceRecord (const std::string &name, uint32_t ttl)
 Default constructor.
 
 DnsResourceRecord (const DnsResourceRecord &)=delete
 Disallow copy construction.
 
DnsResourceRecordoperator= (const DnsResourceRecord &)=delete
 Disallow copy assignment.
 
virtual ~DnsResourceRecord (void)
 Destructor.
 
Class classId (void) const
 A_brief_member_function_description.
 
const char * classStr (void) const
 
const std::string & typeStr (void) const
 
virtual std::string toString (void) const
 
void setName (const std::string &name)
 
const std::string & name (void) const
 
void setTtl (uint32_t ttl)
 
uint32_t ttl (void) const
 

Additional Inherited Members

- Static Public Member Functions inherited from Async::DnsResourceRecord
static const Type staticType (void)
 The type for this specific class.
 
static const std::string & typeToString (Type type)
 The type for this specific class represented as a string.
 
static const std::string & typeToString (Type type)
 
- Static Public Attributes inherited from Async::DnsResourceRecord
static constexpr Ttl MAX_TTL = 0x7fffffff
 The maximum allowed value for a TTL.
 

Detailed Description

template<typename Derived>
class Async::DnsResourceRecordCRTP< Derived >

A CRTP class for adding some type dependent functions.

Author
Tobias Blomberg / SM0SVX
Date
2021-05-22

All specific resource record classes inherit from this class to add some record type specific functions and types to each specific resource record class.

Definition at line 280 of file AsyncDnsResourceRecord.h.

Member Typedef Documentation

◆ List

template<typename Derived >
using Async::DnsResourceRecordCRTP< Derived >::List = std::vector<std::unique_ptr<Derived>>

The type for a list of resource records.

Definition at line 286 of file AsyncDnsResourceRecord.h.

Constructor & Destructor Documentation

◆ DnsResourceRecordCRTP()

template<typename Derived >
Async::DnsResourceRecordCRTP< Derived >::DnsResourceRecordCRTP ( const Name & name,
Ttl ttl )
inline

Constructor.

Parameters
nameThe name of this record
ttlThe time-to-live, in seconds, for this record

Definition at line 293 of file AsyncDnsResourceRecord.h.

Member Function Documentation

◆ clone()

template<typename Derived >
virtual DnsResourceRecord * Async::DnsResourceRecordCRTP< Derived >::clone ( void ) const
inlinevirtual

Clone this class.

Returns
Return a pointer to a clone of this instance

Implements Async::DnsResourceRecord.

Definition at line 300 of file AsyncDnsResourceRecord.h.

◆ operator==() [1/2]

template<typename Derived >
virtual bool Async::DnsResourceRecordCRTP< Derived >::operator== ( const Derived & other) const
pure virtual

◆ operator==() [2/2]

template<typename Derived >
virtual bool Async::DnsResourceRecordCRTP< Derived >::operator== ( const DnsResourceRecord & other) const
inlinevirtual

Equality comparison operator.

Parameters
otherThe other resource record to comapare to
Returns
Return true if the two records are equal

NOTE: The TTL is not used in the comparison.

Reimplemented from Async::DnsResourceRecord.

Definition at line 312 of file AsyncDnsResourceRecord.h.

◆ type()

template<typename Derived >
virtual const Type Async::DnsResourceRecordCRTP< Derived >::type ( void ) const
inlineoverridevirtual

The type of record.

Returns
Return the type of this record

Implements Async::DnsResourceRecord.

Reimplemented in Async::DnsResourceRecordA, Async::DnsResourceRecordCNAME, Async::DnsResourceRecordPTR, and Async::DnsResourceRecordSRV.

Definition at line 325 of file AsyncDnsResourceRecord.h.


The documentation for this class was generated from the following file: