16 inline HandleGuard<GenApi::NodeMapEnumerator>::HandleGuard(
void* handle) noexcept
17 : HandleGuard<GenApi::NodeMapEnumerator>(handle, [](
void* handle) { CVB_CALL_CAPI(ReleaseObject(handle)); })
42 : handle_(std::move(guard))
73 CVB_CALL_CAPI_CHECKED(ShareObject(
object.
Handle()));
86 return handle_.Handle();
99 auto nodeMapCount = NodeMapCount();
100 names.reserve(nodeMapCount);
101 std::generate_n(std::back_inserter(names), nodeMapCount, [
this, i = 0]()
mutable {
102 return NameAt(i++); });
129 auto iter = nodeMaps_.find(name);
130 if (iter != nodeMaps_.end())
132 if (
auto nodeMap = iter->second.lock())
136 CExports::NODEMAP handle =
nullptr;
138 CVB_CALL_CAPI_CHECKED(NMH2GetNodeMap(
Handle(), cname.c_str(), handle));
141 nodeMaps_[name] = nodeMap;
147 int NodeMapCount() const noexcept
149 size_t numNodeMaps = 0;
150 CExports::NMH2GetNum(
Handle(), numNodeMaps);
151 return static_cast<int>(numNodeMaps);
154 String NameAt(
int index)
const
156 size_t bufferSize = 0;
157 CVB_CALL_CAPI_CHECKED(NMH2GetID(
Handle(), index,
nullptr, bufferSize));
160 CVB_CALL_CAPI_CHECKED(NMH2GetID(
Handle(), index, buffer.data(), bufferSize));
162 return String(buffer.begin(), buffer.end() - 1);
167 HandleGuard<NodeMapEnumerator> handle_;
Lazy enumeration of node maps.
Definition: node_map_enumerator.hpp:31
NodeMapPtr operator[](const String &name) const
Name based node map access.
Definition: node_map_enumerator.hpp:114
static NodeMapEnumerator FromObject(const T &object)
Create a node map enumerator for a given object.
Definition: node_map_enumerator.hpp:71
NodeMapEnumerator(NodeMapEnumerator &&other)=default
Move constructor.
NodeMapPtr NodeMap(const String &name) const
Name based node map access.
Definition: node_map_enumerator.hpp:127
std::vector< String > Names() const
Get the names of all available node maps.
Definition: node_map_enumerator.hpp:96
NodeMapEnumerator & operator=(NodeMapEnumerator &&other)=default
Move operator.
void * Handle() const noexcept
Classic API device handle.
Definition: node_map_enumerator.hpp:84
static NodeMapPtr FromHandle(HandleGuard< NodeMap > &&guard, const String &name, const Device &device)
Creates a node map from a classic API handle.
Definition: detail_node_map.hpp:27
Root namespace for the Image Manager interface.
Definition: c_barcode.h:24