/usr/include/choreonoid-1.1/cnoid/src/Base/LazySignal.h is in libcnoid-dev 1.1.0+dfsg-6.1+b4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | /**
@author Shin'ichiro Nakaoka
*/
#ifndef CNOID_GUIBASE_LAZY_SIGNAL_H_INCLUDED
#define CNOID_GUIBASE_LAZY_SIGNAL_H_INCLUDED
#include "LazyCaller.h"
#include <boost/signal.hpp>
#include <boost/function.hpp>
#include <vector>
#include "exportdecl.h"
namespace cnoid {
// Base class for hiding the boost.bind header into the cpp file.
class CNOID_EXPORT LazySignalBase
{
public:
void request();
protected:
boost::function<void()> emitFunction;
int priority;
bool isIdleEventPending;
std::vector<boost::signals::connection> connectionsToBlock;
virtual void defaultEmitFunction() = 0;
private:
bool onIdle();
};
template <class SignalType> class LazySignal : public LazySignalBase
{
public:
LazySignal(int priority = IDLE_PRIORITY_HIGH) {
this->priority = priority;
isIdleEventPending = false;
}
LazySignal(boost::function<void()> emitFunction, int priority = IDLE_PRIORITY_HIGH) {
this->emitFunction = emitFunction;
this->priority = priority;
isIdleEventPending = false;
}
inline SignalType& signal() { return signal_; }
inline void requestBlocking(boost::signals::connection connection){
connectionsToBlock.push_back(connection);
}
inline bool isBeingRequested() {
return isIdleEventPending;
}
protected:
virtual void defaultEmitFunction() {
signal_();
}
private:
SignalType signal_;
};
}
#endif
|