Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

MarkScope Class Reference

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

#include <MarkScope.h>

Inheritance diagram for MarkScope:

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.

List of all members.

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)

Constructor & Destructor Documentation

MarkScope::MarkScope ( Resource r  ) 

constructor, for marking resources which require no data

Definition at line 14 of file MarkScope.h.

MarkScope::MarkScope ( Resource r,
Resource::Data d 
)

constructor, accepts data parameter to pass to Resource::useResource()

Definition at line 18 of file MarkScope.h.

MarkScope::MarkScope ( const MarkScope ms  ) 

copy constructor, marks resource used, copying ms's data reference (better make sure the Resource support recursive usage...)

Definition at line 22 of file MarkScope.h.

MarkScope::MarkScope ( const MarkScope ms,
Resource::Data d 
)

copy constructor, accepts additional data parameter to pass to Resource::useResource()

Definition at line 26 of file MarkScope.h.

MarkScope::~MarkScope (  ) 

destructor, releases resource

Definition at line 30 of file MarkScope.h.


Member Function Documentation

Resource::Data& MarkScope::getData (  )  const

accessor to return the data used to access the resource

Definition at line 37 of file MarkScope.h.

Resource& MarkScope::getResource (  )  const

accessor to return the resource being marked

Definition at line 35 of file MarkScope.h.

MarkScope& MarkScope::operator= ( const MarkScope  )  [private]

assignment prohibited (can't reassign the reference we already hold)

void MarkScope::reset ( Resource::Data d  ) 

renew the resource usage -- call release and use again with the new data

Definition at line 41 of file MarkScope.h.

void MarkScope::reset (  ) 

renew the resource usage -- call release and use again, with the same data

Definition at line 39 of file MarkScope.h.


Member Data Documentation

data passed to resource when using it and releasing it

Definition at line 45 of file MarkScope.h.

Referenced by getData(), MarkScope(), reset(), and ~MarkScope().

Resource& MarkScope::rsrc [protected]

the resource we're using

Definition at line 44 of file MarkScope.h.

Referenced by ResourceAccessor< R >::accessResource(), getResource(), MarkScope(), reset(), and ~MarkScope().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:12 2016 by Doxygen 1.6.3