ModelComponent Class Reference

Base class for parameterized model components. More...

#include <Component/ModelComponent.H>

Inherits ParamClient, and nub::object.

Inherited by AgentManager, AgentManagerA, AgentManagerA, AgentManagerB, AgentManagerB, ArmController, ArmPlanner, Attentionator, AttentionGateConfigurator, AttentionGuidanceMapConfigurator, AudioGrabber, AudioMixer, BeeSTEM, BeeStem3, BeeStemSim, BeeStemTiny, BeobotBrainMT, BeobotCamera, BeobotControl, BeobotEffectors, BeoBotSim, BeoChip, BeoHawkSim, BeoHead, BeoSub, BeoSubBallast, BeoSubCanny, BeoSubCanny, BeoSubDepthSensor, BeoSubIMU, BeoSubMotor, BeoSubSaliency, BeoSubTaskDecoder, Beowulf, BlobTracker, BotControl, BufferedInputFrameSeries, CachedFrameLoader, CameraControl, ChannelBase [virtual], ColorTracker, Context, ContourConnection, ContourLayer, CudaSaliency, DescriptorVec, EnvInferoTemporal, EnvSaliencyMap, EnvSegmenter, EnvSegmenterConfigurator, EnvSimulationViewer, EnvSimulationViewer, EnvVisualCortexBase, EventLog, EyeHeadControllerConfigurator, EyeSFile, EyeTracker, EyeTrackerConfigurator, featureClusterVision< FLOAT >, FeatureExtractor, FoeDetector, FrameGrabberConfigurator, FrameIstream, FrameOstream, FuzzyART, GeneralGUI, GentleBoostComponent, GistEstimatorConfigurator, GPS, GPS_USGlobalSat_EM_408, GSlocalizer, HandControllerConfigurator, HarrierSim, HeliPose, HippocampusI, HippocampusI, HMR3300, HTTPClient, HttpServer, ImageShuttleI, IMU_MicroStrain_3DM_GX2, IMU_SFE_Atomic, InferoTemporalConfigurator, InferotemporalCortexI, InferotemporalCortexI, InferotemporalCortexI, InputMbariFrameSeries, IntegerMathEngine, IRobotI, IRobotSim, JobServerConfigurator, JoyStick, LateralGeniculateNucleusI, lcd, LeakDetector, LEDcontroller, LoweSIFT, MainWindow, MbariResultViewer, MissileLauncher, ModelManager, MovementController, MPlayerWrapper, NavBot, NeoBrain, NeoBrain, NeuralSimModule< T >, NeuralSimModule< SCInterface >, NeuralSimModule< SimStructure >, ObjRec, ObjRecBOF, ObjRecHMax, ObjRecSalBayes, ObjRecSPM, OutputMbariFrameSeries, ParPort, Pelco, PIDTuner, PingSonar, Pololu, PrefrontalCortexConfigurator, PrefrontalCortexI, PrefrontalCortexI, PrimaryMotorCortexI, PrimaryMotorCortexI, PrimarySomatosensoryCortexI, PTZI, Publisher1I, Publisher2I, PWiiController, RadioDecoder, RangeFinder, RasterInputOptions, RawGistEstimatorStd, RegSaliency, RetinaConfigurator, RetinaI, RobotArm, RobotBrainComponent, RobotBrainStimulator, Roomba, Rovio, RT100, SaccadeControllerEyeConfigurator, SaccadeControllerHeadConfigurator, SaliencyMapConfigurator, SaliencyMapI, SaliencyMT, SaliencyMT, SaliencyMT, SaliencyMT, SaliencyMT, SalientRegionTracker, SC8000, SceneRec, ScorbotConsole, ScorbotI, ScorbotI, ScorbotInterface, ScorbotReallySimple, ScorbotReallySimple, ScorbotSimple, ScorbotSimple, ScorbotSimpleI, SDLdisplay, SegmenterI, Serial, SerialAdvanced, SiftRec, SimEventQueueConfigurator, SimModule [virtual], SimpleLED, SimpleMotor, Simulation, SimulationViewerConfigurator, SimulationViewerI, SingleChannelBeoServer, SockServ, SpaceVariantModule, SpatialMetrics, SpeechSynth, SSC, Staircase, StimController, SubController, SubGUI, SubmapAlgorithm, Subscriber1I, Subscriber2I, SubSim, SupplementaryMotorAreaI, TaskRelevanceMapConfigurator, TCPcommunicator, TigsInputFrameSeries, TigsJob, TopdownLearner, TrainingSet, VCC4, VectorField, Visca, VisualBufferConfigurator, VisualCortexConfigurator, VisualCortexI, VisualTrackerI, WiiMote, and WinnerTakeAllConfigurator.

Collaboration diagram for ModelComponent:
Collaboration graph
[legend]

List of all members.

Classes

struct  Impl
 Private "pimpl" implementation class for ModelComponent. More...

Public Member Functions

Constructors and Destructors

 ModelComponent (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const std::string &crealm="World")
 Constructor.
 ModelComponent (const std::string &descrName, const std::string &tagName, const std::string &crealm="World")
 Constructor overload without an OptionManager.
virtual ~ModelComponent ()
 Virtual destructor ensures proper destruction of derived classes.
void start ()
 Start the component.
bool started () const
 Did we already get a call to start()?
void stop ()
 Stop the component.
void managerDestroyed ()
 Signify that our ModelManager just got destroyed.
OptionManagergetManager () const
 Get our manager.
Name functions

std::string descriptiveName () const
 Get a human-readable descriptive name for this component.
void setDescriptiveName (const std::string &name)
 Change this component's descriptive name.
std::string tagName () const
 Get a programmer-usable tag name for this object.
void setTagName (const std::string &name)
 Change this component's tag name.
std::string realm () const
 Get the realm.
void setRealm (const std::string &crealm)
 Set the realm.
Sub-Component management functions

ModelComponentgetParent () const
 Get this component's parent ModelComponent, or NULL if it has no parent.
ModelComponentgetRootObject ()
 Get this component's root parent (the parent of all parents in our tree).
const ModelComponentgetRootObject () const
 Get this component's root parent (the parent of all parents in our tree).
uint addSubComponent (const nub::ref< ModelComponent > &subc, const bool propagate_realm=true)
 Add a subcomponent to our internal list; return its index.
int removeSubComponent (const ModelComponent &subc, bool removeall=false)
 Remove a subcomponent from our internal list, by address.
void removeSubComponent (const nub::ref< ModelComponent > &subc)
 Remove a subcomponent by nub:ref.
void removeSubComponent (const uint idx)
 Remove a subcomponent from our internal list, by index.
void removeSubComponent (const std::string &tagname)
 Remove a subcomponent from our internal list, by tagName.
void removeAllSubComponents ()
 Remove all our subcomponents.
nub::ref< ModelComponentsubComponent (const uint idx) const
 Access a sub-component by index.
nub::ref< ModelComponentsubComponent (const std::string &tagname, const ModelFlag flags=0) const
 Access a sub-component by tagname.
uint numSubComp () const
 Get current number of subcomponents.
bool hasSubComponent (const std::string &tagname, const ModelFlag flags=0) const
 Return true if we have a subcomponent by that tagname.
