Created
April 27, 2019 00:53
-
-
Save petrstepanov/4e0b8cd79526440438e40369ae4d09a5 to your computer and use it in GitHub Desktop.
ROOT Signal with two parameters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <TQObject.h> | |
#include <RQ_OBJECT.h> | |
class A { | |
RQ_OBJECT("A") | |
private: | |
Int_t fValue1; | |
Int_t fValue2; | |
public: | |
A() : fValue1(0), fValue2(0) { } | |
~A() { } | |
void SetValue(Int_t value1, Int_t value2); // *SIGNAL* | |
void PrintValue() const { printf("value1 = %d; value2 = %d\n", fValue1, fValue2); } | |
}; | |
void A::SetValue(Int_t value1, Int_t value2) { // Set new value | |
fValue1 = value1; | |
fValue2 = value2; | |
// Emit pair of values | |
Int_t args[2]; | |
args[0]=fValue1; | |
args[1]=fValue2; | |
Emit("SetValue(Int_t, Int_t)", args); | |
} | |
// Main program | |
int emittest() { | |
A* a = new A(); | |
A* b = new A(); | |
a->Connect("SetValue(Int_t, Int_t)", "A", b, "SetValue(Int_t, Int_t)"); | |
printf("\n******* Test of SetValue(Int_t) signal *******\n"); | |
b->SetValue(10, 15); | |
printf("\n\t***** b before ******\n"); | |
b->PrintValue(); | |
a->SetValue(20, 30); | |
printf("\t***** b after a->SetValue(20, 30) ******\n"); | |
b->PrintValue(); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment