CVB++ 15.0
detail_composite_stream_base.hpp
1#pragma once
2
3#include "../_decl/decl_composite_stream_base.hpp"
4#include "../../genapi/_decl/decl_node_map.hpp"
5
6#include "../image_stream.hpp"
7#include "../composite_stream.hpp"
8#include "../point_cloud_stream.hpp"
9
10namespace Cvb
11{
12
13 CVB_BEGIN_INLINE_NS
14
15 template <class T, class... ARGS>
16 inline std::shared_ptr<T> CompositeStreamBase::FromHandle(HandleGuard<CompositeStreamBase> &&guard, ARGS &&...args)
17 {
18 if (!guard.Handle())
19 throw std::runtime_error("handle must not be null");
20
21 return std::make_shared<T>(std::move(guard), PrivateTag{}, std::forward<ARGS>(args)...);
22 }
23
25 {
26 auto element = nodeMaps_.find(name);
27 if (element == nodeMaps_.end())
28 return GenApi::NodeMapPtr();
29
30 return element->second.AtomicGet([stream = this, name]() {
31 std::string cname(Internal::CastToAscii(name));
32 return Internal::DoResCallShareOut<GenApi::NodeMap>(
33 [stream, cname](void *&handle) {
34 return CVB_CALL_CAPI(NMH2GetNodeMap(stream->Handle(), cname.c_str(), handle));
35 },
36 name, stream->Handle());
37 });
38 }
39
41 {
43 for (const auto &entry : nodeMaps_)
44 {
45 try
46 {
47 nodeMaps[entry.first] = NodeMap(entry.first);
48 }
49 catch (const std::exception &)
50 {
51 nodeMaps[entry.first] = NodeMapPtr();
52 }
53 }
54 return nodeMaps;
55 }
56
57 CVB_END_INLINE_NS
58
59} // namespace Cvb
NodeMapPtr NodeMap(const String &name) const
Gets the NodeMap with the given name.
Definition detail_composite_stream_base.hpp:24
std::map< String, NodeMapPtr > NodeMaps() const
Gets the dictionary holding all available stream NodeMaps.
Definition detail_composite_stream_base.hpp:40
@ String
String value.
Definition driver.hpp:366
std::shared_ptr< NodeMap > NodeMapPtr
Convenience shared pointer for NodeMap.
Definition genapi.hpp:27
Root namespace for the Image Manager interface.
Definition c_bayer_to_rgb.h:17