Skip to content

title: sgns::crdt::HierarchicalKey summary: A Key represents the unique identifier of an object, inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. Keys are hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:: Key("/Comedy") Key("/Comedy/MontyPython") Also, every namespace can be parametrized to embed relevant object information. For example, the Key name (most specific namespace) could include the object type:: Key("/Comedy/MontyPython/Actor:JohnCleese") Key("/Comedy/MontyPython/Sketch:CheeseShop") Key("/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender").


sgns::crdt::HierarchicalKey

A Key represents the unique identifier of an object, inspired by file systems and Google App Engine key model. Keys are meant to be unique across a system. Keys are hierarchical, incorporating more and more specific namespaces. Thus keys can be deemed 'children' or 'ancestors' of other keys:: Key("/Comedy") Key("/Comedy/MontyPython") Also, every namespace can be parametrized to embed relevant object information. For example, the Key name (most specific namespace) could include the object type:: Key("/Comedy/MontyPython/Actor:JohnCleese") Key("/Comedy/MontyPython/Sketch:CheeseShop") Key("/Comedy/MontyPython/Sketch:CheeseShop/Character:Mousebender").

#include <hierarchical_key.hpp>

Public Functions

Name
HierarchicalKey() =default
HierarchicalKey(std::string key)
HierarchicalKey(const HierarchicalKey & ) =default
virtual ~HierarchicalKey() =default
HierarchicalKey & operator=(const HierarchicalKey & ) =default
void SetKey(const std::string & aKey)
std::string GetKey() const
HierarchicalKey ChildString(std::string_view s) const
Appends s to the key.
std::vector< std::string > GetList() const
bool IsTopLevel() const
bool operator==(const HierarchicalKey & rhs) const
bool operator!=(const HierarchicalKey & rhs) const

Public Functions Documentation

function HierarchicalKey

HierarchicalKey() =default

function HierarchicalKey

HierarchicalKey(
    std::string key
)

Parameters:

  • key Key string

Constructs a key from a string.

function HierarchicalKey

HierarchicalKey(
    const HierarchicalKey & 
) =default

Copy constructor

function ~HierarchicalKey

virtual ~HierarchicalKey() =default

function operator=

HierarchicalKey & operator=(
    const HierarchicalKey & 
) =default

function SetKey

inline void SetKey(
    const std::string & aKey
)

function GetKey

inline std::string GetKey() const

function ChildString

HierarchicalKey ChildString(
    std::string_view s
) const

Appends s to the key.

Parameters:

  • s String to be appended

NewKey("/Comedy/MontyPython").ChildString("Actor:JohnCleese") NewKey("/Comedy/MontyPython/Actor:JohnCleese")

function GetList

std::vector< std::string > GetList() const

List returns the list representation of this Key. NewKey("/Comedy/MontyPython/Actor:JohnCleese").List() ["Comedy", "MontyPythong", "Actor:JohnCleese"]

function IsTopLevel

bool IsTopLevel() const

function operator==

inline bool operator==(
    const HierarchicalKey & rhs
) const

function operator!=

inline bool operator!=(
    const HierarchicalKey & rhs
) const

Updated on 2026-03-04 at 13:10:43 -0800