Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MarkScope Class Reference

#include <MarkScope.h>

Inheritance diagram for MarkScope:

Inheritance graph
[legend]
List of all members.

Detailed Description

Provides a way to mark a resource as used for the duration of the instance's scope.

This is handy because we don't have to worry about releasing the resource if there are multiple return points, exception handling, or other such issues which might otherwise cause you to forget to release it -- let C++ do it for you!

Definition at line 11 of file MarkScope.h.

Public Member Functions

 MarkScope (Resource &r)
 constructor, for marking resources which require no data
 MarkScope (Resource &r, Resource::Data &d)
 constructor, accepts data parameter to pass to Resource::useResource()
 MarkScope (const MarkScope &ms)
 copy constructor, marks resource used, copying ms's data reference (better make sure the Resource support recursive usage...)
 MarkScope (const MarkScope &ms, Resource::Data &d)
 copy constructor, accepts additional data parameter to pass to Resource::useResource()
 ~MarkScope ()
 destructor, releases resource
ResourcegetResource () const
 accessor to return the resource being marked
Resource::DatagetData () const
 accessor to return the data used to access the resource
void reset ()
 renew the resource usage -- call release and use again, with the same data
void reset (Resource::Data &d)
 renew the resource usage -- call release and use again with the new data

Protected Attributes

Resourcersrc
 the resource we're using
Resource::Datadata
 data passed to resource when using it and releasing it

Private Member Functions

MarkScopeoperator= (const MarkScope &)
 assignment prohibited (can't reassign the reference we already hold)


The documentation for this class was generated from the following file:

Tekkotsu v3.0
Generated Fri May 11 20:08:22 2007 by Doxygen 1.4.7