ADTF
Loading...
Searching...
No Matches
application_intf.h
Go to the documentation of this file.
1
7#pragma once
8#include "runnable_intf.h"
9#include "runnable.h"
11
12namespace adtf
13{
14namespace services
15{
16namespace ant
17{
18
25{
26public:
28 ADTF_IID(IApplication, "application.ant.services.adtf.iid");
29
30public:
38 {
39 public:
41 ADTF_IID(IJob, "job.application.ant.services.adtf.iid");
42 };
43
44public:
51 virtual tResult Exec() = 0;
52
60 virtual tResult Exit(tResult oExitResult = ERR_NOERROR) = 0;
61
70 virtual tResult EnqueueJob(const ucom::ant::iobject_ptr<IJob>& oJob, bool bWait) = 0;
71};
72
73} // namespace ant
74
75namespace quiet
76{
77
82{
83public:
85 ADTF_IID(IApplication, "application.quiet.services.adtf.iid");
86
87public:
93};
94
95} // namespace quiet
96
103template<typename CALLABLE>
104class job_runnable final :
105 public base::runnable<base::ant::IRunnable::RUN_JOB, ant::IApplication::IJob, base::flash::IRunnable, CALLABLE>
106{
107public:
109 runnable;
110};
111
116template<typename CALLABLE>
118
126template<typename CALLABLE, std::enable_if_t<std::is_invocable_r<tResult, CALLABLE>::value, bool> = true>
127inline tResult enqueue_job(CALLABLE&& fnJobFunction, bool bWait = false) noexcept
128{
130 RETURN_IF_FAILED(_runtime->GetObject(pApp));
132 [fnJobFunction = std::forward<CALLABLE>(fnJobFunction)]() noexcept -> tResult
133 {
134 RETURN_IF_FAILED(fnJobFunction());
136 }));
137 RETURN_IF_FAILED(pApp->EnqueueJob(pJob, bWait));
139}
140
141using quiet::IApplication;
142} // namespace services
143} // namespace adtf
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
Definition runnable_intf.h:27
@ RUN_JOB
activation code to handle a job call.
Definition runnable_intf.h:61
Definition runnable_intf.h:112
Definition runnable.h:38
Definition application_intf.h:38
ADTF_IID(IJob, "job.application.ant.services.adtf.iid")
definition of jobs identifier
Definition application_intf.h:25
ADTF_IID(IApplication, "application.ant.services.adtf.iid")
definition of iid
virtual tResult EnqueueJob(const ucom::ant::iobject_ptr< IJob > &oJob, bool bWait)=0
virtual tResult Exit(tResult oExitResult=ERR_NOERROR)=0
Definition application_intf.h:106
Definition application_intf.h:82
ADTF_IID(IApplication, "application.quiet.services.adtf.iid")
definition of iid
virtual void ProcessEvents(adtf::base::flash::tNanoSeconds tmMaxTime)=0
Definition object_intf.h:33
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition object_ptr.h:384
Namespace for all service interfaces provided since v3.0.
Definition rpc_object_server_registry_intf.h:82
Namespace for all service interfaces provided since v3.16.
Definition application_intf.h:76
Namespace for a summary of all service interfaces provided by ADTF.
Definition rpc_object_server_registry_intf.h:80
tResult enqueue_job(CALLABLE &&fnJobFunction, bool bWait=false) noexcept
Definition application_intf.h:127
job_runnable(CALLABLE &&) -> job_runnable< CALLABLE && >
ant::IObject IObject
Alias always bringing the latest version of ant::IObject into scope.
Definition object_intf.h:109
object_ptr< Implementation > make_object_ptr(Args &&... args)
Alias always bringing the latest version of ant::make_object_ptr() into scope.
Definition object_ptr_utilities.h:129
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
A timestamp with nanosecond precision.
Definition chrono.h:23