CVB++ 15.0
category_node.hpp
1#pragma once
2
3#include "../global.hpp"
4
5#include "value_node.hpp"
6
7namespace Cvb
8{
9 CVB_BEGIN_INLINE_NS
10 namespace GevServer
11 {
13
15 class CategoryNode : public ValueNode
16 {
17 public:
18 explicit CategoryNode(HandleGuard<Node> &&guard)
19 : ValueNode(std::move(guard))
20 {
21 }
22
33 static CategoryNodePtr Create(const String &name, const GevServer::Namespace &nameSpace)
34 {
35 CExports::GEVSRV handle = nullptr;
36 handle = CExports::CreateGSCategoryNodeTyped(name.data(), static_cast<CExports::TGSNamespace>(nameSpace));
37
38 HandleGuard<Node> guard(handle);
40 }
41
55 static CategoryNodePtr Create(const String &name)
56 {
57 return Create(ParseName(name), ParseNamespace(name));
58 }
59
61
65 void FromString(const String &value) override
66 {
67 (void)value;
68 throw std::runtime_error("not implemented");
69 }
70
76 String ToString() const override
77 {
78 auto bufferSize = NativeCall<size_t>([&](size_t &size) {
79 return CExports::GSNGetInfoAsStringTyped(Handle(), CExports::TGSNodeInfo::GSNI_Alias,
80 reinterpret_cast<Char *>(0), size);
81 });
82
83 bufferSize += sizeof(Char);
84 std::vector<Char> buffer(bufferSize);
85 NativeCall([&]() {
86 return CExports::GSNGetInfoAsStringTyped(Handle(), CExports::TGSNodeInfo::GSNI_Alias, buffer.data(),
87 bufferSize);
88 });
89
90 return buffer.data() ? String(buffer.data()) : String();
91 }
92
94
97 GenApi::AccessMode AccessMode() const noexcept override
98 {
100 }
101
103
106 Cvb::GenApi::CacheMode CacheMode() const noexcept override
107 {
109 }
110
112
116 template <class Rep, class Period>
121
123 bool IsStreamable() const override
124 {
125 return false;
126 }
127
128 [[noreturn]] void SetIsStreamable(const std::int64_t & /*value*/) override
129 {
130 throw std::runtime_error("Category nodes cannot be streamed");
131 }
132
134
142 };
143 } // namespace GevServer
144 CVB_END_INLINE_NS
145} // namespace Cvb
std::vector< NodePtr > Nodes() const
Gets the nodes categorized by this node.
Definition category_node.hpp:138
static CategoryNodePtr Create(const String &name, const GevServer::Namespace &nameSpace)
Creates a new CategoryNode with the given name and nameSpace .
Definition category_node.hpp:33
bool IsStreamable() const override
Categories are never streamable.
Definition category_node.hpp:123
static CategoryNodePtr Create(const String &name)
Creates a new CategoryNode with the given name .
Definition category_node.hpp:55
Cvb::GenApi::CacheMode CacheMode() const noexcept override
Nothing to cache here.
Definition category_node.hpp:106
void FromString(const String &value) override
Not supported.
Definition category_node.hpp:65
void SetIsStreamable(const std::int64_t &) override
Sets whether this node should be used when the camera settings are stored.
Definition category_node.hpp:128
std::chrono::duration< Rep, Period > PollingTime() const noexcept
Nothing to poll.
Definition category_node.hpp:117
GenApi::AccessMode AccessMode() const noexcept override
Categories are always read only.
Definition category_node.hpp:97
String ToString() const override
Gets the value of the alias node, if any is present. Empty string otherwise.
Definition category_node.hpp:76
static GevServer::Namespace ParseNamespace(const String &name)
Gets the Namespace from the given name .
Definition decl_node.hpp:591
static String ParseName(const String &name)
Gets the name part of the given node name .
Definition decl_node.hpp:611
void * Handle() const noexcept
Classic API node handle.
Definition decl_node.hpp:102
std::vector< std::shared_ptr< T > > GetDependentNodes(const NodeList &type) const
Gets the nodes categorized by this node.
Definition detail_node.hpp:410
T make_shared(T... args)
T move(T... args)
CacheMode
Defines how the value is cached.
Definition genapi.hpp:218
@ NoCache
No caching used.
Definition genapi.hpp:220
AccessMode
Access possibility of the node.
Definition genapi.hpp:183
@ ReadOnly
Node can only be read.
Definition genapi.hpp:209
Describes a GenICam Pixel Format Naming Convention (PFNC) compatible image memory buffer with possibl...
Definition decl_int_swiss_knife_node.hpp:11
Namespace
The possible name spaces a node can be in.
Definition gevserver.hpp:147
std::shared_ptr< CategoryNode > CategoryNodePtr
Convenience shared pointer for CategoryNode.
Definition gevserver.hpp:60
@ String
Node is a string node (no reg).
Definition gevserver.hpp:168
@ Child
Definition gevserver.hpp:250
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17
char Char
Character type for wide characters or unicode characters.
Definition string.hpp:63