Toyomasa Watarai
/
Mbed-example-WS-W27
Mbed Cloud example program for workshop in W27 2018.
easy-connect/wifi-x-nucleo-idw01m1/BlockExecuter.h
- Committer:
- MACRUM
- Date:
- 2018-06-30
- Revision:
- 0:119624335925
File content as of revision 0:119624335925:
#ifndef BLOCK_EXEC_H #define BLOCK_EXEC_H #include "mbed.h" /* Helper class to execute something whenever entering/leaving a basic block */ class BlockExecuter { public: BlockExecuter(Callback<void()> exit_cb, Callback<void()> enter_cb = Callback<void()>()) : _exit_cb(exit_cb) { if((bool)enter_cb) enter_cb(); } ~BlockExecuter(void) { _exit_cb(); } private: Callback<void()> _exit_cb; }; #endif //BLOCK_EXEC_H