7#include "../../_cexports/c_gev_server.h"
9#include "../../global.hpp"
11#include "../_decl/decl_node.hpp"
12#include "../_decl/decl_node_map.hpp"
13#include "../_decl/decl_server.hpp"
15#include "../../_decl/decl_device.hpp"
17#include "../category_node.hpp"
18#include "../value_node.hpp"
25 inline NodeMap::NodeMap(
const ServerPtr &server) noexcept
33 std::map<String, NodePtr> nodes;
34 for (
const auto &entry : nodes_)
35 nodes[entry.first] =
Node(entry.first);
39 inline void NodeMap::FillNodeKeys()
41 std::size_t numNodes = 0;
42 auto resultNum = CVB_CALL_CAPI(GSNodeCount(Handle(), numNodes));
44 std::rethrow_exception(CvbException::FromCvbResult(resultNum,
"failed to get node count"));
46 for (std::size_t i = 0; i < numNodes; ++i)
48 size_t nameLength = 0;
49 auto resultNameLength = CVB_CALL_CAPI(GSNodeList(Handle(), i,
nullptr, nameLength));
50 if (resultNameLength < 0)
51 std::rethrow_exception(CvbException::FromCvbResult(resultNameLength,
"failed to get node name length"));
53 std::vector<char> buffer(
static_cast<size_t>(nameLength));
54 auto resultBuffer = CVB_CALL_CAPI(GSNodeList(Handle(), i, &buffer[0], nameLength));
56 std::rethrow_exception(CvbException::FromCvbResult(resultBuffer,
"failed to get node name"));
57 String keyString(buffer.begin(), buffer.end() - 1);
59 nodes_[keyString] = std::shared_ptr<class Node>();
65 throw std::runtime_error(
"key must not be empty");
67 throw std::runtime_error(
"node must not be null");
68 auto name = value->NameOnly();
70 throw std::runtime_error(
"key and value->NameOnly() must be equal");
73 return CExports::GSNAddNodeExTyped(value->Handle(),
static_cast<CExports::TGSNodeList
>(kind), key.data(),
78 value->SetNodeMap(std::const_pointer_cast<NodeMap>(shared_from_this()));
Basic GevServer node for device feature access.
Definition decl_node.hpp:34
std::map< String, NodePtr > Nodes() const
Get a dictionary contain all nodes of this node map.
Definition detail_node_map.hpp:105
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< Server > ServerPtr
Convenience shared pointer for GevServer.
Definition gevserver.hpp:37
@ 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