summaryrefslogtreecommitdiff
path: root/src/manager/main/communication-manager.h
diff options
context:
space:
mode:
authorKyungwook Tak <k.tak@samsung.com>2016-04-12 19:19:09 +0900
committerKyungwook Tak <k.tak@samsung.com>2016-04-18 15:36:25 +0900
commitebd0c830669ce3c374f262a4a1b0e8063f2e443f (patch)
tree5beec35f8bb1a63845052f3bc17e21945f7e19be /src/manager/main/communication-manager.h
parent5e4916bf2e05adb0c078aa9eacf24d7686dbee7c (diff)
downloadkey-manager-ae3e3a84c22475d6fce9412b471abef2e0d28900.tar.gz
key-manager-ae3e3a84c22475d6fce9412b471abef2e0d28900.tar.bz2
key-manager-ae3e3a84c22475d6fce9412b471abef2e0d28900.zip
Checker/Guide in http://10.113.136.204/confluence/pages/viewpage.action?pageId=44567756 Change-Id: Ie1c934dcc898b72a68b7a56d43eea4a3298b509c Signed-off-by: Kyungwook Tak <k.tak@samsung.com>
Diffstat (limited to 'src/manager/main/communication-manager.h')
-rw-r--r--src/manager/main/communication-manager.h71
1 files changed, 36 insertions, 35 deletions
diff --git a/src/manager/main/communication-manager.h b/src/manager/main/communication-manager.h
index 92a0a1be..f2702c4f 100644
--- a/src/manager/main/communication-manager.h
+++ b/src/manager/main/communication-manager.h
@@ -33,31 +33,32 @@ namespace CKM {
template <typename M>
class MessageManager {
public:
- NONCOPYABLE(MessageManager);
+ NONCOPYABLE(MessageManager);
- // Listener is an object callable with const M& as argument
- template <typename L>
- void Register(L&& listener)
- {
- m_listeners.push_back(std::move(listener));
- }
+ // Listener is an object callable with const M& as argument
+ template <typename L>
+ void Register(L &&listener)
+ {
+ m_listeners.push_back(std::move(listener));
+ }
- // Sends message of type M to all registered listeners
- // Returns the number of listeners called
- size_t SendMessage(const M& msg) const
- {
- for (auto& it : m_listeners)
- it(msg);
- return m_listeners.size();
- }
+ // Sends message of type M to all registered listeners
+ // Returns the number of listeners called
+ size_t SendMessage(const M &msg) const
+ {
+ for (auto &it : m_listeners)
+ it(msg);
+
+ return m_listeners.size();
+ }
protected:
- MessageManager() {}
- // No one is going to destroy this class directly (only via inherited class). Hence no 'virtual'
- ~MessageManager() {}
+ MessageManager() {}
+ // No one is going to destroy this class directly (only via inherited class). Hence no 'virtual'
+ ~MessageManager() {}
private:
- std::list<std::function<void(const M&)>> m_listeners;
+ std::list<std::function<void(const M &)>> m_listeners;
};
// generic template declaration
@@ -70,25 +71,25 @@ struct CommunicationManager;
*/
template <typename First, typename... Args>
struct CommunicationManager<First, Args...> :
- public MessageManager<First>, public CommunicationManager<Args...> {
+ public MessageManager<First>, public CommunicationManager<Args...> {
public:
- CommunicationManager() {}
- NONCOPYABLE(CommunicationManager);
+ CommunicationManager() {}
+ NONCOPYABLE(CommunicationManager);
- // M - message type, L - listener to register
- template <typename M, typename L>
- void Register(L&& listener)
- {
- MessageManager<M>::Register(std::move(listener));
- }
+ // M - message type, L - listener to register
+ template <typename M, typename L>
+ void Register(L &&listener)
+ {
+ MessageManager<M>::Register(std::move(listener));
+ }
- // M message type
- // Sending a message calls an unknown listener callback on the receiving side. It may throw.
- template <typename M>
- size_t SendMessage(const M& msg) const
- {
- return MessageManager<M>::SendMessage(msg);
- }
+ // M message type
+ // Sending a message calls an unknown listener callback on the receiving side. It may throw.
+ template <typename M>
+ size_t SendMessage(const M &msg) const
+ {
+ return MessageManager<M>::SendMessage(msg);
+ }
};
// stop condition for recursive inheritance