Move function defns from smt_engine_scope.h to cpp (#216)
authorAndres Noetzli <andres.noetzli@gmail.com>
Mon, 14 Aug 2017 22:32:23 +0000 (15:32 -0700)
committerGitHub <noreply@github.com>
Mon, 14 Aug 2017 22:32:23 +0000 (15:32 -0700)
Additionally, this commit removes unnecessary includes, adds includes to
smt_engine.h in files that require it and removes s_smtEngine_current from
smt_engine_scope.h.

src/smt/model.cpp
src/smt/smt_engine_scope.cpp
src/smt/smt_engine_scope.h
src/theory/quantifiers/macros.cpp
src/theory/quantifiers/term_database_sygus.cpp

index 7bfe307c3994e9499475c4af87cb4fabc8f554e0..892e8d888e8337c86b72e5830210717713099289 100644 (file)
@@ -21,6 +21,7 @@
 #include "printer/printer.h"
 #include "smt/command.h"
 #include "smt/command_list.h"
+#include "smt/smt_engine.h"
 #include "smt/smt_engine_scope.h"
 
 using namespace std;
index 87823775a42dd32bd9f37f07b25623a65a2cbd42..6c360cdc953afce9364da23519cde42d92a4f6ac 100644 (file)
  ** \todo document this file
  **/
 
-#include "smt/smt_engine.h"
 #include "smt/smt_engine_scope.h"
 
+#include "base/configuration_private.h"
+#include "base/cvc4_assert.h"
+#include "base/output.h"
+#include "base/tls.h"
+#include "proof/proof.h"
+#include "smt/smt_engine.h"
+
 namespace CVC4 {
 namespace smt {
 
 CVC4_THREADLOCAL(SmtEngine*) s_smtEngine_current = NULL;
 
+SmtEngine* currentSmtEngine() {
+  Assert(s_smtEngine_current != NULL);
+  return s_smtEngine_current;
+}
+
+bool smtEngineInScope() { return s_smtEngine_current != NULL; }
+
+ProofManager* currentProofManager() {
+#if IS_PROOFS_BUILD
+  Assert(s_smtEngine_current != NULL);
+  return s_smtEngine_current->d_proofManager;
+#else  /* IS_PROOFS_BUILD */
+  InternalError("proofs/unsat cores are not on, but ProofManager requested");
+  return NULL;
+#endif /* IS_PROOFS_BUILD */
+}
+
+SmtScope::SmtScope(const SmtEngine* smt)
+    : NodeManagerScope(smt->d_nodeManager),
+      d_oldSmtEngine(s_smtEngine_current) {
+  Assert(smt != NULL);
+  s_smtEngine_current = const_cast<SmtEngine*>(smt);
+  Debug("current") << "smt scope: " << s_smtEngine_current << std::endl;
+}
+
+SmtScope::~SmtScope() {
+  s_smtEngine_current = d_oldSmtEngine;
+  Debug("current") << "smt scope: returning to " << s_smtEngine_current
+                   << std::endl;
+}
+
+StatisticsRegistry* SmtScope::currentStatisticsRegistry() {
+  Assert(smtEngineInScope());
+  return s_smtEngine_current->d_statisticsRegistry;
+}
+
 }/* CVC4::smt namespace */
 }/* CVC4 namespace */
index a3f7162383c74d7d67ec776254f081df874bf479..fda4d5e109e6b57a037f2ee4fdf1acd3bf0cb3e0 100644 (file)
 
 #include "cvc4_private.h"
 
-#pragma once
+#ifndef __CVC4__SMT__SMT_ENGINE_SCOPE_H
+#define __CVC4__SMT__SMT_ENGINE_SCOPE_H
 
-#include "base/configuration_private.h"
-#include "base/cvc4_assert.h"
-#include "base/output.h"
-#include "base/tls.h"
 #include "expr/node_manager.h"
-#include "proof/proof.h"
-#include "proof/proof_manager.h"
-#include "options/smt_options.h"
-#include "smt/smt_engine.h"
-
 
 namespace CVC4 {
 
 class ProofManager;
+class SmtEngine;
+class StatisticsRegistry;
 
 namespace smt {
 
-extern CVC4_THREADLOCAL(SmtEngine*) s_smtEngine_current;
-
-inline SmtEngine* currentSmtEngine() {
-  Assert(s_smtEngine_current != NULL);
-  return s_smtEngine_current;
-}
-inline bool smtEngineInScope() {
-  return s_smtEngine_current != NULL;
-}
+SmtEngine* currentSmtEngine();
+bool smtEngineInScope();
 
 // FIXME: Maybe move into SmtScope?
-inline ProofManager* currentProofManager() {
-#if IS_PROOFS_BUILD
-  Assert(s_smtEngine_current != NULL);
-  return s_smtEngine_current->d_proofManager;
-#else /* IS_PROOFS_BUILD */
-  InternalError("proofs/unsat cores are not on, but ProofManager requested");
-  return NULL;
-#endif /* IS_PROOFS_BUILD */
-}
+ProofManager* currentProofManager();
 
 class SmtScope : public NodeManagerScope {
   /** The old NodeManager, to be restored on destruction. */
   SmtEngine* d_oldSmtEngine;
 
 public:
+ SmtScope(const SmtEngine* smt);
+ ~SmtScope();
 
-  SmtScope(const SmtEngine* smt) :
-    NodeManagerScope(smt->d_nodeManager),
-    d_oldSmtEngine(s_smtEngine_current) {
-    Assert(smt != NULL);
-    s_smtEngine_current = const_cast<SmtEngine*>(smt);
-    Debug("current") << "smt scope: " << s_smtEngine_current << std::endl;
-  }
-
-  ~SmtScope() {
-    s_smtEngine_current = d_oldSmtEngine;
-    Debug("current") << "smt scope: returning to " << s_smtEngine_current << std::endl;
-  }
-
-  /**
-   * This returns the StatisticsRegistry attached to the currently in scope
-   * SmtEngine.
-   */
-  static StatisticsRegistry* currentStatisticsRegistry() {
-    Assert(smtEngineInScope());
-    return s_smtEngine_current->d_statisticsRegistry;
-  }
+ /**
+  * This returns the StatisticsRegistry attached to the currently in scope
+  * SmtEngine.
+  */
+ static StatisticsRegistry* currentStatisticsRegistry();
 
 };/* class SmtScope */
 
 
 }/* CVC4::smt namespace */
 }/* CVC4 namespace */
+
+#endif /* __CVC4__SMT__SMT_ENGINE_SCOPE_H */
index 6b071f8f7d7de7b655a63242442d111903a3b42b..a9fad80ae7f78eef39044fc13139df7dde014c62 100644 (file)
@@ -21,6 +21,7 @@
 #include "options/quantifiers_modes.h"
 #include "options/quantifiers_options.h"
 #include "proof/proof_manager.h"
+#include "smt/smt_engine.h"
 #include "smt/smt_engine_scope.h"
 #include "theory/quantifiers/term_database.h"
 #include "theory/quantifiers/trigger.h"
index 62ba32d1e8b7d15d330318039687ac306bc7c04c..0a48b88347a4a84de6d8d75b37e853b615684ab9 100644 (file)
@@ -16,8 +16,9 @@
 
 #include "expr/datatype.h"
 #include "options/base_options.h"
-#include "options/quantifiers_options.h"
 #include "options/datatypes_options.h"
+#include "options/quantifiers_options.h"
+#include "smt/smt_engine.h"
 #include "theory/quantifiers/ce_guided_instantiation.h"
 #include "theory/quantifiers/first_order_model.h"
 #include "theory/quantifiers/fun_def_engine.h"