diff options
Diffstat (limited to 'src/context')
-rw-r--r-- | src/context/cdmap.h | 9 | ||||
-rw-r--r-- | src/context/cdmap_forward.h | 42 | ||||
-rw-r--r-- | src/context/cdset.h | 17 |
3 files changed, 63 insertions, 5 deletions
diff --git a/src/context/cdmap.h b/src/context/cdmap.h index 76c05fd4d..1e7e931da 100644 --- a/src/context/cdmap.h +++ b/src/context/cdmap.h @@ -92,20 +92,19 @@ #ifndef __CVC4__CONTEXT__CDMAP_H #define __CVC4__CONTEXT__CDMAP_H -#include "context/context.h" -#include "util/Assert.h" - #include <vector> #include <iterator> #include <ext/hash_map> +#include "context/context.h" +#include "util/Assert.h" +#include "context/cdmap_forward.h" + namespace CVC4 { namespace context { // Auxiliary class: almost the same as CDO (see cdo.h) -template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > class CDMap; - template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > class CDOmap : public ContextObj { friend class CDMap<Key, Data, HashFcn>; diff --git a/src/context/cdmap_forward.h b/src/context/cdmap_forward.h new file mode 100644 index 000000000..1024f0b54 --- /dev/null +++ b/src/context/cdmap_forward.h @@ -0,0 +1,42 @@ +/********************* */ +/*! \file cdmap_forward.h + ** \verbatim + ** Original author: mdeters + ** Major contributors: none + ** Minor contributors (to current version): none + ** This file is part of the CVC4 prototype. + ** Copyright (c) 2009, 2010 The Analysis of Computer Systems Group (ACSys) + ** Courant Institute of Mathematical Sciences + ** New York University + ** See the file COPYING in the top-level source directory for licensing + ** information.\endverbatim + ** + ** \brief This is a forward declaration header to declare the CDMap<> + ** template + ** + ** This is a forward declaration header to declare the CDMap<> + ** template. It's useful if you want to forward-declare CDMap<> + ** without including the full cdmap.h header, for example, in a + ** public header context. + ** + ** For CDMap<> in particular, it's difficult to forward-declare it + ** yourself, becase it has a default template argument. + **/ + +#include "cvc4_public.h" + +#ifndef __CVC4__CONTEXT__CDMAP_FORWARD_H +#define __CVC4__CONTEXT__CDMAP_FORWARD_H + +namespace __gnu_cxx { + template <class Key> class hash; +}/* __gnu_cxx namespace */ + +namespace CVC4 { + namespace context { + template <class Key, class Data, class HashFcn = __gnu_cxx::hash<Key> > + class CDMap; + }/* CVC4::context namespace */ +}/* CVC4 namespace */ + +#endif /* __CVC4__CONTEXT__CDMAP_FORWARD_H */ diff --git a/src/context/cdset.h b/src/context/cdset.h index 7032f76ba..47848c26f 100644 --- a/src/context/cdset.h +++ b/src/context/cdset.h @@ -34,6 +34,23 @@ class CDSet : protected CDMap<V, V, HashFcn> { public: + // ensure these are publicly accessible + static void* operator new(size_t size, bool b) { + return ContextObj::operator new(size, b); + } + + static void operator delete(void* pMem, bool b) { + return ContextObj::operator delete(pMem, b); + } + + void deleteSelf() { + this->ContextObj::deleteSelf(); + } + + static void operator delete(void* pMem) { + AlwaysAssert(false, "It is not allowed to delete a ContextObj this way!"); + } + CDSet(Context* context) : super(context) { } |