7 #ifndef __FWCOM_SLOTBASE_HPP__ 8 #define __FWCOM_SLOTBASE_HPP__ 10 #include "fwCom/config.hpp" 11 #include "fwCom/util/convert_function_type.hpp" 13 #include <fwCore/BaseObject.hpp> 14 #include <fwCore/mt/types.hpp> 31 template<
typename T,
typename R >
35 template<
typename F >
38 template<
typename F >
58 typedef std::string IDType;
102 template<
typename A1,
typename A2,
typename A3 >
103 void run(A1 a1, A2 a2, A3 a3)
const;
105 template<
typename A1,
typename A2 >
106 void run(A1 a1, A2 a2)
const;
108 template<
typename A1 >
109 void run(A1 a1)
const;
111 FWCOM_API
void run()
const;
121 template<
typename R,
typename A1,
typename A2,
typename A3 >
122 R call(A1 a1, A2 a2, A3 a3)
const;
124 template<
typename R,
typename A1,
typename A2 >
125 R call(A1 a1, A2 a2)
const;
127 template<
typename R,
typename A1 >
130 template<
typename R >
142 template<
typename A1,
typename A2,
typename A3 >
143 VoidSharedFutureType asyncRun(A1 a1, A2 a2, A3 a3)
const;
145 template<
typename A1,
typename A2 >
146 VoidSharedFutureType asyncRun(A1 a1, A2 a2)
const;
148 template<
typename A1 >
149 VoidSharedFutureType asyncRun(A1 a1)
const;
151 FWCOM_API VoidSharedFutureType asyncRun()
const;
162 template<
typename R,
typename A1,
typename A2,
typename A3 >
163 std::shared_future< R > asyncCall(A1 a1, A2 a2, A3 a3)
const;
165 template<
typename R,
typename A1,
typename A2 >
166 std::shared_future< R > asyncCall(A1 a1, A2 a2)
const;
168 template<
typename R,
typename A1 >
169 std::shared_future< R > asyncCall(A1 a1)
const;
171 template<
typename R >
172 std::shared_future< R > asyncCall()
const;
175 size_t getNumberOfConnections()
const 179 return m_connections.size();
192 template <
typename F >
195 template <
typename F >
198 template<
typename T,
typename R >
203 template <
typename F >
207 std::string signature = std::string(
"function_type(") +
typeid(F).name() +
")";
226 ConnectionSetType m_connections;
228 mutable ::
fwCore::mt::ReadWriteMutex m_connectionsMutex;
229 mutable ::
fwCore::mt::ReadWriteMutex m_workerMutex;
Base class for all FW4SPL's classes.
unsigned int arity() const
Returns Slot's arity. The arity defines the number of parameters in Slot signature.
Namespace containing fw4spl communication tools.
This namespace fwCore provides common foundations for FW4SPL.
::boost::unique_lock< ReadWriteMutex > WriteLock
Defines a lock of write type for read/write mutex.
Base class for Slot connection implementation. This class is for internal use purpose.
std::string getTypeName() const
Returns F typeid name.
void setWorker(const std::shared_ptr< ::fwThread::Worker > &worker)
Sets Slot's Worker.
::boost::shared_lock< ReadWriteMutex > ReadLock
Defines a lock of read type for read/write mutex.
std::set< std::shared_ptr< const SlotConnectionBase > > ConnectionSetType
Connections container type.
Weak functor class. Store a zero-arg-function and a weak pointer on an object. The WeakCall is callab...
Base class for Slot implementations.
This class creates and manages a task loop. The default implementation create a loop in a new thread...
This namespace fwThread provides few tools to execute asynchronous tasks on different threads...
const unsigned int m_arity
Slot's arity.
This file defines SpyLog macros. These macros are used to log messages to a file or to the console du...
std::shared_future< void > VoidSharedFutureType
SlotBase::asyncRun return type.
std::string m_signature
Slot's signature based on typeid.