Skip to content

Pylon::PylonAutoInitTerm#

Helper class to automagically call PylonInitialize and PylonTerminate in constructor and destructor. More…

#include <pylon/PylonBase.h>

Public Functions#

Name
PylonAutoInitTerm(void )
~PylonAutoInitTerm(void )

Detailed Description#

class Pylon::PylonAutoInitTerm;

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.

Public Functions Documentation#

PylonAutoInitTerm#

inline PylonAutoInitTerm(
    void 
)

~PylonAutoInitTerm#

inline ~PylonAutoInitTerm(
    void 
)

Updated on 5 July 2022 at 15:30:00