CatapultServer  v0.5.0.1 (Elephant)
catapult::state::RootNamespace Class Reference

A root namespace. More...

Collaboration diagram for catapult::state::RootNamespace:

Classes

struct  ChildNamespaceData
 Child namespace information. More...
 
struct  PathsComparator
 

Public Types

using Children = std::unordered_map< NamespaceId, ChildNamespaceData, utils::BaseValueHasher< NamespaceId > >
 
using OrderedChildPaths = std::set< Namespace::Path, PathsComparator >
 

Public Member Functions

 RootNamespace (NamespaceId id, const Key &owner, const NamespaceLifetime &lifetime)
 Creates a root namespace around id, owner and liftime. More...
 
 RootNamespace (NamespaceId id, const Key &owner, const NamespaceLifetime &lifetime, const std::shared_ptr< Children > &pChildren)
 Creates a root namespace around id, owner, liftime and pChildren. More...
 
NamespaceId id () const
 Gets the namespace id. More...
 
const Childrenchildren () const
 Gets a const reference to the children. More...
 
const Keyowner () const
 Gets a const reference to the owner of this namespace. More...
 
const NamespaceLifetimelifetime () const
 Gets a const reference to the lifetime of this namespace. More...
 
bool empty () const
 Returns true if this root namespace has no children. More...
 
size_t size () const
 Gets the number of child namespaces. More...
 
Namespace child (NamespaceId id) const
 
const NamespaceAliasalias (NamespaceId id) const
 Gets a namespace alias for root or child namespace id. More...
 
void add (const Namespace &ns)
 Adds the child namespace ns. More...
 
void remove (NamespaceId id)
 
void setAlias (NamespaceId id, const NamespaceAlias &alias)
 Sets an alias for root or child namespace id. More...
 
bool operator== (const RootNamespace &rhs) const
 Returns true if this root namespace is equal to rhs. More...
 
bool operator!= (const RootNamespace &rhs) const
 Returns true if this root namespace is not equal to rhs. More...
 
RootNamespace renew (const NamespaceLifetime &newLifetime) const
 
OrderedChildPaths sortedChildPaths () const
 

Private Attributes

NamespaceId m_id
 
NamespaceAlias m_alias
 
Key m_owner
 
NamespaceLifetime m_lifetime
 
std::shared_ptr< Childrenm_pChildren
 

Detailed Description

A root namespace.

Member Typedef Documentation

◆ Children

◆ OrderedChildPaths

Constructor & Destructor Documentation

◆ RootNamespace() [1/2]

catapult::state::RootNamespace::RootNamespace ( NamespaceId  id,
const Key owner,
const NamespaceLifetime lifetime 
)

Creates a root namespace around id, owner and liftime.

Here is the caller graph for this function:

◆ RootNamespace() [2/2]

catapult::state::RootNamespace::RootNamespace ( NamespaceId  id,
const Key owner,
const NamespaceLifetime lifetime,
const std::shared_ptr< Children > &  pChildren 
)

Creates a root namespace around id, owner, liftime and pChildren.

Member Function Documentation

◆ add()

void catapult::state::RootNamespace::add ( const Namespace ns)

Adds the child namespace ns.

Here is the call graph for this function:

◆ alias()

const NamespaceAlias & catapult::state::RootNamespace::alias ( NamespaceId  id) const

Gets a namespace alias for root or child namespace id.

Here is the caller graph for this function:

◆ child()

Namespace catapult::state::RootNamespace::child ( NamespaceId  id) const

Gets a child namespace specified by its namespace id.

Note
This method throws if the id is unknown.
Here is the caller graph for this function:

◆ children()

const RootNamespace::Children & catapult::state::RootNamespace::children ( ) const

Gets a const reference to the children.

◆ empty()

bool catapult::state::RootNamespace::empty ( ) const

Returns true if this root namespace has no children.

◆ id()

NamespaceId catapult::state::RootNamespace::id ( ) const

Gets the namespace id.

Here is the caller graph for this function:

◆ lifetime()

const NamespaceLifetime & catapult::state::RootNamespace::lifetime ( ) const

Gets a const reference to the lifetime of this namespace.

Here is the caller graph for this function:

◆ operator!=()

bool catapult::state::RootNamespace::operator!= ( const RootNamespace rhs) const

Returns true if this root namespace is not equal to rhs.

◆ operator==()

bool catapult::state::RootNamespace::operator== ( const RootNamespace rhs) const

Returns true if this root namespace is equal to rhs.

◆ owner()

const Key & catapult::state::RootNamespace::owner ( ) const

Gets a const reference to the owner of this namespace.

Here is the caller graph for this function:

◆ remove()

void catapult::state::RootNamespace::remove ( NamespaceId  id)

Removes a child namespace specified by id.

Note
This method throws if the id is unknown.
Here is the call graph for this function:

◆ renew()

RootNamespace catapult::state::RootNamespace::renew ( const NamespaceLifetime newLifetime) const

Creates a new root namespace with lifetime.

Note
The method shares the children of this root namespace with the new root namespace.
Here is the call graph for this function:

◆ setAlias()

void catapult::state::RootNamespace::setAlias ( NamespaceId  id,
const NamespaceAlias alias 
)

Sets an alias for root or child namespace id.

Here is the call graph for this function:

◆ size()

size_t catapult::state::RootNamespace::size ( ) const

Gets the number of child namespaces.

Here is the caller graph for this function:

◆ sortedChildPaths()

RootNamespace::OrderedChildPaths catapult::state::RootNamespace::sortedChildPaths ( ) const

Creates an ordered set of child namespace paths.

Note
Child paths are ordered lexicographically.
Here is the call graph for this function:

Member Data Documentation

◆ m_alias

NamespaceAlias catapult::state::RootNamespace::m_alias
private

◆ m_id

NamespaceId catapult::state::RootNamespace::m_id
private

◆ m_lifetime

NamespaceLifetime catapult::state::RootNamespace::m_lifetime
private

◆ m_owner

Key catapult::state::RootNamespace::m_owner
private

◆ m_pChildren

std::shared_ptr<Children> catapult::state::RootNamespace::m_pChildren
private

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