ADTF
Loading...
Searching...
No Matches
configurable_streamers.h
Go to the documentation of this file.
1
7#pragma once
9
10namespace adtf::filter
11{
12
13namespace wolverine
14{
15
17
18namespace detail
19{
20template<typename BaseStreamer>
21class configurable_streamer : public BaseStreamer, public base::ant::IConfiguration
22{
23public:
24 tResult SetStreamerPin(const ucom::ant::iobject_ptr<streaming::flash::IStreamerPin>& pStreamerPin) override
25 {
26 RETURN_IF_FAILED(BaseStreamer::SetStreamerPin(pStreamerPin));
27 m_pPinConfiguration = ucom::ucom_cast<base::ant::IConfiguration*>(pStreamerPin.Get());
29 }
30 tResult GetProperties(ucom::ant::iobject_ptr<const base::ant::IProperties>& pProperties) const override
31 {
32 RETURN_IF_FAILED(CheckState());
33 m_pPinConfiguration->GetProperties(pProperties);
35 }
36 tResult GetProperties(ucom::ant::iobject_ptr<base::ant::IProperties>& pProperties) override
37 {
38 RETURN_IF_FAILED(CheckState());
39 m_pPinConfiguration->GetProperties(pProperties);
41 }
42
43#if defined(_MSC_VER)
44 #pragma warning(push)
45 #pragma warning(disable : 4996)
46#elif defined(__GNUC__)
47 #pragma GCC diagnostic push
48 #pragma GCC diagnostic ignored "-Wdeprecated-declarations"
49#endif
50
51 tResult AttachConfiguration(const char* strName, base::ant::IConfiguration& oAttachedConfiguration) override
52 {
53 RETURN_IF_FAILED(CheckState());
54
55 m_pPinConfiguration->AttachConfiguration(strName, oAttachedConfiguration);
57 }
58 tResult DetachConfiguration(const char* strName) override
59 {
60 RETURN_IF_FAILED(CheckState());
61 m_pPinConfiguration->DetachConfiguration(strName);
63 }
64
65#if defined(_MSC_VER)
66 #pragma warning(pop)
67#elif defined(__GNUC__)
68 #pragma GCC diagnostic pop
69#endif
70
71private:
72 tResult CheckState() const
73 {
74 if (!m_pPinConfiguration)
75 {
76 RETURN_ERROR_DESC(ERR_INVALID_STATE, "Streamer is not connected to a pin with a configuration interface.");
77 }
78
80 }
81 base::ant::IConfiguration* m_pPinConfiguration;
82};
83
84}
85
87
97template <typename BaseReader = streaming::flash::cDynamicSampleReader>
98using configurable_reader = detail::configurable_streamer<BaseReader>;
99
109template <typename BaseWriter = streaming::flash::cSampleWriter>
110using configurable_writer = detail::configurable_streamer<BaseWriter>;
111
112} // namespace wolverine
113
116
117} // namespace adtf::filter
A_UTILS_NS::cResult tResult
For backwards compatibility and to bring latest version into scope.
Definition result.h:736
#define RETURN_ERROR_DESC(_code,...)
Same as RETURN_ERROR(_error) using a printf like parameter list for detailed error description.
Definition result.h:44
#define RETURN_NOERROR
Return status ERR_NOERROR, which requires the calling function's return type to be tResult.
Definition result.h:29
detail::configurable_streamer< BaseWriter > configurable_writer
Definition configurable_streamers.h:110
detail::configurable_streamer< BaseReader > configurable_reader
Definition configurable_streamers.h:98
Namespace for the ADTF Filter SDK.
Definition configurable_runner.h:18