diff options
author | Tim King <taking@google.com> | 2016-01-28 12:35:45 -0800 |
---|---|---|
committer | Tim King <taking@google.com> | 2016-01-28 12:35:45 -0800 |
commit | 2ba8bb701ce289ba60afec01b653b0930cc59298 (patch) | |
tree | 46df365b7b41ce662a0f94de5b11c3ed20829851 /src/expr/node_manager.cpp | |
parent | 42b665f2a00643c81b42932fab1441987628c5a5 (diff) |
Adding listeners to Options.
- Options
-- Added the new option attribute :notify. One can get a notify() call on the Listener after a the option's value is updated. This is the new preferred way to achieve dynamic dispatch for options.
-- Removed SmtOptionsHandler and pushed its functionality into OptionsHandler and Listeners.
-- Added functions to Options for registering listeners of the notify calls.
-- Changed a number of options to use the new listener infrastructure.
-- Fixed a number of warnings in options.
-- Added the ArgumentExtender class to better capture how arguments are inserted while parsing options and ease memory management. Previously this was the "preemptGetopt" procedure.
-- Moved options/options_handler_interface.{cpp,h} to options/options_handler.{cpp,h}.
- Theories
-- Reimplemented alternative theories to use a datastructure stored on TheoryEngine instead of on Options.
- Ostream Handling:
-- Added new functionality that generalized how ostreams are opened, options/open_stream.h.
-- Simplified the memory management for different ostreams, smt/managed_ostreams.h.
-- Had the SmtEnginePrivate manage the memory for the ostreams set by options.
-- Simplified how the setting of ostreams are updated, smt/update_ostream.h.
- Configuration and Tags:
-- Configuration can now be used during predicates and handlers for options.
-- Moved configuration.{cpp,h,i} and configuration_private.h from util/ into base/.
-- Moved {Debug,Trace}_tags.* from being generated in options/ into base/.
- cvc4_private.h
-- Upgraded #warning's in cvc4_private.h and cvc4_private_library.h to #error's.
-- Added public first-order (non-templatized) member functions for options get and set the value of options outside of libcvc4. Fixed all of the use locations.
-- Made lib/lib/clock_gettime.h a cvc4_private_library.h header.
- Antlr
-- Fixed antlr and cvc4 macro definition conflicts that caused warnings.
- SmtGlobals
-- Refactored replayStream and replayLog out of SmtGlobals.
-- Renamed SmtGlobals to LemmaChannels and moved the implementation into smt_util/lemma_channels.{h,cpp}.
Diffstat (limited to 'src/expr/node_manager.cpp')
-rw-r--r-- | src/expr/node_manager.cpp | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/src/expr/node_manager.cpp b/src/expr/node_manager.cpp index 13960b717..e52776fce 100644 --- a/src/expr/node_manager.cpp +++ b/src/expr/node_manager.cpp @@ -23,9 +23,11 @@ #include <utility> #include "base/cvc4_assert.h" +#include "base/listener.h" #include "base/tls.h" #include "expr/attribute.h" #include "expr/node_manager_attributes.h" +#include "expr/node_manager_listeners.h" #include "expr/type_checker.h" #include "options/options.h" #include "options/smt_options.h" @@ -84,6 +86,7 @@ NodeManager::NodeManager(ExprManager* exprManager) : d_options(new Options()), d_statisticsRegistry(new StatisticsRegistry()), d_resourceManager(new ResourceManager()), + d_registrations(new ListenerRegistrationList()), next_id(0), d_attrManager(new expr::attr::AttributeManager()), d_exprManager(exprManager), @@ -96,16 +99,19 @@ NodeManager::NodeManager(ExprManager* exprManager) : NodeManager::NodeManager(ExprManager* exprManager, const Options& options) : - d_options(new Options(options)), + d_options(new Options()), d_statisticsRegistry(new StatisticsRegistry()), d_resourceManager(new ResourceManager()), + d_registrations(new ListenerRegistrationList()), next_id(0), d_attrManager(new expr::attr::AttributeManager()), d_exprManager(exprManager), d_nodeUnderDeletion(NULL), d_inReclaimZombies(false), d_abstractValueCount(0), - d_skolemCounter(0) { + d_skolemCounter(0) +{ + d_options->copyValues(options); init(); } @@ -135,6 +141,16 @@ void NodeManager::init() { if((*d_options)[options::cpuTime]) { d_resourceManager->useCPUTime(true); } + + // Do not notify() upon registration as these were handled manually above. + d_registrations->add(d_options->registerTlimitListener( + new TlimitListener(d_resourceManager), false)); + d_registrations->add(d_options->registerTlimitPerListener( + new TlimitPerListener(d_resourceManager), false)); + d_registrations->add(d_options->registerRlimitListener( + new RlimitListener(d_resourceManager), false)); + d_registrations->add(d_options->registerRlimitPerListener( + new RlimitPerListener(d_resourceManager), false)); } NodeManager::~NodeManager() { @@ -180,6 +196,8 @@ NodeManager::~NodeManager() { // defensive coding, in case destruction-order issues pop up (they often do) delete d_statisticsRegistry; d_statisticsRegistry = NULL; + delete d_registrations; + d_registrations = NULL; delete d_resourceManager; d_resourceManager = NULL; delete d_attrManager; |