IDS peak genericC++  v1.7.1
peak_node.hpp
Go to the documentation of this file.
1 
11 #pragma once
12 
13 
15 #include <peak/dll_interface/peak_dll_interface_util.hpp>
16 #include <peak/generic/peak_t_callback_manager.hpp>
17 
18 #include <type_traits>
19 #include <cstddef>
20 #include <cstdint>
21 #include <functional>
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 
27 namespace peak
28 {
29 namespace core
30 {
31 
32 class NodeMap;
33 
37 namespace nodes
38 {
39 
44 enum class NodeAccessStatus
45 {
48  WriteOnly,
49  ReadOnly,
50  ReadWrite
51 };
52 
57 enum class NodeCachingMode
58 {
62  NoCache,
71 };
72 
77 enum class NodeNamespace
78 {
79  Custom,
80  Standard
81 };
82 
86 enum class NodeType
87 {
88  Integer,
89  Boolean,
90  Command,
91  Float,
92  String,
93  Register,
94  Category,
97 };
98 
102 enum class NodeVisibility
103 {
104  Beginner,
105  Expert,
106  Guru,
107  Invisible
108 };
109 
111 struct NodeChangedCallbackContainer;
113 
121 class Node : public std::enable_shared_from_this<Node>
122 {
123 public:
125  using ChangedCallback = std::function<void(const std::shared_ptr<Node>& changedNode)>;
128 
129  Node() = delete;
130  virtual ~Node();
131  Node(const Node& other) = delete;
132  Node& operator=(const Node& other) = delete;
133  Node(Node&& other) = delete;
134  Node& operator=(Node&& other) = delete;
135 
145  std::string Name() const;
146 
156  std::string DisplayName() const;
157 
167  NodeNamespace Namespace() const;
168 
178  NodeVisibility Visibility() const;
179 
191 
202  bool IsCacheable() const;
203 
214  bool IsAccessStatusCacheable() const;
215 
226  bool IsStreamable() const;
227 
238  bool IsDeprecated() const;
239 
251  bool IsFeature() const;
252 
262  NodeCachingMode CachingMode() const;
263 
273  int64_t PollingTime() const;
274 
284  std::string ToolTip() const;
285 
295  std::string Description() const;
296 
309  NodeType Type() const;
310 
320  std::shared_ptr<NodeMap> ParentNodeMap() const;
321 
335  std::shared_ptr<Node> FindInvalidatedNode(const std::string& name) const;
336 
351  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
352  std::shared_ptr<NodeType> FindInvalidatedNode(const std::string& name) const
353  {
354  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindInvalidatedNode(name));
355  if (!castedNode)
356  {
357  throw InvalidCastException("Invalid node cast!");
358  }
359 
360  return castedNode;
361  }
362 
372  std::vector<std::shared_ptr<Node>> InvalidatedNodes() const;
373 
387  std::shared_ptr<Node> FindInvalidatingNode(const std::string& name) const;
388 
403  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
404  std::shared_ptr<NodeType> FindInvalidatingNode(const std::string& name) const
405  {
406  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindInvalidatingNode(name));
407  if (!castedNode)
408  {
409  throw InvalidCastException("Invalid node cast!");
410  }
411 
412  return castedNode;
413  }
414 
424  std::vector<std::shared_ptr<Node>> InvalidatingNodes() const;
425 
439  std::shared_ptr<Node> FindSelectedNode(const std::string& name) const;
440 
455  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
456  std::shared_ptr<NodeType> FindSelectedNode(const std::string& name) const
457  {
458  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindSelectedNode(name));
459  if (!castedNode)
460  {
461  throw InvalidCastException("Invalid node cast!");
462  }
463 
464  return castedNode;
465  }
466 
476  std::vector<std::shared_ptr<Node>> SelectedNodes() const;
477 
491  std::shared_ptr<Node> FindSelectingNode(const std::string& name) const;
492 
507  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
508  std::shared_ptr<NodeType> FindSelectingNode(const std::string& name) const
509  {
510  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindSelectingNode(name));
511  if (!castedNode)
512  {
513  throw InvalidCastException("Invalid node cast!");
514  }
515 
516  return castedNode;
517  }
518 
528  std::vector<std::shared_ptr<Node>> SelectingNodes() const;
529 
544  ChangedCallbackHandle RegisterChangedCallback(const ChangedCallback& callback);
545 
557  void UnregisterChangedCallback(ChangedCallbackHandle callbackHandle);
558 
559 protected:
561  Node(PEAK_NODE_HANDLE nodeHandle, const std::weak_ptr<peak::core::NodeMap>& parentNodeMap);
563 private:
564  struct NodeChangedCallbackContainer
565  {
566  std::shared_ptr<Node> _Node;
567  Node::ChangedCallback Callback;
568  };
569  static void PEAK_CALL_CONV ChangedCallbackCWrapper(PEAK_NODE_HANDLE, void* context);
570 
571  friend ClassCreator<Node>;
572  PEAK_NODE_HANDLE m_backendHandle;
573 
574  std::weak_ptr<NodeMap> m_parentNodeMap;
575 
576  std::unique_ptr<TCallbackManager<PEAK_NODE_CHANGED_CALLBACK_HANDLE, NodeChangedCallbackContainer>>
577  m_changedCallbackManager;
578 };
579 
580 inline std::string GetNodeName(PEAK_NODE_HANDLE nodeHandle)
581 {
582  return QueryStringFromCInterfaceFunction([&](char* nodeName, size_t* nodeNameSize) {
583  return PEAK_C_ABI_PREFIX PEAK_Node_GetName(nodeHandle, nodeName, nodeNameSize);
584  });
585 }
586 
587 } /* namespace nodes */
588 } /* namespace core */
589 } /* namespace peak */
590 
592 
593 /* Implementation */
594 namespace peak
595 {
596 namespace core
597 {
598 namespace nodes
599 {
600 
601 inline std::string ToString(NodeAccessStatus entry)
602 {
603  std::string entryString;
604 
606  {
607  entryString = "NotImplemented";
608  }
609  else if (entry == NodeAccessStatus::NotAvailable)
610  {
611  entryString = "NotAvailable";
612  }
613  else if (entry == NodeAccessStatus::WriteOnly)
614  {
615  entryString = "WriteOnly";
616  }
617  else if (entry == NodeAccessStatus::ReadOnly)
618  {
619  entryString = "ReadOnly";
620  }
621  else if (entry == NodeAccessStatus::ReadWrite)
622  {
623  entryString = "ReadWrite";
624  }
625 
626  return entryString;
627 }
628 
629 inline std::string ToString(NodeCachingMode entry)
630 {
631  std::string entryString;
632 
633  if (entry == NodeCachingMode::NoCache)
634  {
635  entryString = "NoCache";
636  }
637  else if (entry == NodeCachingMode::WriteThrough)
638  {
639  entryString = "WriteThrough";
640  }
641  else if (entry == NodeCachingMode::WriteAround)
642  {
643  entryString = "WriteAround";
644  }
645 
646  return entryString;
647 }
648 
649 inline std::string ToString(NodeNamespace entry)
650 {
651  std::string entryString;
652 
653  if (entry == NodeNamespace::Custom)
654  {
655  entryString = "Custom";
656  }
657  else if (entry == NodeNamespace::Standard)
658  {
659  entryString = "Standard";
660  }
661 
662  return entryString;
663 }
664 
665 inline std::string ToString(NodeType entry)
666 {
667  std::string entryString;
668 
669  if (entry == NodeType::Integer)
670  {
671  entryString = "Integer";
672  }
673  else if (entry == NodeType::Boolean)
674  {
675  entryString = "Boolean";
676  }
677  else if (entry == NodeType::Command)
678  {
679  entryString = "Command";
680  }
681  else if (entry == NodeType::Float)
682  {
683  entryString = "Float";
684  }
685  else if (entry == NodeType::String)
686  {
687  entryString = "String";
688  }
689  else if (entry == NodeType::Register)
690  {
691  entryString = "Register";
692  }
693  else if (entry == NodeType::Category)
694  {
695  entryString = "Category";
696  }
697  else if (entry == NodeType::Enumeration)
698  {
699  entryString = "Enumeration";
700  }
701  else if (entry == NodeType::EnumerationEntry)
702  {
703  entryString = "EnumerationEntry";
704  }
705 
706  return entryString;
707 }
708 
709 inline std::string ToString(NodeVisibility entry)
710 {
711  std::string entryString;
712 
713  if (entry == NodeVisibility::Beginner)
714  {
715  entryString = "Beginner";
716  }
717  else if (entry == NodeVisibility::Expert)
718  {
719  entryString = "Expert";
720  }
721  else if (entry == NodeVisibility::Guru)
722  {
723  entryString = "Guru";
724  }
725  else if (entry == NodeVisibility::Invisible)
726  {
727  entryString = "Invisible";
728  }
729 
730  return entryString;
731 }
732 
734 inline Node::Node(PEAK_NODE_HANDLE nodeHandle, const std::weak_ptr<peak::core::NodeMap>& parentNodeMap)
735  : m_backendHandle(nodeHandle)
736  , m_parentNodeMap(parentNodeMap)
737  , m_changedCallbackManager()
738 {
739  m_changedCallbackManager =
740  std::make_unique<TCallbackManager<PEAK_NODE_CHANGED_CALLBACK_HANDLE, NodeChangedCallbackContainer>>(
741  [&](void* callbackContext) {
742  return QueryNumericFromCInterfaceFunction<PEAK_NODE_CHANGED_CALLBACK_HANDLE>(
743  [&](PEAK_NODE_CHANGED_CALLBACK_HANDLE* nodeChangedCallbackHandle) {
745  m_backendHandle, ChangedCallbackCWrapper, callbackContext, nodeChangedCallbackHandle);
746  });
747  },
748  [&](PEAK_NODE_CHANGED_CALLBACK_HANDLE callbackHandle) {
749  CallAndCheckCInterfaceFunction([&] {
750  return PEAK_C_ABI_PREFIX PEAK_Node_UnregisterChangedCallback(m_backendHandle, callbackHandle);
751  });
752  });
753 }
755 
756 inline Node::~Node()
757 {
758  m_changedCallbackManager->UnregisterAllCallbacks();
759 }
760 
761 inline std::string Node::Name() const
762 {
763  return GetNodeName(m_backendHandle);
764 }
765 
766 inline std::string Node::DisplayName() const
767 {
768  return QueryStringFromCInterfaceFunction([&](char* displayName, size_t* displayNameSize) {
769  return PEAK_C_ABI_PREFIX PEAK_Node_GetDisplayName(m_backendHandle, displayName, displayNameSize);
770  });
771 }
772 
774 {
775  return static_cast<NodeNamespace>(
776  QueryNumericFromCInterfaceFunction<PEAK_NODE_NAMESPACE>([&](PEAK_NODE_NAMESPACE* _namespace) {
777  return PEAK_C_ABI_PREFIX PEAK_Node_GetNamespace(m_backendHandle, _namespace);
778  }));
779 }
780 
782 {
783  return static_cast<NodeVisibility>(
784  QueryNumericFromCInterfaceFunction<PEAK_NODE_VISIBILITY>([&](PEAK_NODE_VISIBILITY* visibility) {
785  return PEAK_C_ABI_PREFIX PEAK_Node_GetVisibility(m_backendHandle, visibility);
786  }));
787 }
788 
790 {
791  return static_cast<NodeAccessStatus>(
792  QueryNumericFromCInterfaceFunction<PEAK_NODE_ACCESS_STATUS>([&](PEAK_NODE_ACCESS_STATUS* accessStatus) {
793  return PEAK_C_ABI_PREFIX PEAK_Node_GetAccessStatus(m_backendHandle, accessStatus);
794  }));
795 }
796 
797 inline bool Node::IsCacheable() const
798 {
799  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isCacheable) {
800  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsCacheable(m_backendHandle, isCacheable);
801  }) > 0;
802 }
803 
804 inline bool Node::IsAccessStatusCacheable() const
805 {
806  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isAccessStatusCacheable) {
807  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsAccessStatusCacheable(m_backendHandle, isAccessStatusCacheable);
808  }) > 0;
809 }
810 
811 inline bool Node::IsStreamable() const
812 {
813  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isStreamable) {
814  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsStreamable(m_backendHandle, isStreamable);
815  }) > 0;
816 }
817 
818 inline bool Node::IsDeprecated() const
819 {
820  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isDeprecated) {
821  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsDeprecated(m_backendHandle, isDeprecated);
822  }) > 0;
823 }
824 
825 inline bool Node::IsFeature() const
826 {
827  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isFeature) {
828  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsFeature(m_backendHandle, isFeature);
829  }) > 0;
830 }
831 
833 {
834  return static_cast<NodeCachingMode>(
835  QueryNumericFromCInterfaceFunction<PEAK_NODE_CACHING_MODE>([&](PEAK_NODE_CACHING_MODE* cachingMode) {
836  return PEAK_C_ABI_PREFIX PEAK_Node_GetCachingMode(m_backendHandle, cachingMode);
837  }));
838 }
839 
840 inline int64_t Node::PollingTime() const
841 {
842  return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* pollingTime_ms) {
843  return PEAK_C_ABI_PREFIX PEAK_Node_GetPollingTime(m_backendHandle, pollingTime_ms);
844  });
845 }
846 
847 inline std::string Node::ToolTip() const
848 {
849  return QueryStringFromCInterfaceFunction([&](char* toolTip, size_t* toolTipSize) {
850  return PEAK_C_ABI_PREFIX PEAK_Node_GetToolTip(m_backendHandle, toolTip, toolTipSize);
851  });
852 }
853 
854 inline std::string Node::Description() const
855 {
856  return QueryStringFromCInterfaceFunction([&](char* description, size_t* descriptionSize) {
857  return PEAK_C_ABI_PREFIX PEAK_Node_GetDescription(m_backendHandle, description, descriptionSize);
858  });
859 }
860 
861 inline NodeType Node::Type() const
862 {
863  return static_cast<NodeType>(QueryNumericFromCInterfaceFunction<PEAK_NODE_TYPE>(
864  [&](PEAK_NODE_TYPE* type) { return PEAK_C_ABI_PREFIX PEAK_Node_GetType(m_backendHandle, type); }));
865 }
866 
867 inline std::shared_ptr<peak::core::NodeMap> Node::ParentNodeMap() const
868 {
869  return LockOrThrow(m_parentNodeMap);
870 }
871 
872 inline std::shared_ptr<Node> Node::FindInvalidatedNode(const std::string& name) const
873 {
874  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
876  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
877  });
878 
879  auto nodeName = GetNodeName(nodeHandle);
880 
881  return ParentNodeMap()->FindNode(name);
882 }
883 
884 inline std::vector<std::shared_ptr<Node>> Node::InvalidatedNodes() const
885 {
886  auto numInvalidatedNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numInvalidatedNodes) {
887  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumInvalidatedNodes(m_backendHandle, _numInvalidatedNodes);
888  });
889 
890  std::vector<std::shared_ptr<Node>> invalidatedNodes;
891  for (size_t x = 0; x < numInvalidatedNodes; ++x)
892  {
893  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
894  [&](PEAK_NODE_HANDLE* _nodeHandle) {
895  return PEAK_C_ABI_PREFIX PEAK_Node_GetInvalidatedNode(m_backendHandle, x, _nodeHandle);
896  });
897 
898  auto nodeName = GetNodeName(nodeHandle);
899 
900  invalidatedNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
901  }
902 
903  return invalidatedNodes;
904 }
905 
906 inline std::shared_ptr<Node> Node::FindInvalidatingNode(const std::string& name) const
907 {
908  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
910  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
911  });
912 
913  auto nodeName = GetNodeName(nodeHandle);
914 
915  return ParentNodeMap()->FindNode(name);
916 }
917 
918 inline std::vector<std::shared_ptr<Node>> Node::InvalidatingNodes() const
919 {
920  auto numInvalidatingNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numInvalidatedNodes) {
921  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumInvalidatingNodes(m_backendHandle, _numInvalidatedNodes);
922  });
923 
924  std::vector<std::shared_ptr<Node>> invalidatingNodes;
925  for (size_t x = 0; x < numInvalidatingNodes; ++x)
926  {
927  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
928  [&](PEAK_NODE_HANDLE* _nodeHandle) {
929  return PEAK_C_ABI_PREFIX PEAK_Node_GetInvalidatingNode(m_backendHandle, x, _nodeHandle);
930  });
931 
932  auto nodeName = GetNodeName(nodeHandle);
933 
934  invalidatingNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
935  }
936 
937  return invalidatingNodes;
938 }
939 
940 inline std::shared_ptr<Node> Node::FindSelectedNode(const std::string& name) const
941 {
942  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
944  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
945  });
946 
947  auto nodeName = GetNodeName(nodeHandle);
948 
949  return ParentNodeMap()->FindNode(name);
950 }
951 
952 inline std::vector<std::shared_ptr<Node>> Node::SelectedNodes() const
953 {
954  auto numSelectedNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numSelectedNodes) {
955  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumSelectedNodes(m_backendHandle, _numSelectedNodes);
956  });
957 
958  std::vector<std::shared_ptr<Node>> selectedNodes;
959  for (size_t x = 0; x < numSelectedNodes; ++x)
960  {
961  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
962  [&](PEAK_NODE_HANDLE* _nodeHandle) {
963  return PEAK_C_ABI_PREFIX PEAK_Node_GetSelectedNode(m_backendHandle, x, _nodeHandle);
964  });
965 
966  auto nodeName = GetNodeName(nodeHandle);
967 
968  selectedNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
969  }
970 
971  return selectedNodes;
972 }
973 
974 inline std::shared_ptr<Node> Node::FindSelectingNode(const std::string& name) const
975 {
976  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
978  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
979  });
980 
981  auto nodeName = GetNodeName(nodeHandle);
982 
983  return ParentNodeMap()->FindNode(name);
984 }
985 
986 inline std::vector<std::shared_ptr<Node>> Node::SelectingNodes() const
987 {
988  auto numSelectingNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numSelectingNodes) {
989  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumSelectingNodes(m_backendHandle, _numSelectingNodes);
990  });
991 
992  std::vector<std::shared_ptr<Node>> selectingNodes;
993  for (size_t x = 0; x < numSelectingNodes; ++x)
994  {
995  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
996  [&](PEAK_NODE_HANDLE* _nodeHandle) {
997  return PEAK_C_ABI_PREFIX PEAK_Node_GetSelectingNode(m_backendHandle, x, _nodeHandle);
998  });
999 
1000  auto nodeName = GetNodeName(nodeHandle);
1001 
1002  selectingNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
1003  }
1004 
1005  return selectingNodes;
1006 }
1007 
1009 {
1010  return reinterpret_cast<ChangedCallbackHandle>(
1011  m_changedCallbackManager->RegisterCallback(NodeChangedCallbackContainer{ shared_from_this(), callback }));
1012 }
1013 
1015 {
1016  m_changedCallbackManager->UnregisterCallback(
1017  reinterpret_cast<PEAK_NODE_CHANGED_CALLBACK_HANDLE>(callbackHandle));
1018 }
1019 
1020 inline void PEAK_CALL_CONV Node::ChangedCallbackCWrapper(PEAK_NODE_HANDLE, void* context)
1021 {
1022  auto callbackContainer = static_cast<NodeChangedCallbackContainer*>(context);
1023 
1024  callbackContainer->Callback(callbackContainer->_Node);
1025 }
1026 
1027 } /* namespace nodes */
1028 } /* namespace core */
1029 } /* namespace peak */
PEAK_C_API PEAK_Node_GetNumSelectedNodes(PEAK_NODE_HANDLE nodeHandle, size_t *numSelectedNodes)
Asks the given node for its number of selected nodes.
std::shared_ptr< Node > FindSelectingNode(const std::string &name) const
Tries to find a selecting node with the given name.
Definition: peak_node.hpp:974
std::vector< std::shared_ptr< Node > > InvalidatingNodes() const
Returns the invalidating nodes.
Definition: peak_node.hpp:918
ChangedCallback * ChangedCallbackHandle
Definition: peak_node.hpp:127
int32_t PEAK_NODE_CACHING_MODE
Definition: peak_backend.h:217
PEAK_C_API PEAK_Node_FindInvalidatingNode(PEAK_NODE_HANDLE nodeHandle, const char *name, size_t nameSize, PEAK_NODE_HANDLE *invalidatingNodeHandle)
Tells the given node to find an invalidating node with the given name.
bool IsDeprecated() const
Checks whether the node is deprecated.
Definition: peak_node.hpp:818
PEAK_C_API PEAK_Node_GetCachingMode(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_CACHING_MODE *cachingMode)
Asks the given node for its caching mode.
PEAK_C_API PEAK_Node_GetIsDeprecated(PEAK_NODE_HANDLE nodeHandle, PEAK_BOOL8 *isDeprecated)
Asks the given node whether it is deprecated.
bool IsCacheable() const
Checks whether the node is cacheable.
Definition: peak_node.hpp:797
PEAK_C_API PEAK_Node_FindSelectingNode(PEAK_NODE_HANDLE nodeHandle, const char *name, size_t nameSize, PEAK_NODE_HANDLE *selectingNodeHandle)
Tells the given node to find a selecting node with the given name.
NodeNamespace Namespace() const
Returns the namespace the node belongs to.
Definition: peak_node.hpp:773
int8_t PEAK_BOOL8
Definition: peak_backend.h:26
int32_t PEAK_NODE_TYPE
Definition: peak_backend.h:279
The "peak" namespace directly contains convenience functionality like the DeviceManager as well as th...
Definition: peak_dynamic_loader.h:32
PEAK_C_API PEAK_Node_GetIsFeature(PEAK_NODE_HANDLE nodeHandle, PEAK_BOOL8 *isFeature)
Asks the given node whether it is a feature, i.e. it can be reached via category nodes from a categor...
The exception thrown for trying to apply an invalid cast.
Definition: peak_exception.hpp:81
std::string Description() const
Returns the description.
Definition: peak_node.hpp:854
std::string DisplayName() const
Returns the display name.
Definition: peak_node.hpp:766
PEAK_C_API PEAK_Node_GetIsStreamable(PEAK_NODE_HANDLE nodeHandle, PEAK_BOOL8 *isStreamable)
Asks the given node whether it is streamable.
std::shared_ptr< Node > FindInvalidatingNode(const std::string &name) const
Tries to find an invalidating node with the given name.
Definition: peak_node.hpp:906
PEAK_C_API PEAK_Node_GetPollingTime(PEAK_NODE_HANDLE nodeHandle, int64_t *pollingTime_ms)
Asks the given node for its polling time.
virtual ~Node()
Definition: peak_node.hpp:756
int32_t PEAK_NODE_VISIBILITY
Definition: peak_backend.h:289
PEAK_C_API PEAK_Node_FindInvalidatedNode(PEAK_NODE_HANDLE nodeHandle, const char *name, size_t nameSize, PEAK_NODE_HANDLE *invalidatedNodeHandle)
Tells the given node to find an invalidated node with the given name.
std::shared_ptr< NodeType > FindSelectedNode(const std::string &name) const
Tries to find a selected node with the given name and type.
Definition: peak_node.hpp:456
PEAK_C_API PEAK_Node_GetNumSelectingNodes(PEAK_NODE_HANDLE nodeHandle, size_t *numSelectingNodes)
Asks the given node for its number of selecting nodes.
std::vector< std::shared_ptr< Node > > InvalidatedNodes() const
Returns the invalidated nodes.
Definition: peak_node.hpp:884
std::function< void(const std::shared_ptr< Node > &changedNode)> ChangedCallback
Definition: peak_node.hpp:125
NodeVisibility
Definition: peak_node.hpp:102
std::shared_ptr< NodeType > FindInvalidatedNode(const std::string &name) const
Tries to find an invalidated node with the given name and type.
Definition: peak_node.hpp:352
std::string ToolTip() const
Returns the tool tip.
Definition: peak_node.hpp:847
struct PEAK_NODE * PEAK_NODE_HANDLE
Definition: peak_backend.h:411
PEAK_C_API PEAK_Node_FindSelectedNode(PEAK_NODE_HANDLE nodeHandle, const char *name, size_t nameSize, PEAK_NODE_HANDLE *selectedNodeHandle)
Tells the given node to find a selected node with the given name.
PEAK_C_API PEAK_Node_RegisterChangedCallback(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_CHANGED_CALLBACK callback, void *callbackContext, PEAK_NODE_CHANGED_CALLBACK_HANDLE *callbackHandle)
Registers a callback signaling a change at the given node.
std::string ToString(NodeCacheUsePolicy entry)
Definition: peak_common_node_enums.hpp:54
PEAK_C_API PEAK_Node_GetSelectingNode(PEAK_NODE_HANDLE nodeHandle, size_t index, PEAK_NODE_HANDLE *selectingNodeHandle)
Asks the given node for the selecting node with the given index.
int32_t PEAK_NODE_NAMESPACE
Definition: peak_backend.h:251
PEAK_C_API PEAK_Node_GetNumInvalidatedNodes(PEAK_NODE_HANDLE nodeHandle, size_t *numInvalidatedNodes)
Asks the given node for its number of invalidated nodes.
std::string Name() const
Returns the name.
Definition: peak_node.hpp:761
PEAK_C_API PEAK_Node_GetNamespace(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_NAMESPACE *_namespace)
Asks the given node for its namespace.
PEAK_C_API PEAK_Node_GetDisplayName(PEAK_NODE_HANDLE nodeHandle, char *displayName, size_t *displayNameSize)
Asks the given node for its display name.
PEAK_C_API PEAK_Node_GetNumInvalidatingNodes(PEAK_NODE_HANDLE nodeHandle, size_t *numInvalidatingNodes)
Asks the given node for its number of invalidating nodes.
void UnregisterChangedCallback(ChangedCallbackHandle callbackHandle)
Unregisters a changed callback.
Definition: peak_node.hpp:1014
std::shared_ptr< NodeType > FindSelectingNode(const std::string &name) const
Tries to find a selecting node with the given name and type.
Definition: peak_node.hpp:508
std::vector< std::shared_ptr< Node > > SelectingNodes() const
Returns the selecting nodes.
Definition: peak_node.hpp:986
std::shared_ptr< NodeType > FindInvalidatingNode(const std::string &name) const
Tries to find an invalidating node with the given name and type.
Definition: peak_node.hpp:404
PEAK_C_API PEAK_Node_GetType(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_TYPE *type)
Asks the given node for its type.
NodeCachingMode
Definition: peak_node.hpp:57
int64_t PollingTime() const
Returns the polling time.
Definition: peak_node.hpp:840
int32_t PEAK_NODE_ACCESS_STATUS
Definition: peak_backend.h:208
NodeAccessStatus AccessStatus() const
Returns the access status.
Definition: peak_node.hpp:789
std::shared_ptr< NodeMap > ParentNodeMap() const
Returns the parent node map.
Definition: peak_node.hpp:867
PEAK_NODE_CHANGED_CALLBACK * PEAK_NODE_CHANGED_CALLBACK_HANDLE
Definition: peak_backend.h:560
NodeType
Definition: peak_node.hpp:86
PEAK_C_API PEAK_Node_GetVisibility(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_VISIBILITY *visibility)
Asks the given node for its visibility.
PEAK_C_API PEAK_Node_GetAccessStatus(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_ACCESS_STATUS *accessStatus)
Asks the given node for its access status.
NodeCachingMode CachingMode() const
Returns the caching mode.
Definition: peak_node.hpp:832
PEAK_C_API PEAK_Node_GetInvalidatingNode(PEAK_NODE_HANDLE nodeHandle, size_t index, PEAK_NODE_HANDLE *invalidatingNodeHandle)
Asks the given node for the invalidating node with the given index.
PEAK_C_API PEAK_Node_GetName(PEAK_NODE_HANDLE nodeHandle, char *name, size_t *nameSize)
Asks the given node for its name.
std::vector< std::shared_ptr< Node > > SelectedNodes() const
Returns the selected nodes.
Definition: peak_node.hpp:952
#define PEAK_CALL_CONV
Definition: peak_dynamic_loader.h:29
#define PEAK_C_ABI_PREFIX
Definition: peak_dll_defines.h:16
NodeNamespace
Definition: peak_node.hpp:77
std::shared_ptr< Node > FindInvalidatedNode(const std::string &name) const
Tries to find an invalidated node with the given name.
Definition: peak_node.hpp:872
std::shared_ptr< Node > FindSelectedNode(const std::string &name) const
Tries to find a selected node with the given name.
Definition: peak_node.hpp:940
ChangedCallbackHandle RegisterChangedCallback(const ChangedCallback &callback)
Registers a callback for signaling a change to the node.
Definition: peak_node.hpp:1008
NodeType Type() const
Returns the type.
Definition: peak_node.hpp:861
bool IsStreamable() const
Checks whether the node is streamable.
Definition: peak_node.hpp:811
PEAK_C_API PEAK_Node_GetSelectedNode(PEAK_NODE_HANDLE nodeHandle, size_t index, PEAK_NODE_HANDLE *selectedNodeHandle)
Asks the given node for the selected node with the given index.
PEAK_C_API PEAK_Node_GetDescription(PEAK_NODE_HANDLE nodeHandle, char *description, size_t *descriptionSize)
Asks the given node for its description.
PEAK_C_API PEAK_Node_GetToolTip(PEAK_NODE_HANDLE nodeHandle, char *toolTip, size_t *toolTipSize)
Asks the given node for its tooltip.
PEAK_C_API PEAK_Node_GetIsAccessStatusCacheable(PEAK_NODE_HANDLE nodeHandle, PEAK_BOOL8 *isAccessStatusCacheable)
Asks the given node whether its access status is cacheable.
Represents a GenAPI node.
Definition: peak_node.hpp:121
std::string GetNodeName(PEAK_NODE_HANDLE nodeHandle)
Definition: peak_node.hpp:580
bool IsAccessStatusCacheable() const
Checks whether the node&#39;s access status is cacheable.
Definition: peak_node.hpp:804
PEAK_C_API PEAK_Node_UnregisterChangedCallback(PEAK_NODE_HANDLE nodeHandle, PEAK_NODE_CHANGED_CALLBACK_HANDLE callbackHandle)
Unregisters the changed callback with the given handle from the given node.
bool IsFeature() const
Checks whether the node is a feature, i.e. it can be reached via category nodes from a category node ...
Definition: peak_node.hpp:825
PEAK_C_API PEAK_Node_GetInvalidatedNode(PEAK_NODE_HANDLE nodeHandle, size_t index, PEAK_NODE_HANDLE *invalidatedNodeHandle)
Asks the given node for the invalidated node with the given index.
PEAK_C_API PEAK_Node_GetIsCacheable(PEAK_NODE_HANDLE nodeHandle, PEAK_BOOL8 *isCacheable)
Asks the given node whether it is cacheable.
NodeVisibility Visibility() const
Returns the visibility.
Definition: peak_node.hpp:781
NodeAccessStatus
Definition: peak_node.hpp:44