#include <ClosableObject.h>
Inheritance diagram for ClosableObject:
Public Member Functions | |
virtual | ~ClosableObject () |
Destructor. | |
bool | isClosed () const |
| |
void | close () |
Closes this object, releasing any unallocated resources. | |
Protected Member Functions | |
virtual void | closeImpl ()=0 |
Must be implemented by derived class to release any resources. | |
ClosableObject () | |
Protected Attributes | |
bool | needsClose |
to avoid the error of calling virtual methods from a base class destructor). Deriving from ClosableObject makes it easier to instantiate a shared_ptr which takes care of automatic close on destruction (see ClosableObjectDestructor).
Definition at line 36 of file ClosableObject.h.
ClosableObject::ClosableObject | ( | ) | [explicit, protected] |
Definition at line 29 of file ClosableObject.cpp.
References needsClose.
00030 { 00031 needsClose = true; 00032 }
ClosableObject::~ClosableObject | ( | ) | [virtual] |
Destructor.
An assertion violation will result if the object has not yet been closed.
Definition at line 34 of file ClosableObject.cpp.
References needsClose.
00035 { 00036 assert(!needsClose); 00037 }
virtual void ClosableObject::closeImpl | ( | ) | [protected, pure virtual] |
Must be implemented by derived class to release any resources.
Implemented in CacheImpl< PageT, VictimPolicyT >, ByteArrayInputStream, ByteArrayOutputStream, ByteOutputStream, CheckpointThread, Database, BarrierExecStream, DoubleBufferExecStream, ExecStream, ExecStreamGraphImpl, MockResourceExecStream, ReshapeExecStream, ScratchBufferExecStream, SegBufferExecStream, SegBufferReader, SegBufferReaderExecStream, SegBufferWriter, SegBufferWriterExecStream, JavaSinkExecStream, JavaTransformExecStream, FlatFileBuffer, FlatFileExecStreamImpl, BTreeExecStream, BTreeInsertExecStream, BTreePrefetchSearchExecStream, BTreeReadExecStream, BTreeSearchExecStream, FtrsTableWriterExecStream, LhxAggExecStream, LhxJoinExecStream, LbmBitOpExecStream, LbmChopperExecStream, LbmGeneratorExecStream, LbmIntersectExecStream, LbmMinusExecStream, LbmSplicerExecStream, LbmUnionExecStream, LcsClusterAppendExecStream, LcsRowScanBaseExecStream, LcsRowScanExecStream, DelegatingSegment, DynamicDelegatingSegment, ScratchSegment, SegInputStream, Segment, SegOutputStream, SegPageBackupRestoreDevice, SegStream, SegStreamAllocation, SpillOutputStream, and ExternalSortExecStreamImpl.
Referenced by close().
bool ClosableObject::isClosed | ( | ) | const [inline] |
Definition at line 58 of file ClosableObject.h.
00059 { 00060 return !needsClose; 00061 }
void ClosableObject::close | ( | ) |
Closes this object, releasing any unallocated resources.
Reimplemented in CollectExecStream, CorrelationJoinExecStream, LcsClusterAppendExecStream, and LcsClusterReplaceExecStream.
Definition at line 39 of file ClosableObject.cpp.
References closeImpl(), and needsClose.
Referenced by CacheImpl< PageT, VictimPolicyT >::allocatePages(), LcsRowScanBaseExecStream::closeImpl(), ExecStreamGraphImpl::closeImpl(), FlatFileBuffer::open(), ClosableObjectDestructor::operator()(), and Segment::~Segment().
00040 { 00041 if (!needsClose) { 00042 return; 00043 } 00044 needsClose = false; 00045 closeImpl(); 00046 }
bool ClosableObject::needsClose [protected] |
Definition at line 44 of file ClosableObject.h.
Referenced by SegStreamAllocation::beginWrite(), ExecStreamGraphImpl::clear(), ClosableObject(), close(), FlatFileBuffer::open(), ExecStreamGraphImpl::open(), ExecStream::open(), and ~ClosableObject().