LoMetlogLoader.H

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