LoBaylogAnalyzer.H

00001 /**
00002    \file  Robots/LoBot/control/LoBaylogAnalyzer.H
00003    \brief A class for analyzing the metrics logs for the Bayesian
00004    time-to-impact prediction experiments.
00005 
00006    This file defines a class that loads and parses all the Robolocust
00007    metrics logs for a dataset containing the logs for a Bayesian
00008    time-to-impact prediction experiment. The logs are analyzed and then
00009    the results for that dataset written out to a file.
00010 
00011    Each analyzer runs in its own thread. The lobay program uses this
00012    facility to process multiple datasets in parallel.
00013 */
00014 
00015 // //////////////////////////////////////////////////////////////////// //
00016 // The iLab Neuromorphic Vision C++ Toolkit - Copyright (C) 2000-2005   //
00017 // by the University of Southern California (USC) and the iLab at USC.  //
00018 // See http://iLab.usc.edu for information about this project.          //
00019 // //////////////////////////////////////////////////////////////////// //
00020 // Major portions of the iLab Neuromorphic Vision Toolkit are protected //
00021 // under the U.S. patent ``Computation of Intrinsic Perceptual Saliency //
00022 // in Visual Environments, and Applications'' by Christof Koch and      //
00023 // Laurent Itti, California Institute of Technology, 2001 (patent       //
00024 // pending; application number 09/912,225 filed July 23, 2001; see      //
00025 // http://pair.uspto.gov/cgi-bin/final/home.pl for current status).     //
00026 // //////////////////////////////////////////////////////////////////// //
00027 // This file is part of the iLab Neuromorphic Vision C++ Toolkit.       //
00028 //                                                                      //
00029 // The iLab Neuromorphic Vision C++ Toolkit is free software; you can   //
00030 // redistribute it and/or modify it under the terms of the GNU General  //
00031 // Public License as published by the Free Software Foundation; either  //
00032 // version 2 of the License, or (at your option) any later version.     //
00033 //                                                                      //
00034 // The iLab Neuromorphic Vision C++ Toolkit is distributed in the hope  //
00035 // that it will be useful, but WITHOUT ANY WARRANTY; without even the   //
00036 // implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
00037 // PURPOSE.  See the GNU General Public License for more details.       //
00038 //                                                                      //
00039 // You should have received a copy of the GNU General Public License    //
00040 // along with the iLab Neuromorphic Vision C++ Toolkit; if not, write   //
00041 // to the Free Software Foundation, Inc., 59 Temple Place, Suite 330,   //
00042 // Boston, MA 02111-1307 USA.                                           //
00043 // //////////////////////////////////////////////////////////////////// //
00044 //
00045 // Primary maintainer for this file: mviswana usc edu
00046 // $HeadURL: svn://isvn.usc.edu/software/invt/trunk/saliency/src/Robots/LoBot/baylog/LoBaylogAnalyzer.H $
00047 // $Id: LoBaylogAnalyzer.H 14083 2010-09-30 13:59:37Z mviswana $
00048 //
00049 
00050 #ifndef LOBOT_BAYLOG_ANALYZER_DOT_H
00051 #define LOBOT_BAYLOG_ANALYZER_DOT_H
00052 
00053 //------------------------------ HEADERS --------------------------------
00054 
00055 // lobot headers
00056 #include "Robots/LoBot/thread/LoThread.H"
00057 
00058 //----------------------------- NAMESPACE -------------------------------
00059 
00060 namespace lobot {
00061 
00062 //------------------------- CLASS DEFINITION ----------------------------
00063 
00064 // Forward declarations
00065 class DirList ;
00066 
00067 /**
00068    \class lobot::BaylogAnalyzer
00069    \brief A class for loading and parsing the metrics logs for a Bayesian
00070    TTI prediction dataset in a separate thread.
00071 
00072    This class implements an interface for loading and parsing all the
00073    metrics logs for an entire Bayesian time-to-impact prediction dataset.
00074    Analyzing one such dataset is completely unrelated to analyzing
00075    another. Thus, multiple datasets can be processed in parallel.
00076    Consequently, this analyzer object does its thing in a separate
00077    thread.
00078 */
00079 class BaylogAnalyzer : private Thread {
00080 public:
00081    /// This class uses the "named constructor" idiom to ensure that
00082    /// clients not create instances of it on the stack. This method is
00083    /// the named constructor (aka factory method).
00084    ///
00085    /// When clients create these analyzers, they should supply a list of
00086    /// directories containing the datasets that need to be analyzed. Upon
00087    /// creation, analyzers will automatically launch a new thread to
00088    /// perform the dataset analysis and will use the client-supplied
00089    /// directory list to figure out which dataset is next in line for
00090    /// processing.
00091    ///
00092    /// NOTE: This named constructor is the only publically accessible
00093    /// thing in this class. Once an analyzer is created, the rest of its
00094    /// work proceeds automatically. Clients can either continue on with
00095    /// their business or choose to wait for all the analyzer threads to
00096    /// complete.
00097    static BaylogAnalyzer* create(const DirList&) ;
00098 
00099 private:
00100    /// Private constructor because only the factory method or named
00101    /// constructor can be used to instantiate this class.
00102    BaylogAnalyzer(const DirList&) ;
00103 
00104    /// This member keeps track of the list of datasets to be loaded and
00105    /// which one is next in line. We can think of this list as the input
00106    /// to this analyzer class.
00107    const DirList& m_dirs ;
00108 
00109    // Since we're using private inheritance, Thread::start() won't be
00110    // visible to subclasses without this explicit say-so.
00111    using Thread::start ;
00112 
00113    /// This method implements the dataset analysis functionality. It
00114    /// executes in a separate thread.
00115    void run() ;
00116 
00117    // Prevent copy and assignment
00118    BaylogAnalyzer(const BaylogAnalyzer&) ;
00119    BaylogAnalyzer& operator=(const BaylogAnalyzer&) ;
00120 } ;
00121 
00122 //-----------------------------------------------------------------------
00123 
00124 } // end of namespace encapsulating this file's definitions
00125 
00126 #endif
00127 
00128 /* So things look consistent in everyone's emacs... */
00129 /* Local Variables: */
00130 /* indent-tabs-mode: nil */
00131 /* End: */
Generated on Sun May 8 08:05:44 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3