Go to the documentation of this file.
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>
52 struct AutoResourceRef
54 typedef typename Policy::handle_type
ref_type;
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)
AutoResource()
Default (no argument) ctor initializes with value indicating no resource currently owned.
PURPOSE: The AutoResource class template is an analog of std::auto_ptr for managing arbitrary resourc...
handle_type get() const
Return handle of resource, retaining ownership.
AutoResourceRef(ref_type h)
Policy::handle_type handle_type
~AutoResource()
Free resource when AutoResource object reaches end of lifetime.
AutoResource & operator=(AutoResource &x)
Assignment takes over ownership of resource owned by x.
handle_type release()
Relinquish ownership of resource and return its handle.
Utility class used in implementing AutoResource operations.
Policy::handle_type ref_type