PStack  2.0
Stack trace printer for MSVC and GCC binaries
managed_handle_proxy.hpp
Go to the documentation of this file.
1 // ===-- include/psystem/framework/managed_handle_proxy.hpp -*- C++ -*- --=== //
2 // Copyright (c) 2015 Matt Bisson. All rights reserved.
3 
19 #pragma once
20 #ifndef PSYSTEM_FRAMEWORK_MANAGED_HANDLE_PROXY_HPP
21 #define PSYSTEM_FRAMEWORK_MANAGED_HANDLE_PROXY_HPP
22 
23 #include "platform.hpp"
24 
25 #include "not_assignable.hpp"
26 #include "stack_allocated.hpp"
27 
28 namespace psystem {
29 
31 namespace internal {
32 
50 template <typename T, typename C>
52  : public psystem::not_assignable,
54 {
58 public:
63  explicit managed_handle_proxy(C& container) noexcept
64  : m_handle(container.get()),
65  m_container(container)
66  {
67  }
68 
73  {
74  m_container.reset(m_handle);
75  }
76 
80 public:
85  operator T*() noexcept
86  {
87  return &m_handle;
88  }
89 
93 private:
97 
100 };
101 
102 } // namespace internal
103 } // namespace psystem
104 
105 #endif // PSYSTEM_FRAMEWORK_MANAGED_HANDLE_PROXY_HPP
~managed_handle_proxy() noexcept
Synchronize changes back to the container on destruction.
Definition: managed_handle_proxy.hpp:72
Master header file for Platform-wide declarations.
Defines the psystem::not_assignable interface.
T m_handle
A temporary handle for tracking changes while accessed as a pointer-to-handle type.
Definition: managed_handle_proxy.hpp:96
Disable heap allocation and deallocation.
Definition: stack_allocated.hpp:42
#define noexcept
Replace keyword with something useful.
Definition: platform.hpp:71
Removes the ability to use an assignment operation on derived classes.
Definition: not_assignable.hpp:42
Allows safe modification of a managed handle container when accessed by the handle's address...
Definition: managed_handle_proxy.hpp:51
C & m_container
The container tracking the handle.
Definition: managed_handle_proxy.hpp:99
Contains the process examination "system" and basic frameworks.
Definition: pstack_event_handler.hpp:28
Defines the psystem::stack_allocated interface.
managed_handle_proxy(C &container) noexcept
Construct an instance for handle management.
Definition: managed_handle_proxy.hpp:63