Lumiera  0.pre.03
»edit your freedom«
symbol-table.hpp File Reference

Go to the source code of this file.

Description

Registry table for automatically interned strings.

The implementation of the lib::Symbol token relies on unique string pointers, such as to create one distinct identity for each distinct "symbol string". The idea is to generate unique and distinct numeric token IDs, while still holding onto a human readable string. Which in turn requires us to manage a registry of already known symbol strings; when a Symbol object with such an already known string is created, it will thus connect internally to the known token ID.

Todo:
as of this writing (4/2017), it is neither clear if we really need such a facility, nor do we know enough to judge the implementation approach taken here. It might well turn out that a mere hash over the symbol string would be sufficient. Just the general vision for Lumiera indicates that we're going to rely heavily on some kind of symbolic or meta processing, involving a rules based query system, and in the light of such future developments, introducing a distinct lib::Symbol datatype seemed like a good idea. When we started to generate command IDs systematically, just literal c-string constants weren't sufficient anymore, leading to this very preliminary table based implementation.
See also
symbol-impl.cpp
Symbol_test
Symbol_HashtableTest
SessionCommandFunction_test multithreaded access

Definition in file symbol-table.hpp.

#include "lib/sync.hpp"
#include "lib/symbol.hpp"
#include "lib/nocopy.hpp"
#include <unordered_set>
#include <utility>
#include <string>

Classes

class  SymbolTable
 Table for automatically interned strings. More...
 

Namespaces

 lib
 Implementation namespace for support and library code.