|
carl
25.04
Computer ARithmetic Library
|
Implements a manager for sorts, containing the actual contents of these sort and allocating their ids. More...
#include <SortManager.h>


Public Types | |
| using | SortTemplate = std::pair< std::vector< std::string >, Sort > |
| The type of a sort template, define by define-sort. More... | |
Public Member Functions | |
| SortManager (const SortManager &)=delete | |
| SortManager (SortManager &&)=delete | |
| SortManager & | operator= (const SortManager &)=delete |
| SortManager & | operator= (SortManager &&)=delete |
| ~SortManager () noexcept override=default | |
| void | clear () |
| const std::string & | get_name (const Sort &sort) const |
| const std::vector< Sort > * | getParameters (const Sort &sort) const |
| const std::vector< std::size_t > * | getIndices (const Sort &sort) const |
| VariableType | getType (const Sort &sort) const |
| std::ostream & | print (std::ostream &os, const Sort &sort) const |
| Prints the given sort on the given output stream. More... | |
| void | exportDefinitions (std::ostream &os) const |
| Sort | getInterpreted (VariableType type) const |
| Sort | replace (const Sort &sort, const std::map< std::string, Sort > ¶meters) |
| Recursively replaces sorts within the given sort according to the mapping of sort names to sorts as declared by the given map. More... | |
| bool | declare (const std::string &name, std::size_t arity) |
| Adds a sort declaration. More... | |
| bool | define (const std::string &name, const std::vector< std::string > ¶ms, const Sort &sort) |
| Adds a sort template definitions. More... | |
| std::size_t | getArity (const Sort &sort) const |
| Sort | addInterpretedMapping (const Sort &sort, VariableType type) |
| Sort | addInterpretedSort (const std::string &name, VariableType type) |
| Sort | addInterpretedSort (const std::string &name, const std::vector< Sort > ¶meters, VariableType type) |
| Sort | addSort (const std::string &name, VariableType type=VariableType::VT_UNINTERPRETED) |
| Sort | addSort (const std::string &name, const std::vector< Sort > ¶meters, VariableType type=VariableType::VT_UNINTERPRETED) |
| void | makeSortIndexable (const Sort &sort, std::size_t indices, VariableType type) |
| bool | isInterpreted (const Sort &sort) const |
| Sort | index (const Sort &sort, const std::vector< std::size_t > &indices) |
| Sort | getSort (const std::string &name) |
| Gets the sort with arity zero (thus it is maybe interpreted) corresponding the given name. More... | |
| Sort | getSort (const std::string &name, const std::vector< Sort > ¶ms) |
| Gets the sort with arity greater than zero corresponding the given name and having the arguments of the given sorts. More... | |
| Sort | getSort (const std::string &name, const std::vector< std::size_t > &indices) |
| Sort | getSort (const std::string &name, const std::vector< std::size_t > &indices, const std::vector< Sort > ¶ms) |
Static Public Member Functions | |
| static SortManager & | getInstance () |
| Returns the single instance of this class by reference. More... | |
Private Member Functions | |
| SortManager () | |
| Constructs a sort manager. More... | |
| const SortContent & | getContent (const Sort &sort) const |
| bool | isSymbolFree (const std::string &name) const |
| Sort | getSort (std::unique_ptr< SortContent > &&content, VariableType type) |
| std::size_t | addSortContent (std::unique_ptr< SortContent > &&content, VariableType type) |
| VariableType | checkIndices (const SortContent &content, std::size_t count) const |
Private Attributes | |
| friend | Singleton< SortManager > |
| std::vector< std::unique_ptr< SortContent > > | mSorts |
| Maps the unique ids to the sort content. More... | |
| std::vector< VariableType > | mSortTypes |
| Maps the unique ids to the sort types. More... | |
| std::map< const SortContent *, std::size_t, carl::less< const SortContent * > > | mSortMap |
| Maps the sort contents to unique ids. More... | |
| std::map< std::string, std::size_t > | mDeclarations |
| Stores all sort declarations invoked by a declare-sort. More... | |
| std::map< std::string, SortTemplate > | mDefinitions |
| Stores all sort definitions invoked by a define-sort. More... | |
| std::map< Sort, std::pair< std::size_t, VariableType > > | mIndexable |
| Stores all sorts that may become interpreted when indexed. More... | |
| std::map< VariableType, Sort > | mInterpreted |
| Maps variable types to actual sorts. More... | |
Implements a manager for sorts, containing the actual contents of these sort and allocating their ids.
Definition at line 105 of file SortManager.h.
| using carl::SortManager::SortTemplate = std::pair<std::vector<std::string>, Sort> |
The type of a sort template, define by define-sort.
Definition at line 110 of file SortManager.h.
|
inlineprivate |
Constructs a sort manager.
Definition at line 133 of file SortManager.h.

