Skip to content

Commit

Permalink
Merge pull request #355 from odin-detector/hdf-zero-frames
Browse files Browse the repository at this point in the history
Allow setting hdf plugin frames to zero
  • Loading branch information
GDYendell authored Aug 15, 2024
2 parents d30ca44 + 04d6a20 commit acdcc9d
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cpp/frameProcessor/src/FileWriterPlugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ void FileWriterPlugin::configure(OdinData::IpcMessage& config, OdinData::IpcMess

// Check to see if we are being told how many frames to write
if (config.has_param(FileWriterPlugin::CONFIG_FRAMES) &&
config.get_param<size_t>(FileWriterPlugin::CONFIG_FRAMES) > 0) {
config.get_param<size_t>(FileWriterPlugin::CONFIG_FRAMES) >= 0) {
size_t totalFrames = config.get_param<size_t>(FileWriterPlugin::CONFIG_FRAMES);
next_acquisition_->total_frames_ = totalFrames;
next_acquisition_->frames_to_write_ = calc_num_frames(totalFrames);
Expand Down Expand Up @@ -822,7 +822,7 @@ bool FileWriterPlugin::reset_statistics()
* ii) this function has the side-effect of moving from the current-acq to
* the next-acq if that helps us match the frame.
*
* The function will set an error if the frame does not match a writing acquisition.
* The function will set an error if the frame does not match a writing acquisition.
* \param[in] frame - Pointer to the Frame object.
*/
bool FileWriterPlugin::frame_in_acquisition(boost::shared_ptr<Frame> frame) {
Expand Down
25 changes: 25 additions & 0 deletions cpp/frameProcessor/test/FrameProcessorTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1011,6 +1011,31 @@ BOOST_AUTO_TEST_CASE( FileWriterPluginCalcNumFramesTest1000fpb )

}

BOOST_AUTO_TEST_CASE( FileWriterPluginZeroFrames )
{
OdinData::IpcMessage reply;
FrameProcessor::FileWriterPlugin fwp;
fwp.set_name("hdf");
{
OdinData::IpcMessage cfg;
cfg.set_param("frames", 1);
fwp.configure(cfg, reply);

OdinData::IpcMessage reply2;
fwp.requestConfiguration(reply2);
BOOST_CHECK_EQUAL(1, reply2.get_param<int>("hdf/frames"));
}
{
OdinData::IpcMessage cfg;
cfg.set_param("frames", 0);
fwp.configure(cfg, reply);

OdinData::IpcMessage reply2;
fwp.requestConfiguration(reply2);
BOOST_CHECK_EQUAL(0, reply2.get_param<int>("hdf/frames"));
}
}

BOOST_AUTO_TEST_SUITE_END(); //FileWriterPluginTest

BOOST_AUTO_TEST_SUITE(SumPluginUnitTest);
Expand Down

0 comments on commit acdcc9d

Please sign in to comment.