SHOGUN  6.1.3
Signal.h
Go to the documentation of this file.
1 /*
2  * This program is free software; you can redistribute it and/or modify
3  * it under the terms of the GNU General Public License as published by
4  * the Free Software Foundation; either version 3 of the License, or
5  * (at your option) any later version.
6  *
7  * Written (W) 1999-2009 Soeren Sonnenburg
8  * Written (W) 2017 Giovanni De Toni
9  * Copyright (C) 1999-2009 Fraunhofer Institute FIRST and Max-Planck-Society
10  */
11 
12 #ifndef __SIGNAL__H_
13 #define __SIGNAL__H_
14 
15 #include <shogun/base/SGObject.h>
16 
17 namespace shogun
18 {
23  {
26  };
27 
38  {
39  public:
43  typedef rxcpp::subscriber<int,
46 
47  CSignal();
48  virtual ~CSignal();
49 
54  static void handler(int signal);
55 
56 #ifndef SWIG // SWIG should skip this part
57 
62  {
63  return m_observable;
64  };
65 #endif
66 
67 #ifndef SWIG // SWIG should skip this part
68 
73  {
74  return m_subscriber;
75  };
76 #endif
77 
81  {
82  m_active = true;
83  }
87  static void reset_handler();
88 
90  virtual const char* get_name() const { return "Signal"; }
91 
92  private:
94  static bool m_active;
95 
96  public:
98  static SGSubjectS* m_subject;
101 };
102 }
103 #endif // __SIGNAL__H_
rxcpp::subjects::subject< int > SGSubjectS
Definition: Signal.h:40
virtual const char * get_name() const
Definition: Signal.h:90
rxcpp::subscriber< int, rxcpp::observer< int, void, void, void, void > > SGSubscriberS
Definition: Signal.h:45
rxcpp::observable< int, rxcpp::dynamic_observable< int > > SGObservableS
Definition: Signal.h:42
static SGSubjectS * m_subject
Definition: Signal.h:98
SGObservableS * get_observable()
Definition: Signal.h:61
Class SGObject is the base class of all shogun objects.
Definition: SGObject.h:124
sg_signals_types
Definition: Signal.h:22
void enable_handler()
Definition: Signal.h:80
static SGObservableS * m_observable
Definition: Signal.h:99
static void handler(int signal)
Definition: Signal.cpp:38
static void reset_handler()
Definition: Signal.cpp:82
virtual ~CSignal()
Definition: Signal.cpp:34
all of classes and functions are contained in the shogun namespace
Definition: class_list.h:18
static SGSubscriberS * m_subscriber
Definition: Signal.h:100
Class Signal implements signal handling to e.g. allow CTRL+C to cancel a long running process...
Definition: Signal.h:37
SGSubscriberS * get_subscriber()
Definition: Signal.h:72

SHOGUN Machine Learning Toolbox - Documentation