|
delete |
|
delete |
|
overridedefaultnoexcept |
|
inline |
|
inline |
|
inline |
| Sort carl::SortManager::addSort | ( | const std::string & | name, |
| const std::vector< Sort > & | parameters, | ||
| VariableType | type = VariableType::VT_UNINTERPRETED |
||
| ) |
| Sort carl::SortManager::addSort | ( | const std::string & | name, |
| VariableType | type = VariableType::VT_UNINTERPRETED |
||
| ) |
Definition at line 73 of file SortManager.cpp.


|
inlineprivate |
Definition at line 159 of file SortManager.h.


|
inlineprivate |
Definition at line 166 of file SortManager.h.


|
inline |
| bool carl::SortManager::declare | ( | const std::string & | name, |
| std::size_t | arity | ||
| ) |
Adds a sort declaration.
| name | The name of the declared sort. |
| arity | The arity of the declared sort. |
Definition at line 54 of file SortManager.cpp.

| bool carl::SortManager::define | ( | const std::string & | name, |
| const std::vector< std::string > & | params, | ||
| const Sort & | sort | ||
| ) |
Adds a sort template definitions.
| name | The name of the defined sort template. |
| params | The template parameter of the defined sort. |
| sort | The sort to instantiate into. |
Definition at line 61 of file SortManager.cpp.

| void carl::SortManager::exportDefinitions | ( | std::ostream & | os | ) | const |
Definition at line 31 of file SortManager.cpp.
|
inline |
| sort | A sort. |
Definition at line 199 of file SortManager.h.

| size_t carl::SortManager::getArity | ( | const Sort & | sort | ) | const |
| sort | The sort to get the arity for. |
Definition at line 67 of file SortManager.cpp.


|
inlineprivate |
Definition at line 137 of file SortManager.h.


|
inline |
Definition at line 205 of file SortManager.h.


|
inlinestaticinherited |
Returns the single instance of this class by reference.
If there is no instance yet, a new one is created.
Definition at line 45 of file Singleton.h.
|
inline |
Definition at line 224 of file SortManager.h.
| Sort carl::SortManager::getSort | ( | const std::string & | name | ) |
Gets the sort with arity zero (thus it is maybe interpreted) corresponding the given name.
| name | The name of the sort to get. |
Definition at line 96 of file SortManager.cpp.
Gets the sort with arity greater than zero corresponding the given name and having the arguments of the given sorts.
| name | The name of the sort to get. |
| params | The sort of the arguments of the sort to get. |
Definition at line 107 of file SortManager.cpp.

| Sort carl::SortManager::getSort | ( | const std::string & | name, |
| const std::vector< std::size_t > & | indices | ||
| ) |
|
inlineprivate |
Definition at line 151 of file SortManager.h.


|
inline |
Definition at line 208 of file SortManager.h.


Definition at line 85 of file SortManager.cpp.


|
inline |
| sort | A sort. |
Definition at line 281 of file SortManager.h.

|
inlineprivate |
| void carl::SortManager::makeSortIndexable | ( | const Sort & | sort, |
| std::size_t | indices, | ||
| VariableType | type | ||
| ) |
Definition at line 81 of file SortManager.cpp.
|
delete |
|
delete |
| std::ostream & carl::SortManager::print | ( | std::ostream & | os, |
| const Sort & | sort | ||
| ) | const |
Prints the given sort on the given output stream.
| os | The output stream to print the given sort on. |
| sort | The sort to print. |
Definition at line 13 of file SortManager.cpp.

| Sort carl::SortManager::replace | ( | const Sort & | sort, |
| const std::map< std::string, Sort > & | parameters | ||
| ) |
Recursively replaces sorts within the given sort according to the mapping of sort names to sorts as declared by the given map.
| sort | The sort to replace sorts by sorts in. |
| parameters | The map of sort names to sorts. |
Definition at line 41 of file SortManager.cpp.


|
private |
Stores all sort declarations invoked by a declare-sort.
Definition at line 122 of file SortManager.h.
|
private |
Stores all sort definitions invoked by a define-sort.
Definition at line 124 of file SortManager.h.
|
private |
Stores all sorts that may become interpreted when indexed.
Definition at line 126 of file SortManager.h.
|
private |
Maps variable types to actual sorts.
Definition at line 128 of file SortManager.h.
|
private |
Maps the sort contents to unique ids.
Definition at line 120 of file SortManager.h.
|
private |
Maps the unique ids to the sort content.
Definition at line 116 of file SortManager.h.
|
private |
Maps the unique ids to the sort types.
Definition at line 118 of file SortManager.h.
|
private |
Definition at line 106 of file SortManager.h.