This example explores retrieving information from all major node types on the camera. This includes string, integer, float, boolean, command, enumeration, category, and value types. Looping through multiple child nodes is also covered. A few node types are not covered - base, port, and register - as they are not fundamental. The final node type - enumeration entry - is explored and printed for nodes whose parent node is a selector node.
Once comfortable with NodeMapInfo, we suggest checking out ImageFormatControl and Exposure. ImageFormatControl explores customizing image settings on a camera while Exposure introduces the standard structure of configuring a device, acquiring some images, and then returning the device to a default state.
#include <iostream>
#include <sstream>
using namespace std;
{
};
void Indent(
unsigned int level)
{
for (unsigned int i = 0; i < level; i++)
{
cout << " ";
}
}
{
int result = 0;
try
{
if (node->IsSelector() && (node->GetPrincipalInterfaceType() == intfIEnumeration))
{
}
gcstring displayName = ptrValueNode->GetDisplayName();
gcstring value = ptrValueNode->ToString();
{
}
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrStringNode->GetDisplayName();
gcstring value = ptrStringNode->GetValue();
{
}
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrIntegerNode->GetDisplayName();
int64_t value = ptrIntegerNode->GetValue();
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrFloatNode->GetDisplayName();
double value = ptrFloatNode->GetValue();
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrBooleanNode->GetDisplayName();
gcstring value = (ptrBooleanNode->GetValue() ?
"true" :
"false");
cout << displayName << ": " << value << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrCommandNode->GetDisplayName();
gcstring tooltip = ptrCommandNode->GetToolTip();
{
}
cout << displayName << ": " << tooltip << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
if (node->IsSelector())
{
}
CEnumEntryPtr ptrEnumEntryNode = ptrEnumerationNode->GetCurrentEntry();
gcstring displayName = ptrEnumerationNode->GetDisplayName();
gcstring currentEntrySymbolic = ptrEnumEntryNode->GetSymbolic();
cout << displayName << ": " << currentEntrySymbolic << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
{
{
}
{
switch (node->GetPrincipalInterfaceType())
{
{
}
{
}
{
}
{
}
{
}
{
}
default:
{
cout << "Unexpected interface type." << endl;
return -1;
}
}
}
default:
{
cout << "Unexpected read type." << endl;
return -1;
}
}
}
{
int result = 0;
try
{
FeatureList_t selectedFeatures;
node->GetSelectedFeatures(selectedFeatures);
ptrSelectorNode->GetSymbolics(entries);
CEnumEntryPtr ptrCurrentEntry = ptrSelectorNode->GetCurrentEntry();
gcstring displayName = ptrSelectorNode->GetDisplayName();
gcstring currentEntrySymbolic = ptrSelectorNode->ToString();
cout << displayName << ": " << currentEntrySymbolic << endl;
for (size_t i = 0; i < entries.size(); i++)
{
CEnumEntryPtr selectorEntry = ptrSelectorNode->GetEntryByName(entries[i]);
FeatureList_t::const_iterator it;
{
{
ptrSelectorNode->SetIntValue(selectorEntry->GetValue());
cout << displayName << ": " << ptrSelectorNode->ToString() << endl;
}
}
for (it = selectedFeatures.begin(); it != selectedFeatures.end(); ++it)
{
{
continue;
}
else
{
result = result |
PrintNode(ptrFeatureNode, level + 2);
}
}
}
{
ptrSelectorNode->SetIntValue(ptrCurrentEntry->GetValue());
}
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
try
{
gcstring displayName = ptrCategoryNode->GetDisplayName();
cout << displayName << endl;
FeatureList_t features;
ptrCategoryNode->GetFeatures(features);
FeatureList_t::const_iterator it;
for (it = features.begin(); it != features.end(); ++it)
{
{
continue;
}
if (ptrFeatureNode->GetPrincipalInterfaceType() ==
intfICategory)
{
}
else
{
result = result |
PrintNode(ptrFeatureNode, level + 1);
}
}
cout << endl;
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
unsigned int level = 0;
try
{
cout << endl << "*** PRINTING TRANSPORT LAYER DEVICE NODEMAP ***" << endl << endl;
INodeMap& genTLNodeMap = cam->GetTLDeviceNodeMap();
cout << "*** PRINTING TL STREAM NODEMAP ***" << endl << endl;
INodeMap& nodeMapTLStream = cam->GetTLStreamNodeMap();
cout << "*** PRINTING GENICAM NODEMAP ***" << endl << endl;
cam->Init();
INodeMap& appLayerNodeMap = cam->GetNodeMap();
cam->DeInit();
}
{
cout <<
"Error: " << e.
what() << endl;
result = -1;
}
return result;
}
{
int result = 0;
cout << "Application build date: " << __DATE__ << " " << __TIME__ << endl << endl;
const LibraryVersion spinnakerLibraryVersion = system->GetLibraryVersion();
cout <<
"Spinnaker library version: " << spinnakerLibraryVersion.
major <<
"." << spinnakerLibraryVersion.
minor
<<
"." << spinnakerLibraryVersion.
type <<
"." << spinnakerLibraryVersion.
build << endl
<< endl;
unsigned int numCameras = camList.
GetSize();
cout << "Number of cameras detected: " << numCameras << endl << endl;
if (numCameras == 0)
{
system->ReleaseInstance();
cout << "Not enough cameras!" << endl;
cout << "Done! Press Enter to exit..." << endl;
getchar();
return -1;
}
for (unsigned int i = 0; i < numCameras; i++)
{
cout << endl << "Running example for camera " << i << "..." << endl;
cout << "Camera " << i << " example complete..." << endl << endl;
}
pCam = nullptr;
system->ReleaseInstance();
cout << endl << "Done! Press Enter to exit..." << endl;
getchar();
return result;
}
int main(int, char **)
Definition Acquisition.cpp:527
int RunSingleCamera(CameraPtr pCam)
Definition Acquisition.cpp:479
int PrintFloatNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:229
int PrintEnumerationNodeAndCurrentEntry(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:349
int PrintNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:402
int PrintCategoryNodeAndAllFeatures(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:537
int PrintIntegerNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:188
readType
Definition NodeMapInfo.cpp:64
@ INDIVIDUAL
Definition NodeMapInfo.cpp:66
@ VALUE
Definition NodeMapInfo.cpp:65
int PrintValueNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:83
int PrintStringNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:144
void Indent(unsigned int level)
Definition NodeMapInfo.cpp:72
int PrintBooleanNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:267
const unsigned int maxChars
Definition NodeMapInfo.cpp:52
int PrintCommandNode(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:306
int PrintEnumerationSelector(CNodePtr node, unsigned int level)
Definition NodeMapInfo.cpp:457
const readType chosenRead
Definition NodeMapInfo.cpp:69
Used to hold a list of camera objects.
Definition CameraList.h:42
void Clear()
Clears the list of cameras and destroys their corresponding reference counted objects.
CameraPtr GetByIndex(unsigned int index) const
Returns a pointer to a camera object at the "index".
unsigned int GetSize() const
Returns the size of the camera list.
A reference tracked pointer to a camera object.
Definition CameraPtr.h:44
The Exception object represents an error that is returned from the library.
Definition Exception.h:51
virtual const char * what() const
virtual override for what().
SmartPointer for IFloat interface pointer.
Definition Pointer.h:421
virtual gcstring substr(size_t offset=0, size_t count=GCSTRING_NPOS) const
virtual size_t size(void) const
A reference tracked pointer to a system object.
Definition SystemPtr.h:44
bool IsWritable(EAccessMode AccessMode)
Tests if writable.
Definition INode.h:277
bool IsReadable(EAccessMode AccessMode)
Tests if readable.
Definition INode.h:253
interface SPINNAKER_API_ABSTRACT INodeMap
Interface to access the node map.
Definition INodeMap.h:54
GenICam::gcstring_vector StringList_t
A list of strings.
Definition Types.h:160
@ intfIFloat
ICommand interface.
Definition Types.h:211
@ intfIInteger
IBase interface.
Definition Types.h:208
@ intfIString
IFloat interface.
Definition Types.h:212
@ intfIBoolean
IInteger interface.
Definition Types.h:209
@ intfICategory
IRegister interface.
Definition Types.h:214
@ intfICommand
IBoolean interface.
Definition Types.h:210
@ intfIEnumeration
ICategory interface.
Definition Types.h:215
Definition Autovector.h:36
Provides easier access to the current version of Spinnaker.
Definition SpinnakerDefs.h:657
unsigned int minor
Minor version of the library.
Definition SpinnakerDefs.h:662
unsigned int major
Major version of the library.
Definition SpinnakerDefs.h:659
unsigned int type
Version type of the library.
Definition SpinnakerDefs.h:665
unsigned int build
Build number of the library.
Definition SpinnakerDefs.h:668