NVIDIA DeepStream SDK API Reference

8.0 Release
common_factory.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 
21 #ifndef NVIDIA_DEEPSTREAM_COMMON_FACTORY
22 #define NVIDIA_DEEPSTREAM_COMMON_FACTORY
23 
24 #include <string>
25 #include <memory>
26 
27 #include "object.hpp"
28 #include "custom_factory.hpp"
29 
30 namespace deepstream {
31 
36 public:
37  virtual ~CommonFactory() = default;
38 
39  CommonFactory(const CommonFactory&) = delete;
40  CommonFactory(CommonFactory&&) = delete;
41  CommonFactory& operator=(const CommonFactory&) = delete;
43 
50  virtual std::unique_ptr<CustomObject> createObject(const std::string& factory_key, const std::string& name) = 0;
51 
61  virtual bool addCustomFactory(CustomFactory* factory, const char* key) = 0;
62 
69  virtual CustomFactory* getCustomFactory(const char* factory_name) = 0;
70 
72  static CommonFactory& getInstance();
73 
74 protected:
75  CommonFactory() = default;
76 
77  static bool _load(const std::string& plugin_name);
78 };
79 
80 }
81 
82 #endif
deepstream::CommonFactory::operator=
CommonFactory & operator=(const CommonFactory &)=delete
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: common_factory.hpp:35
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: buffer.hpp:33
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: custom_factory.hpp:32
object.hpp
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.