NVIDIA NvNeural SDK  2022.2
GPU inference framework for NVIDIA Nsight Deep Learning Designer
NetworkDebuggerList.h
Go to the documentation of this file.
1 /*
2 * SPDX-FileCopyrightText: Copyright (c) 2020-2021 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
3 * SPDX-License-Identifier: MIT
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
11 *
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
14 *
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
21 * DEALINGS IN THE SOFTWARE.
22 */
23 
25 
26 #ifndef NVNEURAL_NETWORKDEBUGGERLIST_H
27 #define NVNEURAL_NETWORKDEBUGGERLIST_H
28 
29 #include <nvneural/CoreTypes.h>
30 #include <nvneural/RefPtr.h>
31 #include <nvneural/RefObject.h>
32 
33 #include <algorithm>
34 #include <vector>
35 
36 namespace nvneural {
37 
39 class NetworkDebuggerList : public refobj::RefObjectBase<refobj::Implements<INetworkDebuggerList>>
40 {
41 public:
44  explicit NetworkDebuggerList(const std::vector<RefPtr<INetworkDebugger>>& debuggerList)
45  : m_debuggerList(debuggerList)
46  {
47  }
48 
52  explicit NetworkDebuggerList(std::vector<RefPtr<INetworkDebugger>>&& debuggerList)
53  : m_debuggerList(std::move(debuggerList))
54  {
55  }
56 
58  size_t debuggerCount() const noexcept override
59  {
60  return m_debuggerList.size();
61  }
62 
64  INetworkDebugger* getNetworkDebuggerByIndex(size_t index) const noexcept override
65  {
66  if (index < m_debuggerList.size())
67  {
68  return m_debuggerList[index].get();
69  }
70  else
71  {
72  return nullptr;
73  }
74  }
75 
76 private:
77  std::vector<RefPtr<INetworkDebugger>> m_debuggerList;
78 };
79 
80 } // namespace nvneural
81 #endif // NVNEURAL_NETWORKDEBUGGERLIST_H
Fundamental NvNeural data types are declared here.
Standard implementation for IRefObject-derived objects.
Smart pointer class for tracking IRefObject instances.
INetworkDebugger defines a callback interface for network inference.
Definition: NetworkTypes.h:51
Standard implementation of INetworkDebuggerList wrapping a vector<RefPtr<INetworkDebugger>>
Definition: NetworkDebuggerList.h:40
size_t debuggerCount() const noexcept
Definition: NetworkDebuggerList.h:58
NetworkDebuggerList(const std::vector< RefPtr< INetworkDebugger >> &debuggerList)
Creates a NetworkDebuggerList from a const reference.
Definition: NetworkDebuggerList.h:44
INetworkDebugger * getNetworkDebuggerByIndex(size_t index) const noexcept
Returns the Nth network debugger in the collection.
Definition: NetworkDebuggerList.h:64
NetworkDebuggerList(std::vector< RefPtr< INetworkDebugger >> &&debuggerList)
Creates a NetworkDebuggerList from an rvalue reference.
Definition: NetworkDebuggerList.h:52
Intrusive pointer using IRefObject's reference counting system.
Definition: RefPtr.h:46
Parameterized base class implementing common IRefObject operations.
Definition: RefObject.h:336