How do I set the Ringbuffer size in 3° generation CPP?

I have the following piece of code:

auto stream = activeLineScanDevice->Stream<Cvb::ImageStream>(0);
	//	Set rigbuffer size 
	//stream->RingBuffer()->ChangeCount(nbrOfLines, Cvb::DeviceUpdateMode::NewDeviceImage);
			
    // Define the softwareTrigger
	auto softwareTrigger = activeDeviceNodemap->Node<Cvb::CommandNode>CVB_LIT("TriggerSoftware"));
			
	std::vector<Cvb::ImagePtr> imgVec;
	imgVec.reserve(nbrOfLines);
	stream->Start();
	for (const auto index = 0; index < nbrOfLines; ++index)
	{
	softwareTrigger->Execute();	//	grab data
	auto [multiPartImage, waitStatus, enumerator] = stream->WaitFor(std::chrono::milliseconds(millisecondsTimeOut));
	/* ... */
	auto image = Cvb::get<Cvb::ImagePtr>(firstElement);
	auto linearAccess = image->Plane(0).LinearAccess();
	std::cout << "acquired line: " << index << " at memory location: " << linearAccess.BasePtr() << "\n";
	imgVec.push_back(image);
	}
		
	stream->Stop();

I would like to set the camera ringbuffer size to e.g. nbrOfLines (line 3), but the command

auto stream = activeLineScanDevice->Stream();
stream->RingBuffer()->ChangeCount(...)

throws an exception: […] does not support legacy streams, and I don’t know how to set the ringbuffer size with the new c++ templated api, e.g.

auto stream = activeLineScanDevice->Stream<Cvb::ImageStream>(0);
stream->????

… as I cannot access the Ringbuffer there. Anyone has an idea? - thanks in advance!

You can set the Ringuffer introduced in the old concepts in the 3rd Generation acquisition interface as follows:

    //Set the number of Flows (In the old concept of cvb -> ring buffer)
    dataStream->RegisterManagedFlowSetPool(int(framerate));
    
    dataStream->Start();

Thank you very much… the RegisterManagedFlowSetPool command indeed solved my problem. Are the workings of …flowSetPool documented somewhere other than the APIs? I mean, is there a 3°generation tutorial document somewhere?

Sure! You can find the relevant information in this regard in our new online CVB documentation: Common Vision Blox: Migration Guide for the Acquisition Stacks

1 Like