10#include <cvb/device_factory.hpp>
11#include <cvb/global.hpp>
12#include <cvb/driver/composite_stream.hpp>
13#include <cvb/genapi/node_map_enumerator.hpp>
16static const constexpr int NUM_ELEMENTS_TO_ACQUIRE = 5000;
17static const constexpr int FEEDBACK_INTERVAL = NUM_ELEMENTS_TO_ACQUIRE / 10;
18static const constexpr int NUM_FLOW_SETS = 10;
31 auto& item = itemList.at(0);
37 item.SetParameter(CVB_LIT(
"UseRdma"), CVB_LIT(
"1"));
40 auto device = Cvb::DeviceFactory::Open<Cvb::GenICamDevice>(item.AccessToken(), Cvb::AcquisitionStack::GenTL);
41 auto payloadSize =
static_cast<double>(device->NodeMap(Cvb::NodeMapID::Device)->Node<
Cvb::IntegerNode>(CVB_LIT(
"PayloadSize"))->Value());
54 for (
auto i = 0; i < NUM_ELEMENTS_TO_ACQUIRE; i++)
59 std::tie(composite, waitStatus, enumerator) = dataStream->WaitFor(TIMEOUT);
74 if (i && i % FEEDBACK_INTERVAL == 0)
77 auto firstElement = composite->ItemAt(0);
78 if (!Cvb::holds_alternative<Cvb::ImagePtr>(firstElement))
80 std::cout <<
"acquired composites: " << i <<
" which is not an image" << std::endl;
84 auto image = Cvb::get<Cvb::ImagePtr>(firstElement);
85 std::cout <<
"acquired images: " << i <<
" | size: " << image->Width() <<
" x " << image->Height() << std::endl;
90 auto durationMs = std::chrono::duration_cast<std::chrono::milliseconds>(endTime - startTime).count();
91 dataStream->TryAbort();
94 auto dataRate =
static_cast<int>((
static_cast<double>(NUM_ELEMENTS_TO_ACQUIRE) * payloadSize) / (1000.0 *
static_cast<double>(durationMs)));
95 std::cout << std::endl <<
"acquired " << NUM_ELEMENTS_TO_ACQUIRE <<
" buffers in " << durationMs <<
" ms ( " << dataRate <<
" MB/s )" << std::endl;
static std::vector< DiscoveryInformation > Discover()
Discovers available devices (not vins) with a default time span of 300ms.
Definition: decl_device_factory.hpp:221
void RegisterManagedFlowSetPool(int flowSetCount)
Registers an internal flows set pool.
Definition: decl_composite_stream_base.hpp:291
Streams composites.
Definition: composite_stream.hpp:21
Represents a integer number.
Definition: integer_node.hpp:20
Lazy enumeration of node maps.
Definition: node_map_enumerator.hpp:31
WaitStatus
Status after waiting for an image to be returned.
Definition: global.hpp:376
@ Abort
The acquisition has been stopped asynchronously, there is no image buffer.
@ Ok
Everything is fine, a new image arrived.
@ Timeout
A timeout occurred, no image buffer has been returned.