bool hasSubComponent (const nub::soft_ref< ModelComponent > &c, const ModelFlag flags=0) const
 Return true if we have the pointee as subcomponent.
void printout (std::ostream &s, const std::string &prefix="") const
 Show our ModelParam internals and those of our subcomponents.
void reset (const ModelFlag flags)
 Reset a model component and propagate the request to the sub-components.
void save (const ModelComponentSaveInfo &sinfo, const ModelFlag flags=MC_RECURSE)
 Save/display our current state.
Access to tunable ModelParam's

void exportOptions (const ModelFlag flags)
 Export some of our ModelParam parameters as command-line-options.
bool hasModelParam (const std::string &name, const ModelFlag flags=0) const
 Check for named param in this component (and possibly its subcomponents).
void setModelParamString (const std::string &name, const std::string &value, const ModelFlag flags=0)
 Parse a parameter value given as string and set the param.
template<class T >
void setModelParamVal (const std::string &name, const T &val, const ModelFlag flags=0)
 Set a parameter value.
void setModelParamValAux (const std::string &name, const RefHolder &val, const ModelFlag flags)
 Auxiliary implementation function for setModelParamVal().
std::string getModelParamString (const std::string &name, const ModelFlag flags=0) const
 Get a parameter value.
template<class T >
getModelParamVal (const std::string &name, const ModelFlag flags=0) const
 Get a parameter value.
void getModelParamValAux (const std::string &name, RefHolder &val, const ModelFlag flags) const
 Auxiliary implementation function for getModelParamVal().
bool doRequestOption (const ModelOptionDef *opt, const bool useMyVal=false, const bool recurse=true, const bool warn=true)
 External request that one of our ModelParam becomes an option.
void hideOption (const ModelOptionDef *opt)
 External request that we hide a command-line option.
size_t getNumModelParams () const
 Return the number of params that we have.
const ModelParamBasegetModelParam (size_t i) const
 Get non-const access to the i'th model parameter.
ModelParamBasegetModelParam (size_t i)
 Get non-const access to the i'th model parameter.
ParamMap-based configuration functions

void readParamsFrom (const ParamMap &pmap, const bool noerr=true)
 Read params from the ParamMap.
void writeParamsTo (ParamMap &pmap) const
 Write params to the ParamMap.
ParamClient interface

virtual void registerParam (ModelParamBase *mp)
 our parameters will register with us upon construction
virtual void registerOptionedParam (OptionedModelParam *mp, const ParamFlag flags)
 Our parameters will register with us upon construction.
virtual void unregisterParam (const ModelParamBase *mp)
 our parameters will un-register with us upon destruction
virtual void paramChanged (ModelParamBase *param, const bool valueChanged, ParamClient::ChangeStatus *status)
 Called whenever a ModelParamBase has its value changed.
void forgetExports ()
 Clear our list of command-line options to be exported.

Protected Member Functions

void setManager (OptionManager &mgr)
 Set our manager.
bool hasBeenExported () const
 Check if our options have already been exported.
virtual void start1 ()
 This is called from within start() before the subcomponents start.
virtual void start2 ()
 This is called from within start() after the subcomponents have started.
virtual void stop1 ()
 This is called from within stop() before the subcomponents stop.
virtual void stop2 ()
 This is called from within stop() after the subcomponents have stopped.
virtual void reset1 ()
 This is called from within reset() before the subcomponents are reset.
virtual void reset2 ()
 This is called from within reset() after the subcomponents are reset.
virtual void save1 (const ModelComponentSaveInfo &sinfo)
 This is called from within save() before the subcomponents save.
virtual void save2 (const ModelComponentSaveInfo &sinfo)
 This is called from within save() after the subcomponents have saved.
 ModelComponent ()
 Default constructor without arguments. DO NOT USE!
void init (OptionManager &mgr, const std::string &descrName, const std::string &tagName, const std::string &crealm="World")
 Make sure you call this if you have used the default constructor.

Detailed Description

Base class for parameterized model components.

The goal is to provide a unified interface by which tunable parameters can be set, read, or exported as command-line options or in parameter maps or files, so that executables using a variable collection of model components can easily be built and configured using command-line options and config files. To this end, ModelComponent provides a set of facilities that allow it to hold a number of ModelParamBase data members. A ModelComponent also holds a list of sub-components that are ModelComponent as well, and many of the ModelComponent functions will first apply to the component itself, then recursively to its subcomponents. The ModelParamBase are the tunable parameters that are persistent and may be associated with a command-line option; see ModelParam.H for details. A ModelComponent is attached to a OptionManager that will handle option parsing and ModelParamBase load/save. A ModelComponent may request its master to associate some of its ModelParamBase data members with command-line options. Command-line option definitions are typically given in one master file per source directory (e.g. Devices/DeviceOpts.C, Media/MediaOpts.C, Neuro/NeuroOpts.C), although some components may also define private command-line options internally in their own .C files. Command-line parsing will set the value of ALL ModelParamBase objects in all ModelComponent objects and their subcomponents that have requested the option to the value specified on the command line. So this mechanism should be used sparingly, for parameters that may be used across a variety of models and a variety of ModelComponent derivatives.

There is one trick to be aware of with respect to the basic operation and setup of ModelComponent. For speed reasons, we want our ModelParam parameters to be true data members, so that we can access them as efficiently as normal data members (rather than having to first look them up by name). On the other hand, the ModelComponent must also be able to produce a list of all its ModelParam members, so that they can be saved to a ParamMap. To resolve this, ModelComponent both holds each ModelParam as a regular data member, and a list of pointers to all its ModelParam members. In addition, this list keeps track of which model params are affiliated with command-line options, as well as which should actually be exported on the command-line. This list is automatically maintained when the ModelParam objects are constructed and destroyed, so that the user does not have to worry about it.

Definition at line 125 of file ModelComponent.H.


Constructor & Destructor Documentation

ModelComponent::ModelComponent ( OptionManager mgr,
const std::string descrName,
const std::string tagName,
const std::string crealm = "World" 
)

Constructor.

Typically, in the constructor you should perform all initializations that are independent of the values of your ModelParam data members. Since the command-line usually has not been parsed yet at the time you construct your various ModelComponent objects, however, the start() function below is provided to allow you to perform additional initializations after the command-line has been parsed and the ModelParam data members have been configured.

Parameters:
mgr our option manager; see OptionManager.H
descrName a human-readable descriptive name
tagname a computer-oriented unique name (used for storage in ParamMap)
crealm the realm in which this component lives, used for partitioning the SimEvent space into possibly distinct realms.

Definition at line 244 of file ModelComponent.C.

References rutz::full_object_cast().

ModelComponent::ModelComponent ( const std::string descrName,
const std::string tagName,
const std::string crealm = "World" 
)

Constructor overload without an OptionManager.

In this case, you must call setManager() before using any other functions. In fact, if you aren't ModelManager, you probably shouldn't be using this constructor! (ModelManager needs it due to an implementation quirk related to multiple inheritance).

Definition at line 256 of file ModelComponent.C.

References rutz::full_object_cast().

ModelComponent::~ModelComponent (  )  [virtual]

Virtual destructor ensures proper destruction of derived classes.

Definition at line 287 of file ModelComponent.C.

References rutz::full_object_cast(), and stop().

