CVB++ 14.0
NodeMap Class Reference

Contains all nodes of the GevServer. More...

#include <cvb/gevserver/node_map.hpp>

Inherits enable_shared_from_this< NodeMap >.

Public Member Functions

void * Handle () const noexcept
 Get the native handle of the server. More...
 
ServerPtr Server ()
 Get the shared pointer of the server. More...
 
std::map< String, NodePtrNodes () const
 Get a dictionary containing all nodes of this node map. More...
 
void AddNode (const String &key, const NodePtr &value)
 Adds the given value to this NodeMap. More...
 
void AddNode (const String &key, const NodePtr &value, const NodeList &kind)
 Adds the given value to this NodeMap. More...
 
void AddNode (const NodePtr &value)
 Adds the given value to this NodeMap. More...
 
bool RemoveNode (const Node &node)
 Removes the node from this NodeMap. More...
 
bool RemoveNode (const String &key)
 Removes a Node from this NodeMap by its key . More...
 
bool IsReadOnly () const
 Gets whether this node map is read only. More...
 
String ModelName () const
 Gets the model name of the Server.
 
String ModuleName () const noexcept
 Gets this NodeMaps module name. More...
 
String TransportLayerNamespace () const noexcept
 Gets this NodeMaps transport layer namespace. More...
 
String VendorName () const noexcept
 Get the device vendor name of the Server. More...
 
GenApi::NodeMap::GenApiVersion XmlFileSchemaVersion () const noexcept
 Gets the GenICam GenApi XML schema version this server creates. More...
 
GenApi::NodeMap::GenApiVersion XmlFileVersion () const noexcept
 Gets the version of this server's GenApi XML description. More...
 
void SetXmlFileVersion (const GenApi::NodeMap::GenApiVersion &genApiVersion) const
 Sets the version of this server's GenApi XML description. More...
 
template<class T >
std::shared_ptr< T > Node (const String &name) const
 Get the node with the given name from the node map. More...
 
NodePtr Node (const String &name) const
 Get the node with the given name from the node map. More...
 
template<class T >
std::shared_ptr< T > TryGetNode (const String &name) const
 Tries to get the node with the given name from the node map. More...
 
NodePtr TryGetNode (const String &name) const
 Tries to get the node from the node map. More...
 

Detailed Description

Contains all nodes of the GevServer.

Member Function Documentation

◆ AddNode() [1/3]

void AddNode ( const NodePtr value)
inline

Adds the given value to this NodeMap.

The key will be the full value .Node.Name.

Parameters
valueNode to add.

◆ AddNode() [2/3]

void AddNode ( const String key,
const NodePtr value 
)
inline

Adds the given value to this NodeMap.

Parameters
keyMust be value .Node::Name.
valueThe Node to add.

◆ AddNode() [3/3]

void AddNode ( const String key,
const NodePtr value,
const NodeList kind 
)
inline

Adds the given value to this NodeMap.

Parameters
keyThe Node.Name of the node to add.
Parameters
valueNode to add.
kindThe NodeList kind of the node to add.

◆ Handle()

void * Handle ( ) const
inlinenoexcept

Get the native handle of the server.

Returns
The GevServer native handle, nullptr if no server in node map
Exceptions
Anyexception derived from std::exception including CvbException.

◆ IsReadOnly()

bool IsReadOnly ( ) const
inline

Gets whether this node map is read only.

Read only when the Server is not in the GevServer::State::Configuration GevServer::State.

◆ ModuleName()

String ModuleName ( ) const
inlinenoexcept

Gets this NodeMaps module name.

This is the Device NodeMap.

◆ Node() [1/2]

std::shared_ptr< T > Node ( const String name) const
inline

Get the node with the given name from the node map.

Parameters
[in]nameName of the node.
Returns
A pointer to the node, cast to the provided type.
Exceptions
Anyexception derived from std::exception including CvbException.

If a name without a namespace prefix is provided "Cust" is searched before "Std."

◆ Node() [2/2]

