NVIDIA DeepStream SDK API Reference

9.1 Release
service-maker/includes/common_factory.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 
26 #ifndef NVIDIA_DEEPSTREAM_COMMON_FACTORY
27 #define NVIDIA_DEEPSTREAM_COMMON_FACTORY
28 
29 #include <string>
30 #include <memory>
31 
32 #include "object.hpp"
33 #include "custom_factory.hpp"
34 
35 namespace deepstream {
36 
41 public:
42  virtual ~CommonFactory() = default;
43 
44  CommonFactory(const CommonFactory&) = delete;
45  CommonFactory(CommonFactory&&) = delete;
46  CommonFactory& operator=(const CommonFactory&) = delete;
48 
55  virtual std::unique_ptr<CustomObject> createObject(const std::string& factory_key, const std::string& name) = 0;
56 
66  virtual bool addCustomFactory(CustomFactory* factory, const char* key) = 0;
67 
74  virtual CustomFactory* getCustomFactory(const char* factory_name) = 0;
75 
77  static CommonFactory& getInstance();
78 
79 protected:
80  CommonFactory() = default;
81 
82  static bool _load(const std::string& plugin_name);
83 };
84 
85 }
86 
87 #endif
deepstream::CommonFactory::operator=
CommonFactory & operator=(const CommonFactory &)=delete
object.hpp
deepstream::CommonFactory::_load
static bool _load(const std::string &plugin_name)
deepstream::CommonFactory
r\Represents a unified interface for managing custom objects and factories
Definition: service-maker/includes/common_factory.hpp:40
deepstream::CommonFactory::getInstance
static CommonFactory & getInstance()
Acquire the reference of the singleton.
deepstream::CommonFactory::CommonFactory
CommonFactory()=default
deepstream::CommonFactory::addCustomFactory
virtual bool addCustomFactory(CustomFactory *factory, const char *key)=0
Add a custom factory.
deepstream
Definition: service-maker/includes/buffer.hpp:38
deepstream::CommonFactory::getCustomFactory
virtual CustomFactory * getCustomFactory(const char *factory_name)=0
Find a custom factory that supports a certan object type.
custom_factory.hpp
deepstream::CustomFactory
Interface definition for a custom factory.
Definition: service-maker/includes/custom_factory.hpp:37
deepstream::CommonFactory::~CommonFactory
virtual ~CommonFactory()=default
deepstream::CommonFactory::createObject
virtual std::unique_ptr< CustomObject > createObject(const std::string &factory_key, const std::string &name)=0
Create a custom object from a custom factory.