ModelComponent::ModelComponent (  )  [protected]

Default constructor without arguments. DO NOT USE!

This constructor exists only so that we don't have to explicitly call the parameterized ModelComponent constructor in each and every object that has a ModelComponent virtual base somewhere in its inheritance hierarchy. This constructor, however, will leave the object uninitialized and you must call init() before you can use the object. Here is what you should do when building an inheritance hierarchy that has ModelComponent as virtual base: 1) in the constructor of the class that virtually derives from ModelComponent, call init(). See for example Channels/ChannelBase; 2) in classes that concretely derive from the latter one, just construct as usual; see for example Channels/SingleChannel, Channels/BlueChannel, etc.

Definition at line 265 of file ModelComponent.C.


Member Function Documentation

uint ModelComponent::addSubComponent ( const nub::ref< ModelComponent > &  subc,
const bool  propagate_realm = true 
)

Add a subcomponent to our internal list; return its index.

NOTE that by default this will set the realm of the subcomponent (and its subs) to our realm

Definition at line 549 of file ModelComponent.C.

Referenced by OutputFrameSeries::addFrameDest(), Simulation::addModule(), ComplexChannel::addSubChan(), IntegerComplexChannel::addSubChan(), ArmController::ArmController(), AttentionGateConfigurator::AttentionGateConfigurator(), AttentionGuidanceMapConfigurator::AttentionGuidanceMapConfigurator(), BeeSTEM::BeeSTEM(), BeeStem3::BeeStem3(), BeeStemSim::BeeStemSim(), BeeStemTiny::BeeStemTiny(), BeobotCamera::BeobotCamera(), BeobotEffectors::BeobotEffectors(), BeoHeadBrain::BeoHeadBrain(), BeoSub::BeoSub(), BeoSubDepthSensor::BeoSubDepthSensor(), BeoSubIMU::BeoSubIMU(), BeoSubOneBal::BeoSubOneBal(), BeoSubTwoBal::BeoSubTwoBal(), Beowulf::Beowulf(), BufferedInputFrameSeries::BufferedInputFrameSeries(), CameraControl::CameraControl(), BeoSub::CenterBin(), SingleChannelBeoServer::check(), EyeHeadControllerConfigurator::EyeHeadControllerConfigurator(), EyeTrackerConfigurator::EyeTrackerConfigurator(), EyeTrackerDML::EyeTrackerDML(), EyeTrackerISCAN::EyeTrackerISCAN(), EyeTrackerTIL::EyeTrackerTIL(), BeoSub::FollowPipeLine(), GetSaliency::GetSaliency(), GistEstimatorConfigurator::GistEstimatorConfigurator(), GistEstimatorStd::GistEstimatorStd(), GPS::GPS(), HandControllerConfigurator::HandControllerConfigurator(), HeliPose::HeliPose(), HMR3300::HMR3300(), ImageInfo::ImageInfo(), InferoTemporalConfigurator::InferoTemporalConfigurator(), InferoTemporalSIFT::InferoTemporalSIFT(), lcd::lcd(), Localization::Localization(), main(), MainWindow::MainWindow(), MbariResultViewer::MbariResultViewer(), MonkeyEyeHeadController::MonkeyEyeHeadController(), MonkeySaccadeController::MonkeySaccadeController(), MotionSpatioTemporalChannel::MotionSpatioTemporalChannel(), NeoBrain::NeoBrain(), OutputHttpStream::OutputHttpStream(), TigsInputFrameSeries::paramChanged(), SimEventQueueConfigurator::paramChanged(), AttentionGuidanceMapConfigurator::paramChanged(), QtDisplayStream::paramChanged(), TaskRelevanceMapConfigurator::paramChanged(), EyeTrackerConfigurator::paramChanged(), EnvSegmenterConfigurator::paramChanged(), VisualCortexConfigurator::paramChanged(), SaccadeControllerHeadConfigurator::paramChanged(), RetinaConfigurator::paramChanged(), SimulationViewerConfigurator::paramChanged(), InputFrameSeries::paramChanged(), AttentionGateConfigurator::paramChanged(), PrefrontalCortexConfigurator::paramChanged(), VisualBufferConfigurator::paramChanged(), WinnerTakeAllConfigurator::paramChanged(), GistEstimatorConfigurator::paramChanged(), SaliencyMapConfigurator::paramChanged(), HandControllerConfigurator::paramChanged(), SaccadeControllerEyeConfigurator::paramChanged(), FrameGrabberConfigurator::paramChanged(), EyeHeadControllerConfigurator::paramChanged(), InferoTemporalConfigurator::paramChanged(), ContourChannel::paramChanged(), ParticleFilter::ParticleFilter(), Pelco::Pelco(), PingSonar::PingSonar(), Pololu::Pololu(), PrefrontalCortexConfigurator::PrefrontalCortexConfigurator(), RadioDecoder::RadioDecoder(), RangeFinder::RangeFinder(), RasterInputSeries::RasterInputSeries(), RetinaConfigurator::RetinaConfigurator(), RetinaCT::RetinaCT(), Roomba::Roomba(), RT100::RT100(), SaccadeControllerEyeConfigurator::SaccadeControllerEyeConfigurator(), SaccadeControllerHeadConfigurator::SaccadeControllerHeadConfigurator(), SaliencyMapAdapter::SaliencyMapAdapter(), SaliencyMapConfigurator::SaliencyMapConfigurator(), SC8000::SC8000(), SDLdisplayStream::SDLdisplayStream(), FrameOfilt::setConfigInfo(), Deinterlacer::setConfigInfo(), BufferedFrameIstream::setConfigInfo(), InputFrameSeries::setFrameSource(), SingleChannel::setSubmapAlgorithm(), ShapeEstimator::ShapeEstimator(), SimEventQueueConfigurator::SimEventQueueConfigurator(), SimInputFrameSeries::SimInputFrameSeries(), SimOutputFrameSeries::SimOutputFrameSeries(), SimpleEyeHeadController::SimpleEyeHeadController(), Simulation::Simulation(), SimulationViewerAdapter::SimulationViewerAdapter(), SimulationViewerConfigurator::SimulationViewerConfigurator(), SimulationViewerEyeHand::SimulationViewerEyeHand(), SimulationViewerEyeMvt::SimulationViewerEyeMvt(), SimulationViewerEyeMvt2::SimulationViewerEyeMvt2(), SimulationViewerHand::SimulationViewerHand(), SimulationViewerNerdCam::SimulationViewerNerdCam(), SimulationViewerStd::SimulationViewerStd(), SimulationViewerSurpCont::SimulationViewerSurpCont(), SingleChannel::SingleChannel(), SingleChannelBeoServer::SingleChannelBeoServer(), SSC::SSC(), StdBrain::StdBrain(), SubController::SubController(), submain(), TaskRelevanceMapConfigurator::TaskRelevanceMapConfigurator(), TCPcommunicator::TCPcommunicator(), ThresholdFrictionSaccadeController::ThresholdFrictionSaccadeController(), ThresholdSaccadeController::ThresholdSaccadeController(), VCC4::VCC4(), Visca::Visca(), VisualBufferConfigurator::VisualBufferConfigurator(), VisualCortexConfigurator::VisualCortexConfigurator(), VisualCortexEnv::VisualCortexEnv(), VisualCortexInt::VisualCortexInt(), VisualCortexStd::VisualCortexStd(), WinnerTakeAllConfigurator::WinnerTakeAllConfigurator(), and SDLdisplayStream::writeFrame().

