OutputFrameSeries Class Reference

A FrameSeries with additional facilities for writing output frames. More...

#include <Media/FrameSeries.H>

Inheritance diagram for OutputFrameSeries:
Inheritance graph
[legend]
Collaboration diagram for OutputFrameSeries:
Collaboration graph
[legend]

List of all members.

Classes

struct  Impl

Public Member Functions

 OutputFrameSeries (OptionManager &mgr, const std::string &descrName="Frame Series", const std::string &tagName="FrameSeries")
 Constructor.
virtual ~OutputFrameSeries ()
 Destructor.
virtual void reset1 ()
 resets this FrameSeries to its state after construction
virtual void paramChanged (ModelParamBase *const param, const bool valueChanged, ParamClient::ChangeStatus *status)
 Override the base version so that we can trap --out options.
FrameState update (const SimTime &stime, bool new_event)
 Update internal state and return corresponding FrameState.
FrameState updateNext ()
 Update by moving to the next frame and not worrying about time counts.
bool shouldWait () const
 Have we displayed frames and need to wait for a user keypress?
virtual void writeFrame (const GenericFrame &frame, const std::string &shortname, const FrameInfo &auxinfo=FrameOstream::defaultInfo)
 Write a frame to all frame destinations.
virtual bool isVoid () const
 Check if we have no output destinations (e.g., user gave --out=none).
bool becameVoid () const
 Check if we have become void after starting out non-void.
virtual void closeStream (const std::string &shortname)
 Call closeStream(shortname) on all of our substreams.
void addFrameDest (const std::string &source)
 Add a frame destination; same as doing --out=source on the command line.
int frame () const
 Get the current frame number.
size_t getNumFrameDests () const
 Get the number of frame destinations that we have.
nub::ref< FrameOstreamgetFrameDest (size_t n) const
 Get a reference to the n-th frame destination.
template<class T >
nub::soft_ref< T > findFrameDestType () const
 Try to return a frame destination matching type T, if any.

Detailed Description

A FrameSeries with additional facilities for writing output frames.

OutputFrameSeries implements a number of helper functions to facilitate writing frames in a standardized manner, with possible on-the-fly rescaling and visualization.

SEE ADDITIONAL DOCUMENTATION in InputFrameSeries.

Definition at line 317 of file FrameSeries.H.


Constructor & Destructor Documentation

OutputFrameSeries::OutputFrameSeries ( OptionManager mgr,
const std::string descrName = "Frame Series",
const std::string tagName = "FrameSeries" 
)

Constructor.

Definition at line 1043 of file FrameSeries.C.

OutputFrameSeries::~OutputFrameSeries (  )  [virtual]

Destructor.

Definition at line 1067 of file FrameSeries.C.


Member Function Documentation

void OutputFrameSeries::addFrameDest ( const std::string source  ) 

Add a frame destination; same as doing --out=source on the command line.

Definition at line 1200 of file FrameSeries.C.

References ModelComponent::addSubComponent(), ModelComponent::getManager(), makeFrameOstream(), MC_RECURSE, and ModelComponent::removeSubComponent().

Referenced by paramChanged().

bool OutputFrameSeries::becameVoid (  )  const

Check if we have become void after starting out non-void.

This is useful to test in main loops to know whether some substream has gotten closed (e.g. the user pressing the close button on an open window).

Definition at line 1187 of file FrameSeries.C.

References isVoid().

void OutputFrameSeries::closeStream ( const std::string shortname  )  [virtual]

Call closeStream(shortname) on all of our substreams.

Implements FrameOstream.

Definition at line 1193 of file FrameSeries.C.

template<class T >
nub::soft_ref<T> OutputFrameSeries::findFrameDestType (  )  const [inline]

Try to return a frame destination matching type T, if any.

Definition at line 391 of file FrameSeries.H.

References getFrameDest(), and getNumFrameDests().

int OutputFrameSeries::frame (  )  const

Get the current frame number.

Definition at line 1260 of file FrameSeries.C.

References FrameCounter::currentFrame(), and OModelParam< T >::getVal().

nub::ref< FrameOstream > OutputFrameSeries::getFrameDest ( size_t  n  )  const

Get a reference to the n-th frame destination.

Definition at line 1236 of file FrameSeries.C.

References ASSERT.

Referenced by findFrameDestType().

size_t OutputFrameSeries::getNumFrameDests (  )  const

Get the number of frame destinations that we have.

Definition at line 1230 of file FrameSeries.C.

Referenced by findFrameDestType().

bool OutputFrameSeries::isVoid (  )  const [virtual]

Check if we have no output destinations (e.g., user gave --out=none).

Clients can test isVoid() before they generate potentially expensive output images. This is just a performance optimization -- even if isVoid() is true, it's still safe to call writeRGB(), writeGray(), etc., but those calls will do nothing, and so any time spent computing the image will have been wasted.

Reimplemented from FrameOstream.

Definition at line 1175 of file FrameSeries.C.

Referenced by becameVoid().

void OutputFrameSeries::paramChanged ( ModelParamBase *const   param,
const bool  valueChanged,
ParamClient::ChangeStatus status 
) [virtual]

Override the base version so that we can trap --out options.

Reimplemented from ModelComponent.

Definition at line 1087 of file FrameSeries.C.

References addFrameDest(), OModelParam< T >::getVal(), and FrameCounter::reset().

void OutputFrameSeries::reset1 (  )  [virtual]

resets this FrameSeries to its state after construction

Reimplemented from ModelComponent.

Definition at line 1073 of file FrameSeries.C.

References OModelParam< T >::getVal(), and FrameCounter::reset().

bool OutputFrameSeries::shouldWait (  )  const

Have we displayed frames and need to wait for a user keypress?

This is reset to false on each call to update(), and becomes true if (1) any frames were written AND (2) itsWaitForUser is true (which the use can control with --wait/--nowait). You can check it in order to decide whether you should pause and wait for the user after each series of displays at a given time step).

Definition at line 1138 of file FrameSeries.C.

References OModelParam< T >::getVal().

FrameState OutputFrameSeries::update ( const SimTime stime,
bool  new_event 
)

Update internal state and return corresponding FrameState.

Parameters:
stime current time in seconds
sdelay time step in seconds
new_event whether a new application-defined event has occurred

Definition at line 1108 of file FrameSeries.C.

References FrameCounter::currentFrame(), OModelParam< T >::getVal(), SimTime::msecs(), sformat(), ModelComponent::tagName(), textLog(), and FrameCounter::update().

FrameState OutputFrameSeries::updateNext (  ) 

Update by moving to the next frame and not worrying about time counts.

Definition at line 1132 of file FrameSeries.C.

References FrameCounter::updateNext().

void OutputFrameSeries::writeFrame ( const GenericFrame frame,
const std::string shortname,
const FrameInfo auxinfo = FrameOstream::defaultInfo 
) [virtual]

Write a frame to all frame destinations.

Implements FrameOstream.

Definition at line 1146 of file FrameSeries.C.

References ASSERT, FrameCounter::currentFrame(), and OModelParam< T >::getVal().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:43:38 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3