Kea: isc::dns::rdata::AbstractRdataFactory Class Reference

| Kea 3.2.0-git

isc::dns::rdata::AbstractRdataFactory Class Referenceabstract

The `AbstractRdataFactory` class is an abstract base class to encapsulate a set of Rdata factory methods in a polymorphic way. More...

`#include <rrparamregistry.h>`

Inheritance diagram for isc::dns::rdata::AbstractRdataFactory:
[legend]

## Public Member Functions
Factory methods for polymorphic creation.
virtual RdataPtr | create (const std::string &rdata_str) const =0
| Create RDATA from a string.
virtual RdataPtr | create (isc::util::InputBuffer &buff, size_t rdata_len) const =0
| Create RDATA from wire-format data.
virtual RdataPtr | create (const rdata::Rdata &source) const =0
| Create RDATA from another `Rdata` object of the same type.
virtual RdataPtr | create (MasterLexer &lexer, const Name *origin, MasterLoader::Options options, MasterLoaderCallbacks &callbacks) const =0
| Create RDATA using MasterLexer.

## Constructors and Destructor
| AbstractRdataFactory ()
| The default constructor.
virtual | ~AbstractRdataFactory ()
| The destructor.

## Detailed Description

The `AbstractRdataFactory` class is an abstract base class to encapsulate a set of Rdata factory methods in a polymorphic way.

An external developer who wants to introduce a new or experimental RR type is expected to define a corresponding derived class of `AbstractRdataFactory` and register it via `RRParamRegistry`.

Other users of this API normally do not have to care about this class or its derived classes; this class is generally intended to be used as an internal utility of the API implementation.

Definition at line 57 of file rrparamregistry.h.

## Constructor & Destructor Documentation

## ◆ AbstractRdataFactory()

isc::dns::rdata::AbstractRdataFactory::AbstractRdataFactory | ( |  | ) |
| inlineprotected

The default constructor.

This is intentionally defined as `protected` as this base class should never be instantiated (except as part of a derived class).

Definition at line 67 of file rrparamregistry.h.

## ◆ ~AbstractRdataFactory()

virtual isc::dns::rdata::AbstractRdataFactory::~AbstractRdataFactory | ( |  | ) |
| inlinevirtual

The destructor.

Definition at line 70 of file rrparamregistry.h.

## Member Function Documentation

## ◆ create() [1/4]

virtual RdataPtr isc::dns::rdata::AbstractRdataFactory::create | ( | const rdata::Rdata & | source | ) | const
| pure virtual

Create RDATA from another `Rdata` object of the same type.

This method creates an `Rdata` object of specific class corresponding to the specific derived class of `AbstractRdataFactory`, copying the content of the given `Rdata`, `source`.

`source` must be an object of the concrete derived class corresponding to the specific derived class of `AbstractRdataFactory`; otherwise, an exception of class `std::bad_cast` will be thrown.

Parameters

  source | A reference to an `Rdata` object whose content is to be copied to the created `Rdata` object.

Returns
  An `RdataPtr` object pointing to the created `Rdata` object.

Implemented in isc::dns::RdataFactory< T >.

## ◆ create() [2/4]

virtual RdataPtr isc::dns::rdata::AbstractRdataFactory::create | ( | const std::string & | rdata_str | ) | const
| pure virtual

Create RDATA from a string.

This method creates from a string an `Rdata` object of specific class corresponding to the specific derived class of `AbstractRdataFactory`.

Parameters

  rdata_str | A string of textual representation of the `Rdata`.

Returns
  An `RdataPtr` object pointing to the created `Rdata` object.

Implemented in isc::dns::RdataFactory< T >.

## ◆ create() [3/4]

virtual RdataPtr isc::dns::rdata::AbstractRdataFactory::create | ( | isc::util::InputBuffer & | buff,
|  | size_t | rdata_len ) const
| pure virtual

Create RDATA from wire-format data.

This method creates from wire-format binary data an `Rdata` object of specific class corresponding to the specific derived class of `AbstractRdataFactory`.

Parameters

  buff | A reference to an `InputBuffer` object storing the `Rdata` to parse.
  rdata_len | The length in buffer of the `Rdata`. In bytes.

Returns
  An `RdataPtr` object pointing to the created `Rdata` object.

Implemented in isc::dns::RdataFactory< T >.

## ◆ create() [4/4]

virtual RdataPtr isc::dns::rdata::AbstractRdataFactory::create | ( | MasterLexer & | lexer,
|  | const Name * | origin,
|  | MasterLoader::Options | options,
|  | MasterLoaderCallbacks & | callbacks ) const
| pure virtual

Create RDATA using MasterLexer.

This version of the method defines the entry point of factory of a specific RR type and class for `RRParamRegistry::createRdata()` that uses `MasterLexer`. See its description for the expected behavior and meaning of the parameters.

Implemented in isc::dns::RdataFactory< T >.

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

- rrparamregistry.h