std::string ModelComponent::descriptiveName (  )  const
bool ModelComponent::doRequestOption ( const ModelOptionDef opt,
const bool  useMyVal = false,
const bool  recurse = true,
const bool  warn = true 
)

External request that one of our ModelParam becomes an option.

This is to allow external callers to selectively decide that some of our internal ModelParam parameters should be exported as command-line options. If recurse is true, will look for the ModelParam in all our subcomponents, and will link all matching ModelParam in us and our subcomponents to the option (so that if a command-line value is provided, it will affect all matching ModelParam objects in us and all our subcomponents). Will return false (and generate a warning message if warn is true) if we (or our subcomponents if recurse is true) don't have a ModelParam of the specified name. Will generate a fatal error if we have the ModelParam but no known command-line option exists for that name in ModelOptionDefs.C. Returns true if the ModelParam was found and added as a command-line option. Throws a fatal error is we are started.

Definition at line 806 of file ModelComponent.C.

References ModelOptionDef::name, and OptionManager::requestOption().

void ModelComponent::exportOptions ( const ModelFlag  flags  ) 

Export some of our ModelParam parameters as command-line-options.

This should be called once on the model manager to decide which sets of ModelParam paremeters should become command-line options; the call will then recurse through all ModelComponent objects that have been registered with the manager. This is provided so that external meta-knowledge about what a collection of ModelComponent objects forming a computational model can be used to decide on which command-line options are relevant: for instance, if you build a model that has no OutputFrameSeries, then you will not be able to call saveResults() on your Brain or other objects, so you would not want to export command-line options that relate to which results should be saved. This is handled by the exportFlag member of each ModelOptionDef, which must match the ModelManager's current export mask (set by ModelManager::allowOptions()) in order for that option to actually be exported.

HISTORICAL NOTE: It used to be that every subclass of ModelComponent would need to override exportOptions(), and explicitly request that each model param be exported. This is no longer the case -- instead, when each OModelParam is constructed in the subclass's constructor, it ends up calling registerOptionedParam() on the ModelComponent, which adds the param to our list of params, but also marks the param for command-line export whenever exportOptions() is finally called. For those rare cases where you do not want an OModelParam exported to the command-line, you can call forgetExports(), and then explicitly re-export any desired options using doRequestOption().

Definition at line 700 of file ModelComponent.C.

References MC_RECURSE, and OptionManager::requestOption().

Referenced by StereoChannel::buildSubChans(), main(), ModelManager::parseCommandLine(), MexModelManager::parseMexCommandLine(), and submain().

void ModelComponent::forgetExports (  ) 

Clear our list of command-line options to be exported.

Definition at line 979 of file ModelComponent.C.

OptionManager & ModelComponent::getManager (  )  const

Get our manager.

Definition at line 1031 of file ModelComponent.C.

Referenced by OutputFrameSeries::addFrameDest(), MultiColorBandChannel::buildSubChans(), IntensityBandChannel::buildSubChans(), IntegerMotionChannel::buildSubChans(), DepthMotionChannel::buildSubChans(), EndPointChannel::buildSubChans(), FoeMSTChannel::buildSubChans(), LJunctionChannel::buildSubChans(), StereoChannel::buildSubChans(), SoxChannel::buildSubChans(), MotionSpatioTemporalChannel::buildSubChans(), XJunctionChannel::buildSubChans(), IntegerOrientationChannel::buildSubChans(), OrientationChannel::buildSubChans(), MotionOpticalFlowChannel::buildSubChans(), MotionChannel::buildSubChans(), TJunctionChannel::buildSubChans(), SingleChannelBeoServer::check(), ColorChannel::ColorChannel(), featureClusterVision< FLOAT >::fCVsetUpfCV(), MultiConvolveChannel::MultiConvolveChannel(), TigsInputFrameSeries::paramChanged(), SimEventQueueConfigurator::paramChanged(), AttentionGuidanceMapConfigurator::paramChanged(), RawVisualCortex::paramChanged(), QtDisplayStream::paramChanged(), TaskRelevanceMapConfigurator::paramChanged(), SpatialMetrics::paramChanged(), EyeTrackerConfigurator::paramChanged(), EnvSegmenterConfigurator::paramChanged(), VisualCortexConfigurator::paramChanged(), SaccadeControllerHeadConfigurator::paramChanged(), RetinaConfigurator::paramChanged(), IntegerRawVisualCortex::paramChanged(), SimulationViewerConfigurator::paramChanged(), InputFrameSeries::paramChanged(), AttentionGateConfigurator::paramChanged(), PrefrontalCortexConfigurator::paramChanged(), VisualBufferConfigurator::paramChanged(), WinnerTakeAllConfigurator::paramChanged(), ColorChannel::paramChanged(), GistEstimatorConfigurator::paramChanged(), SaliencyMapConfigurator::paramChanged(), VisualCortexSurprise::paramChanged(), HandControllerConfigurator::paramChanged(), SaccadeControllerEyeConfigurator::paramChanged(), FrameGrabberConfigurator::paramChanged(), EyeHeadControllerConfigurator::paramChanged(), InferoTemporalConfigurator::paramChanged(), ContourChannel::paramChanged(), FrameOfilt::setConfigInfo(), SpatialMetrics::setFOAradius(), SpatialMetrics::setFoveaRadius(), MultiDirectFeedChannel::setNumChans(), setSubmapAlgorithmBiased(), SimulationViewerCompress::SimulationViewerCompress(), SimulationViewerEyeHand::SimulationViewerEyeHand(), SimulationViewerEyeMvt::SimulationViewerEyeMvt(), SimulationViewerEyeMvt2::SimulationViewerEyeMvt2(), SimulationViewerEyeMvtNeuro::SimulationViewerEyeMvtNeuro(), SimulationViewerHand::SimulationViewerHand(), InferoTemporalHmax::start1(), GistEstimatorGen::start1(), GistEstimatorStd::start1(), BayesianBiaser::visitSingleChannel(), and SDLdisplayStream::writeFrame().

ModelParamBase * ModelComponent::getModelParam ( size_t  i  ) 

Get non-const access to the i'th model parameter.

Definition at line 878 of file ModelComponent.C.

const ModelParamBase * ModelComponent::getModelParam ( size_t  i  )  const

Get non-const access to the i'th model parameter.

Definition at line 868 of file ModelComponent.C.

Referenced by PrefsWindow::addPrefsForComponent().

std::string ModelComponent::getModelParamString ( const std::string name,
const ModelFlag  flags = 0 
) const

Get a parameter value.

Because the parameter may exist both in us and in several of our subcomponents, we will stop and return the value of the first instance encountered, searching first in us, then recursively in our subcomponents (depth-first search, if flags contains MC_RECURSE), in the order in which they were added.

If the parameter is not found in us (or in any of our subcomponents, if flags contains MC_RECURSE), this function will not return (will abort or throw an exception) -- to avoid such an error, call hasModelParam() first to check that the particular param exists.

It is ok to call this on a started ModelComponent.

