dlvhex
2.5.0
|
Registry for entities used in programs as IDs (collection of symbol tables) More...
#include <include/dlvhex2/Registry.h>
Data Structures | |
struct | Impl |
Public Member Functions | |
Registry () | |
Constructor. | |
Registry (const Registry &other) | |
Creates a real deep copy. | |
~Registry () | |
Destructor. | |
ID | storeOrdinaryAtom (OrdinaryAtom &ogatom) |
Retrieval of ordinary atoms. | |
ID | storeOrdinaryGAtom (OrdinaryAtom &ogatom) |
Retrieval of ordinary ground atoms. | |
ID | storeOrdinaryNAtom (OrdinaryAtom &onatom) |
Retrieval of ordinary nonground atoms. | |
ID | storeConstOrVarTerm (Term &term) |
Allows for storing constant or variable terms. | |
ID | storeConstantTerm (const std::string &symbol, bool aux=false) |
Allows for storing constant terms. | |
ID | storeVariableTerm (const std::string &symbol, bool aux=false) |
Allows for storing variable terms. | |
ID | storeTerm (Term &term) |
Allows for storing terms of arbitrary sub kind. | |
ID | getNewConstantTerm (std::string prefix="unnamed") |
Creates a globally new constand term (new ID and new text). | |
ID | storeRule (Rule &rule) |
Allows for storing a rule. | |
void | setupAuxiliaryGroundAtomMask () |
Initialization of the mask of all auxiliary atoms. | |
ID | getAuxiliaryConstantSymbol (char type, ID id) |
Creates auxiliary constant symbols. | |
ID | getAuxiliaryVariableSymbol (char type, ID id) |
Creates auxiliary variable symbols. | |
ID | getAuxiliaryAtom (char type, ID id) |
Allows for direct application of getAuxiliaryConstantSymbol to the predicate of an ordinary atom. | |
ID | getIDByAuxiliaryConstantSymbol (ID auxConstantID) const |
Inverse method of getAuxiliaryConstantSymbol wrt. | |
ID | getIDByAuxiliaryVariableSymbol (ID auxVariableID) const |
Inverse method of getAuxiliaryVariableSymbol wrt. | |
bool | isPositiveExternalAtomAuxiliaryAtom (ID auxID) |
Checks if an external atom auxiliary is positive or negated. | |
bool | isNegativeExternalAtomAuxiliaryAtom (ID auxID) |
Checks if an external atom auxiliary is positive or negated. | |
ID | swapExternalAtomAuxiliaryAtom (ID auxID) |
Inverses an external auxiliary symbol. | |
char | getTypeByAuxiliaryConstantSymbol (ID auxConstantID) const |
Maps an auxiliary constant symbol back to the type behind. | |
bool | isNullTerm (ID term) const |
Checks if an auxiliary term represents a 'null' term. | |
InterpretationConstPtr | getAuxiliaryGroundAtomMask () |
Get predicate mask to auxiliary ground atoms. | |
std::ostream & | print (std::ostream &o) |
Prints the registry. | |
virtual std::ostream & | print (std::ostream &o) const |
const OrdinaryAtom & | lookupOrdinaryAtom (ID id) const |
Lookup ground or nonground ordinary atoms. | |
const std::string & | getTermStringByID (ID termid) const |
Lookup constant term. | |
void | getExternalAtomsInTuple (const Tuple &t, Tuple &out) const |
Extracts all external atom IDs from t . | |
void | getVariablesInID (ID id, std::set< ID > &out, bool includeAnonymous=false, bool includeLocalAggVar=true) const |
Extracts all variable IDs from id . | |
std::set< ID > | getVariablesInID (const ID &id, bool includeAnonymous=false, bool includeLocalAggVar=true) const |
Extracts all variable IDs from id . | |
void | getOutVariablesInID (ID id, std::set< ID > &out, bool includeAnonymous=false, bool includeLocalAggVar=true) const |
Retrieves variables in a term, an ordinary atom or the output list of an external atom. | |
void | getVariablesInTuple (const Tuple &t, std::set< ID > &out, bool includeAnonymous=false, bool includeLocalAggVar=true) const |
Applies getVariablesInID to multiple IDs. | |
std::set< ID > | getVariablesInTuple (const Tuple &t, bool includeAnonymous=false, bool includeLocalAggVar=true) const |
Applies getVariablesInID to multiple IDs. | |
ID | replaceVariablesInTerm (const ID term, const ID var, const ID by) |
Recursively substitutes variables in terms. | |
ID | getPredicateOfAtom (ID atom) |
Gets the predicate of an ordinary or external atom. | |
void | registerUserAuxPrinter (AuxPrinterPtr printer) |
Allows for adding customized printers for auxiliary symbols. | |
void | registerUserDefaultAuxPrinter (AuxPrinterPtr printer) |
Defines a printer for auxiliary symbols to be used if no other printer applies. | |
bool | printAtomForUser (std::ostream &o, IDAddress address, const std::string &prefix="") |
Prints an atom in human-readable form. | |
Data Fields | |
TermTable | terms |
Table of terms. | |
PredicateTable | preds |
Table of predicate terms. | |
OrdinaryAtomTable | ogatoms |
Table of ordinary ground atoms. | |
OrdinaryAtomTable | onatoms |
Table of ordinary nonground atoms. | |
BuiltinAtomTable | batoms |
Table of builtin atoms. | |
AggregateAtomTable | aatoms |
Table of aggregate atoms. | |
ExternalAtomTable | eatoms |
Table of external atoms. | |
ModuleAtomTable | matoms |
Table of module atoms. | |
RuleTable | rules |
Table of rules atoms. | |
ModuleTable | moduleTable |
std::vector< Tuple > | inputList |
EAInputTupleCachePtr | eaInputTupleCache |
Cache of external atom input tuples. | |
Protected Attributes | |
boost::scoped_ptr< Impl > | pimpl |
Registry for entities used in programs as IDs (collection of symbol tables)
Definition at line 84 of file Registry.h.
Constructor.
Definition at line 147 of file Registry.cpp.
Registry::Registry | ( | const Registry & | other | ) | [explicit] |
Creates a real deep copy.
other | Registry to copy. |
Definition at line 156 of file Registry.cpp.
Destructor.
Definition at line 176 of file Registry.cpp.
ID Registry::getAuxiliaryAtom | ( | char | type, |
ID | id | ||
) |
Allows for direct application of getAuxiliaryConstantSymbol to the predicate of an ordinary atom.
Replaces the predicate of atom id by its auxiliary predicate using getAuxiliaryConstantSymbol and returns the ID of the new (ground or nonground) atom.
type | Type of auxiliary predicate to use. |
id | ID of an ordinary atom for whose predicate shall be replaced by an auxiliary. |
id
with the predicate being replaced by an auxiliary predicate. Definition at line 731 of file Registry.cpp.
References ID::ALL_ONES, DBGLOG, getAuxiliaryConstantSymbol(), Atom::kind, lookupOrdinaryAtom(), ID::PROPERTY_AUX, ID::PROPERTY_MASK, storeOrdinaryAtom(), and Atom::tuple.
ID Registry::getAuxiliaryConstantSymbol | ( | char | type, |
ID | id | ||
) |
Creates auxiliary constant symbols.
Create or lookup auxiliary constant symbol of type <type> for ID <id> with multiple calls, for one <type>/<id> pair the same symbol/ID will be returned we limit ourselves to types of one letter, this should be sufficient see Registry.cpp for documentation of types used internally in dlvhex (plugins may also want to use this method for their own auxiliaries).
type | A character to encode the type of auxiliary. |
id | ID of an arbitrary object for which a new auxiliary symbol shall be created. |
Definition at line 633 of file Registry.cpp.
References DBGLOG, DBGLOG_SCOPE, TermTable::getIDByString(), ID_FAIL(), Term::kind, ID::MAINKIND_TERM, pimpl, ID::PROPERTY_AUX, ID::PROPERTY_EXTERNALAUX, ID::PROPERTY_EXTERNALINPUTAUX, TermTable::storeAndGetID(), ID::SUBKIND_TERM_CONSTANT, Term::symbol, and terms.
Referenced by getAuxiliaryAtom(), isNegativeExternalAtomAuxiliaryAtom(), isPositiveExternalAtomAuxiliaryAtom(), and swapExternalAtomAuxiliaryAtom().
Get predicate mask to auxiliary ground atoms.
Definition at line 837 of file Registry.cpp.
References pimpl.
Referenced by printAtomForUser().
ID Registry::getAuxiliaryVariableSymbol | ( | char | type, |
ID | id | ||
) |
Creates auxiliary variable symbols.
Create or lookup auxiliary variable symbol of type <type> for ID <id> with multiple calls, for one <type>/<id> pair the same symbol/ID will be returned we limit ourselves to types of one letter, this should be sufficient see Registry.cpp for documentation of types used internally in dlvhex (plugins may also want to use this method for their own auxiliaries).
type | A character to encode the type of auxiliary. |
id | ID of an arbitrary object for which a new auxiliary symbol shall be created. |
Definition at line 683 of file Registry.cpp.
References DBGLOG, DBGLOG_SCOPE, TermTable::getIDByString(), ID_FAIL(), ID::MAINKIND_TERM, pimpl, ID::PROPERTY_AUX, TermTable::storeAndGetID(), ID::SUBKIND_TERM_VARIABLE, Term::symbol, and terms.
void Registry::getExternalAtomsInTuple | ( | const Tuple & | t, |
Tuple & | out | ||
) | const |
Extracts all external atom IDs from t
.
Get all external atom IDs in tuple and recursively in aggregates in tuple append these ids to second given tuple tuple t
contains IDs of literals or atoms.
t | Vector of IDs of atoms. |
out | Reference to the tuple where external atom IDs to be added. |
Definition at line 264 of file Registry.cpp.
References aatoms, AggregateAtomTable::getByID(), and AggregateAtom::literals.
ID Registry::getIDByAuxiliaryConstantSymbol | ( | ID | auxConstantID | ) | const |
Inverse method of getAuxiliaryConstantSymbol wrt.
the original ID.
Maps an auxiliary constant or variable symbol back to the ID behind.
auxConstantID | An ID as created by getAuxiliaryConstantSymbol. |
auxConstantID
. Definition at line 745 of file Registry.cpp.
References DBGLOG, ID_FAIL(), ID::isConstantTerm(), and pimpl.
Referenced by isNegativeExternalAtomAuxiliaryAtom(), isPositiveExternalAtomAuxiliaryAtom(), and swapExternalAtomAuxiliaryAtom().
ID Registry::getIDByAuxiliaryVariableSymbol | ( | ID | auxVariableID | ) | const |
Inverse method of getAuxiliaryVariableSymbol wrt.
the original ID.
Maps an auxiliary constant or variable symbol back to the ID behind.
auxConstantID | An ID as created by getAuxiliaryVariableSymbol. |
auxVariableID
. Definition at line 764 of file Registry.cpp.
References DBGLOG, ID_FAIL(), ID::isVariableTerm(), and pimpl.
ID Registry::getNewConstantTerm | ( | std::string | prefix = "unnamed" | ) |
Creates a globally new constand term (new ID and new text).
prefix | The new term starts with the prefix; the method appends a string in order to guarantee uniqueness. |
Definition at line 594 of file Registry.cpp.
References DBGLOG, TermTable::getIDByString(), ID_FAIL(), ID::MAINKIND_TERM, storeTerm(), ID::SUBKIND_TERM_CONSTANT, and terms.
void Registry::getOutVariablesInID | ( | ID | id, |
std::set< ID > & | out, | ||
bool | includeAnonymous = false , |
||
bool | includeLocalAggVar = true |
||
) | const |
Retrieves variables in a term, an ordinary atom or the output list of an external atom.
Get all IDs of variables in atom given by ID, but skip input variables in external atoms. add these ids to out
id | Atom, literal or term ID. |
out | Reference to a set of IDs where all identified variables are to be added. |
includeAnonymous | True to include the anonymous variable ("_") if present, false to skip it. |
includeLocalAggVar | Specifies whether to include local variables in aggregates. |
Definition at line 336 of file Registry.cpp.
References aatoms, Term::arguments, batoms, eatoms, BuiltinAtomTable::getByID(), AggregateAtomTable::getByID(), ExternalAtomTable::getByID(), TermTable::getByID(), OrdinaryAtomTable::getByID(), AggregateAtom::literals, onatoms, terms, Atom::tuple, and AggregateAtom::variables.
ID Registry::getPredicateOfAtom | ( | ID | atom | ) |
Gets the predicate of an ordinary or external atom.
atom | ID of an ordinary or external atom. |
atom
. Definition at line 445 of file Registry.cpp.
References eatoms, ExternalAtomTable::getByID(), ID_FAIL(), ID::isExternalAtom(), ID::isOrdinaryAtom(), lookupOrdinaryAtom(), ExternalAtom::predicate, and Atom::tuple.
const std::string& Registry::getTermStringByID | ( | ID | termid | ) | const [inline] |
Lookup constant term.
termid | Identifies the term to retrieve. |
termid
. Definition at line 387 of file Registry.h.
char Registry::getTypeByAuxiliaryConstantSymbol | ( | ID | auxConstantID | ) | const |
Maps an auxiliary constant symbol back to the type behind.
auxConstantID | An ID as created by getAuxiliaryConstantSymbol. |
auxConstantID
. Definition at line 819 of file Registry.cpp.
void Registry::getVariablesInID | ( | ID | id, |
std::set< ID > & | out, | ||
bool | includeAnonymous = false , |
||
bool | includeLocalAggVar = true |
||
) | const |
Extracts all variable IDs from id
.
Get all IDs of variables in atom given by ID add these ids to out
.
id | Atom, literal or term ID. |
out | Reference to a set of IDs where all identified variables are to be added. |
includeAnonymous | True to include the anonymous variable ("_") if present, false to skip it. |
includeLocalAggVar | Specifies whether to include local variables in aggregates. |
Definition at line 283 of file Registry.cpp.
References aatoms, Term::arguments, batoms, eatoms, BuiltinAtomTable::getByID(), AggregateAtomTable::getByID(), ExternalAtomTable::getByID(), TermTable::getByID(), OrdinaryAtomTable::getByID(), ExternalAtom::inputs, ID::isVariableTerm(), AggregateAtom::literals, onatoms, terms, Atom::tuple, and AggregateAtom::variables.
Referenced by getVariablesInID(), and getVariablesInTuple().
std::set< ID > Registry::getVariablesInID | ( | const ID & | id, |
bool | includeAnonymous = false , |
||
bool | includeLocalAggVar = true |
||
) | const |
Extracts all variable IDs from id
.
Get all IDs of variables in atom given by ID returns these ids.
includeAnonymous | True to include the anonymous variable ("_") if present, false to skip it. |
includeLocalAggVar | Specifies whether to include local variables in aggregates. |
Definition at line 389 of file Registry.cpp.
References getVariablesInID().
void Registry::getVariablesInTuple | ( | const Tuple & | t, |
std::set< ID > & | out, | ||
bool | includeAnonymous = false , |
||
bool | includeLocalAggVar = true |
||
) | const |
Applies getVariablesInID to multiple IDs.
Get all IDs of variables in atoms in given tuple add these ids to out
tuple t
contains IDs of literals or atoms.
t | Vector of IDs of atoms, literals and terms. |
out | Reference to the tuple where variable IDs to be added. |
includeAnonymous | True to include the anonymous variable ("_") if present, false to skip it. |
includeLocalAggVar | Specifies whether to include local variables in aggregates. |
Definition at line 400 of file Registry.cpp.
References getVariablesInID().
Referenced by getVariablesInTuple().
std::set< ID > Registry::getVariablesInTuple | ( | const Tuple & | t, |
bool | includeAnonymous = false , |
||
bool | includeLocalAggVar = true |
||
) | const |
Applies getVariablesInID to multiple IDs.
Get all IDs of variables in atoms in given tuple add these ids to out
tuple t
contains IDs of literals or atoms.
t | Vector of IDs of atoms, literals and terms. |
includeAnonymous | True to include the anonymous variable ("_") if present, false to skip it. |
includeLocalAggVar | Specifies whether to include local variables in aggregates. |
Definition at line 408 of file Registry.cpp.
References getVariablesInTuple().
bool Registry::isNegativeExternalAtomAuxiliaryAtom | ( | ID | auxID | ) |
Checks if an external atom auxiliary is positive or negated.
Checks for an external auxiliary constant if it is of type 'r' or 'n'.
auxID | An auxiliary ID of type 'r' or 'n' created by getAuxiliaryConstantSymbol. |
auxID
is of type 'n' and false otherwise. Definition at line 792 of file Registry.cpp.
References getAuxiliaryConstantSymbol(), getIDByAuxiliaryConstantSymbol(), ID::isExternalAuxiliary(), ID::isExternalInputAuxiliary(), and lookupOrdinaryAtom().
bool Registry::isNullTerm | ( | ID | term | ) | const [inline] |
Checks if an auxiliary term represents a 'null' term.
Null terms are used to represent unnamed constants introduced by existential quantifiers.
term | An ID created by getAuxiliaryConstantSymbol. |
term
represents a null term and false otherwise. Definition at line 348 of file Registry.h.
References ID::isAuxiliary().
bool Registry::isPositiveExternalAtomAuxiliaryAtom | ( | ID | auxID | ) |
Checks if an external atom auxiliary is positive or negated.
Checks for an external auxiliary constant if it is of type 'r' or 'n'.
auxID | An auxiliary ID of type 'r' or 'n' created by getAuxiliaryConstantSymbol. |
auxID
is of type 'r' and false otherwise. Definition at line 782 of file Registry.cpp.
References getAuxiliaryConstantSymbol(), getIDByAuxiliaryConstantSymbol(), ID::isExternalAuxiliary(), ID::isExternalInputAuxiliary(), and lookupOrdinaryAtom().
const OrdinaryAtom & Registry::lookupOrdinaryAtom | ( | ID | id | ) | const |
Lookup ground or nonground ordinary atoms.
id | Identifies the atom to retrieve. |
id
. Definition at line 252 of file Registry.cpp.
References OrdinaryAtomTable::getByID(), ogatoms, and onatoms.
Referenced by getAuxiliaryAtom(), getPredicateOfAtom(), isNegativeExternalAtomAuxiliaryAtom(), isPositiveExternalAtomAuxiliaryAtom(), and swapExternalAtomAuxiliaryAtom().
std::ostream & Registry::print | ( | std::ostream & | o | ) |
Prints the registry.
o | Stream to print. |
o
. Definition at line 214 of file Registry.cpp.
References aatoms, batoms, eatoms, inputList, matoms, moduleTable, ogatoms, onatoms, preds, ExternalAtomTable::print(), RuleTable::print(), printvector(), rules, and terms.
virtual std::ostream& Registry::print | ( | std::ostream & | o | ) | const [inline, virtual] |
bool Registry::printAtomForUser | ( | std::ostream & | o, |
IDAddress | address, | ||
const std::string & | prefix = "" |
||
) |
Prints an atom in human-readable form.
o | Stream to printer. |
address | IDAddress of a ground atom. |
prefix | String to print before the actual atom (if the atom itself is printed). |
Definition at line 868 of file Registry.cpp.
References DBGLOG, DLVHEX_BENCHMARK_REGISTER_AND_SCOPE, getAuxiliaryGroundAtomMask(), OrdinaryAtomTable::getByAddress(), OrdinaryAtomTable::getIDByAddress(), ID::isHiddenAtom(), ID::MAINKIND_ATOM, ogatoms, pimpl, ID::PROPERTY_AUX, ID::SUBKIND_ATOM_ORDINARYG, and OrdinaryAtom::text.
void Registry::registerUserAuxPrinter | ( | AuxPrinterPtr | printer | ) |
Allows for adding customized printers for auxiliary symbols.
For auxiliary symbols, the printers are called in sequence until one of them actually prints the object.
Printer | to be used for printing selected auxiliary constants in customized format. |
Definition at line 851 of file Registry.cpp.
void Registry::registerUserDefaultAuxPrinter | ( | AuxPrinterPtr | printer | ) |
Defines a printer for auxiliary symbols to be used if no other printer applies.
printer | Default auxiliary printer. |
Definition at line 859 of file Registry.cpp.
ID Registry::replaceVariablesInTerm | ( | const ID | term, |
const ID | var, | ||
const ID | by | ||
) |
Recursively substitutes variables in terms.
term | ID of a (possibly nested) term. |
var | ID of the variable to be replaced. |
by | ID of the term to be inserted for var . |
Definition at line 416 of file Registry.cpp.
References Term::arguments, DBGLOG, TermTable::getByID(), TermTable::getIDByString(), ID_FAIL(), ID::isTerm(), ID::kind, TermTable::storeAndGetID(), ID::SUBKIND_MASK, ID::SUBKIND_TERM_BUILTIN, ID::SUBKIND_TERM_CONSTANT, ID::SUBKIND_TERM_INTEGER, ID::SUBKIND_TERM_NESTED, ID::SUBKIND_TERM_PREDICATE, ID::SUBKIND_TERM_VARIABLE, Term::symbol, terms, and Term::updateSymbolOfNestedTerm().
Initialization of the mask of all auxiliary atoms.
Must be called after construction and before any call to getAuxiliaryConstantSymbol.
Definition at line 626 of file Registry.cpp.
References pimpl.
ID Registry::storeConstantTerm | ( | const std::string & | symbol, |
bool | aux = false |
||
) |
Allows for storing constant terms.
Assert symbol is constant lookup symbol and return ID if exists otherwise register as constant and return ID.
symbol | String to store in a term. |
aux | Defines whether to mark the new term as auxiliary or not. |
Definition at line 531 of file Registry.cpp.
References DBGLOG, TermTable::getIDByString(), PredicateTable::getIDByString(), ID_FAIL(), Term::kind, ID::MAINKIND_TERM, preds, ID::PROPERTY_AUX, TermTable::storeAndGetID(), ID::SUBKIND_TERM_CONSTANT, and terms.
Referenced by FunctionInterprete::retrieve(), and TestPlugin::ProductionRequirementsAtom::retrieve().
ID Registry::storeConstOrVarTerm | ( | Term & | term | ) |
Allows for storing constant or variable terms.
Lookup by symbol, if it does not exist create it in term table assume term.kind and term.symbol is initialized assume term is not an integer (i.e., term.symbol does not start with a digit).
term | Term to store. |
Definition at line 514 of file Registry.cpp.
References DBGLOG, TermTable::getIDByString(), PredicateTable::getIDByString(), ID_FAIL(), preds, TermTable::storeAndGetID(), Term::symbol, and terms.
Referenced by storeTerm().
ID Registry::storeOrdinaryAtom | ( | OrdinaryAtom & | ogatom | ) |
Retrieval of ordinary atoms.
Lookup by tuple, if does not exist create text and store as new atom assume, that oatom.kind and oatom.tuple is initialized! assume, that oatom.text is not initialized! oatom.text will be modified.
The method can be used both for ground and nonground atoms.
ogatom | Atom pattern. |
ogatom
. Definition at line 492 of file Registry.cpp.
References Atom::kind, ogatoms, onatoms, ID::SUBKIND_ATOM_ORDINARYG, and ID::SUBKIND_MASK.
Referenced by getAuxiliaryAtom(), and swapExternalAtomAuxiliaryAtom().
ID Registry::storeOrdinaryGAtom | ( | OrdinaryAtom & | ogatom | ) |
Retrieval of ordinary ground atoms.
Lookup by tuple, if does not exist create text and store as new ground atom assume, that oatom.kind and oatom.tuple is initialized! assume, that oatom.text is not initialized! oatom.text will be modified.
ogatom | Atom pattern. |
ogatom
. Definition at line 499 of file Registry.cpp.
References ogatoms.
ID Registry::storeOrdinaryNAtom | ( | OrdinaryAtom & | onatom | ) |
Retrieval of ordinary nonground atoms.
Lookup by tuple, if does not exist create text and store as new nonground atom assume, that oatom.kind and oatom.tuple is initialized! assume, that oatom.text is not initialized! oatom.text will be modified.
onatom | Atom pattern. |
onatom
. Definition at line 507 of file Registry.cpp.
References onatoms.
ID Registry::storeRule | ( | Rule & | rule | ) |
Allows for storing a rule.
Check if rule is contained in registry if yes return integer id otherwise store and return new id assume rule is fully initialized.
rule | Rule to store. |
Definition at line 613 of file Registry.cpp.
References Rule::body, RuleTable::getIDByElement(), Rule::head, ID_FAIL(), Rule::kind, rules, and RuleTable::storeAndGetID().
ID Registry::storeTerm | ( | Term & | term | ) |
Allows for storing terms of arbitrary sub kind.
Check if term is integer if yes return integer ID otherwise add subkind flags (variable vs constant) to term.kind call storeConstOrVarTerm assume term.kind is at least MAINKIND_TERM and term.symbol is fully initialized.
term | Term to store; can be of any sub kind. |
Definition at line 566 of file Registry.cpp.
References Term::kind, storeConstOrVarTerm(), ID::SUBKIND_TERM_CONSTANT, ID::SUBKIND_TERM_VARIABLE, Term::symbol, and ID::termFromInteger().
Referenced by getNewConstantTerm(), and FunctionInterprete::retrieve().
ID Registry::storeVariableTerm | ( | const std::string & | symbol, |
bool | aux = false |
||
) |
Allows for storing variable terms.
Assert symbol is variable lookup symbol and return ID if exists otherwise register as variable and return ID.
symbol | Variable to store. |
aux | Defines whether to mark the new term as auxiliary or not. |
Definition at line 550 of file Registry.cpp.
References DBGLOG, TermTable::getIDByString(), ID_FAIL(), Term::kind, ID::MAINKIND_TERM, ID::PROPERTY_AUX, TermTable::storeAndGetID(), ID::SUBKIND_TERM_VARIABLE, and terms.
ID Registry::swapExternalAtomAuxiliaryAtom | ( | ID | auxID | ) |
Inverses an external auxiliary symbol.
Transforms an external auxiliary constant symbol of type 'r' into the according auxiliary constant of type 'n' and vice versa.
auxID | An auxiliary ID of type 'r' or 'n' created by getAuxiliaryConstantSymbol. |
Definition at line 802 of file Registry.cpp.
References getAuxiliaryConstantSymbol(), getIDByAuxiliaryConstantSymbol(), ID::isExternalAuxiliary(), ID::isExternalInputAuxiliary(), ID::kind, lookupOrdinaryAtom(), and storeOrdinaryAtom().
Table of aggregate atoms.
Definition at line 108 of file Registry.h.
Referenced by getExternalAtomsInTuple(), getOutVariablesInID(), getVariablesInID(), RawPrinter::print(), and print().
Table of builtin atoms.
Definition at line 106 of file Registry.h.
Referenced by getOutVariablesInID(), getVariablesInID(), RawPrinter::print(), and print().
Cache of external atom input tuples.
This cache is used by BaseModelGenerator but it should persist over the lifetime of different model generators, can be shared by various kinds of model generators derived from BaseModelGenerator, and its content depends only on the registry, so we store it here.
Definition at line 126 of file Registry.h.
Table of external atoms.
Definition at line 110 of file Registry.h.
Referenced by getOutVariablesInID(), getPredicateOfAtom(), getVariablesInID(), RawPrinter::print(), and print().
std::vector<Tuple> Registry::inputList |
Definition at line 116 of file Registry.h.
Referenced by print().
Table of module atoms.
Definition at line 112 of file Registry.h.
Referenced by RawPrinter::print(), and print().
Definition at line 115 of file Registry.h.
Referenced by print().
Table of ordinary ground atoms.
Definition at line 102 of file Registry.h.
Referenced by lookupOrdinaryAtom(), RawPrinter::print(), print(), printAtomForUser(), RawPrinter::printWithoutPrefix(), TestPlugin::SumNonZeroAtom::retrieve(), TestPlugin::ProductionRequirementsAtom::retrieve(), storeOrdinaryAtom(), and storeOrdinaryGAtom().
Table of ordinary nonground atoms.
Definition at line 104 of file Registry.h.
Referenced by getOutVariablesInID(), getVariablesInID(), lookupOrdinaryAtom(), RawPrinter::print(), print(), storeOrdinaryAtom(), and storeOrdinaryNAtom().
boost::scoped_ptr<Impl> Registry::pimpl [protected] |
Definition at line 515 of file Registry.h.
Referenced by getAuxiliaryConstantSymbol(), getAuxiliaryGroundAtomMask(), getAuxiliaryVariableSymbol(), getIDByAuxiliaryConstantSymbol(), getIDByAuxiliaryVariableSymbol(), getTypeByAuxiliaryConstantSymbol(), printAtomForUser(), registerUserAuxPrinter(), registerUserDefaultAuxPrinter(), and setupAuxiliaryGroundAtomMask().
Table of predicate terms.
Definition at line 100 of file Registry.h.
Referenced by RawPrinter::print(), print(), storeConstantTerm(), and storeConstOrVarTerm().
Table of rules atoms.
Definition at line 114 of file Registry.h.
Referenced by RawPrinter::print(), print(), and storeRule().
Table of terms.
Definition at line 98 of file Registry.h.
Referenced by getAuxiliaryConstantSymbol(), getAuxiliaryVariableSymbol(), getNewConstantTerm(), getOutVariablesInID(), getVariablesInID(), RawPrinter::print(), print(), replaceVariablesInTerm(), FunctionComposeAtom::retrieve(), FunctionDecomposeAtom::retrieve(), IsFunctionTermAtom::retrieve(), GetArityAtom::retrieve(), FunctionDecomposeGeneralAtom::retrieve(), FunctionInterprete::retrieve(), storeConstantTerm(), storeConstOrVarTerm(), storeVariableTerm(), and Term::updateSymbolOfNestedTerm().