sigslots_manager.cpp
Go to the documentation of this file.
00001 
00009 /*****************************************************************************
00010 ** Includes
00011 *****************************************************************************/
00012 
00013 #include <iostream>
00014 #include "../../include/ecl/sigslots.hpp"
00015 
00016 /*****************************************************************************
00017 ** Fuctions
00018 *****************************************************************************/
00023 void g() {
00024         std::cout << "  This is standalone g()" << std::endl;
00025 }
00026 void h(int i) {
00027         std::cout << "  This is standalone g(int): " << i << std::endl;
00028 }
00029 
00030 class A {
00031 public:
00032         void g() {
00033                 std::cout << "  This is A::g()" << std::endl;
00034         }
00035         void h(int i) {
00036                 std::cout << "  This is A::g(int): " << i << std::endl;
00037         }
00038 };
00039 
00044 /*****************************************************************************
00045 ** Main
00046 *****************************************************************************/
00047 
00048 int main(int argc, char **argv) {
00049         A a;
00050         std::cout << std::endl;
00051         std::cout << "***************************************************************" << std::endl;
00052         std::cout << "*                 1 Signal, 2 Slots" << std::endl;
00053         std::cout << "***************************************************************" << std::endl;
00054         std::cout << std::endl;
00055 
00056         ecl::Signal<> sig_void;
00057         ecl::Slot<> slot_void0(g);
00058         ecl::Slot<> slot_void1(&A::g,a);
00059 
00060         sig_void.connect("void_test");
00061         slot_void0.connect("void_test");
00062         slot_void1.connect("void_test");
00063         std::cout << "Emitting:" << std::endl;
00064         sig_void.emit();
00065 
00066         std::cout << std::endl;
00067         std::cout << "***************************************************************" << std::endl;
00068         std::cout << "*                     Statistics" << std::endl;
00069         std::cout << "***************************************************************" << std::endl;
00070         std::cout << std::endl;
00071 
00072         ecl::SigSlotsManager<>::printStatistics();
00073 
00074         std::cout << std::endl;
00075         std::cout << "***************************************************************" << std::endl;
00076         std::cout << "*                 1 Data Signal, 2 Data Slots" << std::endl;
00077         std::cout << "***************************************************************" << std::endl;
00078         std::cout << std::endl;
00079 
00080         ecl::Signal<int> sig_data;
00081         ecl::Slot<int> slot_data0(h);
00082         ecl::Slot<int> slot_data1(&A::h,a);
00083 
00084         sig_data.connect("data_test");
00085         slot_data0.connect("data_test");
00086         slot_data1.connect("data_test");
00087         std::cout << "Emitting:" << std::endl;
00088         sig_data.emit(3);
00089 
00090         std::cout << std::endl;
00091         std::cout << "***************************************************************" << std::endl;
00092         std::cout << "*                     Statistics" << std::endl;
00093         std::cout << "***************************************************************" << std::endl;
00094         std::cout << std::endl;
00095 
00096         ecl::SigSlotsManager<int>::printStatistics();
00097 
00098         return 0;
00099 }
00100 


ecl_sigslots
Author(s): Daniel Stonier
autogenerated on Thu Jan 2 2014 11:13:07