Definition at line 782 of file ModelComponent.C.

References ASSERT, GVX_ERR_CONTEXT, MC_IGNORE_MISSING, and rutz::sfmt().

Referenced by ModelParamBatch::installValues().

template<class T >
T ModelComponent::getModelParamVal ( const std::string name,
const ModelFlag  flags = 0 
) const [inline]

Get a parameter value.

This is slow, as it will search for the ModelParam by name. If you need efficient access to ModelParam values, you should define a wrapper method in your ModelComponent derivative. In normal operation, indeed, only the methods of the ModelComponent derivative should directly access the ModelParam, not external people. Because the parameter may exist both in us and in several of our subcomponents, we will stop and return the value of the first instance encountered, searching first in us, then recursively in our subcomponents (depth-first search, if flags contains MC_RECURSE), in the order in which they were added.

If the parameter is not found in us (or in any of our subcomponents, if flags contains MC_RECURSE), this function will not return (will abort or throw an exception) -- to avoid such an error, call hasModelParam() first to check that the particular param exists.

It is ok to call this on a started ModelComponent.

Definition at line 709 of file ModelComponent.H.

References getModelParamValAux().

Referenced by DescriptorVec::buildDV(), DescriptorVec::buildParticleCountDV(), DescriptorVec::buildRawDV(), and DescriptorVec::buildSingleChannelFV().

void ModelComponent::getModelParamValAux ( const std::string name,
RefHolder val,
const ModelFlag  flags 
) const

Auxiliary implementation function for getModelParamVal().

Definition at line 1075 of file ModelComponent.C.

References ASSERT, GVX_ERR_CONTEXT, MC_IGNORE_MISSING, and rutz::sfmt().

Referenced by getModelParamVal().

size_t ModelComponent::getNumModelParams (  )  const

Return the number of params that we have.

Definition at line 862 of file ModelComponent.C.

Referenced by PrefsWindow::addPrefsForComponent().

ModelComponent * ModelComponent::getParent (  )  const

Get this component's parent ModelComponent, or NULL if it has no parent.

Internally, each component stores a weak smart pointer to its parent, while the parent stores a strong smart pointer to the child. This avoids unbreakable reference-counting cycles, but still lets us traverse the parent-child in both directions component tree using getParent() and subComponent().

Definition at line 524 of file ModelComponent.C.

References nub::soft_ref< T >::get_weak().

Referenced by getRootObject().

const ModelComponent * ModelComponent::getRootObject (  )  const

Get this component's root parent (the parent of all parents in our tree).

If this component has no parent, then getRootObject() returns a pointer to this component itself.

Definition at line 540 of file ModelComponent.C.

References getParent().

ModelComponent * ModelComponent::getRootObject (  ) 

Get this component's root parent (the parent of all parents in our tree).

If this component has no parent, then getRootObject() returns a pointer to this component itself.

Definition at line 531 of file ModelComponent.C.

References getParent().

Referenced by SimulationViewerStats::save1(), RetinaCT::start1(), and SimModule::start1().

bool ModelComponent::hasBeenExported (  )  const [protected]

Check if our options have already been exported.

Definition at line 1044 of file ModelComponent.C.

Referenced by ModelManager::parseCommandLine().

bool ModelComponent::hasModelParam ( const std::string name,
const ModelFlag  flags = 0 
) const

Check for named param in this component (and possibly its subcomponents).

Use this to verify that a param exists before doing a getModelParamVal() or setModelParamVal(), since those functions will throw an exception if the named param is non-existent.

Definition at line 750 of file ModelComponent.C.

bool ModelComponent::hasSubComponent ( const nub::soft_ref< ModelComponent > &  c,
const ModelFlag  flags = 0 
) const

Return true if we have the pointee as subcomponent.

Parameters:
flags if containing MC_RECURSE, will look not only in our subcomponents but also recursively in their subcomponents (depth-first search)

Definition at line 681 of file ModelComponent.C.

References MC_RECURSE.

bool ModelComponent::hasSubComponent ( const std::string tagname,
const ModelFlag  flags = 0 
) const

Return true if we have a subcomponent by that tagname.

Parameters:
flags if containing MC_RECURSE, will look not only in our subcomponents but also recursively in their subcomponents (depth-first search)

Definition at line 662 of file ModelComponent.C.

References MC_RECURSE.

Referenced by MbariResultViewer::MbariResultViewer().

void ModelComponent::hideOption ( const ModelOptionDef opt  ) 

External request that we hide a command-line option.

In some rare cases (see, e.g., VisualCortexConfigurator), we want to create a component but avoid exporting some of its ModelParam members as command-line options. Use with caution, since the ModelParam still looks and feels like an option, just the ModelManager will ignore it. This must be called immediately after construction of the ModelComponent and before exportOptions() is called (either explicitly or automatically when the command-line is parsed). Throws a fatal error if exportOptions() has already been called, we don't have the option, or we are started.

Definition at line 845 of file ModelComponent.C.

References ModelOptionDef::name.

Referenced by SingleSvChannel::SingleSvChannel().

void ModelComponent::init ( OptionManager mgr,
const std::string descrName,
const std::string tagName,
const std::string crealm = "World" 
) [protected]

Make sure you call this if you have used the default constructor.

Definition at line 277 of file ModelComponent.C.

Referenced by ChannelBase::ChannelBase(), SimEventBuffer::SimEventBuffer(), and SimModule::SimModule().

void ModelComponent::managerDestroyed (  ) 

Signify that our ModelManager just got destroyed.

This should not be called manually, but will be called from within our parent ModelComponent's destructor. It will ensure that we do not try to unregister with our ModelManager if the manager is destroyed before us.

Definition at line 421 of file ModelComponent.C.

Referenced by ModelManager::~ModelManager().

uint ModelComponent::numSubComp (  )  const

Get current number of subcomponents.

Definition at line 658 of file ModelComponent.C.

Referenced by PrefsWindow::addPrefsForComponent(), and SimulationViewerCompress::start1().

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

Called whenever a ModelParamBase has its value changed.

Subclasses of ModelComponent should override this function if they need to do any internal reconfiguration when their parameters change value (whether due to a command-line option, or a setModelParamString(), or a readParamsFrom()). See OrientationChannel::paramChanged() in Channels/OrientationChannel.C for an example; also see SaccadeControllerConfigurator::paramChanged() in Neuro/SaccadeControllers.C for for how to use this to select subcomponents at runtime.

Parameters:
param the address of the ModelParamBase that changed; subclasses can compare this with the addresses of their model param members to figure out which is the relevant param
valueChanged true if the value actually changed, false if the value was "set" but the new value is the same as the old value; some clients may want to avoid re-doing expensive operations if the value did not actually change
status the subclass that implements paramChanged() should set *status to CHANGE_REJECTED if it wishes to reject a particular parameter change; the caller of paramChanged() is expected to set *status to CHANGE_ACCEPTED prior to calling paramChanged(), so the implentation of paramChanged() does not need to set *status CHANGE_ACCEPTED if it wishes to allow the change since that will already be the default status

