Euresys::EGrabber Coaxlink Programmer's Guide
Of course, the application must also be aware that it might receive notifications for events of type X that are
older than notifications of events of type Y that have already been received and processed. Aer all, this is the
differentiating factor between the single thread and multi thread models.
To give the user maximum flexibility, we support all three callback models. This is why Euresys::EGrabber exists
in different flavors. So far, we have eluded the meaning of the angle brackets in EGrabber<>. The EGrabber class
is actually a template class, i.e., a class that is parameterized by another type:
• In this case, the template parameter is the callback model to use: one of CallbackOnDemand,
CallbackSingleThread or CallbackMultiThread.
• The empty <> are used to select the default template parameter, which is CallbackOnDemand.
• The types of grabber that can be instantiated are:
• EGrabber<CallbackOnDemand>
• EGrabber<CallbackSingleThread>
• EGrabber<CallbackMultiThread>
• EGrabber<> which is equivalent to EGrabber<CallbackOnDemand>
• The EGrabber header file also defines the following type aliases (synonyms):
typedef EGrabber<CallbackOnDemand> EGrabberCallbackOnDemand;
typedef EGrabber<CallbackSingleThread> EGrabberCallbackSingleThread;
typedef EGrabber<CallbackMultiThread> EGrabberCallbackMultiThread;
• The .NET generics don't quite match the C++ templates, so in .NET the template EGrabber class does not
exist and we must use one of EGrabberCallbackOnDemand, EGrabberCallbackSingleThread or
EGrabberCallbackMultiThread.
Events and callbacks examples
On demand callbacks
This program displays basic information about CIC events generated by a grabber:
#include <iostream>
#include <EGrabber.h>
using namespace Euresys; // 1
class MyGrabber : public EGrabber<CallbackOnDemand> { // 2
public:
MyGrabber(EGenTL &gentl) : EGrabber<CallbackOnDemand>(gentl) { // 3
runScript("config.js"); // 4
enableEvent<CicData>(); // 5
reallocBuffers(3);
start();
}
private:
virtual void onCicEvent(const CicData &data) {
std::cout << "timestamp: " << std::dec << data.timestamp << " us, " // 6
<< "numid: 0x" << std::hex << data.numid // 6
<< " (" << getEventDescription(data.numid) << ")"
<< std::endl;
}
};
int main() {
try {
21