119 void post(std::function<
void()> cb);
129template<
typename TProto>
133 using TFunc = std::function<TProto>;
146 : cb_(std::forward<TFunc>(func))
160 file_ = other->file_;
168 constexpr const TFunc&
operator*() const noexcept {
return cb_; }
171 constexpr explicit operator bool() const noexcept {
return static_cast<bool>(cb_); }
183template<
typename TProto>
187 using TFunc = std::function<TProto>;
192 template<
typename TCallback>
193 auto ioContextWrapper(TCallback&& fun)
195 return [
this, fun {std::move(fun)}](
196 auto&&... args) ->
decltype(fun(std::forward<
decltype(args)>(args)...)) {
197 post([fun {std::move(fun)},
198 forwardArgs = std::make_tuple(std::move(args)...)]()
mutable {
199 std::apply(std::move(fun), std::move(forwardArgs));
217 cb_ = ioContextWrapper(func);
228 cb_ = ioContextWrapper(other.cb_);
229 file_ = other->file_;
237 constexpr const TFunc&
operator*() const noexcept {
return cb_; }
240 constexpr explicit operator bool() const noexcept {
return static_cast<bool>(cb_); }
250std::pair<std::string, std::shared_ptr<CallbackWrapperBase>>
255 return std::make_pair((
const std::string&) Ts::name,
257 std::forward<std::function<typename Ts::cb_type>>(func), file, linum));
261std::pair<std::string, std::shared_ptr<CallbackWrapperBase>>
266 return std::make_pair((
const std::string&) Ts::name,
268 std::forward<std::function<typename Ts::cb_type>>(func), file, linum));
272 const std::map<std::string, std::shared_ptr<CallbackWrapperBase>>&);
275using MediaMap = std::map<std::string, std::string>;
void post(std::function< void()> cb)
constexpr const TFunc & operator*() const noexcept
CallbackWrapper(const std::shared_ptr< CallbackWrapperBase > &p) noexcept
CallbackWrapper(TFunc &&func, const char *filename, uint32_t linum) noexcept
CallbackWrapper() noexcept
SerializedCallbackWrapper(TFunc &&func, const char *filename, uint32_t linum) noexcept
constexpr const TFunc & operator*() const noexcept
SerializedCallbackWrapper(const std::shared_ptr< CallbackWrapperBase > &p) noexcept
SerializedCallbackWrapper() noexcept
LIBJAMI_PUBLIC bool start(const std::filesystem::path &config_file={}) noexcept
Start asynchronously daemon created by init().
const char * version() noexcept
Return the library version as string.
LIBJAMI_PUBLIC void logging(const std::string &whom, const std::string &action) noexcept
Control log handlers.
void registerSignalHandlers(const std::map< std::string, std::shared_ptr< CallbackWrapperBase > > &handlers)
std::string_view platform() noexcept
Return the target platform (OS) as a string.
LIBJAMI_PUBLIC bool init(enum InitFlag flags) noexcept
Initialize globals, create underlaying daemon.
std::string_view arch() noexcept
Return the target architecture as a string.
void unregisterSignalHandlers()
std::map< std::string, std::string > MediaMap
LIBJAMI_PUBLIC bool initialized() noexcept
std::pair< std::string, std::shared_ptr< CallbackWrapperBase > > exportable_serialized_callback(std::function< typename Ts::cb_type > &&func, const char *file=CURRENT_FILENAME(), uint32_t linum=CURRENT_LINE())
LIBJAMI_PUBLIC void fini() noexcept
Stop and freeing any resource allocated by daemon.
@ LIBJAMI_FLAG_CONSOLE_LOG
@ LIBJAMI_FLAG_IOS_EXTENSION
@ LIBJAMI_FLAG_NO_AUTOLOAD
@ LIBJAMI_FLAG_AUTOANSWER
@ LIBJAMI_FLAG_NO_AUTOSYNC
@ LIBJAMI_FLAG_NO_LOCAL_AUDIO
@ LIBJAMI_FLAG_NO_LOCAL_VIDEO
@ LIBJAMI_FLAG_NO_LOCAL_MEDIA
std::pair< std::string, std::shared_ptr< CallbackWrapperBase > > exportable_callback(std::function< typename Ts::cb_type > &&func, const char *file=CURRENT_FILENAME(), uint32_t linum=CURRENT_LINE())
Return an exportable callback object.