HISTORICAL NOTE: In the past, subclasses would override setModelParamString() for this same purpose, but in the new setup, setModelParamString() is NOT virtual and hence should not be (cannot be) overridden by subclasses. This setup is cleaner (and potentially more efficient) because subclasses don't have to compare string names to figure out which param changed; instead they are passed the address of the param itself. Furthermore, the new setup is more robust, since we can handle param value changes that come from any source (e.g., setModelParamVal(), or ModelParamBase::setValString(), or OModelParam::setVal()), and not just those that come through setModelParamString().

Implements ParamClient.

Reimplemented in Beowulf, ColorChannel, ContourChannel, DepthMotionChannel, EndPointChannel, FoeMSTChannel, IntegerMathEngine, IntegerMotionChannel, IntegerOrientationChannel, IntegerRawVisualCortex, IntensityBandChannel, LJunctionChannel, MotionChannel, MotionOpticalFlowChannel, MotionSpatioTemporalChannel, MultiColorBandChannel, MultiSpectralResidualChannel, OrientationChannel, RawVisualCortex, SingleChannel, SoxChannel, StereoChannel, TJunctionChannel, XJunctionChannel, ModelManager, CudaSaliency, FrameGrabberConfigurator, QtDisplayStream, QtDisplayStream, EnvSimulationViewer, EnvSimulationViewer, MbariResultViewer, InputFrameSeries, OutputFrameSeries, AttentionGateConfigurator, AttentionGuidanceMapConfigurator, EnvInferoTemporal, EnvSaliencyMap, EnvSegmenterColorRegion, EnvSegmenterConfigurator, EnvVisualCortexBase, EyeHeadControllerConfigurator, GistEstimatorConfigurator, HandControllerConfigurator, InferoTemporalConfigurator, NeoBrain, NeoBrain, PrefrontalCortexConfigurator, RetinaConfigurator, SaccadeControllerEyeConfigurator, SaccadeControllerHeadConfigurator, SaliencyMapConfigurator, SimulationViewerCompress, SimulationViewerConfigurator, SpatialMetrics, TaskRelevanceMapConfigurator, VisualBufferConfigurator, VisualCortexConfigurator, VisualCortexSurprise, WinnerTakeAllConfigurator, EyeTrackerConfigurator, MovementController, SimEventQueueConfigurator, SaliencyMapFeatureExtractor, TigsJob, TigsInputFrameSeries, and RasterInputOptions.

Definition at line 973 of file ModelComponent.C.

void ModelComponent::printout ( std::ostream &  s,
const std::string prefix = "" 
) const

Show our ModelParam internals and those of our subcomponents.

Definition at line 434 of file ModelComponent.C.

Referenced by SimulationViewerStats::save1(), and ModelManager::start1().

void ModelComponent::readParamsFrom ( const ParamMap pmap,
const bool  noerr = true 
)

Read params from the ParamMap.

Throws a fatal error is we are started.

Parameters:
noerr will not generate an error message if some of our parameters do not exist in ParamMap

Definition at line 888 of file ModelComponent.C.

References ParamMap::getSubpmap(), and ParamMap::hasParam().

Referenced by ModelManager::loadConfig(), and ModelManager::parseCommandLine().

std::string ModelComponent::realm (  )  const
void ModelComponent::registerOptionedParam ( OptionedModelParam mp,
const ParamFlag  flags 
) [virtual]

Our parameters will register with us upon construction.

Parameters:
flags Pass USE_MY_VAL here if you want the current value of the model param to be taken as the new default value, otherwise pass 0 for flags.

Implements ParamClient.

Definition at line 938 of file ModelComponent.C.

References USE_MY_VAL.

Referenced by Beowulf::paramChanged().

void ModelComponent::registerParam ( ModelParamBase mp  )  [virtual]

our parameters will register with us upon construction

override of ParamClient's pure virtual function

Implements ParamClient.

Definition at line 932 of file ModelComponent.C.

void ModelComponent::removeAllSubComponents (  ) 

Remove all our subcomponents.

Definition at line 624 of file ModelComponent.C.

Referenced by SingleChannelBeoServer::check().

void ModelComponent::removeSubComponent ( const std::string tagname  ) 

Remove a subcomponent from our internal list, by tagName.

This will only remove the component from our list of registered subcomponents, but will not attempt to destroy it.

Definition at line 606 of file ModelComponent.C.

void ModelComponent::removeSubComponent ( const uint  idx  ) 

Remove a subcomponent from our internal list, by index.

This will only remove the component from our list of registered subcomponents, but will not attempt to destroy it.

Definition at line 595 of file ModelComponent.C.

void ModelComponent::removeSubComponent ( const nub::ref< ModelComponent > &  subc  ) 

Remove a subcomponent by nub:ref.

Definition at line 618 of file ModelComponent.C.

References removeSubComponent().

int ModelComponent::removeSubComponent ( const ModelComponent subc,
bool  removeall = false 
)

Remove a subcomponent from our internal list, by address.

This will only remove the component from our list of registered subcomponents, but will not attempt to destroy it. If removeall is true, then all components matching subc are removed; otherwise, only the first is removed. Returns the number of subcomponents that were removed.

Definition at line 569 of file ModelComponent.C.

Referenced by OutputFrameSeries::addFrameDest(), SingleChannelBeoServer::check(), main(), TigsInputFrameSeries::paramChanged(), SimEventQueueConfigurator::paramChanged(), AttentionGuidanceMapConfigurator::paramChanged(), QtDisplayStream::paramChanged(), TaskRelevanceMapConfigurator::paramChanged(), EyeTrackerConfigurator::paramChanged(), EnvSegmenterConfigurator::paramChanged(), VisualCortexConfigurator::paramChanged(), SaccadeControllerHeadConfigurator::paramChanged(), RetinaConfigurator::paramChanged(), SimulationViewerConfigurator::paramChanged(), AttentionGateConfigurator::paramChanged(), PrefrontalCortexConfigurator::paramChanged(), VisualBufferConfigurator::paramChanged(), WinnerTakeAllConfigurator::paramChanged(), GistEstimatorConfigurator::paramChanged(), SaliencyMapConfigurator::paramChanged(), HandControllerConfigurator::paramChanged(), SaccadeControllerEyeConfigurator::paramChanged(), FrameGrabberConfigurator::paramChanged(), EyeHeadControllerConfigurator::paramChanged(), InferoTemporalConfigurator::paramChanged(), ContourChannel::paramChanged(), ComplexChannel::removeAllSubChans(), IntegerComplexChannel::removeAllSubChans(), ComplexChannel::removeSubChan(), IntegerComplexChannel::removeSubChan(), removeSubComponent(), FrameOfilt::setConfigInfo(), BufferedFrameIstream::setConfigInfo(), InputFrameSeries::setFrameSource(), MultiDirectFeedChannel::setNumChans(), and SingleChannel::setSubmapAlgorithm().

void ModelComponent::reset ( const ModelFlag  flags  ) 

Reset a model component and propagate the request to the sub-components.

For each ModelComponent reset should set it into the state that it was just after calling the constructor. It will depend on the component what exactly that involves.

Parameters:
flags if containing MC_RECURSE, then we recursively reset() our subcomponents as well

PROGRAMMER NOTE: This function is not virtual, so you should not try to override this function in your derived class; instead override reset1() and/or reset2(). In those overrides, be sure to call your base class's version of reset1() or reset2().

Definition at line 986 of file ModelComponent.C.

