|
Clingo
|
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. | |
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.
| auto CppClingo::SymbolStore::fun | ( | SharedString const & | name, |
| SharedSymbolSpan | args, | ||
| bool | sign | ||
| ) | -> SharedSymbol |
Construct a function symbol.
For example: f(x,y).
| auto CppClingo::SymbolStore::fun | ( | String | name, |
| SymbolSpan | args, | ||
| bool | sign | ||
| ) | -> SharedSymbol |
Construct a function symbol.
For example: f(x,y).
| auto CppClingo::SymbolStore::fun_ref | ( | String | name, |
| SymbolSpan | args, | ||
| bool | sign | ||
| ) | -> Symbol |
Construct a function symbol.
For example: f(x,y).
|
inline |
Cleanup symbols.
Returns the number of symbols owners, the number of symbols with reference count greater 0, and the number of symbols collected.
|
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).
|
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.
|
staticnoexcept |
Construct a quoted string.
A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".
|
staticnoexcept |
Construct a quoted string.
A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".
Construct a quoted string.
A raw string is stored and quoted when the symbol is output. For example: "foo\nbar".
| auto CppClingo::SymbolStore::string | ( | std::string_view | str | ) | -> SharedString |
Construct a string.
The string is stored as is.
| auto CppClingo::SymbolStore::string_ref | ( | std::string_view | str | ) | -> String |
Construct a string.
The string is stored as is.
| auto CppClingo::SymbolStore::tup | ( | SharedSymbolSpan | args | ) | -> SharedSymbol |
Construct a tuple.
For example: (x,y).
| auto CppClingo::SymbolStore::tup | ( | SymbolSpan | args | ) | -> SharedSymbol |
Construct a tuple.
For example: (x,y).
| auto CppClingo::SymbolStore::tup_ref | ( | SymbolSpan | args | ) | -> Symbol |
Construct a tuple.
For example: (x,y).