forked from OpenDDS/OpenDDS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Bench] Replace worker Proactor use with EventDispatcher
- Loading branch information
1 parent
290031d
commit ba4b450
Showing
13 changed files
with
110 additions
and
141 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#pragma once | ||
|
||
#include "dds/DCPS/EventDispatcher.h" | ||
|
||
#include <memory> | ||
|
||
namespace Bench { | ||
|
||
/** | ||
* MemFunEvent is a helper class for adapting void member funtions of existing | ||
* classes into dispatchable events | ||
*/ | ||
template <typename Delegate> | ||
class MemFunEvent : public OpenDDS::DCPS::EventBase { | ||
public: | ||
typedef void (Delegate::*PMF)(); | ||
|
||
MemFunEvent(std::shared_ptr<Delegate> delegate, PMF function) | ||
: delegate_(delegate) | ||
, function_(function) | ||
{} | ||
|
||
void handle_event() | ||
{ | ||
std::shared_ptr<Delegate> handle = delegate_.lock(); | ||
if (handle) { | ||
((*handle).*function_)(); | ||
} | ||
} | ||
|
||
private: | ||
std::weak_ptr<Delegate> delegate_; | ||
PMF function_; | ||
}; | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.