mirror of
https://github.com/resiprocate/resiprocate.git
synced 2026-01-12 00:05:02 +08:00
35 lines
845 B
C++
35 lines
845 B
C++
#if !defined CommonAction_hxx
|
|
#define CommonAction_hxx
|
|
|
|
#include "rutil/Data.hxx"
|
|
#include "tfm/ActionBase.hxx"
|
|
|
|
#include <functional>
|
|
#include <utility>
|
|
|
|
class TestEndPoint;
|
|
|
|
class CommonAction : public ActionBase
|
|
{
|
|
public:
|
|
typedef std::function<void(void)> Functor;
|
|
|
|
explicit CommonAction(TestEndPoint* tua, resip::Data action, Functor f) :
|
|
mTestEndPoint(tua),
|
|
mFunctor(std::move(f)),
|
|
mActionName(action)
|
|
{}
|
|
virtual ~CommonAction() = default;
|
|
|
|
virtual void operator()(std::shared_ptr<Event> event) { (*this)(); }
|
|
virtual void operator()() { mFunctor(); }
|
|
|
|
virtual resip::Data toString() const { return mActionName; }
|
|
|
|
protected:
|
|
TestEndPoint* mTestEndPoint;
|
|
Functor mFunctor;
|
|
resip:: Data mActionName;
|
|
};
|
|
#endif
|