ANNA Suite  2020b
Multipurpose development suite for Telco applications
Guard.hpp
Go to the documentation of this file.
1 // ANNA - Anna is Not Nothingness Anymore //
2 // //
3 // (c) Copyright 2005-2015 Eduardo Ramos Testillano & Francisco Ruiz Rayo //
4 // //
5 // See project site at http://redmine.teslayout.com/projects/anna-suite //
6 // See accompanying file LICENSE or copy at http://www.teslayout.com/projects/public/anna.LICENSE //
7 
8 
9 #ifndef anna_core_mt_Guard_hpp
10 #define anna_core_mt_Guard_hpp
11 
13 #include <anna/core/mt/Safe.hpp>
14 
15 namespace anna {
16 
35 class Guard {
36 public:
41  Guard(const Safe& object) noexcept(false) : a_whatis(NULL) {
42  lock(a_safeObject = const_cast <Safe*>(&object), NULL);
43  }
44 
49  Guard(const Safe* object) noexcept(false);
50 
56  Guard(const Safe& object, const char* whatis) noexcept(false) : a_whatis(whatis) {
57  lock(a_safeObject = const_cast <Safe*>(&object), whatis);
58  }
59 
65  Guard(const Safe* object, const char* whatis) noexcept(false);
66 
72  virtual ~Guard() { deactivate(); }
73 
77  void deactivate() ;
78 
79 private:
80  Safe* a_safeObject;
81  const char* a_whatis;
82 
83  void lock(Safe*, const char* whatis) noexcept(false);
84 };
85 
86 } //namespace anna
87 
88 #endif
Guard(const Safe &object, const char *whatis) noexcept(false)
Definition: Guard.hpp:56
void deactivate()
Guard(const Safe &object) noexcept(false)
Definition: Guard.hpp:41
Definition: app.hpp:12
Definition: Guard.hpp:35
Definition: Safe.hpp:23
virtual ~Guard()
Definition: Guard.hpp:72