44template<
typename DATA_TYPE>
51template<tTimeStamp TIME_RANGE,
bool STORELASTSAMPLE = true>
55template<
size_t MAX_SIZE,
bool STORELASTSAMPLE = true>
64template<
typename Interface>
94 if (!m_pClient ||
IS_FAILED(m_pClient->GetServerObject(m_pInterface)))
109 return *m_pInterface;
114 THROW_ERROR_DESC(ERR_NOT_INITIALIZED,
"interface client has not been created");
117 auto nResult = m_pClient->GetServerObject(m_pInterface);
122 THROW_IF_FAILED_DESC(nResult,
"Unable to aquire server object for client '%s' with interface '%s'.",
127 return *m_pInterface;
130 Interface* operator->()
const
173 public base::cConfiguration
274 m_strInputName(std::accumulate(lstInputNames.begin(),
277 [](const auto& strPrevious, const auto& strNext)
278 {
return strPrevious.empty() ? strNext : strPrevious +
";" + strNext; }))
287 return m_strInputName.c_str();
291 std::string m_strInputName;
445 const void* pSampleData,
446 size_t nSampleDataSize);
463 template<
typename ReaderType = cPinReader>
465 CreateInputPin(
const char* strName,
bool bDataInTrigger =
true,
bool bForwardTriggerViaOutputPins =
true);
483 template<
typename ReaderType = cPinReader>
486 bool bDataInTrigger =
true,
487 bool bForwardTriggerViaOutputPins =
true);
519 CALLABLE&& fnTriggerCallback,
520 bool bForwardTriggerViaOutputPins =
true);
549 std::enable_if_t<std::is_invocable_r_v<
tResult,
550 std::decay_t<CALLABLE>,
555 CALLABLE&& fnSampleCallback,
556 bool bForwardTriggerViaOutputPins =
true);
590 CALLABLE&& fnSampleDataCallback,
591 bool bForwardTriggerViaOutputPins =
true);
628 CALLABLE&& fnDataCallback,
629 bool bForwardTriggerViaOutputPins =
true);
659 template<
typename WriterType = cPinWriter>
674 template<
typename WriterType = cPinWriter>
693 template<
typename RequestableWriterType = streaming::requestable_writer<>>
694 RequestableWriterType*
717 bool bForwardTriggerViaOutputPins =
true);
741 template<
typename CALLABLE,
745 CALLABLE&& fnRunFunction,
747 bool bForwardTriggerViaOutputPins =
true);
767 template<
typename Interface,
typename Instance>
781 template<
typename Interface>
795 template<
typename Interface>
810 template<
typename ReaderType = cPinReader>
825 template<
typename WriterType = cPinWriter>
828 using cRuntimeBehaviour::RegisterRunner;
840 template<
typename CALLABLE,
961 uint32_t nSubStreamId,
1114 std::string_view strName,
1117 util::log::tLogLevel eDefaultLogLevel = util::log::tLogLevel::Detail);
1138 tResult SetName(const
char* strName);
1141 ucom::object_ptr<
services::
ant::IMacroResolver> GetParentMacroResolver() const;
1155 const
char* strName,
1163 bool bDataInTrigger = true,
1164 bool bForwardTriggerViaOutputPins = true);
1170 template<typename CALLABLE,
1171 std::enable_if_t<std::is_invocable_r_v<
tResult, std::decay_t<CALLABLE>,
base::
flash::tNanoSeconds>,
bool> =
1174 CALLABLE&& fnTriggerCallback,
1175 bool bForwardTriggerViaOutputPins);
1181 const
char* strTriggerFunctionName,
1182 bool bForwardTriggerViaOutputPins = true);
1192 bool bForwardTriggerViaOutputPins);
1194 std::
string GetFullName();
1210 class cImplementation;
1211 std::unique_ptr<cImplementation> m_pImplementation;
1214 void LockedCallEnableSubStream(
streaming::
flash::ISampleWriter* pWriter,
1215 uint32_t nSubStreamId,
1216 const
base::
ant::IProperties* pRequestProperties);
1217 void LockedCallDisableSubStream(
streaming::
flash::ISampleWriter* pWriter, uint32_t nSubStreamId);
1218 std::recursive_mutex& GetProcessMutex();
1221template<typename CALLABLE,
1222 std::enable_if_t<std::is_invocable_r_v<
tResult, std::decay_t<CALLABLE>,
base::
flash::tNanoSeconds>,
bool>>
1224 CALLABLE&& fnTriggerCallback,
1225 bool bForwardTriggerViaOutputPins)
1227 std::string strName;
1229 const auto strTriggerFunctionName =
"process_" + strName;
1231 strTriggerFunctionName.c_str(),
1234 std::lock_guard<std::recursive_mutex> oGuard(GetProcessMutex());
1235 RETURN_IF_FAILED(fnTriggerCallback(tmTrigger));
1238 CreateInputPin(pReader, strTriggerFunctionName.c_str(), bForwardTriggerViaOutputPins);
1241template<
typename ReaderType>
1245 bForwardTriggerViaOutputPins);
1248template<
typename ReaderType>
1251 bool bDataInTrigger,
1252 bool bForwardTriggerViaOutputPins)
1255 CreateInputPin(pReader, bDataInTrigger, bForwardTriggerViaOutputPins);
1256 return pReader.get();
1259template<
typename ReaderType,
1264 CALLABLE&& fnTriggerCallback,
1265 bool bForwardTriggerViaOutputPins)
1268 CreateInputPin(pReader, std::forward<CALLABLE>(fnTriggerCallback), bForwardTriggerViaOutputPins);
1269 return pReader.get();
1272template<
typename ReaderType,
1274 std::enable_if_t<std::is_invocable_r_v<
tResult,
1275 std::decay_t<CALLABLE>,
1280 CALLABLE&& fnSampleCallback,
1281 bool bForwardTriggerViaOutputPins)
1289 while (
IS_OK(pReader->GetNextSample(pSample)))
1292 "Error while processing sample with timestamp = %" PRIi64
1293 "ns, substream id = %" PRIu32
" and buffer size = %zu",
1299 if (
IS_OK(pSample->Lock(pBuffer)))
1301 return pBuffer->GetSize();
1310 bForwardTriggerViaOutputPins);
1311 return pReader.get();
1314template<
typename ReaderType,
1317 std::is_invocable_r_v<tResult, std::decay_t<CALLABLE>, base::flash::tNanoSeconds,
const void*,
size_t>,
1320 const cStreamTypeHelper& oType,
1321 CALLABLE&& fnSampleDataCallback,
1322 bool bForwardTriggerViaOutputPins)
1326 [fnSampleDataCallback = std::forward<CALLABLE>(fnSampleDataCallback)](
1329 ucom::object_ptr_shared_locked<const streaming::ISampleBuffer> pBuffer;
1330 RETURN_IF_FAILED(pSample->Lock(pBuffer));
1333 bForwardTriggerViaOutputPins);
1338 typename ReaderType,
1340 std::enable_if_t<std::is_invocable_r_v<tResult, std::decay_t<CALLABLE>, base::flash::tNanoSeconds,
const Type&>,
1344 CALLABLE&& fnDataCallback,
1345 bool bForwardTriggerViaOutputPins)
1349 [fnDataCallback = std::forward<CALLABLE>(fnDataCallback)](
1353 return fnDataCallback(oSampleData.
GetTimeNs(), *oSampleData);
1355 bForwardTriggerViaOutputPins);
1358template<
typename WriterType>
1364template<
typename WriterType>
1369 return pWriter.get();
1372template<
typename Interface,
typename Instance>
1377 if (!pInstancePointer)
1380 "Unable to add interface server '%s', object_ptr_from_this has not been initialized. "
1381 "This AddInterfaceServer overload cannot be called from within the constructor.",
1392template<
typename Interface>
1403template<
typename Interface>
1411 return pBindingClient;
1414template<
typename ReaderType>
1417 auto pReader = std::make_shared<ReaderType>();
1419 pReader->SetAcceptTypeCallback(
1420 [pReader = pReader.get(),
1423 util::log::cCurrentThreadDefaultLogChannel oLogger(a_util_get_current_log_channel());
1424 return AcceptType(pReader, pType);
1429template<
typename WriterType>
1432 auto pWriter = std::make_shared<WriterType>();
1437template<
typename CALLABLE,
1440 CALLABLE&& fnRunFunction,
1442 bool bForwardTriggerViaOutputPins)
1444 auto pRunner =
RegisterRunner(strName, std::forward<CALLABLE>(fnRunFunction));
1445 ConfigureRunner(pRunner.Get(), oTriggerHint, bForwardTriggerViaOutputPins);
1446 return pRunner.Get();
1449template<
typename CALLABLE,
1452 CALLABLE&& fnRunFunction)
1457 [
this, fnRunFunction = std::forward<CALLABLE>(fnRunFunction),
1461 "Error while processing trigger with timestamp %" PRIi64
"ns on %s.%s",
1462 tmTrigger.nCount, GetFullName().c_str(), strName.c_str());
1470template<
typename RequestableWriterType>
1475 pWriter->SetCallbacks(
1476 std::bind(&cGraphObject::LockedCallEnableSubStream,
this, pWriter.get(), std::placeholders::_1,
1477 std::placeholders::_2),
1478 std::bind(&cGraphObject::LockedCallDisableSubStream,
this, pWriter.get(), std::placeholders::_1));
1479 return pWriter.get();
#define THROW_ERROR_DESC(_code,...)
throws a tResult exception
Definition result.h:85
#define IS_FAILED(s)
Check if result is failed.
Definition result.h:20
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:775
#define THROW_IF_FAILED_DESC(s,...)
throws if the expression returns a failed tResult and ammends the error message.
Definition result.h:98
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
#define IS_OK(s)
Check if result is OK.
Definition result.h:17
#define THROW_IF_FAILED(s)
throws if the expression returns a failed tResult
Definition result.h:88
#define RETURN_IF_FAILED_DESC(s,...)
Definition result.h:168
Definition property_intf.h:213
Definition runnable_intf.h:27
Wrapping template for a rvalue reference of an IString interface for the type T.
Definition string_intf.h:281
tAction
Definition error_handling_intf.h:32
@ Stop
log error and stop the session.
Definition error_handling_intf.h:35
Definition runnable_intf.h:112
cDataTriggerHint(const char *strInputName)
Definition graph_object.h:265
const char * GetInputName() const
Definition graph_object.h:285
cDataTriggerHint(const std::vector< std::string > &lstInputNames)
Definition graph_object.h:273
Definition graph_object.h:190
bool GetCyclic() const
Definition graph_object.h:211
cThreadTriggerHint(bool bCyclic=true)
Definition graph_object.h:204
cTimerTriggerHint(tTimeStamp tmInterval)
Definition graph_object.h:238
base::flash::tNanoSeconds GetInterval() const
Definition graph_object.h:246
cTimerTriggerHint(base::flash::tNanoSeconds tmInterval)
Definition graph_object.h:230
Definition graph_object.h:181
WriterType * CreateOutputPin(const char *strName)
Definition graph_object.h:1359
tResult ActivatePins() override
void SetDescription(const char *strDescription)
tResult RegisterRunner(const ucom::ant::iobject_ptr< streaming::ant::IRunner > &pRunner) override
virtual void DisableSubStream(streaming::flash::ISampleWriter *pWriter, uint32_t nSubStreamId)
void SetMainThreadAffinity(bool bEnabled)
util::log::ILogChannel * a_util_get_current_log_channel() const noexcept
util::log::ILogChannel * CreateLogChannel(std::string_view strName, base::elasto::IErrorHandling::tAction eDefaultErrorAction=base::elasto::IErrorHandling::tAction::Stop, tRecoverableAction eDefaultRecoverableAction=tRecoverableAction::Log, util::log::tLogLevel eDefaultLogLevel=util::log::tLogLevel::Detail)
void SetHelpLink(const char *strUrl)
virtual tResult ProcessInput(base::flash::tNanoSeconds tmTrigger, streaming::flash::ISampleReader *pReader)
void SetDescription(const char *strItem, const char *strDescription)
interface_client< Interface > CreateInterfaceClient(const char *strName)
Definition graph_object.h:1404
~cGraphObject() override
Destructor.
tResult ConfigureThreadTrigger(const char *strRunnerName, bool bCallCyclic)
virtual tResult RequestDynamicOutputPin(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
void RegisterPropertyVariable(const char *strName, base::cPropertyVariable &oPropertyVariable)
ReaderType * CreateInputPinWithCallback(const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnTriggerCallback, bool bForwardTriggerViaOutputPins=true)
Definition graph_object.h:1262
virtual tResult ProcessInput(streaming::flash::ISampleReader *pReader, base::flash::tNanoSeconds tmSample, const void *pSampleData, size_t nSampleDataSize)
std::shared_ptr< WriterType > CreateWriter(const char *strName, const cStreamTypeHelper &oType)
Definition graph_object.h:1430
tResult RequestBindingObject(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingServer > &pServer)
For internal use. This will call RequestDynamicInterfaceServer().
virtual tResult Process(base::flash::tNanoSeconds tmTrigger, streaming::ant::IRunner *pRunner)
virtual tResult EnableSubStream(streaming::flash::ISampleWriter *pWriter, uint32_t nSubStreamId, const base::ant::IProperties *pRequestProperties=nullptr)
tResult ConfigureTimerTrigger(const char *strRunnerName, tTimeStamp tmPeriod)
tResult RegisterRunner(const char *strName, base::flash::IRunnable &oRunnable)
ReaderType * CreateInputPinWithCallback(const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnSampleDataCallback, bool bForwardTriggerViaOutputPins=true)
virtual tResult RequestDynamicInterfaceClient(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
virtual tResult RequestDynamicInterfaceServer(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType)
ucom::ant::object_ptr< streaming::ant::IRunner > RegisterRunner(const char *strName, CALLABLE &&fnRunFunction)
Definition graph_object.h:1451
cGraphObject()
Default Constructor.
tResult ConfigureDataOutTrigger(const char *strRunnerName, const char *strPinName)
ReaderType * CreateInputPin(const char *strName, bool bDataInTrigger=true, bool bForwardTriggerViaOutputPins=true)
Definition graph_object.h:1242
void CreateInterfaceServer(const char *strName, ucom::ant::enable_object_ptr_from_this< Instance > *pInstance)
Definition graph_object.h:1373
tRecoverableAction
Definition graph_object.h:1091
@ Fatal
Treat as a fatal error.
Definition graph_object.h:1093
@ Log
Log only, continue processing.
Definition graph_object.h:1092
void SetEditor(const char *strName, const char *strUrl)
virtual tResult AcceptType(streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
RequestableWriterType * CreateRequestableOutputPin(const char *strName, const cStreamTypeHelper &oType=streaming::ant::stream_meta_type_anonymous())
Definition graph_object.h:1471
streaming::ant::IRunner * CreateRunner(const char *strName, const cTriggerHint &oTriggerHint=cNoTriggerHint(), bool bForwardTriggerViaOutputPins=true)
tResult RequestBindingObject(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IBindingType > &pType, ucom::ant::iobject_ptr< streaming::ant::IBindingClient > &pClient)
For internal use. This will call RequestDynamicInterfaceClient().
tResult RegisterRunner(const char *strName, adtf::base::ant::IRunnable &oRunnable) override
void SetupStreamer(std::shared_ptr< streaming::flash::ISampleStreamer > pStreamer, const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
tResult RequestPin(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IOutPin > &pOutPin)
For internal use. This will call RequestDynamicOutputPin().
util::log::ILogChannel * GetLogChannel(std::string_view strName={})
std::shared_ptr< ReaderType > CreateReader(const char *strName, const cStreamTypeHelper &oType)
Definition graph_object.h:1415
tResult ConfigureDataInTrigger(const char *strRunnerName, const char *strPinName)
virtual tResult ProcessInput(streaming::flash::ISampleReader *pReader, const ucom::ant::iobject_ptr< const streaming::ant::ISample > &pSample)
ucom::ant::object_ptr< services::ant::IReferenceClock > _clock
Definition graph_object.h:1207
tResult RequestPin(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType, ucom::ant::iobject_ptr< streaming::ant::IInPin > &pInPin)
For internal use. This will call RequestDynamicInputPin().
virtual tResult RequestDynamicInputPin(const char *strName, const ucom::ant::iobject_ptr< const streaming::ant::IStreamType > &pType)
ReaderType * CreateInputPinWithCallback(const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnSampleCallback, bool bForwardTriggerViaOutputPins=true)
Definition stream_type_helper.h:31
ucom::ant::object_ptr< const streaming::ant::IStreamType > GetStreamType() const
Definition graph_object.h:66
bool IsValid()
Definition graph_object.h:87
interface_client()=default
default constructor that initializes the object to an invalid state.
interface_client(const ucom::ant::iobject_ptr< streaming::ant::IBindingClient > &pClient)
Definition graph_object.h:75
Interface & Get() const
Definition graph_object.h:105
Definition runner_intf.h:24
Definition interface_binding_type.h:96
Definition data_binding.h:25
Definition interface_binding.h:23
virtual tResult RegisterBindingObject(const ucom::ant::iobject_ptr< IBindingObject > &pBindingObject)
Definition runtime_behaviour.h:22
Definition samplestreamer_intf.h:188
Definition samplestreamer_intf.h:234
Definition named_graph_object.h:129
Definition samplewriter.h:361
Definition samplewriter.h:499
Definition sample_data.h:429
adtf::base::flash::tNanoSeconds GetTimeNs() const
Definition sample_data.h:491
Safely retrieve a valid object_ptr<> instance to *this when all we have is *this.
Definition object_ptr_utilities.h:40
object_ptr< T > object_ptr_from_this()
Retrieve an object_ptr with *this being the shared resource.
Definition object_ptr_utilities.h:57
Base object pointer to realize binary compatible reference counting in interface methods.
Definition object_ptr_intf.h:112
Definition lockedobject_intf.h:273
Definition object_ptr.h:384
Namespace for the ADTF Base SDK.
Definition adtf_base_type_traits.h:13
Namespace for all functionality of the ADTF Filter SDK provided since v3.0.
Definition filter.h:26
Namespace for all functionality of the ADTF Filter SDK provided since v3.5.
Definition triggered_filter.h:179
Namespace for the ADTF Filter SDK.
Definition configurable_runner.h:18
adtf::streaming::flash::sample_writer< DATA_TYPE > pin_writer
Definition graph_object.h:45
adtf::streaming::flash::size_limited_sample_reader< MAX_SIZE, STORELASTSAMPLE > size_limited_pin_reader
Definition graph_object.h:56
adtf::streaming::flash::cSampleWriter cPinWriter
use cSampleWriter as cPinWriter
Definition graph_object.h:41
adtf::streaming::flash::cDynamicSampleReader cPinReader
use cSampleReader as cPinReader
Definition graph_object.h:48
adtf::streaming::flash::time_limited_sample_reader< TIME_RANGE, STORELASTSAMPLE > time_limited_pin_reader
Definition graph_object.h:52
Namespace for a summary of all service interfaces provided by ADTF.
Definition rpc_object_server_registry_intf.h:80
Namespace for all functionality of the ADTF Streaming SDK provided since v3.0.
Definition bindingproxyoutport.h:16
sample_reader< ant::size_limited_sample_reader_queue< MAX_SIZE >, STORELASTSAMPLE > size_limited_sample_reader
Definition samplereader.h:1121
sample_reader< ant::cDynamicSampleReaderQueue > cDynamicSampleReader
The cDynamicSampleReader will create a sample reader which will create a internal sample queue with u...
Definition samplereader.h:1107
sample_reader< ant::time_limited_sample_reader_queue< TIME_RANGE >, STORELASTSAMPLE > time_limited_sample_reader
Definition samplereader.h:1114
Namespace for the ADTF Streaming SDK.
Definition bindingproxyinport.h:14
uint32_t get_sample_substream_id(const ant::ISample &oSample)
base::flash::tNanoSeconds get_sample_time(const ucom::ant::iobject_ptr< const ant::ISample > &pSample)
Namespace for all functionality of the ADTF UCOM SDK provided since v3.0.
Definition test_runtime.h:14
object_ptr< T > ucom_object_ptr_cast(object_ptr< T > oCasted)
Create an object_ptr with an already shared resource of implicitly convertible type.
Definition object_ptr_utilities.h:135
object_ptr< Implementation > make_object_ptr(Args &&... args)
Create an instance of type object_ptr with Implementation as the shared resource.
Definition object_ptr_utilities.h:160
Namespace for the ADTF uCOM SDK.
Definition adtf_system.h:324
ant::iobject_ptr< T > iobject_ptr
Alias always bringing the latest version of ant::iobject_ptr into scope.
Definition object_ptr_intf.h:446
constexpr const char * get_iid() noexcept
Alias bringing the latest version of ant::get_iid() into scope.
Definition adtf_iid.h:429
Namespace for all functionality provided by ADTF and its SDKs.
Definition adtf_client_connector.h:14
#define adtf_string_intf(__string__)
Definition string_intf.h:465
A timestamp with nanosecond precision.
Definition chrono.h:23