Loading...
Searching...
No Matches
autoDeletable.h
Go to the documentation of this file.
// -*- Mode: C++; tab-width: 2; -*-
// vi: set ts=2:
//
#ifndef BALL_CONCEPT_AUTODELETABLE_H
#define BALL_CONCEPT_AUTODELETABLE_H
#ifndef BALL_CONFIG_CONFIG_H
# include <BALL/CONFIG/config.h>
#endif
#ifndef BALL_COMMON_COMMON_H
# include <BALL/COMMON/debug.h>
#endif
#ifndef BALL_COMMON_GLOBAL_H
# include <BALL/COMMON/global.h>
#endif
#include <cstdlib>
#include <new>
#include <iostream>
namespace BALL
{
class BALL_EXPORT AutoDeletable
{
public:
virtual ~AutoDeletable()
;
void* operator new(size_t size)
;
void operator delete(void* ptr)
;
void* operator new(size_t size, void* ptr)
;
void operator delete(void* ptr, void*)
;
void setAutoDeletable(bool enable)
;
/* This is required for cleaning up in case we want to
valgrind our stuff -- otherwise we get "still reachable"
blocks through this ptr.
*/
static void clearLastPtr() { last_ptr_ = 0; }
bool isAutoDeletable() const
;
protected:
/*_ Default constructor.
Should be called by subclasses only. There's no need to construct
AutoDeletable objects by themselves.
*/
AutoDeletable()
;
/*_ Copy constructor.
*/
AutoDeletable(const AutoDeletable& auto_deletable, bool deep = false)
;
private:
/*_ Flag describing whether the object may be deleted automatically.
*/
bool enabled_;
/*_ The last new pointer.
This pointe ris used internally to determine whether a given
instance of AutoDeletable was constructed statically or dynamically.
*/
static void* last_ptr_;
};
# ifndef BALL_NO_INLINE_FUNCTIONS
# include <BALL/CONCEPT/autoDeletable.iC>
# endif
} // namespace BALL
#endif // BALL_CONCEPT_AUTODELETABLE_H
global.h
BALL_EXPORT
#define BALL_EXPORT
Definition COMMON/global.h:50
BALL::AutoDeletable::clearLastPtr
static void clearLastPtr()
Definition autoDeletable.h:129
BALL::AutoDeletable::setAutoDeletable
void setAutoDeletable(bool enable)
BALL::AutoDeletable::AutoDeletable
AutoDeletable(const AutoDeletable &auto_deletable, bool deep=false)
BALL::AutoDeletable::AutoDeletable
AutoDeletable()
BALL::AutoDeletable::~AutoDeletable
virtual ~AutoDeletable()
BALL::AutoDeletable::isAutoDeletable
bool isAutoDeletable() const
debug.h
BALL
Definition constants.h:13