SimEventQueueDebug.C

Go to the documentation of this file.
00001 /*!@file Simulation/SimEventQueueDebug.C Dispatch simulation events */
00002 
00003 // //////////////////////////////////////////////////////////////////// //
00004 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
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/Simulation/SimEventQueueDebug.C $
00035 // $Id: SimEventQueueDebug.C 11082 2009-04-02 23:31:50Z itti $
00036 //
00037 
00038 #include "Simulation/SimEventQueueDebug.H"
00039 
00040 #include "Simulation/SimEvents.H"  // for SimEventBreak
00041 #include "rutz/demangle.h"
00042 
00043 // ######################################################################
00044 SimEventQueueDebug::SimEventQueueDebug(OptionManager& mgr,
00045                                        const std::string& descrName,
00046                                        const std::string& tagName,
00047                                        const SimTime starttime) :
00048   SimEventQueue(mgr, descrName, tagName, starttime)
00049 { }
00050 
00051 // ######################################################################
00052 SimEventQueueDebug::~SimEventQueueDebug()
00053 { }
00054 
00055 // ######################################################################
00056 SimStatus SimEventQueueDebug::evolve()
00057 {
00058   LINFO("*** Queue contents before evolve() at t=%fms:", t.msecs());
00059 
00060   SeqData::const_iterator itr = itsQueue.begin(), stop = itsQueue.end();
00061   while (itr != stop) {
00062     const char *rname = itr->first.c_str();
00063     const RealmData *rd = &(itr->second);
00064     const SeqEntryVec *seq = &(rd->events);
00065 
00066     if (seq->size()) {
00067         SeqEntryVec::const_iterator e = seq->begin(), stop = seq->end();
00068 
00069         while (e != stop) {
00070             LINFO("*** [%s] %s posted at t=%fms [done by: %s]",
00071                   rname, e->second->toString().c_str(),
00072                   e->first.msecs(), e->second->getDoneList().c_str());
00073             ++e;
00074         }
00075     } else LINFO("*** [Queue is empty]");
00076 
00077     ++itr;
00078   }
00079   return SimEventQueue::evolve();
00080 }
00081 
00082 // ######################################################################
00083 void SimEventQueueDebug::clear()
00084 {
00085   LINFO("Clearing the event queue...");
00086   SimEventQueue::clear();
00087 }
00088 
00089 // ######################################################################
00090 void SimEventQueueDebug::resetTime(const SimTime& tim)
00091 {
00092   LINFO("Resetting time to %fms and clearing queue...", tim.msecs());
00093   SimEventQueue::resetTime(tim);
00094 }
00095 
00096 // ######################################################################
00097 void SimEventQueueDebug::prune(const SimTime& tt)
00098 {
00099   LINFO("Pruning events with t < %fms", tt.msecs());
00100   SimEventQueue::prune(tt);
00101 }
00102 
00103 // ######################################################################
00104 void SimEventQueueDebug::postHelper(const std::type_info& etype,
00105                                     const rutz::shared_ptr<SimEvent>& e)
00106 {
00107   LINFO("%s, t=%fms", e->toString().c_str(), t.msecs());
00108 }
00109 
00110 
00111 // ######################################################################
00112 void
00113 SimEventQueueDebug::checkHelper(const std::type_info& etype,
00114                                 const rutz::shared_ptr<SimEvent>& e,
00115                                 const SimModule* caller,
00116                                 const SimEventQueueFlag flags,
00117                                 const SimModule* eventsrc)
00118 {
00119   if (eventsrc)
00120     LINFO("%s:%s: Returning [%s] (request narrowed down to %s)",
00121           caller ? caller->descriptiveName().c_str() :
00122           "[Anonymous Caller]", rutz::demangled_name(etype),
00123           e.is_valid() ? e->toString().c_str() : "No match",
00124           eventsrc->descriptiveName().c_str());
00125   else
00126     LINFO("%s:%s: Returning [%s]",
00127           caller ? caller->descriptiveName().c_str() :
00128           "[Anonymous Caller]", rutz::demangled_name(etype),
00129           e.is_valid() ? e->toString().c_str() : "No match");
00130 
00131 }
00132 
00133 // ######################################################################
00134 /* So things look consistent in everyone's emacs... */
00135 /* Local Variables: */
00136 /* mode: c++ */
00137 /* indent-tabs-mode: nil */
00138 /* End: */
Generated on Sun May 8 08:42:18 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3