NVIDIA DeepStream SDK API Reference

9.1 Release
service-maker/includes/signal_emitter.hpp
Go to the documentation of this file.
1 /*
2  * SPDX-FileCopyrightText: Copyright (c) 2024-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3  * SPDX-License-Identifier: Apache-2.0
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  */
17 
28 #ifndef NVIDIA_DEEPSTREAM_SIGNAL_EMITTER
29 #define NVIDIA_DEEPSTREAM_SIGNAL_EMITTER
30 
31 #include <memory>
32 #include "custom_object.hpp"
33 
34 namespace deepstream {
35 
36 class Element;
37 
47 class SignalEmitter : public CustomObject {
48 public:
50  class IActionOwner {
51  public:
52  virtual ~IActionOwner() {}
53 
55  virtual std::vector<std::string> list() = 0;
56 
66  virtual void onAttached(SignalEmitter* emitter, const std::string& action, const std::string& object) = 0;
67  };
68 
77  SignalEmitter(const std::string& name, IActionOwner* owner);
78 
88  SignalEmitter(const std::string& name, const char* factory, IActionOwner* owner);
89 
91  virtual ~SignalEmitter();
92 
94  static unsigned long type();
95 
97  SignalEmitter& attach(const std::string& action_name, Object& object);
105  SignalEmitter& emit(const std::string& action_name, const std::string& object_name, ...);
106 
107 protected:
108  std::multimap<std::string, Object> object_map_;
109  std::unique_ptr<IActionOwner> owner_;
110 };
111 
112 }
113 
114 
115 #endif
deepstream::SignalEmitter::owner_
std::unique_ptr< IActionOwner > owner_
Definition: service-maker/includes/signal_emitter.hpp:109
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: service-maker/includes/custom_object.hpp:39
deepstream::SignalEmitter::attach
SignalEmitter & attach(const std::string &action_name, Object &object)
Attach the signal emitter to an object on specified action.
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: service-maker/includes/buffer.hpp:38
deepstream::SignalEmitter::IActionOwner
required interface for a signal emitter
Definition: service-maker/includes/signal_emitter.hpp:50
deepstream::SignalEmitter::SignalEmitter
SignalEmitter(const std::string &name, IActionOwner *owner)
Constructor.
deepstream::SignalEmitter::IActionOwner::~IActionOwner
virtual ~IActionOwner()
Definition: service-maker/includes/signal_emitter.hpp:52
custom_object.hpp
deepstream::SignalEmitter::~SignalEmitter
virtual ~SignalEmitter()
Destructor.
deepstream::SignalEmitter::object_map_
std::multimap< std::string, Object > object_map_
Definition: service-maker/includes/signal_emitter.hpp:108
deepstream::SignalEmitter
SignalEmitter class.
Definition: service-maker/includes/signal_emitter.hpp:47
deepstream::Object
Base Object class.
Definition: service-maker/includes/object.hpp:49
deepstream::SignalEmitter::IActionOwner::list
virtual std::vector< std::string > list()=0
list the name of actions supported by this emitter