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
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,
1087 std::string_view strName,
1090 util::log::tLogLevel eDefaultLogLevel = util::log::tLogLevel::Detail);
1111 tResult SetName(const
char* strName);
1114 ucom::object_ptr<
services::
ant::IMacroResolver> GetParentMacroResolver() const;
1128 const
char* strName,
1136 bool bDataInTrigger = true,
1137 bool bForwardTriggerViaOutputPins = true);
1143 template<typename CALLABLE,
1144 std::enable_if_t<std::is_invocable_r_v<
tResult, std::decay_t<CALLABLE>,
base::
flash::tNanoSeconds>,
bool> =
1147 CALLABLE&& fnTriggerCallback,
1148 bool bForwardTriggerViaOutputPins);
1154 const
char* strTriggerFunctionName,
1155 bool bForwardTriggerViaOutputPins = true);
1165 bool bForwardTriggerViaOutputPins);
1167 std::
string GetFullName();
1183 class cImplementation;
1184 std::unique_ptr<cImplementation> m_pImplementation;
1187 void LockedCallEnableSubStream(
streaming::
flash::ISampleWriter* pWriter,
1188 uint32_t nSubStreamId,
1189 const
base::
ant::IProperties* pRequestProperties);
1190 void LockedCallDisableSubStream(
streaming::
flash::ISampleWriter* pWriter, uint32_t nSubStreamId);
1191 std::recursive_mutex& GetProcessMutex();
1194template<typename CALLABLE,
1195 std::enable_if_t<std::is_invocable_r_v<
tResult, std::decay_t<CALLABLE>,
base::
flash::tNanoSeconds>,
bool>>
1197 CALLABLE&& fnTriggerCallback,
1198 bool bForwardTriggerViaOutputPins)
1200 std::string strName;
1202 const auto strTriggerFunctionName =
"process_" + strName;
1204 strTriggerFunctionName.c_str(),
1207 std::lock_guard<std::recursive_mutex> oGuard(GetProcessMutex());
1208 RETURN_IF_FAILED(fnTriggerCallback(tmTrigger));
1211 CreateInputPin(pReader, strTriggerFunctionName.c_str(), bForwardTriggerViaOutputPins);
1214template<
typename ReaderType>
1218 bForwardTriggerViaOutputPins);
1221template<
typename ReaderType>
1224 bool bDataInTrigger,
1225 bool bForwardTriggerViaOutputPins)
1228 CreateInputPin(pReader, bDataInTrigger, bForwardTriggerViaOutputPins);
1229 return pReader.get();
1232template<
typename ReaderType,
1237 CALLABLE&& fnTriggerCallback,
1238 bool bForwardTriggerViaOutputPins)
1241 CreateInputPin(pReader, std::forward<CALLABLE>(fnTriggerCallback), bForwardTriggerViaOutputPins);
1242 return pReader.get();
1245template<
typename ReaderType,
1247 std::enable_if_t<std::is_invocable_r_v<
tResult,
1248 std::decay_t<CALLABLE>,
1253 CALLABLE&& fnSampleCallback,
1254 bool bForwardTriggerViaOutputPins)
1262 while (
IS_OK(pReader->GetNextSample(pSample)))
1265 "Error while processing sample with timestamp = %" PRIi64
1266 "ns, substream id = %" PRIu32
" and buffer size = %zu",
1272 if (
IS_OK(pSample->Lock(pBuffer)))
1274 return pBuffer->GetSize();
1283 bForwardTriggerViaOutputPins);
1284 return pReader.get();
1287template<
typename ReaderType,
1290 std::is_invocable_r_v<tResult, std::decay_t<CALLABLE>, base::flash::tNanoSeconds,
const void*,
size_t>,
1293 const cStreamTypeHelper& oType,
1294 CALLABLE&& fnSampleDataCallback,
1295 bool bForwardTriggerViaOutputPins)
1299 [fnSampleDataCallback = std::forward<CALLABLE>(fnSampleDataCallback)](
1302 ucom::object_ptr_shared_locked<const streaming::ISampleBuffer> pBuffer;
1303 RETURN_IF_FAILED(pSample->Lock(pBuffer));
1306 bForwardTriggerViaOutputPins);
1311 typename ReaderType,
1313 std::enable_if_t<std::is_invocable_r_v<tResult, std::decay_t<CALLABLE>, base::flash::tNanoSeconds,
const Type&>,
1317 CALLABLE&& fnDataCallback,
1318 bool bForwardTriggerViaOutputPins)
1322 [fnDataCallback = std::forward<CALLABLE>(fnDataCallback)](
1326 return fnDataCallback(oSampleData.
GetTimeNs(), *oSampleData);
1328 bForwardTriggerViaOutputPins);
1331template<
typename WriterType>
1337template<
typename WriterType>
1342 return pWriter.get();
1345template<
typename Interface,
typename Instance>
1350 if (!pInstancePointer)
1353 "Unable to add interface server '%s', object_ptr_from_this has not been initialized. "
1354 "This AddInterfaceServer overload cannot be called from within the constructor.",
1365template<
typename Interface>
1376template<
typename Interface>
1384 return pBindingClient;
1387template<
typename ReaderType>
1390 auto pReader = std::make_shared<ReaderType>();
1392 pReader->SetAcceptTypeCallback(
1393 [pReader = pReader.get(),
1396 util::log::cCurrentThreadDefaultLogChannel oLogger(a_util_get_current_log_channel());
1397 return AcceptType(pReader, pType);
1402template<
typename WriterType>
1405 auto pWriter = std::make_shared<WriterType>();
1410template<
typename CALLABLE,
1413 CALLABLE&& fnRunFunction,
1415 bool bForwardTriggerViaOutputPins)
1417 auto pRunner =
RegisterRunner(strName, std::forward<CALLABLE>(fnRunFunction));
1418 ConfigureRunner(pRunner.Get(), oTriggerHint, bForwardTriggerViaOutputPins);
1419 return pRunner.Get();
1422template<
typename CALLABLE,
1425 CALLABLE&& fnRunFunction)
1430 [
this, fnRunFunction = std::forward<CALLABLE>(fnRunFunction),
1434 "Error while processing trigger with timestamp %" PRIi64
"ns on %s.%s",
1435 tmTrigger.nCount, GetFullName().c_str(), strName.c_str());
1443template<
typename RequestableWriterType>
1448 pWriter->SetCallbacks(
1449 std::bind(&cGraphObject::LockedCallEnableSubStream,
this, pWriter.get(), std::placeholders::_1,
1450 std::placeholders::_2),
1451 std::bind(&cGraphObject::LockedCallDisableSubStream,
this, pWriter.get(), std::placeholders::_1));
1452 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:736
#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
Definition configuration.h:85
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
Definition configuration.h:389
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:1332
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)
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:1377
void RegisterPropertyVariable(const char *strName, base::ant::cPropertyVariable &oPropertyVariable)
~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)
ReaderType * CreateInputPinWithCallback(const char *strName, const cStreamTypeHelper &oType, CALLABLE &&fnTriggerCallback, bool bForwardTriggerViaOutputPins=true)
Definition graph_object.h:1235
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:1403
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:1424
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:1215
void CreateInterfaceServer(const char *strName, ucom::ant::enable_object_ptr_from_this< Instance > *pInstance)
Definition graph_object.h:1346
tRecoverableAction
Definition graph_object.h:1064
@ Fatal
Treat as a fatal error.
Definition graph_object.h:1066
@ Log
Log only, continue processing.
Definition graph_object.h:1065
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:1444
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:1388
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:1180
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:104
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:129
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:437
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