lean cpp library
A lean C++ library providing efficient utility classes for high-performance C++ applications.
|
Defines RAII-style classes that automatically take care of resource handling, (un)locking and other common and tedious tasks. More...
Classes | |
class | auto_restore |
Auto restore class that automatically restores the initial value of the stored object on destruction. More... | |
class | cloneable |
Base class that may be used to tag a specific class cloneable. More... | |
class | cloneable_obj |
Cloneable object class that stores an automatic instance of the given cloneable type. More... | |
class | com_ptr |
COM pointer class that performs reference counting on COM objects of the given type. More... | |
struct | close_handle_policy |
Default handle guard policy. More... | |
struct | destroy_window_policy |
Window handle guard policy. More... | |
struct | free_library_policy |
Dll handle guard policy. More... | |
class | handle_guard |
Handle guard that releases the stored handle on destruction. More... | |
class | ref_counter |
Reference counter class that maintains strong and weak reference counts. More... | |
class | resource |
Base class that may be used to tag a specific class as a resource. More... | |
class | resource_interface |
Interface that may be used to tag a specific class as a resource. More... | |
class | resource_ptr |
Resource pointer class that performs strong reference counting on the given resource type. More... | |
class | scope_annex_base |
Stores and calls a callable object on destruction. More... | |
class | scope_annex_impl |
Stores and calls a callable object on destruction. More... | |
class | scope_guard_base |
Stores and calls a callable object on destruction, if not disarmed. More... | |
class | scope_guard_impl |
Stores and calls a callable object on destruction, if not disarmed. More... | |
struct | default_lock_policy |
Default locking policy. More... | |
class | scoped_lock |
Automatic lock management class that locks a given object on construction to be unlocked on destruction. More... | |
struct | generic_ptr_policy |
Generic scoped pointer policy. More... | |
struct | generic_ptr_policy< Type[]> |
struct | delete_ptr_policy |
Delete scoped pointer policy. More... | |
struct | delete_ptr_policy< Type[]> |
struct | destroy_ptr_policy |
Destroy scoped pointer policy. More... | |
struct | release_ptr_policy |
Release scoped pointer policy. More... | |
class | scoped_ptr |
Scoped pointer class that releases the object pointed to on destruction. More... | |
class | terminate_guard |
Terminates the application on destruction, if not disarmed. More... | |
class | weak_resource_ptr |
Resource pointer class that performs weak reference counting on the given resource type. More... | |
Typedefs | |
typedef const scope_annex_base & | scope_annex |
Convenience type for temporary scope annex variables. | |
typedef const scope_guard_base & | scope_guard |
Convenience type for temporary scope guard variables. | |
Functions | |
template<class Cloneable > | |
LEAN_INLINE Cloneable * | clone_cloneable (const Cloneable &cloneable) |
Clones the given cloneable object by calling. | |
template<class Cloneable > | |
LEAN_INLINE void | destroy_cloneable (Cloneable *cloneable) |
Destroys the given cloneable object by calling. | |
template<class COMType > | |
LEAN_INLINE void | acquire_com (COMType &object) |
Acquires a reference to the given COM object. | |
template<class COMType > | |
LEAN_INLINE void | release_com (COMType *object) |
Releases a reference to the given COM object. | |
template<class COMType > | |
LEAN_INLINE com_ptr< COMType, true > | bind_com (COMType *object) |
Binds the given COM reference to a new COM pointer. | |
template<class Resource > | |
LEAN_INLINE void | destroy_resource (Resource *resource) |
Destroys the given resource by calling. | |
template<class Resource > | |
LEAN_INLINE resource_ptr < Resource, true > | bind_resource (Resource *resource) |
Binds the given resource reference to a new resource pointer. | |
template<class Resource > | |
LEAN_INLINE resource_ptr < Resource, true > | secure_resource (Resource *resource) |
Binds a new reference of the given resource to a resource pointer. | |
template<class Resource > | |
resource_ptr< Resource, true > | new_resource (...) |
Creates a new resource using operator new. | |
template<class Callable > | |
LEAN_INLINE scope_annex_impl < Callable > | make_scope_annex (const Callable &callable) |
Constructs a scope annex object from the given callable object. | |
template<class Signature > | |
LEAN_INLINE scope_annex_impl < callable_fun< Signature > > | make_scope_annex (Signature *fun) |
Constructs a scope annex object from the given function pointer. | |
template<class Class , class Signature > | |
LEAN_INLINE scope_annex_impl < callable_memfun< Class, Signature > > | make_scope_annex (Class *obj, Signature Class::*fun) |
Constructs a scope annex object from the given object and method pointer. | |
template<class Callable > | |
LEAN_INLINE scope_guard_impl < Callable > | make_scope_guard (const Callable &callable) |
Constructs a scope guard from the given callable object. | |
template<class Signature > | |
LEAN_INLINE scope_guard_impl < callable_fun< Signature > > | make_scope_guard (Signature *fun) |
Constructs a scope guard from the given function pointer. | |
template<class Class , class Signature > | |
LEAN_INLINE scope_guard_impl < callable_memfun< Class, Signature > > | make_scope_guard (Class *obj, Signature Class::*fun) |
Constructs a scope guard from the given object and method pointer. | |
template<class Type > | |
LEAN_INLINE void | release_ptr (Type *object) |
Deletes the given object (default policy implementation). | |
template<class Type > | |
LEAN_INLINE void | release_array_ptr (Type *object) |
Deletes the given array (default policy implementation). |
Defines RAII-style classes that automatically take care of resource handling, (un)locking and other common and tedious tasks.
LEAN_INLINE Cloneable* lean::smart::clone_cloneable | ( | const Cloneable & | cloneable | ) |
Clones the given cloneable object by calling.
cloneable.clone()
(default policy implementation).
LEAN_INLINE void lean::smart::destroy_cloneable | ( | Cloneable * | cloneable | ) |
Destroys the given cloneable object by calling.
cloneable->destroy()
(default policy implementation).
LEAN_INLINE void lean::smart::destroy_resource | ( | Resource * | resource | ) |
Destroys the given resource by calling.
delete resource
(default policy implementation).