Clingo
Loading...
Searching...
No Matches
CppClingo::SymbolStore Class Referenceabstract

A store for symbols. More...

#include <symbol.hh>

Public Member Functions

virtual ~SymbolStore () noexcept=default
 Destroy the store and all symbols in it.
 
auto string (std::string_view str) -> SharedString
 Construct a string.
 
auto num (Number num) noexcept -> SharedSymbol
 Construct a number.
 
auto tup (SharedSymbolSpan args) -> SharedSymbol
 Construct a tuple.
 
auto tup (SymbolSpan args) -> SharedSymbol
 Construct a tuple.
 
auto fun (SharedString const &name, SharedSymbolSpan args, bool sign) -> SharedSymbol
 Construct a function symbol.
 
auto fun (String name, SymbolSpan args, bool sign) -> SharedSymbol
 Construct a function symbol.
 
auto string_ref (std::string_view str) -> String
 Construct a string.
 
auto num_ref (Number num) noexcept -> Symbol
 Construct a number (e.g., 42).
 
auto tup_ref (SymbolSpan args) -> Symbol
 Construct a tuple.
 
auto fun_ref (String name, SymbolSpan args, bool sign) -> Symbol
 Construct a function symbol.
 
void gc_block () noexcept
 Block garbage collection.
 
void gc_unblock () noexcept
 Unblock garbage collection.
 
void gc_add_owner (SymbolOwner const &owner)
 Add a symbol owner.
 
void gc_del_owner (SymbolOwner const &owner) noexcept
 Delete a symbol owner.
 
auto gc () -> std::tuple< size_t, size_t, size_t >
 Cleanup symbols.
 

Static Public Member Functions

static auto sup () noexcept -> Symbol
 Construct the infimum constant (#inf).
 
static auto inf () noexcept -> Symbol
 Construct the supremum constant (#sup).
 
static auto str (SharedString str) noexcept -> SharedSymbol
 Construct a quoted string.
 
static auto str (String str) noexcept -> SharedSymbol
 Construct a quoted string.
 
static auto num (int32_t num) noexcept -> SharedSymbol
 Construct a number.
 
static auto str_ref (String str) noexcept -> Symbol
 Construct a quoted string.
 
static auto num_ref (int32_t num) noexcept -> Symbol
 Construct a number.
 

Detailed Description

A store for symbols.

Symbols are stored in a hash table ensuring that there is just one representation for a symbol. Constants and numbers are stored directly in the symbol.

Member Function Documentation

◆ fun() [1/2]

auto CppClingo::SymbolStore::fun ( SharedString const &  name,
SharedSymbolSpan  args,
bool  sign 
) -> SharedSymbol

Construct a function symbol.

For example: f(x,y).

◆ fun() [2/2]

auto CppClingo::SymbolStore::fun ( String  name,
SymbolSpan  args,
bool  sign 
) -> SharedSymbol

Construct a function symbol.

For example: f(x,y).

◆ fun_ref()

auto CppClingo::SymbolStore::fun_ref ( String  name,
SymbolSpan  args,
bool  sign 
) -> Symbol

Construct a function symbol.

For example: f(x,y).

◆ gc()

auto CppClingo::SymbolStore::gc ( ) -> std::tuple<size_t, size_t, size_t>
inline

Cleanup symbols.

Returns the number of symbols owners, the number of symbols with reference count greater 0, and the number of symbols collected.

◆ gc_block()

void CppClingo::SymbolStore::gc_block ( )
inlinenoexcept

Block garbage collection.

Block/unblock calls must be balanced. No symbols should be accessed while a store is unblocked (if a call to gc is intended).

◆ gc_unblock()

void CppClingo::SymbolStore::gc_unblock ( )
inlinenoexcept

Unblock garbage collection.

Block/unblock calls must be balanced. In the multi-threaded case, floating symbols must only be used while a store is blocked.

◆ str() [1/2]

static auto CppClingo::SymbolStore::str ( SharedString  str) -> SharedSymbol
staticnoexcept

Construct a quoted string.

A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".

◆ str() [2/2]

static auto CppClingo::SymbolStore::str ( String  str) -> SharedSymbol
staticnoexcept

Construct a quoted string.

A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".

◆ str_ref()

static auto CppClingo::SymbolStore::str_ref ( String  str) -> Symbol
staticnoexcept

Construct a quoted string.

A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".

◆ string()

auto CppClingo::SymbolStore::string ( std::string_view  str) -> SharedString

Construct a string.

The string is stored as is.

◆ string_ref()

auto CppClingo::SymbolStore::string_ref ( std::string_view  str) -> String

Construct a string.

The string is stored as is.

◆ tup() [1/2]

auto CppClingo::SymbolStore::tup ( SharedSymbolSpan  args) -> SharedSymbol

Construct a tuple.

For example: (x,y).

◆ tup() [2/2]

auto CppClingo::SymbolStore::tup ( SymbolSpan  args) -> SharedSymbol

Construct a tuple.

For example: (x,y).

◆ tup_ref()

auto CppClingo::SymbolStore::tup_ref ( SymbolSpan  args) -> Symbol

Construct a tuple.

For example: (x,y).


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