References MC_RECURSE, reset1(), reset2(), and stop().

void ModelComponent::reset1 (  )  [protected, virtual]
void ModelComponent::reset2 (  )  [protected, virtual]

This is called from within reset() after the subcomponents are reset.

Definition at line 481 of file ModelComponent.C.

Referenced by reset().

void ModelComponent::save ( const ModelComponentSaveInfo sinfo,
const ModelFlag  flags = MC_RECURSE 
)

Save/display our current state.

Over the course of a program run, once in a while it may be desirable to broadcast an order to all ModelComponents to save and/or display their current state or internals. This function achieves this. Like for start(), stop() and reset(), this is a usually recursive call, and derived classes should not override this function, but should instead override save1() (called before we recurse through our subcomponents) and save2() (called after we have recursed through our subcomponents). Default implementations for save1() and save2() are provided which are no-ops.

Definition at line 1008 of file ModelComponent.C.

References MC_RECURSE, save1(), save2(), and stop().

void ModelComponent::save1 ( const ModelComponentSaveInfo sinfo  )  [protected, virtual]
void ModelComponent::save2 ( const ModelComponentSaveInfo sinfo  )  [protected, virtual]

This is called from within save() after the subcomponents have saved.

Definition at line 489 of file ModelComponent.C.

Referenced by save().

void ModelComponent::setDescriptiveName ( const std::string name  ) 
void ModelComponent::setManager ( OptionManager mgr  )  [protected]

Set our manager.

Definition at line 1037 of file ModelComponent.C.

References ASSERT.

Referenced by ModelManager::ModelManager().

void ModelComponent::setModelParamString ( const std::string name,
const std::string value,
const ModelFlag  flags = 0 
)

Parse a parameter value given as string and set the param.

Should not be needed in normal operation, inefficient text-based interface. In normal operation, the internals of the ModelComponent derivative will directly access the ModelParam, not external people. If you want to provide external access to your ModelParam values, you should implement a wrapper for them in your ModelComponent derivative (e.g., implement a function setSize() that will set the value of your Size ModelParam). Returns true if the ModelParam was found and set. Throws a fatal error if the ModelComponent was started, to avoid external people messing around with our ModelParam values during operation of the component.

Parameters:
name the ModelParam tagname
value the parameter value, to be parsed
flags bitwise-or'ed combination of MC_RECURSE, MC_IGNORE_MISSING

HISTORICAL NOTE: In the past, subclasses would override setModelParamString() if they needed special handling when param values changed, this is no longer the case -- instead subclasses should override paramChanged(); see additional documentation there.

Definition at line 759 of file ModelComponent.C.

References GVX_ERR_CONTEXT, and rutz::sfmt().

Referenced by ModelParamBatch::restoreValues().

template<class T >
void ModelComponent::setModelParamVal ( const std::string name,
const T &  val,
const ModelFlag  flags = 0 
) [inline]

Set a parameter value.

This is slow, as it will search for the ModelParam by name. If you need efficient access to ModelParam values, you should define a wrapper method in your ModelComponent derivative. In normal operation, indeed, only the methods of the ModelComponent derivative should directly access the ModelParam, not external people. Returns true if the ModelParam was found and set. Throws a fatal error if the ModelComponent was started, to avoid external people messing around with our ModelParam values during operation of the component.

This function will set the param value for ALL matching model params found in us (and in our subcomponents, if flags contains MC_RECURSE).

If the parameter is not found in us (or in any of our subcomponents, if flags contains MC_RECURSE), this function will not return (will abort or throw an exception) -- to avoid such an error, call hasModelParam() first to check that the particular param exists.

Parameters:
name the ModelParam tagname
val the parameter value
flags bitwise-or'ed combination MC_RECURSE, MC_IGNORE_MISSING

Definition at line 699 of file ModelComponent.H.

References setModelParamValAux().

Referenced by main(), and RetinaCT::start1().

void ModelComponent::setModelParamValAux ( const std::string name,
const RefHolder val,
const ModelFlag  flags 
)

Auxiliary implementation function for setModelParamVal().

Definition at line 1050 of file ModelComponent.C.

References GVX_ERR_CONTEXT, and rutz::sfmt().

Referenced by ModelParamBatch::installValues(), and setModelParamVal().

void ModelComponent::setRealm ( const std::string crealm  ) 

Set the realm.

This will throw a fatal exception if the component is in started state. This is a recursive call which will propagate to all subcomponents.

Definition at line 513 of file ModelComponent.C.

References started().

void ModelComponent::setTagName ( const std::string name  ) 
void ModelComponent::start (  ) 

Start the component.

This will start the component by triggering the following sequence of actions:

  • Check if we are already started and emit a fatal error if so
  • Call start1() that may be overloaded by derived classes
  • Call start() on all our subcomponents
  • Call start2() that may be overloaded by derived classes
  • Switch us to "started" state, in which modifying our ModelParam values externally is forbidden

Derived classes should overload start1() and start2() as a way to get the component started, once the command-line options and config files have been parsed and all the ModelParam objects have been configured. Default no-op implementations are provided for start1() and start2(), so if you don't need to do anything to start your component, you don't need to implement start1() and start2(). Because this is a recursive call on our sub-components, typically you only need to call it once on your root ModelComponent (probably ModelManager) to get your entire hierarchy of ModelComponent objects started.

Reimplemented in Serial, BeoPilot, and Serial.

Definition at line 309 of file ModelComponent.C.

References ASSERT, GVX_ERR_CONTEXT, nub::object::obj_typename(), rutz::sfmt(), start1(), start2(), and tagName().

Referenced by BeoSub::CenterBin(), BeoSub::FollowPipeLine(), WinnerTakeAllStdOptim::integrate(), main(), lobot::App::run(), and submain().

void ModelComponent::start1 (  )  [protected, virtual]

This is called from within start() before the subcomponents start.

