
#include <Component/ModelComponent.H>
Inheritance diagram for ModelComponent:


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.
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. | |
| OptionManager & | getManager () 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 | |
| ModelComponent * | getParent () const |
| Get this component's parent ModelComponent, or NULL if it has no parent. | |
| ModelComponent * | getRootObject () |
| Get this component's root parent (the parent of all parents in our tree). | |
| const ModelComponent * | getRootObject () 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< ModelComponent > | subComponent (const uint idx) const |
| Access a sub-component by index. | |
| nub::ref< ModelComponent > | subComponent (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> | |
| 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 ModelParamBase * | getModelParam (size_t i) const |
| Get non-const access to the i'th model parameter. | |
| ModelParamBase * | getModelParam (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. | |
Classes | |
| struct | Impl |
| Private "pimpl" implementation class for ModelComponent. More... | |
|
||||||||||||||||||||
|
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.
Definition at line 244 of file ModelComponent.C. References dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::PtrChecker::addPtr(), CLDEBUG, rutz::full_object_cast(), and dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::getChecker(). |
|
||||||||||||||||
|
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 dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::PtrChecker::addPtr(), rutz::full_object_cast(), and dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::getChecker(). |
|
|
Virtual destructor ensures proper destruction of derived classes.
Definition at line 280 of file ModelComponent.C. References CLDEBUG, dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::PtrChecker::forgetPtr(), rutz::full_object_cast(), dummy_namespace_to_avoid_gcc411_bug_ModelComponent_C::getChecker(), ModelComponent::Impl::pinfos, ModelComponent::Impl::started, stop(), and ModelComponent::Impl::subComps. |
|
|
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. |
|
||||||||||||
|
|
||||||||||||||||||||
|
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 799 of file ModelComponent.C. References CLERROR, CLFATAL, i, ModelComponent::Impl::mgr, ModelOptionDef::name, ModelComponent::Impl::pinfos, OptionManager::requestOption(), ModelComponent::Impl::started, and ModelComponent::Impl::subComps. Referenced by main(). |
|
|
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 693 of file ModelComponent.C. References CLDEBUG, ModelComponent::Impl::hasBeenExported, i, MC_RECURSE, ModelComponent::Impl::mgr, ModelComponent::Impl::pinfos, OptionManager::requestOption(), and ModelComponent::Impl::subComps. Referenced by StereoChannel::buildSubChans(), ModelManager::parseCommandLine(), and MexModelManager::parseMexCommandLine(). |
|
|
Clear our list of command-line options to be exported.
Definition at line 972 of file ModelComponent.C. References i, and ModelComponent::Impl::pinfos. |
|
|
|
Get non-const access to the i'th model parameter.
Definition at line 871 of file ModelComponent.C. References LFATAL, and ModelComponent::Impl::pinfos. |
|
|
Get non-const access to the i'th model parameter.
Definition at line 861 of file ModelComponent.C. References LFATAL, and ModelComponent::Impl::pinfos. Referenced by PrefsWindow::addPrefsForComponent(). |
|
||||||||||||
|
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 775 of file ModelComponent.C. References ASSERT, CLFATAL, ModelComponent::Impl::findMatchingParams(), GVX_ERR_CONTEXT, MC_IGNORE_MISSING, and rutz::sfmt(). Referenced by ModelParamBatch::installValues(), ModelManagerControl::loadConfig(), and ModelManagerControl::saveConfig(). |
|
||||||||||||||||
|
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(), DescriptorVec::buildSingleChannelFV(), and main(). |
|
||||||||||||||||
|
Auxiliary implementation function for getModelParamVal().
Definition at line 1068 of file ModelComponent.C. References ASSERT, CLFATAL, ModelComponent::Impl::findMatchingParams(), GVX_ERR_CONTEXT, MC_IGNORE_MISSING, and rutz::sfmt(). Referenced by getModelParamVal(). |
|
|
Return the number of params that we have.
Definition at line 855 of file ModelComponent.C. References ModelComponent::Impl::pinfos. Referenced by PrefsWindow::addPrefsForComponent(). |
|
|
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 517 of file ModelComponent.C. References nub::soft_ref< T >::get_weak(), and ModelComponent::Impl::parent. Referenced by getRootObject(), and modelcomponent_xx_root_object_xx_1(). |
|
|
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 533 of file ModelComponent.C. References getParent(), and p. |
|
|
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 524 of file ModelComponent.C. References getParent(), and p. Referenced by modelcomponent_xx_root_object_xx_1(), SimulationViewerStats::save1(), and SimModule::start1(). |
|
|
Check if our options have already been exported.
Definition at line 1037 of file ModelComponent.C. References ModelComponent::Impl::hasBeenExported. |
|
||||||||||||
|
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 743 of file ModelComponent.C. References ModelComponent::Impl::findMatchingParams(). |
|
||||||||||||
|
Return true if we have the pointee as subcomponent.
Definition at line 674 of file ModelComponent.C. References nub::soft_ref< T >::getWeak(), MC_RECURSE, and ModelComponent::Impl::subComps. |
|
||||||||||||
|
Return true if we have a subcomponent by that tagname.
Definition at line 655 of file ModelComponent.C. References MC_RECURSE, and ModelComponent::Impl::subComps. Referenced by MbariResultViewer::MbariResultViewer(), Modelcomponent_Init(), and MPlayerWrapper::runfromSDL(). |
|
|
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 838 of file ModelComponent.C. References CLFATAL, ModelComponent::Impl::hasBeenExported, i, ModelOptionDef::name, ModelComponent::Impl::pinfos, and ModelComponent::Impl::started. |
|
||||||||||||||||||||
|
Make sure you call this if you have used the default constructor.
Definition at line 270 of file ModelComponent.C. References ModelComponent::Impl::dname, ModelComponent::Impl::mgr, ModelComponent::Impl::realm, and ModelComponent::Impl::tname. Referenced by ChannelBase::ChannelBase(), and SimModule::SimModule(). |
|
|
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 414 of file ModelComponent.C. References ModelComponent::Impl::mgr, and ModelComponent::Impl::subComps. Referenced by ModelManager::~ModelManager(). |
|
|
Get current number of subcomponents.
Definition at line 651 of file ModelComponent.C. References ModelComponent::Impl::subComps. Referenced by PrefsWindow::addPrefsForComponent(), Modelcomponent_Init(), and SimulationViewerCompress::start1(). |
|
||||||||||||||||
|
||||||||||||
|
Show our ModelParam internals and those of our subcomponents.
Definition at line 427 of file ModelComponent.C. References i, ModelComponent::Impl::pinfos, ModelComponent::Impl::realm, ModelComponent::Impl::subComps, and ModelComponent::Impl::tname. Referenced by SimulationViewerStats::save1(), and ModelManager::start1(). |
|
||||||||||||
|
Read params from the ParamMap. Throws a fatal error is we are started.
Definition at line 881 of file ModelComponent.C. References CLFATAL, ParamMap::getSubpmap(), ParamMap::hasParam(), i, ModelComponent::Impl::pinfos, ModelComponent::Impl::started, ModelComponent::Impl::subComps, and ModelComponent::Impl::tname. Referenced by ModelManagerDialog::handleApplyButton(), ModelManagerWizard::handleCancelButton(), ModelManagerDialog::handleCancelButton(), ModelManagerDialog::handleItemEdit(), ModelManager::loadConfig(), and ModelManager::parseCommandLine(). |
|
|
Get the realm.
Definition at line 502 of file ModelComponent.C. References ModelComponent::Impl::realm. Referenced by SimEventQueue::check(), SimEventQueue::registerSimCallbackClient(), SimEventQueue::registerSimReqHandlerClient(), and SimEventQueue::start1(). |
|
||||||||||||
|
Our parameters will register with us upon construction.
Implements ParamClient. Definition at line 931 of file ModelComponent.C. References ModelComponent::Impl::addParam(), and USE_MY_VAL. Referenced by Beowulf::paramChanged(). |
|
|
our parameters will register with us upon construction override of ParamClient's pure virtual function Implements ParamClient. Definition at line 925 of file ModelComponent.C. References ModelComponent::Impl::addParam(). |
|
|
Remove all our subcomponents.
Definition at line 617 of file ModelComponent.C. References ModelComponent::Impl::subComps. Referenced by SingleChannelBeoServer::check(), and Modelcomponent_Init(). |
|
|
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 599 of file ModelComponent.C. References CLFATAL, and ModelComponent::Impl::subComps. |
|
|
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 588 of file ModelComponent.C. References CLERROR, and ModelComponent::Impl::subComps. |
|
|
Remove a subcomponent by nub:ref.
Definition at line 611 of file ModelComponent.C. References removeSubComponent(). |
|
||||||||||||
|
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 562 of file ModelComponent.C. References CLERROR, and ModelComponent::Impl::subComps. Referenced by OutputFrameSeries::addFrameDest(), SingleChannelBeoServer::check(), TigsInputFrameSeries::paramChanged(), SimEventQueueConfigurator::paramChanged(), EyeTrackerConfigurator::paramChanged(), WinnerTakeAllConfigurator::paramChanged(), VisualCortexConfigurator::paramChanged(), VisualBufferConfigurator::paramChanged(), TaskRelevanceMapConfigurator::paramChanged(), SimulationViewerConfigurator::paramChanged(), SaliencyMapConfigurator::paramChanged(), SaccadeControllerHeadConfigurator::paramChanged(), SaccadeControllerEyeConfigurator::paramChanged(), RetinaConfigurator::paramChanged(), PrefrontalCortexConfigurator::paramChanged(), InferoTemporalConfigurator::paramChanged(), GistEstimatorConfigurator::paramChanged(), EyeHeadControllerConfigurator::paramChanged(), EnvSegmenterConfigurator::paramChanged(), AttentionGuidanceMapConfigurator::paramChanged(), AttentionGateConfigurator::paramChanged(), QtDisplayStream::paramChanged(), FrameGrabberConfigurator::paramChanged(), ContourChannel::paramChanged(), processWholeImage(), IntegerComplexChannel::removeAllSubChans(), ComplexChannel::removeAllSubChans(), IntegerComplexChannel::removeSubChan(), ComplexChannel::removeSubChan(), removeSubComponent(), MPlayerWrapper::runfromSDL(), FrameOfilt::setConfigInfo(), BufferedFrameIstream::setConfigInfo(), InputFrameSeries::setFrameSource(), MultiDirectFeedChannel::setNumChans(), and SingleChannel::setSubmapAlgorithm(). |
|
|
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.
Definition at line 979 of file ModelComponent.C. References CLFATAL, ModelComponent::Impl::dname, MC_RECURSE, reset1(), reset2(), ModelComponent::Impl::started, stop(), and ModelComponent::Impl::subComps. Referenced by Modelcomponent_Init(). |
|
|
This is called from within reset() before the subcomponents are reset.
Reimplemented in ChannelBase, DirectFeedChannel, FlickerChannel, IntegerFlickerChannel, IntegerSimpleChannel, SingleChannel, SingleOpponentChannel, MbariResultViewer, InputFrameSeries, OutputFrameSeries, AttentionGateStd, SaccadeController, ThresholdSaccadeController, SaliencyMapStd, SaliencyMapTrivial, SaliencyMapFast, ShapeEstimator, SimulationViewerNerdCam, SimulationViewerStd, TargetChecker, TaskRelevanceMapAdapter, TaskRelevanceMapKillStatic, TaskRelevanceMapKillN, TaskRelevanceMapGistClassify, TaskRelevanceMapTigs, TaskRelevanceMapTigs2, WinnerTakeAllAdapter, WinnerTakeAllStd, WinnerTakeAllTempNote, WinnerTakeAllStdOptim, Staircase, and SimEventQueue. Definition at line 470 of file ModelComponent.C. Referenced by reset(), SimEventQueue::reset1(), Staircase::reset1(), WinnerTakeAllAdapter::reset1(), TargetChecker::reset1(), SimulationViewerStd::reset1(), SimulationViewerNerdCam::reset1(), ShapeEstimator::reset1(), SaccadeController::reset1(), OutputFrameSeries::reset1(), InputFrameSeries::reset1(), MbariResultViewer::reset1(), and ChannelBase::reset1(). |
|
|
This is called from within reset() after the subcomponents are reset.
Definition at line 474 of file ModelComponent.C. Referenced by reset(). |
|
||||||||||||
|
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 1001 of file ModelComponent.C. References CLFATAL, ModelComponent::Impl::dname, MC_RECURSE, save1(), save2(), ModelComponent::Impl::started, stop(), and ModelComponent::Impl::subComps. |
|
|
This is called from within save() before the subcomponents save.
Reimplemented in AttentionGuidanceMap, AttentionGuidanceMapSC, RetinaStd, RetinaSpaceVariant, RetinaOSG, SimulationViewerEyeMvt, SimulationViewerNerdCam, SimulationViewerStats, SimulationViewerStd, SimulationViewerSurpCont, TaskRelevanceMapAdapter, TaskRelevanceMapKillStatic, TaskRelevanceMapTigs, TaskRelevanceMapTigs2, and WinnerTakeAllTempNote. Definition at line 478 of file ModelComponent.C. Referenced by save(). |
|
|
This is called from within save() after the subcomponents have saved.
Definition at line 482 of file ModelComponent.C. Referenced by save(). |
|
|
Change this component's descriptive name.
Definition at line 490 of file ModelComponent.C. References ModelComponent::Impl::dname. Referenced by FeatureExtractor::changeFxName(), ColorBandChannel::ColorBandChannel(), DirectFeedChannel::DirectFeedChannel(), DirectionChannel::DirectionChannel(), DisparityChannel::DisparityChannel(), GaborChannel::GaborChannel(), IntegerDirectionChannel::IntegerDirectionChannel(), IntensityChannel::IntensityChannel(), JunctionChannel::JunctionChannel(), MSTChannel::MSTChannel(), OrientationChannel::OrientationChannel(), Deinterlacer::setDelegate(), and SingleChannelSurprise< SMODEL >::SingleChannelSurprise(). |
|
|
Set our manager.
Definition at line 1030 of file ModelComponent.C. References ASSERT, and ModelComponent::Impl::mgr. Referenced by ModelManager::ModelManager(). |
|
||||||||||||||||
|
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.
Definition at line 752 of file ModelComponent.C. References ModelComponent::Impl::findMatchingParams(), GVX_ERR_CONTEXT, i, LFATAL, rutz::sfmt(), and ModelComponent::Impl::started. Referenced by SSCMainForm::lineEditBaudrate_returnPressed(), SSCMainForm::lineEditSerDev_returnPressed(), and ModelParamBatch::restoreValues(). |
|
||||||||||||||||||||
|
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.
Definition at line 699 of file ModelComponent.H. References setModelParamValAux(). |
|
||||||||||||||||
|
Auxiliary implementation function for setModelParamVal().
Definition at line 1043 of file ModelComponent.C. References ModelComponent::Impl::findMatchingParams(), GVX_ERR_CONTEXT, i, LFATAL, rutz::sfmt(), and ModelComponent::Impl::started. Referenced by ModelParamBatch::installValues(), and setModelParamVal(). |
|
|
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 506 of file ModelComponent.C. References CLFATAL, ModelComponent::Impl::realm, started(), and ModelComponent::Impl::subComps. |
|
|
Change this component's tag name.
Definition at line 498 of file ModelComponent.C. References ModelComponent::Impl::tname. Referenced by FeatureExtractor::changeFxName(), ColorBandChannel::ColorBandChannel(), DirectFeedChannel::DirectFeedChannel(), DirectionChannel::DirectionChannel(), DisparityChannel::DisparityChannel(), GaborChannel::GaborChannel(), IntegerDirectionChannel::IntegerDirectionChannel(), IntensityChannel::IntensityChannel(), JunctionChannel::JunctionChannel(), Modelcomponent_Init(), MSTChannel::MSTChannel(), OrientationChannel::OrientationChannel(), Deinterlacer::setDelegate(), and SingleChannelSurprise< SMODEL >::SingleChannelSurprise(). |
|
|
Start the component. This will start the component by triggering the following sequence of actions:
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. Definition at line 302 of file ModelComponent.C. References ASSERT, CLDEBUG, CLFATAL, ModelComponent::Impl::dname, GVX_ERR_CONTEXT, ModelComponent::Impl::hasBeenExported, ModelComponent::Impl::mgr, rutz::sfmt(), start1(), start2(), ModelComponent::Impl::started, ModelComponent::Impl::subComps, and tagName(). Referenced by BeoSub::ApproachPipeLine(), BeoSub::ApproachRedLight(), BeoSub::CenterBin(), BeoSub::FollowPipeLine(), RobotBrainStimulator::getDistanceAngle(), PingSonar::getDists(), WinnerTakeAllStdOptim::integrate(), SSCMainForm::lineEditBaudrate_returnPressed(), SSCMainForm::lineEditSerDev_returnPressed(), V2::ll_angle(), BeoSub::LookForRedLight(), main(), Modelcomponent_Init(), lobot::ModelManagerStarter::ModelManagerStarter(), pressKey(), BeoSub::PushRedLight(), ModelRun::run(), run_master(), run_slave(), IRobotSimService::start(), SimulationViewerService::start(), RetinaService::start(), MissileLauncherService::start(), Publisher2Service::start(), and Publisher1Service::start(). |
|
|
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, DisparityChannel, DKLcolorChannel, GaborChannel, ImagizeColorChannel, IntegerComplexChannel, IntegerDirectionChannel, IntegerRawVisualCortex, IntegerSimpleChannel, MultiConvolveChannel, PedestrianChannel, RawVisualCortex, SingleChannel, StereoChannel, TemplateMatchChannel, SaliencyMT, EventLog, ModelManager, CudaSaliency, RegSaliency, SaliencyMT, BeeSTEM, BeoChip, DC1394Grabber2, GPS_USGlobalSat_EM_408, HTTPClient, IEEE1394grabber, IMU_MicroStrain_3DM_GX2, JoyStick, ParPort, RadioDecoder, RTSPGrabber, V4Lgrabber, VCC4, WiiMote, XCgrabber, XCgrabberFlex, SimpleEyeHeadController, EyeTrackerEyeHeadController, GistEstimatorGen, GistEstimatorStd, InferoTemporalStd, InferoTemporalHmax, InferoTemporalSalBayes, PrefrontalCortexSB, Retina, RetinaToWorld, ThresholdSaccadeController, SimulationViewerCompress, SimulationViewerEyeMvt, SimulationViewerEyeMvt2, SimulationViewerEyeSim, TargetChecker, TaskRelevanceMapKillN, VisualBufferStd, VisualCortexEyeMvt, EyeTracker, EyeTrackerDML, EyeTrackerEyeLink, EyeTrackerISCAN, EyeTrackerTIL, SceneRec, BeoLogger, BeoGPS, FaceDetector, Beobot2_GistSalLocalizerMasterI, Beobot2_GistSalLocalizerWorkerI, Beobot2GistSalMasterI, LRF_Occupancy, Gist_Navigation, Hack_Navigation, ND_Navigation, QT_Navigation, HeliPose, RobotBrainStimulator, ScorbotController, SubController, SimEventQueue, SimModule, SingleChannelSurprise< SMODEL >, SaliencyMapFeatureExtractor, and CoerceVideoFormatOfilt. Definition at line 454 of file ModelComponent.C. Referenced by start(), SimModule::start1(), and ContourChannel::start1(). |
|
|
This is called from within start() after the subcomponents have started.
Reimplemented in ArmController, ArmSim, RobotArm, BeobotCamera, BeoBotSim, BeoSubDepthSensor, BeoSubIMU, BeoSubOneBal, BeoSubSim, BeoSubTwoBal, SeaBee, SubSim, TCPcommunicator, ComplexChannel, DirectionChannel, IntegerComplexChannel, ModelManager, PIDTuner, AudioGrabber, AudioMixer, BeoHead, BeoMonkey, DiskDataStream, GPS, HMR3300, IMU_SFE_Atomic, Pelco, RadioDecoder, Scorbot, Serial, SerialAdvanced, SpeechSynth, Visca, WiiMote, GeneralGUI, SDLdisplay, ImageShuttleI, VisualTracker, HippocampusI, PrimaryMotorCortexI, PTZI, NeoBrain, NeoBrain, RetinaStd, RetinaSpaceVariant, RetinaOSG, SimulationViewerNerdCam, SimulationViewerRecStats, SimulationViewerStats, SimulationViewerStd, ObjRec, ObjRecBOF, ObjRecHMax, ObjRecSalBayes, ObjRecSPM, EyeSFile, EyeTrackerDML, EyeTrackerISCAN, EyeTrackerTIL, Staircase, StimController, BeoHawkSim, HarrierSim, HeliPose, IRobotSim, NavBot, PWiiController, RobotBrainComponent, Rovio, BeeStemSim, SubController, SubGUI, FeatureExtractor, Context, TigsJob, and BobDeinterlacer. Definition at line 458 of file ModelComponent.C. Referenced by start(), BobDeinterlacer::start2(), and EyeTrackerISCAN::start2(). |
|
|
Did we already get a call to start()?
Definition at line 383 of file ModelComponent.C. References ModelComponent::Impl::started. Referenced by TCPcommunicator::contact(), BiasImageForm::evolveBrain(), evolveBrain(), ModelManagerControl::exitPressed(), SingleChannel::killCaches(), IntegerSimpleChannel::killCaches(), Modelcomponent_Init(), Beowulf::requestNode(), OutputMbariFrameSeries::setFileStem(), setRealm(), and ModelManagerControl::start_or_stop(). |
|
|
Stop the component. This will stop the component by triggering the following sequence of actions:
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, and Rovio. Definition at line 387 of file ModelComponent.C. References CLDEBUG, CLFATAL, ModelComponent::Impl::dname, GVX_ERR_CONTEXT, rutz::sfmt(), ModelComponent::Impl::started, stop1(), stop2(), ModelComponent::Impl::subComps, and tagName(). Referenced by SimEventQueue::clear(), MichelsonChannel::doInput(), SimEventQueueDebug::evolve(), BeoLRF::evolve(), ModelManagerControl::exitPressed(), WinnerTakeAllTempNote::getV(), WinnerTakeAllStd::getV(), WinnerTakeAllTempNote::getVth(), IEEE1394grabber::grabPrealloc(), WinnerTakeAllTempNote::inhibit(), WinnerTakeAllStd::inhibit(), WinnerTakeAllTempNote::input(), WinnerTakeAllStd::input(), SaliencyMapStd::input(), SSCMainForm::lineEditBaudrate_returnPressed(), SSCMainForm::lineEditSerDev_returnPressed(), main(), Modelcomponent_Init(), SimEventQueue::post(), SimEventQueue::printCallbacks(), SimEventQueue::prune(), RandomInput::readFrame(), GameOfLifeInput::readFrame(), SimEventQueue::registerSimCallbackClient(), SimEventQueue::registerSimReqHandlerClient(), SimEventQueue::request(), reset(), ModelRun::run(), FeatureExtractor::save(), save(), LowLevelEncoderMap::stop2(), ~ModelComponent(), ModelManager::~ModelManager(), and lobot::ModelManagerStarter::~ModelManagerStarter(). |
|
|
This is called from within stop() before the subcomponents stop.
Reimplemented in BeobotCamera, BeoSubDepthSensor, BeoSubIMU, BeoSubOneBal, SeaBee, LeakDetector, TCPcommunicator, ModelManager, AudioGrabber, AudioMixer, DiskDataStream, GPS, GPS_USGlobalSat_EM_408, HMR3300, IMU_MicroStrain_3DM_GX2, JoyStick, RadioDecoder, Scorbot, VCC4, WiiMote, SDLdisplay, PrimaryMotorCortexI, InferoTemporalStd, InferoTemporalHmax, InferoTemporalSalBayes, SimulationViewerCompress, SimulationViewerEyeMvt, SimulationViewerEyeMvt2, SimulationViewerEyeSim, EyeSFile, EyeTrackerEyeLink, Staircase, StimController, HeliPose, RobotBrainComponent, FeatureExtractor, and Context. Definition at line 462 of file ModelComponent.C. Referenced by stop(), EyeTrackerEyeLink::stop1(), SimulationViewerEyeSim::stop1(), and SimulationViewerEyeMvt2::stop1(). |
|
|
This is called from within stop() after the subcomponents have stopped.
Reimplemented in SaliencyMT, BeobotBrainMT, GSlocalizer, ComplexChannel, IntegerComplexChannel, IntegerRawVisualCortex, IntegerSimpleChannel, RawVisualCortex, SingleChannel, SaliencyMT, EventLog, CudaSaliency, RegSaliency, SaliencyMT, BeeSTEM, BeoChip, DC1394Grabber2, HTTPClient, IEEE1394grabber, ParPort, RTSPGrabber, Serial, SerialAdvanced, SimpleLED, V4Lgrabber, XCgrabber, XCgrabberFlex, InputMPEGStream, SimulationViewerRecStats, SimulationViewerStats, SceneRec, PrimaryMotorCortexI, Rovio, BobDeinterlacer, and LowLevelEncoderMap. Definition at line 466 of file ModelComponent.C. Referenced by stop(), LowLevelEncoderMap::stop2(), and BobDeinterlacer::stop2(). |
|
||||||||||||
|
Access a sub-component by tagname.
Definition at line 631 of file ModelComponent.C. References CLFATAL, MC_RECURSE, and ModelComponent::Impl::subComps. |
|
|
Access a sub-component by index.
Definition at line 621 of file ModelComponent.C. References CLFATAL, ModelComponent::Impl::dname, and ModelComponent::Impl::subComps. Referenced by PrefsWindow::addPrefsForComponent(), biasImage(), evolveBrain(), SceneUnderstandingForm::getDescriptor(), SceneUnderstandingForm::init(), Modelcomponent_Init(), SceneUnderstanding::SceneUnderstanding(), SceneUnderstandingForm::setBiasImage(), SceneUnderstandingForm::showTraj(), SimModule::start1(), and SimulationViewerCompress::start1(). |
|
|
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 494 of file ModelComponent.C. References ModelComponent::Impl::tname. Referenced by ChannelMaps::ChannelMaps(), ComplexChannel::combineOutputs(), IntegerComplexChannel::combineOutputsInt(), SingleChannel::combineSubMaps(), HueChannel::combineSubMaps(), compareChannels(), IntegerComplexChannel::Impl::findSubchanInfo(), ComplexChannel::Impl::findSubchanInfo(), IntegerRawVisualCortex::getChannelOutputMap(), IntegerSimpleChannel::getOutputInt(), SingleChannel::getRawCSmap(), IntegerSimpleChannel::getRawCSmapInt(), IntegerSimpleChannel::getSubmapInt(), SingleChannel::getSubmapNameShort(), IntegerSimpleChannel::getSubmapNameShort(), SingleChannelBeo::handleInput(), Modelcomponent_Init(), SingleChannel::postProcessMap(), InputFrameSeries::Impl::readFrame(), SpectralResidualChannel::saveResults(), SingleChannel::saveResults(), IntegerSimpleChannel::saveResults(), IntegerComplexChannel::saveResults(), ComplexChannel::saveResults(), SingleChannel::saveStats(), ContourChannel::saveStats(), start(), stop(), SimReq::toString(), SimEvent::toString(), OutputFrameSeries::update(), MaskBiaser::visitChannelBase(), BayesianBiaser::visitChannelBase(), OptimalGainsFinder::visitChannelBase(), JetSpecFiller::visitChannelBase(), JetFiller::visitChannelBase(), GuidedSearchBiaser::visitChannelBase(), WeightFinder::visitChannelBase(), FeatureBiaser::visitChannelBase(), ChannelVisitorInstallFacet< CFS, CFC >::visitChannelBase(), GuidedSearchBiaser::visitComplexChannel(), OptimalGainsFinder::visitSingleChannel(), GuidedSearchBiaser::visitSingleChannel(), IntegerComplexChannel::writeTo(), and ComplexChannel::writeTo(). |
|
|
our parameters will un-register with us upon destruction override of ParamClient's pure virtual function Implements ParamClient. Definition at line 944 of file ModelComponent.C. References CLERROR, i, ModelComponent::Impl::mgr, ModelComponent::Impl::pinfos, and OptionManager::unRequestOption(). Referenced by Beowulf::Beowulf(), and Beowulf::paramChanged(). |
|
|
Write params to the ParamMap. Prints out a warning message if we are started. Definition at line 903 of file ModelComponent.C. References i, ModelComponent::Impl::pinfos, ParamMap::putSubpmap(), ModelComponent::Impl::subComps, and ModelComponent::Impl::tname. Referenced by SingleChannelBeo::handleInput(), ModelManagerDialog::handleItemEdit(), ModelManagerWizard::init(), ModelManagerDialog::init(), and ModelManager::saveConfig(). |
1.4.4