本文整理汇总了C++中Monitor::get_str方法的典型用法代码示例。如果您正苦于以下问题:C++ Monitor::get_str方法的具体用法?C++ Monitor::get_str怎么用?C++ Monitor::get_str使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Monitor
的用法示例。
在下文中一共展示了Monitor::get_str方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: main
int main() {
Signal<string> s_string;
Signal<int, int> s_int_int;
Signal<int, string> s_int_string;
Monitor a;
Monitor b;
auto slot_s_string = connect(s_string, slot_string);
assert(slot_s_string.use_count() == 2);
s_string("test_1");
assert(slot_string_global == "test_1");
auto slot_s_int_string = connect(s_int_string, a, &Monitor::slot_int_string);
auto slot_s_int_string2 = connect(s_int_string, b, &Monitor::slot_int_string);
s_int_string(1, "test_int_string");
assert(a.get_int_sum() == 1);
assert(a.get_str() == "test_int_string");
assert(b.get_int_sum() == 1);
assert(b.get_str() == "test_int_string");
s_int_string.disconnect(slot_s_int_string2);
assert(slot_s_int_string2.use_count() == 1);
s_int_string(2, "test_int_string");
assert(a.get_int_sum() == 3);
assert(a.get_str() == "test_int_stringtest_int_string");
assert(b.get_int_sum() == 1);
assert(b.get_str() == "test_int_string");
s_int_string.disconnect(slot_s_int_string);
assert(slot_s_int_string.use_count() == 1);
s_int_string(2, "test_int_string");
assert(a.get_int_sum() == 3);
assert(a.get_str() == "test_int_stringtest_int_string");
s_int_string.connect(slot_s_int_string);
s_int_string(3, "test_int_string_reconnect");
assert(a.get_int_sum() == 6);
assert(a.get_str() == "test_int_stringtest_int_stringtest_int_string_reconnect");
assert(slot_s_int_string.use_count() == 2);
auto slot_int_int = connect(s_int_int, a, &Monitor::slot_int_int);
s_int_int(1, 1);
assert(a.get_int_sum() == 8);
s_int_int(-8, 0);
assert(a.get_int_sum() == 0);
s_int_int(2.5, 10.9999);
assert(a.get_int_sum() == 12);
return 0;
}