CatapultServer  v0.5.0.1 (Elephant)
NamespaceEntry.h
Go to the documentation of this file.
1 
21 #pragma once
22 #include "Namespace.h"
23 #include "RootNamespace.h"
24 
25 namespace catapult { namespace state {
26 
29  public:
32  : m_pNamespace(nullptr)
33  , m_pRoot(nullptr)
34  {}
35 
37  explicit NamespaceEntry(const Namespace& ns, const RootNamespace& root)
38  : m_pNamespace(&ns)
39  , m_pRoot(&root) {
40  if (m_pNamespace->rootId() != m_pRoot->id())
41  CATAPULT_THROW_INVALID_ARGUMENT("ns and root parameters are incompatible");
42  }
43 
44  public:
46  const Namespace& ns() const {
47  return *m_pNamespace;
48  }
49 
51  const RootNamespace& root() const {
52  return *m_pRoot;
53  }
54 
55  private:
58  };
59 }}
catapult::state::NamespaceEntry::m_pNamespace
const Namespace * m_pNamespace
Definition: NamespaceEntry.h:56
catapult::state::Namespace
A catapult namespace.
Definition: Namespace.h:30
Namespace.h
catapult::state::Namespace::rootId
NamespaceId rootId() const
Gets the corresponding root namespace id.
Definition: Namespace.h:53
catapult::state::NamespaceEntry::ns
const Namespace & ns() const
Gets the namespace.
Definition: NamespaceEntry.h:46
catapult::state::NamespaceEntry
A pair composed of a namespace and its root.
Definition: NamespaceEntry.h:28
catapult::state::NamespaceEntry::NamespaceEntry
NamespaceEntry()
Creates an uninitialized entry.
Definition: NamespaceEntry.h:31
catapult::state::NamespaceEntry::m_pRoot
const RootNamespace * m_pRoot
Definition: NamespaceEntry.h:57
catapult::state::NamespaceEntry::root
const RootNamespace & root() const
Gets the root.
Definition: NamespaceEntry.h:51
RootNamespace.h
catapult::state::RootNamespace::id
NamespaceId id() const
Gets the namespace id.
Definition: RootNamespace.cpp:41
CATAPULT_THROW_INVALID_ARGUMENT
#define CATAPULT_THROW_INVALID_ARGUMENT(MESSAGE)
Macro used to throw a catapult invalid argument.
Definition: exceptions.h:179
catapult
Definition: AddressExtractionExtension.cpp:28
catapult::state::RootNamespace
A root namespace.
Definition: RootNamespace.h:31
catapult::state::NamespaceEntry::NamespaceEntry
NamespaceEntry(const Namespace &ns, const RootNamespace &root)
Creates an entry around ns and root.
Definition: NamespaceEntry.h:37