Pylon::PylonAutoInitTerm#
#include <pylon/PylonBase.h>
Detailed Description#
Helper class to automagically call PylonInitialize and PylonTerminate in constructor and destructor.
#include <pylon/TlFactory.h>
// ...
using namespace Pylon;
int main(int argc, char* argv[])
{
PylonAutoInitTerm autoInitTerm;
// Get the transport layer factory
CTlFactory& TlFactory = CTlFactory::GetInstance();
// Get all attached cameras and exit application if no camera is found
DeviceInfoList_t devices;
if ( 0 == TlFactory.EnumerateDevices( devices ) )
{
cerr << "No camera present!" << endl;
return 1;
}
else
{
// do something with devices ...
//...
}
return 0;
} // When leaving the main function, the destructor of the PylonAutoInitTerm object will be called
// and it will in turn call PylonTerminate.