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)); })
38 using GuardType = HandleGuard<Node>;
52 Node(
const Node &other) =
delete;
53 Node &operator=(
const Node &other) =
delete;
54 Node(Node &&other) =
delete;
55 Node &&operator=(Node &&other) =
delete;
59 CExports::NDeregisterUpdate(
Handle(), cbID_);
71 return handle_.Handle();
84 return GetInfoAsString(NodeInfo::Name);
96 return GetInfoAsString(NodeInfo::DisplayName);
106 return GetInfoAsString(NodeInfo::ToolTip);
118 return GetInfoAsString(NodeInfo::Description);
193 return GetInfoAsString(NodeInfo::EventID);
207 return GetInfoAsBool(NodeInfo::Feature);
220 return GetInfoAsBool(NodeInfo::Deprecated);
269 void NativeCall(
std::function<CExports::cvbres_t()> fn)
const
273 Utilities::SystemInfo::ThrowLastError(result);
277 T NativeCall(
std::function<CExports::cvbres_t(T &value)> fn)
const
280 auto result = fn(value);
282 Utilities::SystemInfo::ThrowLastError(result);
286 bool GetInfoAsBool(NodeInfo command)
const
288 return (NativeCall<CExports::cvbbool_t>([&](CExports::cvbbool_t &value) {
289 return CExports::NInfoAsBoolean(
Handle(),
static_cast<CExports::TNodeInfo
>(command), value);
295 std::int64_t GetInfoAsInt(NodeInfo command)
const
297 return static_cast<std::int64_t
>(NativeCall<CExports::cvbint64_t>([&](CExports::cvbint64_t &value) {
298 return CExports::NInfoAsInteger(
Handle(),
static_cast<CExports::TNodeInfo
>(command), value);
302 String GetInfoAsString(NodeInfo command)
const
304 return NativeCall<String>([&](
String &value) {
305 std::size_t bufferSize = 0;
306 auto bufferSizeResult = CExports::NInfoAsStringTyped(
Handle(),
static_cast<CExports::TNodeInfo
>(command),
307 reinterpret_cast<Char *
>(0), bufferSize);
308 if (bufferSizeResult < 0)
309 return bufferSizeResult;
311 std::vector<Char> buffer(bufferSize);
312 auto bufferResult = CExports::NInfoAsStringTyped(
Handle(),
static_cast<CExports::TNodeInfo
>(command),
313 buffer.data(), bufferSize);
314 if (bufferResult < 0)
317 value =
String(buffer.data());
322 int GetDependentNodeCount(NodeList type)
const
324 CExports::cvbdim_t numNodes = 0;
325 auto result = CExports::NListCount(
Handle(),
static_cast<CExports::TNodeList
>(type), numNodes);
327 std::rethrow_exception(CvbException::FromCvbResult(result,
"failed calling NListCount"));
333 std::vector<std::shared_ptr<T>> GetDependentNodes(NodeList type)
const;
335 explicit Node(HandleGuard<Node> &&guard) noexcept
336 : handle_(std::move(guard))
341 static void __stdcall UpdatedCallback(CExports::NODE,
void *pPrivate)
345 auto node =
reinterpret_cast<Node *
>(pPrivate);
346 node->updatedCarrierContainer_.Call<void(Node &)>(*node);
354 bool IsRegisterNode() const noexcept
356 CExports::cvbint64_t value = 0;
357 return CExports::NInfoAsInteger(
Handle(),
static_cast<CExports::TNodeInfo
>(NodeInfo::RegisterLength), value)
362 HandleGuard<Node> handle_;
366 Internal::CarrierContainer updatedCarrierContainer_;
368 void *cbID_ =
nullptr;
Cookie used to unregister event handlers.
Definition global.hpp:591
Basic GenApi node for device feature access.
Definition decl_node.hpp:36
String DisplayName() const
Gets the display name of this node.
Definition decl_node.hpp:94
Cvb::GenApi::Visibility Visibility() const
Gets the complexity level of this node.
Definition decl_node.hpp:228
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:205
bool IsWriteable() const
Helper to check whether this node is writable.
Definition decl_node.hpp:167
bool IsReadable() const
Helper to check whether this node is readable.
Definition decl_node.hpp:157
Cvb::GenApi::CacheMode CacheMode() const
Gets the cache mode of this node.
Definition decl_node.hpp:180
bool IsImplemented() const
Helper to check whether this node is implemented.
Definition decl_node.hpp:136
Cvb::GenApi::AccessMode AccessMode() const
Gets the access mode of this node.
Definition decl_node.hpp:126
String EventID() const
Nodes with an event identifier may become invalidated, if an event / message is delivered from the de...
Definition decl_node.hpp:191
NodeMapPtr NodeMap() const noexcept
Gets the node map this node resides in.
Definition decl_node.hpp:263
String Name() const
Gets the full name of this node.
Definition decl_node.hpp:82
bool IsAvailable() const
Helper to check whether this node is available.
Definition decl_node.hpp:146
bool IsDeprecated() const
Gets whether this node is considered deprecated.
Definition decl_node.hpp:218
String Description() const
Gets the long descriptive text of this node.
Definition decl_node.hpp:116
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:69
String ToolTip() const
Gets the short descriptive text of this node.
Definition decl_node.hpp:104
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:66
Visibility
Feature complexity level.
Definition genapi.hpp:233
CacheMode
Defines how the value is cached.
Definition genapi.hpp:218
std::shared_ptr< NodeMap > NodeMapPtr
Convenience shared pointer for NodeMap.
Definition genapi.hpp:22
AccessMode
Access possibility of the node.
Definition genapi.hpp:183
@ ReadOnly
Node can only be read.
Definition genapi.hpp:209
@ NotAvailable
Definition genapi.hpp:197
@ WriteOnly
Node can only be written to.
Definition genapi.hpp:211
@ ReadWrite
Node can be read and written to.
Definition genapi.hpp:213
@ NotImplemented
Definition genapi.hpp:191
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