summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDejan Jovanović <dejan.jovanovic@gmail.com>2010-02-08 18:45:02 +0000
committerDejan Jovanović <dejan.jovanovic@gmail.com>2010-02-08 18:45:02 +0000
commitbff4e3eb99ce8d70f826d95aff452971f42f26f0 (patch)
tree17a634e24e2ed023f4df6a6a14790e0ab0ccc07f
parent5413dcf70eafbc4c473a4c7c429ed2a0f243a56d (diff)
Moving the template stuff back into the header in order to use CDList.
-rw-r--r--src/context/context.cpp25
-rw-r--r--src/context/context.h21
2 files changed, 20 insertions, 26 deletions
diff --git a/src/context/context.cpp b/src/context/context.cpp
index 5d8ea933b..dce1d0a17 100644
--- a/src/context/context.cpp
+++ b/src/context/context.cpp
@@ -15,8 +15,6 @@
#include "context/context.h"
#include "util/Assert.h"
-#include <cstdlib>
-
namespace CVC4 {
namespace context {
@@ -208,7 +206,6 @@ ContextNotifyObj::ContextNotifyObj(Context* pContext, bool preNotify) {
}
}
-
ContextNotifyObj::~ContextNotifyObj()
{
if (d_pCNOnext != NULL) {
@@ -219,28 +216,6 @@ ContextNotifyObj::~ContextNotifyObj()
}
}
-
-template<class T>
-void CDList<T>::grow() {
- if (d_list == NULL) {
- // Allocate an initial list if one does not yet exist
- d_sizeAlloc = 10;
- d_list = malloc(sizeof(T)*d_sizeAlloc);
- }
- else {
- // Allocate a new array with double the size
- d_sizeAlloc *= 2;
- T* newList = malloc(sizeof(T)*d_sizeAlloc);
-
- // Copy the old data
- memcpy(d_list, newList, sizeof(T)*d_size);
-
- // Free the old list
- free(d_list);
- }
-}
-
-
} /* CVC4::context namespace */
diff --git a/src/context/context.h b/src/context/context.h
index 244a8b792..3d44bb48c 100644
--- a/src/context/context.h
+++ b/src/context/context.h
@@ -18,6 +18,8 @@
#include "context/context_mm.h"
#include "util/Assert.h"
+#include <cstdlib>
+#include <cstring>
namespace CVC4 {
namespace context {
@@ -622,7 +624,24 @@ class CDList :public ContextObj {
/**
* Reallocate the array with more space.
*/
- void grow();
+ void grow() {
+ if (d_list == NULL) {
+ // Allocate an initial list if one does not yet exist
+ d_sizeAlloc = 10;
+ d_list = (T*)malloc(sizeof(T)*d_sizeAlloc);
+ }
+ else {
+ // Allocate a new array with double the size
+ d_sizeAlloc *= 2;
+ T* newList = (T*)malloc(sizeof(T)*d_sizeAlloc);
+
+ // Copy the old data
+ memcpy(d_list, newList, sizeof(T)*d_size);
+
+ // Free the old list
+ free(d_list);
+ }
+ }
public:
/**
generated by cgit on debian on lair
contact matthew@masot.net with questions or feedback