HGCal Test Beam  03a93d6239a951948e06fb3ef8dae4cbdebfad30
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Connection.h
Go to the documentation of this file.
1 #ifndef CONNECTION_H
2 #define CONNECTION_H
3 /////////////////////////////////////////////////////////////////////////
4 // File: Connection.h
5 // Purpose: Model a connection between a Signal and a Slot.
6 // Created: 25-Aug-2002 Harrison B. Prosper
7 // Updated: 05-Jun-2008 HBP Adapt to CMS
8 /////////////////////////////////////////////////////////////////////////
9 //$Revision: 1.1.1.1 $
10 
11 #include <string>
12 #include "TQObject.h"
13 //#include "PhysicsTools/PyGui/interface/Slot.h"
14 #include "HGCal/TBEventDisplay/interface/Slot.h"
15 
16 /** Model a signal/slot association.
17  Many computing systems use the signal/slot model for associating a signal,
18  for example a user interaction with a graphical user interface (GUI), and
19  a slot, that is, a procedure or function that is executed in response to
20  the signal. This class is designed to be used with Python.
21  See TheNtupleMaker/scripts/mkntuplecfi.py for an illustration of how to use
22  this class with the ROOT GUI classes.
23  */
24 class Connection : public TQObject
25 {
26 public:
27  /** Construct a signal/slott association.
28  @param sender - The address of an object able to issue signals
29  (e.g., a TGMainFrame)
30  @param signal - The function, typically of the sender,
31  that is to be called when some action triggers it
32  (e.g., ``CloseWindow()")
33  @param receiver - The address of the object that must respond to the
34  signal
35  @param - The function, typically a method of the receiver, that is to
36  be called upon the issuing of the associated signal.
37  */
38  Connection(TQObject *sender, const char *signal,
39  PyObject *receiver, const char *method);
40 
41  /**
42  */
43  ~Connection();
44 
45  /// True if signal has no arguments.
46  bool noArgs(std::string &signal);
47 
48  ///
49  TQObject *sender() const {return _sender;}
50 
51  ///
52  const char *signal() const {return _signal.c_str();}
53 
54  ///
55  PyObject *receiver() const {return (PyObject *)_slot->receiver();}
56 
57  ///
58  const char *method() const {return _slot->method();}
59 
60 
61 private:
62  TQObject *_sender;
63  std::string _signal;
64  Slot *_slot;
65 };
66 
67 #endif
const char * signal() const
Definition: Connection.h:52
bool noArgs(std::string &signal)
True if signal has no arguments.
Definition: Connection.cc:44
PyObject * receiver() const
Definition: Slot.h:49
Definition: Slot.h:19
PyObject * receiver() const
Definition: Connection.h:55
TQObject * sender() const
Definition: Connection.h:49
Connection(TQObject *sender, const char *signal, PyObject *receiver, const char *method)
Definition: Connection.cc:16
const char * method() const
Definition: Connection.h:58
const char * method() const
Definition: Slot.h:51