35#ifndef BLOCXX_AUTO_RESOURCE_HPP_INCLUDE_GUARD_
36#define BLOCXX_AUTO_RESOURCE_HPP_INCLUDE_GUARD_
42#include "blocxx/BLOCXX_config.h"
51 template <
typename Policy>
96 template <
typename Policy>
109 :
hdl(Policy::null())
175 hdl = Policy::null();
187 if (!Policy::equal(h,
hdl)) {
195 reset(Policy::null());
225 if (!Policy::equal(href.
hdl, this->get()))
#define BLOCXX_SAFE_BOOL_IMPL(classname, type, variable, test)
PURPOSE: The AutoResource class template is an analog of std::auto_ptr for managing arbitrary resourc...
AutoResource & operator=(AutoResourceRef< Policy > href)
Converting assignment to facilitate returning autorc by value (which transfers ownership).
AutoResource()
Default (no argument) ctor initializes with value indicating no resource currently owned.
AutoResource(AutoResource &x)
Take over ownership of resource owned by x.
~AutoResource()
Free resource when AutoResource object reaches end of lifetime.
handle_type get() const
Return handle of resource, retaining ownership.
AutoResource & operator=(AutoResource &x)
Assignment takes over ownership of resource owned by x.
Policy::handle_type handle_type
void reset(handle_type h)
Free resource and take over ownership of another.
handle_type release()
Relinquish ownership of resource and return its handle.
AutoResource(AutoResourceRef< Policy > href)
Conversion to facilitate passing and returning AutoResource by value (which transfers ownership).
AutoResource(handle_type h)
Take over ownership of h.
Utility class used in implementing AutoResource operations.
Policy::handle_type ref_type
AutoResourceRef(ref_type h)