Scarab  v3.5.3
Project 8 C++ Utility Library
cancelable.cc
Go to the documentation of this file.
1 /*
2  * cancelable.cc
3  *
4  * Created on: Jan 24, 2016
5  * Author: nsoblath
6  */
7 
8 #define SCARAB_API_EXPORTS
9 
10 #include "cancelable.hh"
11 
12 #include "logger.hh"
13 #include "signal_handler.hh"
14 
15 namespace scarab
16 {
17  LOGGER( slog, "cancelable" );
18 
20  f_canceled( false )
21  {}
22 
24  f_canceled( a_orig.f_canceled.load() )
25  {}
26 
28  f_canceled( a_orig.f_canceled.load() )
29  {
30  a_orig.f_canceled.store( false );
31  }
32 
34  {
36  }
37 
39  {
40  f_canceled.store( a_orig.f_canceled.load() );
41  return *this;
42  }
43 
45  {
46  f_canceled.store( a_orig.f_canceled.load() );
47  a_orig.f_canceled.store( false );
48  return *this;
49  }
50 
51 #ifdef NDEBUG
52  void cancelable::do_cancellation( int )
53 #else
54  void cancelable::do_cancellation( int a_code )
55 #endif
56  {
57  // override in derived class
58  LDEBUG( slog, "cancelable::do_cancellation with code <" << a_code << ">" );
59  return;
60  }
61 
63  {
64  // override in derived class
65  return;
66  }
67 
68 } /* namespace scarab */
LOGGER(mtlog, "authentication")
virtual ~cancelable()
Definition: cancelable.cc:33
static void remove_cancelable_s(cancelable *a_cancelable)
Static version: remove a cancelable object.
Contains the logger class and macros, based on Kasper&#39;s KLogger class.
std::atomic< bool > f_canceled
Definition: cancelable.hh:45
virtual void do_reset_cancellation()
Definition: cancelable.cc:62
#define LDEBUG(...)
Definition: logger.hh:389
virtual void do_cancellation(int a_code)
Definition: cancelable.cc:54
cancelable & operator=(const cancelable &a_orig)
Definition: cancelable.cc:38