SimulationViewerConfigurator.C

Go to the documentation of this file.
00001 /*!@file Neuro/SimulationViewerConfigurator.C pick a SimulationViewer */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2003   //
00005 // by the University of Southern California (USC) and the iLab at USC.  //
00006 // See http://iLab.usc.edu for information about this project.          //
00007 // //////////////////////////////////////////////////////////////////// //
00008 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00009 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00010 // in Visual Environments, and Applications'' by Christof Koch and      //
00011 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00012 // pending; application number 09/912,225 filed July 23, 2001; see      //
00013 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00014 // //////////////////////////////////////////////////////////////////// //
00015 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00016 //                                                                      //
00017 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00018 // redistribute it and/or modify it under the terms of the GNU General  //
00019 // Public License as published by the Free Software Foundation; either  //
00020 // version 2 of the License, or (at your option) any later version.     //
00021 //                                                                      //
00022 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00023 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00024 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00025 // PURPOSE.  See the GNU General Public License for more details.       //
00026 //                                                                      //
00027 // You should have received a copy of the GNU General Public License    //
00028 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00029 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00030 // Boston, MA 02111-1307 USA.                                           //
00031 // //////////////////////////////////////////////////////////////////// //
00032 //
00033 // Primary maintainer for this file: Laurent Itti <itti@usc.edu>
00034 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Neuro/SimulationViewerConfigurator.C $
00035 // $Id: SimulationViewerConfigurator.C 13657 2010-07-12 22:43:55Z beobot $
00036 //
00037 
00038 #include "Neuro/SimulationViewerConfigurator.H"
00039 #include "Component/OptionManager.H"
00040 #include "Neuro/NeuroOpts.H"
00041 #include "Neuro/SimulationViewer.H"
00042 #include "Neuro/SimulationViewerCompress.H"
00043 #include "Neuro/SimulationViewerEyeMvt.H"
00044 #include "Neuro/SimulationViewerEyeMvt2.H"
00045 #include "Neuro/SimulationViewerEyeMvtNeuro.H"
00046 #include "Neuro/SimulationViewerEyeRegion.H"
00047 #include "Neuro/SimulationViewerEyeSim.H"
00048 #include "Neuro/SimulationViewerStd.H"
00049 #include "Neuro/SimulationViewerStub.H"
00050 #include "Neuro/SimulationViewerSurpCont.H"
00051 #include "Neuro/SimulationViewerNerdCam.H"
00052 #include "Neuro/SimulationViewerStats.H"
00053 #include "Neuro/SimulationViewerRecStats.H"
00054 #include "Neuro/SimulationViewerHand.H"
00055 #include "Neuro/SimulationViewerEyeHand.H"
00056 
00057 // ######################################################################
00058 // ######################################################################
00059 // ######################################################################
00060 SimulationViewerConfigurator::
00061 SimulationViewerConfigurator(OptionManager& mgr,
00062                              const std::string& descrName,
00063                              const std::string& tagName) :
00064   ModelComponent(mgr, descrName, tagName),
00065   itsSVtype(&OPT_SimulationViewerType, this),
00066   itsSV(new SimulationViewerStub(mgr))
00067 {
00068   addSubComponent(itsSV);
00069 }
00070 
00071 // ######################################################################
00072 SimulationViewerConfigurator::~SimulationViewerConfigurator()
00073 {  }
00074 
00075 // ######################################################################
00076 nub::ref<SimulationViewer> SimulationViewerConfigurator::getSV() const
00077 { return itsSV; }
00078 
00079 // ######################################################################
00080 void SimulationViewerConfigurator::
00081 paramChanged(ModelParamBase* const param,
00082              const bool valueChanged,
00083              ParamClient::ChangeStatus* status)
00084 {
00085   ModelComponent::paramChanged(param, valueChanged, status);
00086 
00087   // was that a change of our baby's name?
00088   if (param == &itsSVtype) {
00089     // if we had one, let's unregister it (when we later reset() the
00090     // nub::ref, the current SimulationViewer will unexport its
00091     // command-line options):
00092     removeSubComponent(*itsSV);
00093 
00094     // instantiate a SV of the appropriate type:
00095     if (itsSVtype.getVal().compare("None") == 0
00096         || itsSVtype.getVal().compare("Stub") == 0) // "stub" SimulationViewer
00097       itsSV.reset(new SimulationViewerStub(getManager()));
00098     else if (itsSVtype.getVal().compare("Std") == 0)      // standard
00099       itsSV.reset(new SimulationViewerStd(getManager()));
00100     else if (itsSVtype.getVal().compare("Compress") == 0) // compression
00101       itsSV.reset(new SimulationViewerCompress(getManager()));
00102     else if (itsSVtype.getVal().compare("EyeMvt") == 0) // eye movements
00103       itsSV.reset(new SimulationViewerEyeMvt(getManager()));
00104     else if (itsSVtype.getVal().compare("EyeMvt2") == 0) // eye movements v 2.0
00105       itsSV.reset(new SimulationViewerEyeMvt2(getManager()));
00106     else if (itsSVtype.getVal().compare("EyeMvtNeuro") == 0) // eye mvt neuro
00107       itsSV.reset(new SimulationViewerEyeMvtNeuro(getManager()));
00108     else if (itsSVtype.getVal().compare("EyeRegion") == 0) // eye mvt region
00109       itsSV.reset(new SimulationViewerEyeRegion(getManager()));
00110     else if (itsSVtype.getVal().compare("EyeSim") == 0) // eye mvt simulation
00111       itsSV.reset(new SimulationViewerEyeSim(getManager()));
00112     else if (itsSVtype.getVal().compare("ASAC") == 0) // Surprise Control
00113       itsSV.reset(new SimulationViewerSurpCont(getManager()));
00114     else if (itsSVtype.getVal().compare("NerdCam") == 0) // Surprise Control
00115       itsSV.reset(new SimulationViewerNerdCam(getManager()));
00116     else if (itsSVtype.getVal().compare("Stats") == 0) // Stats
00117       itsSV.reset(new SimulationViewerStats(getManager()));
00118     else if (itsSVtype.getVal().compare("RecStats") == 0) // Stats
00119       itsSV.reset(new SimulationViewerRecStats(getManager()));
00120     else if (itsSVtype.getVal().compare("Hand") == 0) // Hand
00121       itsSV.reset(new SimulationViewerHand(getManager()));
00122     else if (itsSVtype.getVal().compare("EyeHand") == 0) // Hand
00123       itsSV.reset(new SimulationViewerEyeHand(getManager()));
00124     else
00125       LFATAL("Unknown SimulationViewer type %s", itsSVtype.getVal().c_str());
00126 
00127     // add our baby as a subcomponent of us so that it will become
00128     // linked to the manager through us (hopefully we are registered
00129     // with the manager), which in turn will allow it to export its
00130     // command-line options and get configured:
00131 
00132     addSubComponent(itsSV);
00133 
00134     // tell the SV to export its options:
00135     itsSV->exportOptions(MC_RECURSE);
00136 
00137     // some info message:
00138     LINFO("Selected SV of type %s", itsSVtype.getVal().c_str());
00139   }
00140 }
00141 
00142 
00143 // ######################################################################
00144 /* So things look consistent in everyone's emacs... */
00145 /* Local Variables: */
00146 /* indent-tabs-mode: nil */
00147 /* End: */
Generated on Sun May 8 08:41:04 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3