NS-3 based Named Data Networking (NDN) simulator
ndnSIM 2.5: NDN, CCN, CCNx, content centric networks
API Documentation
ndn::name::detail::ComponentType Class Reference

Declare rules regarding a NameComponent type. More...

#include <name-component-types.hpp>

Inheritance diagram for ndn::name::detail::ComponentType:
Collaboration diagram for ndn::name::detail::ComponentType:

Public Types

using Error = Component::Error
 

Public Member Functions

virtual ~ComponentType ()=default
 
virtual void check (const Component &comp) const
 Throw Component::Error if comp is invalid. More...
 
virtual std::pair< bool, ComponentgetSuccessor (const Component &comp) const
 Calculate the successor of comp. More...
 
virtual const std::vector< uint8_t > & getMinValue () const
 Return the minimum allowable TLV-VALUE of this component type. More...
 
virtual const char * getAltUriPrefix () const
 Return the prefix of the alternate URI representation. More...
 
virtual Component parseAltUriValue (const std::string &input) const
 Parse component from alternate URI representation. More...
 
virtual void writeUri (std::ostream &os, const Component &comp) const
 Write URI representation of comp to os. More...
 

Protected Member Functions

std::pair< bool, BlockgetSuccessorImpl (const Component &comp) const
 Calculate the successor of comp, extending TLV-LENGTH if value overflows. More...
 
void writeUriEscapedValue (std::ostream &os, const Component &comp) const
 Write TLV-VALUE as <escaped-value> of NDN URI syntax. More...
 

Detailed Description

Declare rules regarding a NameComponent type.

Definition at line 38 of file name-component-types.hpp.

Member Typedef Documentation

◆ Error

Constructor & Destructor Documentation

◆ ~ComponentType()

virtual ndn::name::detail::ComponentType::~ComponentType ( )
virtualdefault

Member Function Documentation

◆ check()

virtual void ndn::name::detail::ComponentType::check ( const Component comp) const
inlinevirtual

Throw Component::Error if comp is invalid.

Reimplemented in ndn::name::detail::Sha256ComponentType.

Definition at line 49 of file name-component-types.hpp.

◆ getSuccessor()

virtual std::pair<bool, Component> ndn::name::detail::ComponentType::getSuccessor ( const Component comp) const
inlinevirtual

Calculate the successor of comp.

If comp is the maximum possible value of this component type, return true to indicate that the successor should have a greater TLV-TYPE.

Reimplemented in ndn::name::detail::Sha256ComponentType.

Definition at line 59 of file name-component-types.hpp.

References getSuccessorImpl().

Referenced by ndn::name::Component::getSuccessor().

◆ getMinValue()

virtual const std::vector<uint8_t>& ndn::name::detail::ComponentType::getMinValue ( ) const
inlinevirtual

Return the minimum allowable TLV-VALUE of this component type.

Reimplemented in ndn::name::detail::Sha256ComponentType.

Definition at line 67 of file name-component-types.hpp.

Referenced by ndn::name::Component::getSuccessor().

◆ getAltUriPrefix()

virtual const char* ndn::name::detail::ComponentType::getAltUriPrefix ( ) const
inlinevirtual

Return the prefix of the alternate URI representation.

NDN URI specification allows a name component type to declare an alternate URI representation in the form of <prefix>=<value>, in addition to the plain <type-number>=<escaped-value> syntax.

Returns
the <prefix> portion of the alternate URI representation.
Return values
nullptrthis component does not have an alternate URI representation.

Reimplemented in ndn::name::detail::Sha256ComponentType.

Definition at line 83 of file name-component-types.hpp.

◆ parseAltUriValue()

virtual Component ndn::name::detail::ComponentType::parseAltUriValue ( const std::string &  input) const
inlinevirtual

Parse component from alternate URI representation.

Parameters
inputthe <value> portion of the alternate URI representation.
Exceptions
Component::Error
Precondition
getAltUriPrefix() != nullptr

Reimplemented in ndn::name::detail::Sha256ComponentType.

Definition at line 94 of file name-component-types.hpp.

◆ writeUri()

virtual void ndn::name::detail::ComponentType::writeUri ( std::ostream &  os,
const Component comp 
) const
inlinevirtual

Write URI representation of comp to os.

This base class implementation encodes the component in the plain <type-number>=<escaped-value> syntax.

Reimplemented in ndn::name::detail::Sha256ComponentType, and ndn::name::detail::GenericNameComponentType.

Definition at line 106 of file name-component-types.hpp.

References ndn::Block::type(), and writeUriEscapedValue().

Referenced by ndn::name::Component::toUri().

◆ getSuccessorImpl()

std::pair<bool, Block> ndn::name::detail::ComponentType::getSuccessorImpl ( const Component comp) const
inlineprotected

Calculate the successor of comp, extending TLV-LENGTH if value overflows.

Returns
whether TLV-LENGTH was extended, and the successor

Definition at line 117 of file name-component-types.hpp.

References ndn::Block::size(), ndn::Block::type(), ndn::Block::value(), and ndn::Block::value_size().

Referenced by getSuccessor(), and ndn::name::detail::Sha256ComponentType::getSuccessor().

◆ writeUriEscapedValue()

void ndn::name::detail::ComponentType::writeUriEscapedValue ( std::ostream &  os,
const Component comp 
) const
inlineprotected

Write TLV-VALUE as <escaped-value> of NDN URI syntax.

Definition at line 144 of file name-component-types.hpp.

References ndn::escape(), ndn::Block::value(), ndn::Block::value_begin(), ndn::Block::value_end(), and ndn::Block::value_size().

Referenced by writeUri(), and ndn::name::detail::GenericNameComponentType::writeUri().


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