Euresys::EGenTL
Euresys::EGenTL
is a library of C++ classes that provide the same
functionality as standard GenICam GenTL, but with a more user-friendly interface. For
example, it uses std::string
instead of raw char
pointers, and error codes are transformed into exceptions.
Euresys::EGenTL
also takes care of locating the GenTL producer and
loading the functions it exports.
This library is implemented entirely in C++ header files. As a result, you can simply include the relevant header file:
#include <EGenTL.h>
Instead of the raw, low-level C functions that GenTL defines, we get a
Euresys::EGenTL
object that represents the GenTL producer:
-
Each GenTL function is available as a member method of
Euresys::EGenTL
. GenTL function names start with an upper-case prefix. InEuresys::EGenTL
, method names start with the same prefix, but written in lower-case. For example, theGCReadPort
function is exposed as thegcReadPort
method, and theTLOpenInterface
function as thetlOpenInterface
method. -
All GenTL functions return a
GC_ERROR
code indicating success or failure. When a function returns a code other thanGC_ERR_SUCCESS
, an exception is thrown. This removes the burden of manually checking error codes after each function call. -
Since GenTL functions return a
GC_ERROR
, output values are returned through pointers passed as arguments.Euresys::EGenTL
methods offer a more natural interface; they return the output value directly:GC_API TLGetNumInterfaces(TL_HANDLE hTL, uint32_t *piNumIfaces);
uint32_t tlGetNumInterfaces(TL_HANDLE tlh);
(Note that
GC_API
is defined asGC_IMPORT_EXPORT GC_ERROR GC_CALLTYPE
. It is simply aGC_ERROR
decorated with calling convention and DLL import/export attributes.) -
For GenTL functions that deal with text, the corresponding
Euresys::EGenTL
methods convert fromchar *
tostd::string
and vice-versa:GC_API TLGetInterfaceID(TL_HANDLE hTL, uint32_t iIndex, char *sID, size_t *piSize);
std::string tlGetInterfaceID(TL_HANDLE tlh, uint32_t index);
-
Some GenTL functions retrieve information about the camera or frame grabber. These functions fill a
void *
buffer with a value, and indicate in anINFO_DATATYPE
the actual type of the value.Euresys::EGenTL
uses C++ templates to make these functions easy to use:GC_API GCGetInfo(TL_INFO_CMD iInfoCmd, INFO_DATATYPE *piType, void *pBuffer, size_t *piSize);
template<typename T> T gcGetInfo(TL_INFO_CMD cmd);