Element class definition.
Element class derives from the Object class and is a reference based wrapper, supporting copying and moving.
Definition at line 49 of file element.hpp.
Public Types | |
enum | State { INVALID, EMPTY, READY, PAUSED, PLAYING } |
Public Member Functions | |
Element (const std::string &type_name, std::string name=std::string()) | |
Constructor. More... | |
Element (const Object &) | |
Downcast copy constructor from Object class. More... | |
Element (Object &&) | |
Downcast move constructor from Object class. More... | |
virtual | ~Element () |
Destructor. More... | |
Element & | link (Element &dst, std::pair< std::string, std::string > hint) |
Link two Element instances using hint. More... | |
Element & | link (Element &other) |
Link two Element instances directly. More... | |
BufferProbe * | getProbe (const std::string &name) |
Find the buffer probe attached to the elmenent by name. More... | |
Element & | addProbe (const std::string &plugin_name, const std::string &probe_name, const std::string probe_tip="") |
Create and add a buffer probe to the element. More... | |
template<typename... Args> | |
Element & | addProbe (const std::string &plugin_name, const std::string &probe_name, const std::string probe_tip="", const Args &... args) |
Template function for creating and adding buffer probe with properties. More... | |
Element & | addProbe (BufferProbe *probe, const std::string probe_tip="") |
Add a BufferProbe instance to the element. More... | |
SignalHandler * | getSignalHandler (const std::string &name) |
Find the signal handler attached to the element by name. More... | |
Element & | connectSignal (const std::string &signal_name, SignalHandler *handler) |
Connect a signal handler to the element. More... | |
Element & | connectSignal (const std::string &plugin_name, const std::string &handler_name, const std::string &signal_names) |
Create and connect a handler to element's signal. More... | |
template<typename... Args> | |
Element & | connectSignal (const std::string &plugin_name, const std::string &handler_name, const std::string &signal_names, const Args &... args) |
Template function for creating and connecting signal with properties. More... | |
const Pipeline & | getPipeline () |
bool | setState (Element::State state) |
Set the Element in particular state. More... | |
const std::string | getName () const |
Return the name assigned during the construction. More... | |
operator bool () const noexcept | |
Check if the object is void. More... | |
bool | operator== (const Object &other) noexcept |
Check if the two objects are the same. More... | |
GstObject * | give () |
Give up the ownership and return the opaque pointer. More... | |
GstObject * | getGObject () |
Return the opaque object pointer. More... | |
Object & | take (GstObject *object) |
Takes the ownership of a object through the opaque pointer. More... | |
Object & | seize (GstObject *object) |
Seize a opaque object to prevent it from being destroyed somewhere. More... | |
Object & | set (const YAML::Node ¶ms) |
Set the properties from key/value pairs in the yaml format. More... | |
Object & | set (const std::string &name, const Value &value) |
template<typename T , typename... Args> | |
Object & | set (const std::string &name, const T &value, const Args &... args) |
template<typename T , typename... Args> | |
Object & | getProperty (const std::string &name, T &value, Args &... args) |
Template for getting multiple properties. More... | |
std::vector< std::string > | listSignals (bool is_action) |
List all the supported signals from the object. More... | |
bool | connectSignal (const std::string &signal_name, SignalHandler &handler) |
Connect a signal handler to the object. More... | |
void | emitSignal (const std::string &signal_name, va_list args) |
Emit a signal. More... | |
Static Public Member Functions | |
static unsigned long | type () |
Return the object's type id. More... | |
Protected Member Functions | |
Element (GstObject *object) | |
Element & | add_ (CustomObject *object) |
template<class T > | |
T * | find_ (const std::string &name) |
virtual void | set_ (const std::string &name, const Value &value) |
virtual void | set_ (const std::string &name, const YAML::Node &value) |
virtual Value | get_ (const std::string &name) |
Protected Attributes | |
std::shared_ptr< std::unordered_map< std::string, std::unique_ptr< CustomObject > > > | objects_ |
Pipeline * | pipeline_ =nullptr |
GstObject * | object_ |
Friends | |
class | Pipeline |
Enumerator | |
---|---|
INVALID | |
EMPTY | |
READY | |
PAUSED | |
PLAYING |
Definition at line 52 of file element.hpp.
deepstream::Element::Element | ( | const std::string & | type_name, |
std::string | name = std::string() |
||
) |
Constructor.
[in] | type_name | ehe type name for a specific element defined with Deepstream SDK |
[in] | name | name given to the Element instance |
|
virtual |
Destructor.
|
protected |
|
protected |
Element& deepstream::Element::addProbe | ( | BufferProbe * | probe, |
const std::string | probe_tip = "" |
||
) |
Add a BufferProbe instance to the element.
Once the probe is added, the element will take the ownership
[in] | probe | pointer to the buffer probe |
[in] | probe_tip | extra information for adding the probe, e.g name of the pad |
Element& deepstream::Element::addProbe | ( | const std::string & | plugin_name, |
const std::string & | probe_name, | ||
const std::string | probe_tip = "" |
||
) |
Create and add a buffer probe to the element.
A buffer probe will be automatically created by the factory in the plugin.
[in] | plugin_name | name of the plugin where the factory for the buffer probe is defined |
[in] | probe_name | name of the buffer probe to be added |
[in] | probe_tip | extra information for adding the probe, e.g name of the pad |
Referenced by addProbe().
|
inline |
Template function for creating and adding buffer probe with properties.
Definition at line 115 of file element.hpp.
References addProbe(), and getProbe().
Element& deepstream::Element::connectSignal | ( | const std::string & | plugin_name, |
const std::string & | handler_name, | ||
const std::string & | signal_names | ||
) |
Create and connect a handler to element's signal.
A signal handler will be created automatically by the factory defined in the plugin
[in] | plugin_name | name of the plugin where the factory of the signal handler is defined |
[in] | handler_name | name of the signal handler to be added |
[in] | signal_names | names of the signals for the handler to connect, separated by "/" |
|
inline |
Template function for creating and connecting signal with properties.
Definition at line 175 of file element.hpp.
References connectSignal(), and getSignalHandler().
|
inherited |
Connect a signal handler to the object.
[in] | signal_name | name of the signal to be connected |
[in] | handler | handler for the signal |
Element& deepstream::Element::connectSignal | ( | const std::string & | signal_name, |
SignalHandler * | handler | ||
) |
Connect a signal handler to the element.
A signal handler is responsible for handling the asynchronous signals emitted from the element. Signals behave like events and are defined by their names. Detailed information of signal types available within an element can be found from the Plugin Manual of Deepstream.
Once connected, the element takes the ownership of the signal handler
[in] | signal_name | name of the signal to which the handler is connected |
[in] | probe_tip | pointer to the signal handler |
Referenced by connectSignal().
|
inherited |
Emit a signal.
|
inlineprotected |
Definition at line 206 of file element.hpp.
References objects_.
|
protectedvirtualinherited |
Reimplemented in deepstream::CustomObject.
Referenced by deepstream::Object::getProperty().
|
inlineinherited |
Return the opaque object pointer.
Definition at line 140 of file object.hpp.
References deepstream::Object::object_.
|
inherited |
Return the name assigned during the construction.
|
inline |
Definition at line 187 of file element.hpp.
References pipeline_.
|
inline |
Find the buffer probe attached to the elmenent by name.
Definition at line 95 of file element.hpp.
Referenced by addProbe().
|
inlineinherited |
Template for getting multiple properties.
Definition at line 171 of file object.hpp.
References deepstream::Object::get_().
Referenced by deepstream::CountMarker::handleData(), deepstream::TensorMetaParser::handleData(), deepstream::MsgMetaGenerator::handleData(), deepstream::NvDsKittiDump::handleData(), deepstream::LiDARDataSource::initialize(), deepstream::SmartRecordingAction::onAttached(), and deepstream::FileDataSource::read().
|
inline |
Find the signal handler attached to the element by name.
Definition at line 139 of file element.hpp.
Referenced by connectSignal().
|
inherited |
Give up the ownership and return the opaque pointer.
Link two Element instances using hint.
[in] | dst | target element to which this element links |
[in] | hint | hint for the link, providing the source pad name and target pad name |
Link two Element instances directly.
[in] | dst | target element to which this element links |
|
inherited |
List all the supported signals from the object.
|
inlineexplicitnoexceptinherited |
Check if the object is void.
Definition at line 131 of file object.hpp.
References deepstream::Object::object_.
|
inlinenoexceptinherited |
Check if the two objects are the same.
Definition at line 134 of file object.hpp.
References deepstream::Object::object_.
Seize a opaque object to prevent it from being destroyed somewhere.
|
inlineinherited |
Definition at line 161 of file object.hpp.
References deepstream::Object::set(), and deepstream::Object::set_().
Definition at line 154 of file object.hpp.
References deepstream::Object::set_().
|
inherited |
Set the properties from key/value pairs in the yaml format.
Referenced by deepstream::Pipeline::add(), and deepstream::Object::set().
|
protectedvirtualinherited |
Reimplemented in deepstream::CustomObject.
Referenced by deepstream::Object::set().
|
protectedvirtualinherited |
Reimplemented in deepstream::CustomObject.
bool deepstream::Element::setState | ( | Element::State | state | ) |
Set the Element in particular state.
Takes the ownership of a object through the opaque pointer.
|
staticinherited |
Return the object's type id.
|
friend |
Definition at line 218 of file element.hpp.
|
protectedinherited |
Definition at line 198 of file object.hpp.
Referenced by deepstream::Object::getGObject(), deepstream::Object::operator bool(), and deepstream::Object::operator==().
|
protected |
Definition at line 201 of file element.hpp.
Referenced by find_().
|
protected |
Definition at line 203 of file element.hpp.
Referenced by getPipeline().