How to know if node exist

Hello team,

Hope you are doing well.

I have a question that seem to be rather easy, but I can’t find the answer… I have multiple camera without the same firmware. They have a few nodes that the name isn’t the same (exposure time abs and exposure time for example).

So my question is : how can I know if a node exist ? Like if I want to use ExposureTime node, is there a device->Nodes()->Exist(“Std::ExposureTime”); ? or maybe there is another way to know that ?

For now, the only way I get is to use a try catch for each node… That seems rather badly.

Thanks in advance.

Cheers,
Axel

Hi @AxelDosSantosDoAlto,

if you dont want to stick with the general way of handling CvbExceptions, you could try the following:

https://help.commonvisionblox.com/NextGen/14.1/cvbpp/dd/dff/class_cvb_1_1_gen_api_1_1_node_map.html#a82d6ac7e2d944dd0310b2c1bdcc65a5e

The NodeMap class has a Nodes() function that basically gives you a dictionary of all Nodes in the NodeMap.
So with this information you can check if the node you are looking for is on your NodeMap bevorehand.

Cheers
Chris

With CVB 14.1 you can also use the TryGetNode function like this:

if (auto intNode = devNodeMap_->TryGetNode<Cvb::IntegerNode>(featureName))
{

}
1 Like