CVB++ 15.0
detail_int_swiss_knife_node.hpp
1#pragma once
2
3#include "../../_cexports/c_gev_server.h"
4#include "../../global.hpp"
5
6#include "../_decl/decl_node_map.hpp"
7#include "../../gevserver/node_map.hpp"
8
9namespace Cvb
10{
11 CVB_BEGIN_INLINE_NS
12 namespace GevServer
13 {
14 inline void IntSwissKnifeNode::Add(const NodePtr &item, const NodeList &kind, const String &key)
15 {
16 if (item == nullptr)
17 throw std::runtime_error("Added Node must not be nullptr");
18
19 auto nodeMap = NodeMap();
20 if (!nodeMap)
21 throw std::runtime_error("Parent Node must have node map");
22
23 if (key.empty())
24 throw std::runtime_error("Key must not be empty");
25
26 if (item->NodeMap() != NodeMapPtr() && nodeMap->Handle() != item->NodeMap()->Handle())
27 throw std::runtime_error("Added Node must be in the same node map as this Parent");
28
29 NativeCall([&]() {
30 return GSNAddNodeExTyped(Handle(), static_cast<CExports::TGSNodeList>(kind), key.c_str(), item->Handle());
31 });
32
33 nodeMap->Nodes()[item->NameOnly()] = item;
34 }
35 }; // namespace GevServer
36 CVB_END_INLINE_NS
37} // namespace Cvb
Contains all nodes of a device or module.
Definition decl_node_map.hpp:39
void Add(const NodePtr &item, const NodeList &kind, const String &key)
Adds a Node item with a key string.
Definition detail_int_swiss_knife_node.hpp:14
void * Handle() const noexcept
Classic API node handle.
Definition decl_node.hpp:102
Namespace for GevServer based device configuration.
Definition decl_int_swiss_knife_node.hpp:11
std::shared_ptr< Node > NodePtr
Convenience shared pointer for Node.
Definition gevserver.hpp:41
std::shared_ptr< NodeMap > NodeMapPtr
Convenience shared pointer for NodeMap.
Definition gevserver.hpp:45
@ String
Node is a string node (no reg).
Definition gevserver.hpp:177
NodeList
Node access.
Definition gevserver.hpp:258
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17