online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <stdio.h> using namespace std; namespace cc1101 { int getRSSI(); } //------------------------------------------------------- // beim SIGNALduino in SIGNALduino.h und SIGNALduino.cpp //------------------------------------------------------- class CallbackInterface { public: // The prefix "cbi" is to prevent naming clashes. virtual int cbiCallbackFunction(int) = 0; }; class SignalDetectorClass { public: // Clients can connect their callback with this void connectCallback(CallbackInterface *cb) { m_cb = cb; } // Test the callback to make sure it works. void test(int n) { printf("SignalDetectorClass::test() calling callback...n=%d\n",n); int i = m_cb -> cbiCallbackFunction(n); printf("Result: %d\n", i); } private: // The callback provided by the client via connectCallback(). CallbackInterface *m_cb; }; //-------------------------------------- // beim SIGNALduino in SIGNALduino.ino //-------------------------------------- // "Callee" can provide a callback to Caller. class Callee : public CallbackInterface { public: // The callback function that Caller will call. int cbiCallbackFunction(int i) { int rssi = cc1101::getRSSI(); printf(" Callee::cbiCallbackFunction() inside callback i=%d rssi=%d\n",i, rssi); return rssi * i; } }; int main() { SignalDetectorClass musterDecA; SignalDetectorClass musterDecB; Callee callee; // Connect the callback musterDecA.connectCallback(&callee); musterDecB.connectCallback(&callee); // Test the callback musterDecA.test(5); musterDecB.test(6); return 0; } // ---------------------------- // beim SIGNALduino in cc1101.h // ---------------------------- namespace cc1101 { int getRSSI() { return 3; } }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue