NVIDIA DeepStream SDK API Reference

8.0 Release
buffer_probe.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: LicenseRef-NvidiaProprietary
4  *
5  * NVIDIA CORPORATION, its affiliates and licensors retain all intellectual
6  * property and proprietary rights in and to this material, related
7  * documentation and any modifications thereto. Any use, reproduction,
8  * disclosure or distribution of this material and related documentation
9  * without an express license agreement from NVIDIA CORPORATION or
10  * its affiliates is strictly prohibited.
11  */
12 
26 #ifndef NVIDIA_DEEPSTREAM_BUFFER_PROBE
27 #define NVIDIA_DEEPSTREAM_BUFFER_PROBE
28 
29 #include "custom_object.hpp"
30 #include "factory_metadata.h"
31 #include "metadata.hpp"
32 #include "buffer.hpp"
33 #include "pad.hpp"
34 
35 namespace deepstream {
36 
37 class Element;
38 
42 enum class probeReturn {
44  Probe_Ok,
47 };
48 
58 class BufferProbe : public CustomObject {
59 public:
63  class IHandler {
64  public:
65  virtual ~IHandler() {}
66  };
67 
71  class IMetadataHandler : public IHandler {
72  public:
73  virtual ~IMetadataHandler() {}
74  };
75 
79  class IBufferHandler : public IHandler {
80  public:
81  virtual ~IBufferHandler() {}
82  };
83 
88  public:
89  virtual probeReturn handleBuffer(BufferProbe& probe, const Buffer&) = 0;
90  };
91 
96  public:
97  virtual probeReturn handleBuffer(BufferProbe& probe, Buffer&) = 0;
98  };
99 
104  public:
105  virtual probeReturn handleData(BufferProbe& probe, const BatchMetadata& data) = 0;
106  };
107 
112  public:
113  virtual probeReturn handleData(BufferProbe& probe, BatchMetadata& data) = 0;
114  };
115 
124  BufferProbe(const std::string& name, IHandler* handler);
125 
134  BufferProbe(const std::string& name, const char* factory, IHandler* handler);
135 
139  virtual ~BufferProbe();
140 
147  static unsigned long type();
148 
157  BufferProbe& attach(Element* target, Pad pad);
158 
163  Element* getTarget() { return target_; }
164 
169  const Pad& getPad() { return pad_; }
170 
175  template<typename T>
176  bool query(T*& interface) const {
177  auto ptr = metadata_handler_.get();
178  interface = dynamic_cast<T*>(ptr);
179  return interface != nullptr;
180  }
181 
182 protected:
187  std::unique_ptr<IHandler> metadata_handler_;
195 };
196 
197 }
198 
199 
200 #endif
deepstream::probeReturn::Probe_Ok
@ Probe_Ok
Nothing abnormal, the buffer will be treated as usual.
deepstream::BufferProbe::IBufferOperator
Read/write interface for handling buffer.
Definition: buffer_probe.hpp:95
deepstream::BufferProbe::IBufferHandler::~IBufferHandler
virtual ~IBufferHandler()
Definition: buffer_probe.hpp:81
deepstream::BufferProbe::metadata_handler_
std::unique_ptr< IHandler > metadata_handler_
Buffer probe takes the ownership of the handler instance assigned to it during construction.
Definition: buffer_probe.hpp:187
deepstream::Pad
Pad is an abstraction of the I/O with an Element,.
Definition: pad.hpp:33
deepstream::BufferProbe::getPad
const Pad & getPad()
Return the pad from which the probe takes buffers.
Definition: buffer_probe.hpp:169
deepstream::CustomObject
Base class for all the custom objects.
Definition: custom_object.hpp:34
deepstream::BufferProbe::IBufferHandler
Derived interface for handling buffer itself.
Definition: buffer_probe.hpp:79
deepstream::Element
Element class definition.
Definition: element.hpp:49
deepstream::BufferProbe
Represent a custom object for the purpose of probing output buffers.
Definition: buffer_probe.hpp:58
deepstream::BufferProbe::IBatchMetadataOperator
Read/write interface for handling batch metadata.
Definition: buffer_probe.hpp:111
deepstream::BufferProbe::IBatchMetadataObserver
Readonly interface for handling batch metadata.
Definition: buffer_probe.hpp:103
deepstream::BufferProbe::attach
BufferProbe & attach(Element *target, Pad pad)
Attach the BufferProbe instance to an Element instance.
factory_metadata.h
deepstream::BufferProbe::IHandler
Root interface required by a BufferProbe instance.
Definition: buffer_probe.hpp:63
deepstream::BufferProbe::target_
Element * target_
weak reference to the target element to which it is attached,
Definition: buffer_probe.hpp:194
deepstream::BufferProbe::~BufferProbe
virtual ~BufferProbe()
Destructor.
deepstream::probeReturn
probeReturn
Return values from user implemented probe interfaces.
Definition: buffer_probe.hpp:42
deepstream
Definition: buffer.hpp:33
pad.hpp
deepstream::BufferProbe::IBufferOperator::handleBuffer
virtual probeReturn handleBuffer(BufferProbe &probe, Buffer &)=0
deepstream::BufferProbe::IBufferObserver
Readonly interface for handling buffer.
Definition: buffer_probe.hpp:87
deepstream::BufferProbe::IMetadataHandler
Derived interface for handling metadata.
Definition: buffer_probe.hpp:71
deepstream::BatchMetadata
Holds information about a formed batch containingframes from different sources.
Definition: metadata.hpp:652
deepstream::BufferProbe::getTarget
Element * getTarget()
Return the pointer to the element where the probe is attached.
Definition: buffer_probe.hpp:163
deepstream::Buffer
Base class of a buffer.
Definition: buffer.hpp:46
deepstream::BufferProbe::type
static unsigned long type()
Get the unique id associated with this type of BufferProbe.
custom_object.hpp
metadata.hpp
deepstream::BufferProbe::pad_
Pad pad_
the Pad from which the probe takes buffers,
Definition: buffer_probe.hpp:189
deepstream::BufferProbe::BufferProbe
BufferProbe(const std::string &name, IHandler *handler)
Constructor.
deepstream::BufferProbe::IMetadataHandler::~IMetadataHandler
virtual ~IMetadataHandler()
Definition: buffer_probe.hpp:73
deepstream::probeReturn::Probe_Drop
@ Probe_Drop
Something wrong, indicating the pipeline to drop the buffer.
deepstream::BufferProbe::IBatchMetadataOperator::handleData
virtual probeReturn handleData(BufferProbe &probe, BatchMetadata &data)=0
buffer.hpp
deepstream::BufferProbe::IBufferObserver::handleBuffer
virtual probeReturn handleBuffer(BufferProbe &probe, const Buffer &)=0
deepstream::BufferProbe::IHandler::~IHandler
virtual ~IHandler()
Definition: buffer_probe.hpp:65
deepstream::BufferProbe::IBatchMetadataObserver::handleData
virtual probeReturn handleData(BufferProbe &probe, const BatchMetadata &data)=0
deepstream::BufferProbe::query
bool query(T *&interface) const
Template class to query the type of the handler inteface.
Definition: buffer_probe.hpp:176