7#include "../../global.hpp"
8#include "../../exception.hpp"
9#include "../../string.hpp"
10#include "../../utilities/system_info.hpp"
12#include "../genapi.hpp"
20 inline HandleGuard<GenApi::Node>::HandleGuard(
void *handle) noexcept
21 : HandleGuard<GenApi::Node>(handle, [](
void *handle) { CVB_CALL_CAPI(
ReleaseObject(handle)); })
40 using GuardType = HandleGuard<Node>;
54 Node(
const Node &other) =
delete;
55 Node &operator=(
const Node &other) =
delete;
56 Node(Node &&other) =
delete;
57 Node &&operator=(Node &&other) =
delete;
61 CExports::NDeregisterUpdate(
Handle(), cbID_);
73 return handle_.Handle();
86 return GetInfoAsString(NodeInfo::Name);
98 return GetInfoAsString(NodeInfo::DisplayName);
108 return GetInfoAsString(NodeInfo::ToolTip);
120 return GetInfoAsString(NodeInfo::Description);
195 return GetInfoAsString(NodeInfo::EventID);
209 return GetInfoAsBool(NodeInfo::Feature);
222 return GetInfoAsBool(NodeInfo::Deprecated);
271 void NativeCall(
std::function<CExports::cvbres_t()> fn)
const
275 Utilities::SystemInfo::ThrowLastError(result);
279 T NativeCall(
std::function<CExports::cvbres_t(T &value)> fn)
const
282 auto result = fn(value);
284 Utilities::SystemInfo::ThrowLastError(result);
288 bool GetInfoAsBool(NodeInfo command)
const
290 return (NativeCall<CExports::cvbbool_t>([&](CExports::cvbbool_t &value) {
291 return CExports::NInfoAsBoolean(
Handle(),
static_cast<CExports::TNodeInfo
>(command), value);
297 std::int64_t GetInfoAsInt(NodeInfo command)
const
299 return static_cast<std::int64_t
>(NativeCall<CExports::cvbint64_t>([&](CExports::cvbint64_t &value) {
300 return CExports::NInfoAsInteger(
Handle(),
static_cast<CExports::TNodeInfo
>(command), value);
304 String GetInfoAsString(NodeInfo command)
const
306 return NativeCall<String>([&](
String &value) {
307 std::size_t bufferSize = 0;
308 auto bufferSizeResult = CExports::NInfoAsStringTyped(
Handle(),
static_cast<CExports::TNodeInfo
>(command),
309 reinterpret_cast<Char *
>(0), bufferSize);
310 if (bufferSizeResult < 0)
311 return bufferSizeResult;
313 std::vector<Char> buffer(bufferSize);
314 auto bufferResult = CExports::NInfoAsStringTyped(
Handle(),
static_cast<CExports::TNodeInfo
>(command),
315 buffer.data(), bufferSize);
316 if (bufferResult < 0)
319 value =
String(buffer.data());
324 int GetDependentNodeCount(NodeList type)
const
326 CExports::cvbdim_t numNodes = 0;
327 auto result = CExports::NListCount(
Handle(),
static_cast<CExports::TNodeList
>(type), numNodes);
329 std::rethrow_exception(CvbException::FromCvbResult(result,
"failed calling NListCount"));
335 std::vector<std::shared_ptr<T>> GetDependentNodes(NodeList type)
const;
337 explicit Node(HandleGuard<Node> &&guard) noexcept
338 : handle_(std::move(guard))
343 static void __stdcall UpdatedCallback(CExports::NODE,
void *pPrivate)
347 auto node =
reinterpret_cast<Node *
>(pPrivate);
348 node->updatedCarrierContainer_.Call<void(Node &)>(*node);
356 bool IsRegisterNode() const noexcept
358 CExports::cvbint64_t value = 0;
359 return CExports::NInfoAsInteger(
Handle(),
static_cast<CExports::TNodeInfo
>(NodeInfo::RegisterLength), value)
364 HandleGuard<Node> handle_;
368 Internal::CarrierContainer updatedCarrierContainer_;
370 void *cbID_ =
nullptr;
Cookie used to unregister event handlers.
Definition global.hpp:591
Basic GenApi node for device feature access.
Definition decl_node.hpp:38
String DisplayName() const
Gets the display name of this node.
Definition decl_node.hpp:96
Cvb::GenApi::Visibility Visibility() const
Gets the complexity level of this node.
Definition decl_node.hpp:230
EventCookie RegisterEventUpdated(std::function< void(Node &)> handler)
Register a listener to node updated event.
Definition detail_node.hpp:132
bool IsFeature() const
Returns whether this node is considered a feature node.
Definition decl_node.hpp:207
bool IsWriteable() const
Helper to check whether this node is writable.
Definition decl_node.hpp:169
bool IsReadable() const
Helper to check whether this node is readable.
Definition decl_node.hpp:159
Cvb::GenApi::CacheMode CacheMode() const
Gets the cache mode of this node.
Definition decl_node.hpp:182
bool IsImplemented() const
Helper to check whether this node is implemented.
Definition decl_node.hpp:138
Cvb::GenApi::AccessMode AccessMode() const
Gets the access mode of this node.
Definition decl_node.hpp:128
String EventID() const
Nodes with an event identifier may become invalidated, if an event / message is delivered from the de...
Definition decl_node.hpp:193
NodeMapPtr NodeMap() const noexcept
Gets the node map this node resides in.
Definition decl_node.hpp:265
String Name() const
Gets the full name of this node.
Definition decl_node.hpp:84
bool IsAvailable() const
Helper to check whether this node is available.
Definition decl_node.hpp:148
bool IsDeprecated() const
Gets whether this node is considered deprecated.
Definition decl_node.hpp:220
String Description() const
Gets the long descriptive text of this node.
Definition decl_node.hpp:118
void UnregisterEventUpdated(EventCookie eventCookie) noexcept
Manually unregister a listener to the node updated event.
Definition detail_node.hpp:138
NodePtr AliasNode() const
Gets the node, that is an alias value for this node.
Definition detail_node.hpp:123
void * Handle() const noexcept
Classic API node handle.
Definition decl_node.hpp:71
String ToolTip() const
Gets the short descriptive text of this node.
Definition decl_node.hpp:106
cvbbool_t ReleaseObject(OBJ &Object)
const int CVB_WRONGOBJECT
Wrong object.
Definition exception.hpp:79
Namespace for GenApi based device configuration.
Definition decl_fw_updater.hpp:29
std::shared_ptr< Node > NodePtr
Convenience shared pointer for Node.
Definition genapi.hpp:71
Visibility
Feature complexity level.
Definition genapi.hpp:238
CacheMode
Defines how the value is cached.
Definition genapi.hpp:223
std::shared_ptr< NodeMap > NodeMapPtr
Convenience shared pointer for NodeMap.
Definition genapi.hpp:27
AccessMode
Access possibility of the node.
Definition genapi.hpp:188
@ ReadOnly
Node can only be read.
Definition genapi.hpp:214
@ NotAvailable
Definition genapi.hpp:202
@ WriteOnly
Node can only be written to.
Definition genapi.hpp:216
@ ReadWrite
Node can be read and written to.
Definition genapi.hpp:218
@ NotImplemented
Definition genapi.hpp:196
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
std::string String
String for wide characters or unicode characters.
Definition string.hpp:49