Scarab  v2.4.11
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 
14 namespace scarab
15 {
16  LOGGER( slog, "cancelable" );
17 
19  f_canceled( false )
20  {}
21 
23  f_canceled( a_orig.f_canceled.load() )
24  {}
25 
27  f_canceled( a_orig.f_canceled.load() )
28  {
29  a_orig.f_canceled.store( false );
30  }
31 
33  {}
34 
36  {
37  f_canceled.store( a_orig.f_canceled.load() );
38  return *this;
39  }
40 
42  {
43  f_canceled.store( a_orig.f_canceled.load() );
44  a_orig.f_canceled.store( false );
45  return *this;
46  }
47 
48  void cancelable::do_cancellation( int a_code )
49  {
50  // override in derived class
51  LDEBUG( slog, "cancelable::do_cancellation with code <" << a_code << ">" );
52  return;
53  }
54 
56  {
57  // override in derived class
58  return;
59  }
60 
61 } /* namespace scarab */
LOGGER(mtlog, "authentication")
virtual ~cancelable()
Definition: cancelable.cc:32
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:55
#define LDEBUG(...)
Definition: logger.hh:365
virtual void do_cancellation(int a_code)
Definition: cancelable.cc:48
cancelable & operator=(const cancelable &a_orig)
Definition: cancelable.cc:35