IDS peak genericC++  v1.6.0
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;
155  std::string DisplayName() const;
165  NodeNamespace Namespace() const;
175  NodeVisibility Visibility() const;
196  bool IsCacheable() const;
207  bool IsAccessStatusCacheable() const;
218  bool IsStreamable() const;
229  bool IsDeprecated() const;
241  bool IsFeature() const;
251  NodeCachingMode CachingMode() const;
261  int64_t PollingTime() const;
271  std::string ToolTip() const;
281  std::string Description() const;
294  NodeType Type() const;
304  std::shared_ptr<NodeMap> ParentNodeMap() const;
305 
319  std::shared_ptr<Node> FindInvalidatedNode(const std::string& name) const;
334  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
335  std::shared_ptr<NodeType> FindInvalidatedNode(const std::string& name) const
336  {
337  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindInvalidatedNode(name));
338  if (!castedNode)
339  {
340  throw InvalidCastException("Invalid node cast!");
341  }
342 
343  return castedNode;
344  }
354  std::vector<std::shared_ptr<Node>> InvalidatedNodes() const;
368  std::shared_ptr<Node> FindInvalidatingNode(const std::string& name) const;
383  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
384  std::shared_ptr<NodeType> FindInvalidatingNode(const std::string& name) const
385  {
386  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindInvalidatingNode(name));
387  if (!castedNode)
388  {
389  throw InvalidCastException("Invalid node cast!");
390  }
391 
392  return castedNode;
393  }
403  std::vector<std::shared_ptr<Node>> InvalidatingNodes() const;
417  std::shared_ptr<Node> FindSelectedNode(const std::string& name) const;
432  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
433  std::shared_ptr<NodeType> FindSelectedNode(const std::string& name) const
434  {
435  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindSelectedNode(name));
436  if (!castedNode)
437  {
438  throw InvalidCastException("Invalid node cast!");
439  }
440 
441  return castedNode;
442  }
452  std::vector<std::shared_ptr<Node>> SelectedNodes() const;
466  std::shared_ptr<Node> FindSelectingNode(const std::string& name) const;
481  template <class NodeType, typename std::enable_if<std::is_base_of<Node, NodeType>::value, int>::type = 0>
482  std::shared_ptr<NodeType> FindSelectingNode(const std::string& name) const
483  {
484  auto castedNode = std::dynamic_pointer_cast<NodeType>(FindSelectingNode(name));
485  if (!castedNode)
486  {
487  throw InvalidCastException("Invalid node cast!");
488  }
489 
490  return castedNode;
491  }
501  std::vector<std::shared_ptr<Node>> SelectingNodes() const;
502 
517  ChangedCallbackHandle RegisterChangedCallback(const ChangedCallback& callback);
529  void UnregisterChangedCallback(ChangedCallbackHandle callbackHandle);
530 
531 protected:
533  Node(PEAK_NODE_HANDLE nodeHandle, const std::weak_ptr<peak::core::NodeMap>& parentNodeMap);
535 private:
536  struct NodeChangedCallbackContainer
537  {
538  std::shared_ptr<Node> _Node;
539  Node::ChangedCallback Callback;
540  };
541  static void PEAK_CALL_CONV ChangedCallbackCWrapper(PEAK_NODE_HANDLE, void* context);
542 
543  friend ClassCreator<Node>;
544  PEAK_NODE_HANDLE m_backendHandle;
545 
546  std::weak_ptr<NodeMap> m_parentNodeMap;
547 
548  std::unique_ptr<TCallbackManager<PEAK_NODE_CHANGED_CALLBACK_HANDLE, NodeChangedCallbackContainer>>
549  m_changedCallbackManager;
550 };
551 
552 inline std::string GetNodeName(PEAK_NODE_HANDLE nodeHandle)
553 {
554  return QueryStringFromCInterfaceFunction([&](char* nodeName, size_t* nodeNameSize) {
555  return PEAK_C_ABI_PREFIX PEAK_Node_GetName(nodeHandle, nodeName, nodeNameSize);
556  });
557 }
558 
559 } /* namespace nodes */
560 } /* namespace core */
561 } /* namespace peak */
562 
564 
565 /* Implementation */
566 namespace peak
567 {
568 namespace core
569 {
570 namespace nodes
571 {
572 
573 inline std::string ToString(NodeAccessStatus entry)
574 {
575  std::string entryString;
576 
578  {
579  entryString = "NotImplemented";
580  }
581  else if (entry == NodeAccessStatus::NotAvailable)
582  {
583  entryString = "NotAvailable";
584  }
585  else if (entry == NodeAccessStatus::WriteOnly)
586  {
587  entryString = "WriteOnly";
588  }
589  else if (entry == NodeAccessStatus::ReadOnly)
590  {
591  entryString = "ReadOnly";
592  }
593  else if (entry == NodeAccessStatus::ReadWrite)
594  {
595  entryString = "ReadWrite";
596  }
597 
598  return entryString;
599 }
600 
601 inline std::string ToString(NodeCachingMode entry)
602 {
603  std::string entryString;
604 
605  if (entry == NodeCachingMode::NoCache)
606  {
607  entryString = "NoCache";
608  }
609  else if (entry == NodeCachingMode::WriteThrough)
610  {
611  entryString = "WriteThrough";
612  }
613  else if (entry == NodeCachingMode::WriteAround)
614  {
615  entryString = "WriteAround";
616  }
617 
618  return entryString;
619 }
620 
621 inline std::string ToString(NodeNamespace entry)
622 {
623  std::string entryString;
624 
625  if (entry == NodeNamespace::Custom)
626  {
627  entryString = "Custom";
628  }
629  else if (entry == NodeNamespace::Standard)
630  {
631  entryString = "Standard";
632  }
633 
634  return entryString;
635 }
636 
637 inline std::string ToString(NodeType entry)
638 {
639  std::string entryString;
640 
641  if (entry == NodeType::Integer)
642  {
643  entryString = "Integer";
644  }
645  else if (entry == NodeType::Boolean)
646  {
647  entryString = "Boolean";
648  }
649  else if (entry == NodeType::Command)
650  {
651  entryString = "Command";
652  }
653  else if (entry == NodeType::Float)
654  {
655  entryString = "Float";
656  }
657  else if (entry == NodeType::String)
658  {
659  entryString = "String";
660  }
661  else if (entry == NodeType::Register)
662  {
663  entryString = "Register";
664  }
665  else if (entry == NodeType::Category)
666  {
667  entryString = "Category";
668  }
669  else if (entry == NodeType::Enumeration)
670  {
671  entryString = "Enumeration";
672  }
673  else if (entry == NodeType::EnumerationEntry)
674  {
675  entryString = "EnumerationEntry";
676  }
677 
678  return entryString;
679 }
680 
681 inline std::string ToString(NodeVisibility entry)
682 {
683  std::string entryString;
684 
685  if (entry == NodeVisibility::Beginner)
686  {
687  entryString = "Beginner";
688  }
689  else if (entry == NodeVisibility::Expert)
690  {
691  entryString = "Expert";
692  }
693  else if (entry == NodeVisibility::Guru)
694  {
695  entryString = "Guru";
696  }
697  else if (entry == NodeVisibility::Invisible)
698  {
699  entryString = "Invisible";
700  }
701 
702  return entryString;
703 }
704 
706 inline Node::Node(PEAK_NODE_HANDLE nodeHandle, const std::weak_ptr<peak::core::NodeMap>& parentNodeMap)
707  : m_backendHandle(nodeHandle)
708  , m_parentNodeMap(parentNodeMap)
709  , m_changedCallbackManager()
710 {
711  m_changedCallbackManager =
712  std::make_unique<TCallbackManager<PEAK_NODE_CHANGED_CALLBACK_HANDLE, NodeChangedCallbackContainer>>(
713  [&](void* callbackContext) {
714  return QueryNumericFromCInterfaceFunction<PEAK_NODE_CHANGED_CALLBACK_HANDLE>(
715  [&](PEAK_NODE_CHANGED_CALLBACK_HANDLE* nodeChangedCallbackHandle) {
717  m_backendHandle, ChangedCallbackCWrapper, callbackContext, nodeChangedCallbackHandle);
718  });
719  },
720  [&](PEAK_NODE_CHANGED_CALLBACK_HANDLE callbackHandle) {
721  CallAndCheckCInterfaceFunction([&] {
722  return PEAK_C_ABI_PREFIX PEAK_Node_UnregisterChangedCallback(m_backendHandle, callbackHandle);
723  });
724  });
725 }
727 
728 inline Node::~Node()
729 {
730  m_changedCallbackManager->UnregisterAllCallbacks();
731 }
732 
733 inline std::string Node::Name() const
734 {
735  return GetNodeName(m_backendHandle);
736 }
737 
738 inline std::string Node::DisplayName() const
739 {
740  return QueryStringFromCInterfaceFunction([&](char* displayName, size_t* displayNameSize) {
741  return PEAK_C_ABI_PREFIX PEAK_Node_GetDisplayName(m_backendHandle, displayName, displayNameSize);
742  });
743 }
744 
746 {
747  return static_cast<NodeNamespace>(
748  QueryNumericFromCInterfaceFunction<PEAK_NODE_NAMESPACE>([&](PEAK_NODE_NAMESPACE* _namespace) {
749  return PEAK_C_ABI_PREFIX PEAK_Node_GetNamespace(m_backendHandle, _namespace);
750  }));
751 }
752 
754 {
755  return static_cast<NodeVisibility>(
756  QueryNumericFromCInterfaceFunction<PEAK_NODE_VISIBILITY>([&](PEAK_NODE_VISIBILITY* visibility) {
757  return PEAK_C_ABI_PREFIX PEAK_Node_GetVisibility(m_backendHandle, visibility);
758  }));
759 }
760 
762 {
763  return static_cast<NodeAccessStatus>(
764  QueryNumericFromCInterfaceFunction<PEAK_NODE_ACCESS_STATUS>([&](PEAK_NODE_ACCESS_STATUS* accessStatus) {
765  return PEAK_C_ABI_PREFIX PEAK_Node_GetAccessStatus(m_backendHandle, accessStatus);
766  }));
767 }
768 
769 inline bool Node::IsCacheable() const
770 {
771  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isCacheable) {
772  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsCacheable(m_backendHandle, isCacheable);
773  }) > 0;
774 }
775 
776 inline bool Node::IsAccessStatusCacheable() const
777 {
778  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isAccessStatusCacheable) {
779  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsAccessStatusCacheable(m_backendHandle, isAccessStatusCacheable);
780  }) > 0;
781 }
782 
783 inline bool Node::IsStreamable() const
784 {
785  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isStreamable) {
786  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsStreamable(m_backendHandle, isStreamable);
787  }) > 0;
788 }
789 
790 inline bool Node::IsDeprecated() const
791 {
792  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isDeprecated) {
793  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsDeprecated(m_backendHandle, isDeprecated);
794  }) > 0;
795 }
796 
797 inline bool Node::IsFeature() const
798 {
799  return QueryNumericFromCInterfaceFunction<PEAK_BOOL8>([&](PEAK_BOOL8* isFeature) {
800  return PEAK_C_ABI_PREFIX PEAK_Node_GetIsFeature(m_backendHandle, isFeature);
801  }) > 0;
802 }
803 
805 {
806  return static_cast<NodeCachingMode>(
807  QueryNumericFromCInterfaceFunction<PEAK_NODE_CACHING_MODE>([&](PEAK_NODE_CACHING_MODE* cachingMode) {
808  return PEAK_C_ABI_PREFIX PEAK_Node_GetCachingMode(m_backendHandle, cachingMode);
809  }));
810 }
811 
812 inline int64_t Node::PollingTime() const
813 {
814  return QueryNumericFromCInterfaceFunction<int64_t>([&](int64_t* pollingTime_ms) {
815  return PEAK_C_ABI_PREFIX PEAK_Node_GetPollingTime(m_backendHandle, pollingTime_ms);
816  });
817 }
818 
819 inline std::string Node::ToolTip() const
820 {
821  return QueryStringFromCInterfaceFunction([&](char* toolTip, size_t* toolTipSize) {
822  return PEAK_C_ABI_PREFIX PEAK_Node_GetToolTip(m_backendHandle, toolTip, toolTipSize);
823  });
824 }
825 
826 inline std::string Node::Description() const
827 {
828  return QueryStringFromCInterfaceFunction([&](char* description, size_t* descriptionSize) {
829  return PEAK_C_ABI_PREFIX PEAK_Node_GetDescription(m_backendHandle, description, descriptionSize);
830  });
831 }
832 
833 inline NodeType Node::Type() const
834 {
835  return static_cast<NodeType>(QueryNumericFromCInterfaceFunction<PEAK_NODE_TYPE>(
836  [&](PEAK_NODE_TYPE* type) { return PEAK_C_ABI_PREFIX PEAK_Node_GetType(m_backendHandle, type); }));
837 }
838 
839 inline std::shared_ptr<peak::core::NodeMap> Node::ParentNodeMap() const
840 {
841  return LockOrThrow(m_parentNodeMap);
842 }
843 
844 inline std::shared_ptr<Node> Node::FindInvalidatedNode(const std::string& name) const
845 {
846  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
848  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
849  });
850 
851  auto nodeName = GetNodeName(nodeHandle);
852 
853  return ParentNodeMap()->FindNode(name);
854 }
855 
856 inline std::vector<std::shared_ptr<Node>> Node::InvalidatedNodes() const
857 {
858  auto numInvalidatedNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numInvalidatedNodes) {
859  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumInvalidatedNodes(m_backendHandle, _numInvalidatedNodes);
860  });
861 
862  std::vector<std::shared_ptr<Node>> invalidatedNodes;
863  for (size_t x = 0; x < numInvalidatedNodes; ++x)
864  {
865  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
866  [&](PEAK_NODE_HANDLE* _nodeHandle) {
867  return PEAK_C_ABI_PREFIX PEAK_Node_GetInvalidatedNode(m_backendHandle, x, _nodeHandle);
868  });
869 
870  auto nodeName = GetNodeName(nodeHandle);
871 
872  invalidatedNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
873  }
874 
875  return invalidatedNodes;
876 }
877 
878 inline std::shared_ptr<Node> Node::FindInvalidatingNode(const std::string& name) const
879 {
880  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
882  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
883  });
884 
885  auto nodeName = GetNodeName(nodeHandle);
886 
887  return ParentNodeMap()->FindNode(name);
888 }
889 
890 inline std::vector<std::shared_ptr<Node>> Node::InvalidatingNodes() const
891 {
892  auto numInvalidatingNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numInvalidatedNodes) {
893  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumInvalidatingNodes(m_backendHandle, _numInvalidatedNodes);
894  });
895 
896  std::vector<std::shared_ptr<Node>> invalidatingNodes;
897  for (size_t x = 0; x < numInvalidatingNodes; ++x)
898  {
899  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
900  [&](PEAK_NODE_HANDLE* _nodeHandle) {
901  return PEAK_C_ABI_PREFIX PEAK_Node_GetInvalidatingNode(m_backendHandle, x, _nodeHandle);
902  });
903 
904  auto nodeName = GetNodeName(nodeHandle);
905 
906  invalidatingNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
907  }
908 
909  return invalidatingNodes;
910 }
911 
912 inline std::shared_ptr<Node> Node::FindSelectedNode(const std::string& name) const
913 {
914  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
916  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
917  });
918 
919  auto nodeName = GetNodeName(nodeHandle);
920 
921  return ParentNodeMap()->FindNode(name);
922 }
923 
924 inline std::vector<std::shared_ptr<Node>> Node::SelectedNodes() const
925 {
926  auto numSelectedNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numSelectedNodes) {
927  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumSelectedNodes(m_backendHandle, _numSelectedNodes);
928  });
929 
930  std::vector<std::shared_ptr<Node>> selectedNodes;
931  for (size_t x = 0; x < numSelectedNodes; ++x)
932  {
933  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
934  [&](PEAK_NODE_HANDLE* _nodeHandle) {
935  return PEAK_C_ABI_PREFIX PEAK_Node_GetSelectedNode(m_backendHandle, x, _nodeHandle);
936  });
937 
938  auto nodeName = GetNodeName(nodeHandle);
939 
940  selectedNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
941  }
942 
943  return selectedNodes;
944 }
945 
946 inline std::shared_ptr<Node> Node::FindSelectingNode(const std::string& name) const
947 {
948  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>([&](PEAK_NODE_HANDLE* _nodeHandle) {
950  m_backendHandle, name.c_str(), name.size() + 1, _nodeHandle);
951  });
952 
953  auto nodeName = GetNodeName(nodeHandle);
954 
955  return ParentNodeMap()->FindNode(name);
956 }
957 
958 inline std::vector<std::shared_ptr<Node>> Node::SelectingNodes() const
959 {
960  auto numSelectingNodes = QueryNumericFromCInterfaceFunction<size_t>([&](size_t* _numSelectingNodes) {
961  return PEAK_C_ABI_PREFIX PEAK_Node_GetNumSelectingNodes(m_backendHandle, _numSelectingNodes);
962  });
963 
964  std::vector<std::shared_ptr<Node>> selectingNodes;
965  for (size_t x = 0; x < numSelectingNodes; ++x)
966  {
967  auto nodeHandle = QueryNumericFromCInterfaceFunction<PEAK_NODE_HANDLE>(
968  [&](PEAK_NODE_HANDLE* _nodeHandle) {
969  return PEAK_C_ABI_PREFIX PEAK_Node_GetSelectingNode(m_backendHandle, x, _nodeHandle);
970  });
971 
972  auto nodeName = GetNodeName(nodeHandle);
973 
974  selectingNodes.emplace_back(ParentNodeMap()->FindNode(nodeName));
975  }
976 
977  return selectingNodes;
978 }
979 
981 {
982  return reinterpret_cast<ChangedCallbackHandle>(
983  m_changedCallbackManager->RegisterCallback(NodeChangedCallbackContainer{ shared_from_this(), callback }));
984 }
985 
987 {
988  m_changedCallbackManager->UnregisterCallback(
989  reinterpret_cast<PEAK_NODE_CHANGED_CALLBACK_HANDLE>(callbackHandle));
990 }
991 
992 inline void PEAK_CALL_CONV Node::ChangedCallbackCWrapper(PEAK_NODE_HANDLE, void* context)
993 {
994  auto callbackContainer = static_cast<NodeChangedCallbackContainer*>(context);
995 
996  callbackContainer->Callback(callbackContainer->_Node);
997 }
998 
999 } /* namespace nodes */
1000 } /* namespace core */
1001 } /* 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:946
std::vector< std::shared_ptr< Node > > InvalidatingNodes() const
Returns the invalidating nodes.
Definition: peak_node.hpp:890
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:790
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:769
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:745
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:826
std::string DisplayName() const
Returns the display name.
Definition: peak_node.hpp:738
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:878
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:728
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:433
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:856
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:335
std::string ToolTip() const
Returns the tool tip.
Definition: peak_node.hpp:819
struct PEAK_NODE * PEAK_NODE_HANDLE
Definition: peak_backend.h:409
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:733
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:986
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:482
std::vector< std::shared_ptr< Node > > SelectingNodes() const
Returns the selecting nodes.
Definition: peak_node.hpp:958
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:384
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:812
int32_t PEAK_NODE_ACCESS_STATUS
Definition: peak_backend.h:208
NodeAccessStatus AccessStatus() const
Returns the access status.
Definition: peak_node.hpp:761
std::shared_ptr< NodeMap > ParentNodeMap() const
Returns the parent node map.
Definition: peak_node.hpp:839
PEAK_NODE_CHANGED_CALLBACK * PEAK_NODE_CHANGED_CALLBACK_HANDLE
Definition: peak_backend.h:508
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:804
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:924
#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:844
std::shared_ptr< Node > FindSelectedNode(const std::string &name) const
Tries to find a selected node with the given name.
Definition: peak_node.hpp:912
ChangedCallbackHandle RegisterChangedCallback(const ChangedCallback &callback)
Registers a callback for signaling a change to the node.
Definition: peak_node.hpp:980
NodeType Type() const
Returns the type.
Definition: peak_node.hpp:833
bool IsStreamable() const
Checks whether the node is streamable.
Definition: peak_node.hpp:783
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:552
bool IsAccessStatusCacheable() const
Checks whether the node&#39;s access status is cacheable.
Definition: peak_node.hpp:776
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:797
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:753
NodeAccessStatus
Definition: peak_node.hpp:44