SHOGUN  6.1.3
List of all members | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Private Types | Private Member Functions | Private Attributes
CSignal Class Reference

Detailed Description

Class Signal implements signal handling to e.g. allow CTRL+C to cancel a long running process.

  1. A signal handler is attached to trap the SIGINT signal. Pressing CTRL+C or sending the SIGINT (kill ...) signal to the shogun process will make shogun print a message asking the user to choose an option bewteen: immediately exit the running method and fall back to the command line, prematurely stop the current algoritmh and do nothing.

Definition at line 37 of file Signal.h.

Inheritance diagram for CSignal:
[legend]

Public Types

typedef rxcpp::subjects::subject< int > SGSubjectS
 
typedef rxcpp::observable< int, rxcpp::dynamic_observable< int > > SGObservableS
 
typedef rxcpp::subscriber< int, rxcpp::observer< int, void, void, void, void > > SGSubscriberS
 

Public Member Functions

 CSignal ()
 
virtual ~CSignal ()
 
SGObservableSget_observable ()
 
SGSubscriberSget_subscriber ()
 
void enable_handler ()
 
virtual const char * get_name () const
 

Static Public Member Functions

static void handler (int signal)
 
static void reset_handler ()
 

Static Public Attributes

static SGSubjectSm_subject = new rxcpp::subjects::subject<int>()
 
static SGObservableSm_observable
 
static SGSubscriberSm_subscriber
 

Private Types

typedef rxcpp::subjects::subject< ObservedValueSGSubject
 
typedef rxcpp::observable< ObservedValue, rxcpp::dynamic_observable< ObservedValue > > SGObservable
 
typedef rxcpp::subscriber< ObservedValue, rxcpp::observer< ObservedValue, void, void, void, void > > SGSubscriber
 

Private Member Functions

int32_t ref ()
 
int32_t ref_count ()
 
int32_t unref ()
 
virtual CSGObjectshallow_copy () const
 
virtual CSGObjectdeep_copy () const
 
virtual bool is_generic (EPrimitiveType *generic) const
 
template<class T >
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
template<>
void set_generic ()
 
void unset_generic ()
 
virtual void print_serializable (const char *prefix="")
 
virtual bool save_serializable (CSerializableFile *file, const char *prefix="")
 
virtual bool load_serializable (CSerializableFile *file, const char *prefix="")
 
void set_global_io (SGIO *io)
 
SGIOget_global_io ()
 
void set_global_parallel (Parallel *parallel)
 
Parallelget_global_parallel ()
 
void set_global_version (Version *version)
 
Versionget_global_version ()
 
SGStringList< char > get_modelsel_names ()
 
void print_modsel_params ()
 
char * get_modsel_param_descr (const char *param_name)
 
index_t get_modsel_param_index (const char *param_name)
 
void build_gradient_parameter_dictionary (CMap< TParameter *, CSGObject *> *dict)
 
bool has (const std::string &name) const
 
template<typename T >
bool has (const Tag< T > &tag) const
 
template<typename T , typename U = void>
bool has (const std::string &name) const
 
template<typename T >
void set (const Tag< T > &_tag, const T &value)
 
template<typename T , typename U = void>
void set (const std::string &name, const T &value)
 
template<typename T >
get (const Tag< T > &_tag) const
 
template<typename T , typename U = void>
get (const std::string &name) const
 
SGObservableget_parameters_observable ()
 
void subscribe_to_parameters (ParameterObserverInterface *obs)
 
void list_observable_parameters ()
 
virtual void load_serializable_pre () throw (ShogunException)
 
virtual void load_serializable_post () throw (ShogunException)
 
virtual void save_serializable_pre () throw (ShogunException)
 
virtual void save_serializable_post () throw (ShogunException)
 
template<typename T >
void register_param (Tag< T > &_tag, const T &value)
 
template<typename T >
void register_param (const std::string &name, const T &value)
 
virtual void update_parameter_hash ()
 
virtual bool parameter_hash_changed ()
 
virtual bool equals (CSGObject *other, float64_t accuracy=0.0, bool tolerant=false)
 
virtual CSGObjectclone ()
 
bool clone_parameters (CSGObject *other)
 
void observe (const ObservedValue value)
 
void register_observable_param (const std::string &name, const SG_OBS_VALUE_TYPE type, const std::string &description)
 

Private Attributes

SGIOio
 
Parallelparallel
 
Versionversion
 
Parameterm_parameters
 
Parameterm_model_selection_parameters
 
Parameterm_gradient_parameters
 
uint32_t m_hash
 

Member Typedef Documentation

◆ SGObservableS

Definition at line 42 of file Signal.h.

◆ SGSubjectS

Definition at line 40 of file Signal.h.

◆ SGSubscriberS

typedef rxcpp::subscriber<int, rxcpp::observer<int, void, void, void, void> > SGSubscriberS

Definition at line 45 of file Signal.h.

Constructor & Destructor Documentation

◆ CSignal()

CSignal ( )

Definition at line 30 of file Signal.cpp.

◆ ~CSignal()

~CSignal ( )
virtual

Definition at line 34 of file Signal.cpp.

Member Function Documentation

◆ enable_handler()

void enable_handler ( )

Enable signal handler

Definition at line 80 of file Signal.h.

◆ get_name()

virtual const char* get_name ( ) const
virtual
Returns
object name

Implements CSGObject.

Definition at line 90 of file Signal.h.

◆ get_observable()

SGObservableS* get_observable ( )

Get observable

Returns
RxCpp observable

Definition at line 61 of file Signal.h.

◆ get_subscriber()

SGSubscriberS* get_subscriber ( )

Get subscriber

Returns
RxCpp subscriber

Definition at line 72 of file Signal.h.

◆ handler()

void handler ( int  signal)
static

Signal handler. Need to be registered with std::signal.

Parameters
signalsignal number

Definition at line 38 of file Signal.cpp.

◆ reset_handler()

void reset_handler ( )
static

Reset handler in case of multiple instantiation

Definition at line 82 of file Signal.cpp.

Member Data Documentation

◆ m_observable

CSignal::SGObservableS * m_observable
static
Initial value:

Definition at line 99 of file Signal.h.

◆ m_subject

CSignal::SGSubjectS * m_subject = new rxcpp::subjects::subject<int>()
static

Observable

Definition at line 98 of file Signal.h.

◆ m_subscriber

CSignal::SGSubscriberS * m_subscriber
static
Initial value:

Definition at line 100 of file Signal.h.


The documentation for this class was generated from the following files:

SHOGUN Machine Learning Toolbox - Documentation