NodePtr Node ( const String name) const
inline

Get the node with the given name from the node map.

Parameters
[in]nameName of the node.
Returns
A pointer to the node
Exceptions
Anyexception derived from std::exception including CvbException.

If a name without a namespace prefix is provided "Cust" is searched before "Std" and lastly node name without namespace.

Usually you should prefer the template version to get the appropriate node type.

auto booleanNode =
nodeMap->Node<Cvb::BooleanNode>("NodeName");
Node representing a true / false value.
Definition: boolean_node.hpp:19

However, is some cases the actual node type might be unknown. In order to get the node type you may use typeid.

auto node =
nodeMap->Node("NodeName"); if(typeid(*node) == typeid(Cvb::BooleanNode))
{
auto booleanNode = std::dynamic_pointer_cast<Cvb::BooleanNode>(node);
}

◆ Nodes()

std::map< String, NodePtr > Nodes ( ) const
inline

Get a dictionary containing all nodes of this node map.

Returns
Dictionary with all nodes of the node map.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ RemoveNode() [1/2]

bool RemoveNode ( const Node node)
inline

Removes the node from this NodeMap.

Parameters
nodeNode to remove.
Returns
true if node has been removed; false if not present in this NodeMap.

◆ RemoveNode() [2/2]

bool RemoveNode ( const String key)
inline

Removes a Node from this NodeMap by its key .

Parameters
keyKey to identify the Node to remove.
Returns
true if key has been removed; false if not present in this NodeMap.

◆ Server()

ServerPtr Server ( )
inline

Get the shared pointer of the server.

Returns
The GevServer shared pointer, nullptr if no server in node map
Exceptions
Anyexception derived from std::exception including CvbException.

◆ SetXmlFileVersion()

void SetXmlFileVersion ( const GenApi::NodeMap::GenApiVersion genApiVersion) const
inline

Sets the version of this server's GenApi XML description.

It is mandatory to increase the version information when you change anything about the GenApi XML description.

To distinguish between different GenApi XML feature sets use the GevServer::UserVersion property.

See GenApi::GenApiVersion for a description of the version components.

◆ TransportLayerNamespace()

String TransportLayerNamespace ( ) const
inlinenoexcept

Gets this NodeMaps transport layer namespace.

This is always GEV.

◆ TryGetNode() [1/2]

std::shared_ptr< T > TryGetNode ( const String name) const
inline

Tries to get the node with the given name from the node map.

Parameters
[in]nameName of the node.
Returns
A pointer to the node, cast to the provided type.
Exceptions
Anyexception derived from std::exception including CvbException.

If a name without a namespace prefix is provided "Cust" is searched before "Std."

◆ TryGetNode() [2/2]

NodePtr TryGetNode ( const String name) const
inline

Tries to get the node from the node map.

Parameters
[in]nameName of the node to get.
Returns
NodePtr, null if failed to get the node.
Exceptions
Anyexception derived from std::exception including CvbException.
Doesnot throw any exception.

◆ VendorName()

String VendorName ( ) const
inlinenoexcept

Get the device vendor name of the Server.

Returns
The vendor name.
Exceptions
Anyexception derived from std::exception including CvbException.
Attention
Often this name does not match the information of the GenTL port (discovery information).

◆ XmlFileSchemaVersion()

GenApi::NodeMap::GenApiVersion XmlFileSchemaVersion ( ) const
inlinenoexcept

Gets the GenICam GenApi XML schema version this server creates.

Returns
The GenICam GenApi XML schema version.
Exceptions
Anyexception derived from std::exception including CvbException.

◆ XmlFileVersion()

GenApi::NodeMap::GenApiVersion XmlFileVersion ( ) const
inlinenoexcept

Gets the version of this server's GenApi XML description.

It is mandatory to increase the version information when you change anything about the GenApi XML description.

To distinguish between different GenApi XML feature sets use the GevServer::UserVersion property.

See GenApi::GenApiVersion for a description of the version components.