Reimplemented in SaliencyMT, BeobotBrainMT, GSlocalizer, BeoSub, BeoSubOneBal, BeoSubSim, BeoSubTwoBal, SeaBee, LeakDetector, TCPcommunicator, ComplexChannel, CompositeColorChannel, ContourChannel, DirectFeedChannel, DirectionOpticalFlowChannel, DirectionSpatioTemporalChannel, DisparityChannel, DKLcolorChannel, GaborChannel, GaussianPyrChannel, ImagizeColorChannel, IntegerComplexChannel, IntegerDirectionChannel, IntegerRawVisualCortex, IntegerSimpleChannel, MultiConvolveChannel, PedestrianChannel, RawVisualCortex, SingleChannel, SingleSvChannel, StereoChannel, TemplateMatchChannel, SaliencyMT, EventLog, ModelManager, CudaSaliency, RegSaliency, SaliencyMT, BeeSTEM, BeoChip, DC1394Grabber2, GPS_USGlobalSat_EM_408, HTTPClient, HttpServer, IEEE1394grabber, IMU_MicroStrain_3DM_GX2, JoyStick, ParPort, RadioDecoder, RTSPGrabber, V4L2grabber, V4Lgrabber, VCC4, WiiMote, XCgrabber, XCgrabberFlex, QtDisplayStream, NeuralFieldModule, SupColliculusModule, EnvVisualCortexBase, SimpleEyeHeadController, EyeTrackerEyeHeadController, GistEstimatorGen, GistEstimatorStd, TrackerHandController, InferoTemporalStd, InferoTemporalCudaHmax, InferoTemporalHmax, InferoTemporalSalBayes, InferoTemporalSIFT, PrefrontalCortexSB, RetinaAdapter, RetinaCT, ThresholdSaccadeController, SimulationViewerCompress, SimulationViewerEyeHand, SimulationViewerEyeMvt, SimulationViewerEyeMvt2, SimulationViewerEyeMvtNeuro, SimulationViewerEyeRegion, SimulationViewerEyeSim, SimulationViewerHand, TargetChecker, TaskRelevanceMapKillN, TaskRelevanceMapSocial, VisualBufferStd, VisualCortexEyeMvt, EyeTracker, EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerTIL, EyeTrackerUDP, SceneRec, BeoLogger, BeoGPS, FaceDetector, RG_Lane, SaliencyMT, SaliencyMT, TV_Lane, Beobot2_GistSalLocalizerMasterI, Beobot2_GistSalLocalizerWorkerI, Beobot2GistSalMasterI, BeoSLAM, LRF_Occupancy, Gist_Navigation, CornerNavigation, GistSal_Grapher, GistSal_Navigation, Hack_Navigation, ND_Navigation, QT_Navigation, RG_Lane, SLAM_Navigation, HeliPose, RobotBrainStimulator, ScorbotController, SubController, SimEventQueue, SimModule, SpaceVariantEdgeModule, SingleChannelSurprise< SMODEL >, SaliencyMapFeatureExtractor, and CoerceVideoFormatOfilt.

Definition at line 461 of file ModelComponent.C.

Referenced by start().

void ModelComponent::start2 (  )  [protected, virtual]
bool ModelComponent::started (  )  const
void ModelComponent::stop (  ) 

Stop the component.

This will stop the component by triggering the following sequence of actions:

  • Check if we are already started and emit a fatal error if not
  • Call stop1() that may be overloaded by derived classes
  • Call stop() on all our subcomponents
  • Call stop2() that may be overloaded by derived classes
  • Switch us out of "started" state, so that modifying our ModelParam values externally is allowed

Derived classes should overload stop1() and stop2() as a way to get the component stopped, once the command-line options and config files have been parsed and all the ModelParam and objects have been configured. Default no-op implementations are provided for stop1() and stop2(), so if you don't need to do anything to stop your component, you don't need to implement stop1() and stop2(). Because this is a recursive call on our sub-component, typically you only need to call it once on your root ModelComponent (probably ModelManager) to get the entire hierarchy of ModelComponent objects stopped.

Reimplemented in Pelco, Serial, Serial, and Rovio.

Definition at line 394 of file ModelComponent.C.

References GVX_ERR_CONTEXT, nub::object::obj_typename(), rutz::sfmt(), stop1(), stop2(), and tagName().

Referenced by SimEventQueue::clear(), MichelsonChannel::doInput(), SimEventQueueDebug::evolve(), BeoLRF::evolve(), SimEvent::getDoneList(), WinnerTakeAllStd::getV(), WinnerTakeAllTempNote::getV(), IEEE1394grabber::grabPrealloc(), WinnerTakeAllTempNote::input(), WinnerTakeAllStd::input(), SaliencyMapStd::input(), main(), SimEventQueue::post(), SimEventQueue::printCallbacks(), SimEventQueue::prune(), RandomInput::readFrame(), GameOfLifeInput::readFrame(), SimEventQueue::registerSimCallbackClient(), SimEventQueue::registerSimReqHandlerClient(), SimEventQueue::request(), reset(), save(), LowLevelEncoderMap::stop2(), submain(), lobot::App::~App(), ~ModelComponent(), and ModelManager::~ModelManager().

void ModelComponent::stop1 (  )  [protected, virtual]
void ModelComponent::stop2 (  )  [protected, virtual]
nub::ref< ModelComponent > ModelComponent::subComponent ( const std::string tagname,
const ModelFlag  flags = 0 
) const

Access a sub-component by tagname.

Parameters:
flags if containing MC_RECURSE, will look not only in our subcomponents but also recursively in their subcomponents (depth-first search)

Definition at line 638 of file ModelComponent.C.

References MC_RECURSE.

nub::ref< ModelComponent > ModelComponent::subComponent ( const uint  idx  )  const

Access a sub-component by index.

Definition at line 628 of file ModelComponent.C.

Referenced by PrefsWindow::addPrefsForComponent(), SimulationViewerCompress::start1(), and SimModule::start1().

std::string ModelComponent::tagName (  )  const

Get a programmer-usable tag name for this object.

This is intended to be unique among component objects, so that this string could be used for associate-array indexing, for example.

Definition at line 501 of file ModelComponent.C.

Referenced by ChannelMaps::ChannelMaps(), ComplexChannel::combineOutputs(), IntegerComplexChannel::combineOutputsInt(), HueChannel::combineSubMaps(), SingleChannel::combineSubMaps(), ObjDetChannel::doInput(), IntegerRawVisualCortex::getChannelOutputMap(), SingleChannel::getOutput(), SingleChannel::getRawCSmap(), IntegerSimpleChannel::getRawCSmapInt(), SingleSvChannel::getSubmapNameShort(), SingleChannel::getSubmapNameShort(), IntegerSimpleChannel::getSubmapNameShort(), ContourChannel::getSubmapNameShort(), SingleChannelBeo::handleInput(), ChannelBase::input(), SingleChannel::postProcessMap(), RobotBrainComponent::registerSubscription(), ComplexChannel::saveResults(), IntegerComplexChannel::saveResults(), IntegerSimpleChannel::saveResults(), SingleChannel::saveResults(), SpectralResidualChannel::saveResults(), SingleChannel::saveStats(), start(), stop(), RobotBrainComponent::stop1(), SimReq::toString(), SimEvent::toString(), OutputFrameSeries::update(), MaskBiaser::visitChannelBase(), ChannelVisitorInstallFacet< CFS, CFC >::visitChannelBase(), BayesianBiaser::visitChannelBase(), GuidedSearchBiaser::visitChannelBase(), OptimalGainsFinder::visitChannelBase(), FeatureBiaser::visitChannelBase(), JetFiller::visitChannelBase(), JetSpecFiller::visitChannelBase(), WeightFinder::visitChannelBase(), GuidedSearchBiaser::visitComplexChannel(), OptimalGainsFinder::visitSingleChannel(), GuidedSearchBiaser::visitSingleChannel(), ComplexChannel::writeTo(), and IntegerComplexChannel::writeTo().

void ModelComponent::unregisterParam ( const ModelParamBase mp  )  [virtual]

our parameters will un-register with us upon destruction

override of ParamClient's pure virtual function

Implements ParamClient.

Definition at line 951 of file ModelComponent.C.

References OptionManager::unRequestOption().

Referenced by Beowulf::Beowulf(), and Beowulf::paramChanged().

void ModelComponent::writeParamsTo ( ParamMap pmap  )  const

Write params to the ParamMap.

Prints out a warning message if we are started.

Definition at line 910 of file ModelComponent.C.

References ParamMap::putSubpmap().

Referenced by SingleChannelBeo::handleInput(), and ModelManager::saveConfig().


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