NVIDIA DeepStream SDK API Reference

8.0 Release
signal_emitter.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 
23 #ifndef NVIDIA_DEEPSTREAM_SIGNAL_EMITTER
24 #define NVIDIA_DEEPSTREAM_SIGNAL_EMITTER
25 
26 #include <memory>
27 #include "custom_object.hpp"
28 
29 namespace deepstream {
30 
31 class Element;
32 
42 class SignalEmitter : public CustomObject {
43 public:
45  class IActionOwner {
46  public:
47  virtual ~IActionOwner() {}
48 
50  virtual std::vector<std::string> list() = 0;
51 
61  virtual void onAttached(SignalEmitter* emitter, const std::string& action, const std::string& object) = 0;
62  };
63 
72  SignalEmitter(const std::string& name, IActionOwner* owner);
73 
83  SignalEmitter(const std::string& name, const char* factory, IActionOwner* owner);
84 
86  virtual ~SignalEmitter();
87 
89  static unsigned long type();
90 
92  SignalEmitter& attach(const std::string& action_name, Object& object);
100  SignalEmitter& emit(const std::string& action_name, const std::string& object_name, ...);
101 
102 protected:
103  std::multimap<std::string, Object> object_map_;
104  std::unique_ptr<IActionOwner> owner_;
105 };
106 
107 }
108 
109 
110 #endif
deepstream::SignalEmitter::emit
SignalEmitter & emit(const std::string &action_name, const std::string &object_name,...)
Emit the action by name.
deepstream::CustomObject
Base class for all the custom objects.
Definition: custom_object.hpp:34
deepstream::SignalEmitter::attach
SignalEmitter & attach(const std::string &action_name, Object &object)
Attach the signal emitter to an object on specified action.
deepstream::SignalEmitter::owner_
std::unique_ptr< IActionOwner > owner_
Definition: signal_emitter.hpp:104
deepstream::SignalEmitter::IActionOwner::onAttached
virtual void onAttached(SignalEmitter *emitter, const std::string &action, const std::string &object)=0
Callback to be triggered when the emitter is attached.
deepstream::SignalEmitter::type
static unsigned long type()
Return the type id assigned to signal emitter.
deepstream
Definition: buffer.hpp:33
deepstream::SignalEmitter::IActionOwner
required interface for a signal emitter
Definition: signal_emitter.hpp:45
deepstream::SignalEmitter::SignalEmitter
SignalEmitter(const std::string &name, IActionOwner *owner)
Constructor.
custom_object.hpp
deepstream::SignalEmitter::IActionOwner::~IActionOwner
virtual ~IActionOwner()
Definition: signal_emitter.hpp:47
deepstream::SignalEmitter::object_map_
std::multimap< std::string, Object > object_map_
Definition: signal_emitter.hpp:103
deepstream::SignalEmitter::~SignalEmitter
virtual ~SignalEmitter()
Destructor.
deepstream::SignalEmitter
SignalEmitter class.
Definition: signal_emitter.hpp:42
deepstream::Object
Base Object class.
Definition: object.hpp:44
deepstream::SignalEmitter::IActionOwner::list
virtual std::vector< std::string > list()=0
list the name of actions supported by this emitter