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

**URL:** <https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814>\
**Category:** Programming Questions\
**Tags:** cpp\
**Created:** [October 21, 2022, 9:24am UTC](https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814 "2022-10-21T09:24:41Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iwein](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iwein](https://forum.commonvisionblox.com/u/iwein)\
**Post date:** [October 21, 2022, 9:24am UTC](https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814/1 "2022-10-21T09:24:42Z")

</div>

I have the following piece of code:

```auto
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
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
auto stream = activeLineScanDevice->Stream<Cvb::ImageStream>(0);
stream->????

```

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

---

<div class="post-metadata">

**Author:** ![MandanaS](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/mandanas/32/1211_2.png) [@MandanaS](https://forum.commonvisionblox.com/u/MandanaS)\
**Post date:** [October 21, 2022, 11:10am UTC](https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814/2 "2022-10-21T11:10:44Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![iwein](https://avatars.discourse-cdn.com/v4/letter/i/8baadc/32.png) [@iwein](https://forum.commonvisionblox.com/u/iwein)\
**Post date:** [October 21, 2022, 11:55am UTC](https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814/3 "2022-10-21T11:55:48Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![MandanaS](https://yyz1.discourse-cdn.com/flex027/user_avatar/forum.commonvisionblox.com/mandanas/32/1211_2.png) [@MandanaS](https://forum.commonvisionblox.com/u/MandanaS)\
**Post date:** [October 21, 2022, 12:20pm UTC](https://forum.commonvisionblox.com/t/how-do-i-set-the-ringbuffer-size-in-3-generation-cpp/1814/4 "2022-10-21T12:20:29Z")

</div>

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](https://help.commonvisionblox.com/NextGen/14.0/md __c___ j_workspace __next_gen_docume___ fa12bcb2_theory_of_operation_image_manager __migration_guide__ acquisition_stack.html)
