Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

InverseMarkScope Class Reference

Provides a way to mark a resource as unused for the duration of the instance's scope, thus negating MarkScope for a portion. More...

#include <InverseMarkScope.h>


Detailed Description

Provides a way to mark a resource as unused for the duration of the instance's scope, thus negating MarkScope for a portion.

This is handy because we don't have to worry about re-securing 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 InverseMarkScope.h.

List of all members.

Public Member Functions

 InverseMarkScope (Resource &r)
 constructor, for marking resources which require no data
 InverseMarkScope (Resource &r, Resource::Data &d)
 constructor, accepts data parameter to pass to Resource::releaseResource()
 InverseMarkScope (const InverseMarkScope &ms)
 copy constructor, marks resource used, copying ms's data reference (better make sure the Resource support recursive usage...)
 InverseMarkScope (const InverseMarkScope &ms, Resource::Data &d)
 copy constructor, accepts additional data parameter to pass to Resource::releaseResource()
 ~InverseMarkScope ()
 destructor, re-acquires 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 use and release again, with the same data
void reset (Resource::Data &d)
 renew the resource usage -- call use and release 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

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

Constructor & Destructor Documentation

InverseMarkScope::InverseMarkScope ( Resource r  ) 

constructor, for marking resources which require no data

Definition at line 14 of file InverseMarkScope.h.

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

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

Definition at line 18 of file InverseMarkScope.h.

InverseMarkScope::InverseMarkScope ( const InverseMarkScope 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 InverseMarkScope.h.

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

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

Definition at line 26 of file InverseMarkScope.h.

InverseMarkScope::~InverseMarkScope (  ) 

destructor, re-acquires resource

Definition at line 30 of file InverseMarkScope.h.


Member Function Documentation

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

accessor to return the data used to access the resource

Definition at line 37 of file InverseMarkScope.h.

Resource& InverseMarkScope::getResource (  )  const

accessor to return the resource being marked

Definition at line 35 of file InverseMarkScope.h.

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

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

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

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

Definition at line 41 of file InverseMarkScope.h.

void InverseMarkScope::reset (  ) 

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

Definition at line 39 of file InverseMarkScope.h.


Member Data Documentation

data passed to resource when using it and releasing it

Definition at line 45 of file InverseMarkScope.h.

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

the resource we're using

Definition at line 44 of file InverseMarkScope.h.

Referenced by getResource(), InverseMarkScope(), reset(), and ~InverseMarkScope().


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

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