Main MRPT website > C++ reference
MRPT logo

CLog.h

Go to the documentation of this file.
00001 /* +---------------------------------------------------------------------------+
00002    |          The Mobile Robot Programming Toolkit (MRPT) C++ library          |
00003    |                                                                           |
00004    |                   http://mrpt.sourceforge.net/                            |
00005    |                                                                           |
00006    |   Copyright (C) 2005-2011  University of Malaga                           |
00007    |                                                                           |
00008    |    This software was written by the Machine Perception and Intelligent    |
00009    |      Robotics Lab, University of Malaga (Spain).                          |
00010    |    Contact: Jose-Luis Blanco  <jlblanco@ctima.uma.es>                     |
00011    |                                                                           |
00012    |  This file is part of the MRPT project.                                   |
00013    |                                                                           |
00014    |     MRPT is free software: you can redistribute it and/or modify          |
00015    |     it under the terms of the GNU General Public License as published by  |
00016    |     the Free Software Foundation, either version 3 of the License, or     |
00017    |     (at your option) any later version.                                   |
00018    |                                                                           |
00019    |   MRPT is distributed in the hope that it will be useful,                 |
00020    |     but WITHOUT ANY WARRANTY; without even the implied warranty of        |
00021    |     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         |
00022    |     GNU General Public License for more details.                          |
00023    |                                                                           |
00024    |     You should have received a copy of the GNU General Public License     |
00025    |     along with MRPT.  If not, see <http://www.gnu.org/licenses/>.         |
00026    |                                                                           |
00027    +---------------------------------------------------------------------------+ */
00028 
00029 /***************************************************************
00030  * Name:      Log.h
00031  * Purpose:   Defines the Log class
00032  * Author:    Vicente Arévalo (varevalo@ctima.uma.es)
00033  * Created:   2009-09-23
00034  * Copyright: mapir (http://babel.isa.uma.es/mapir)
00035  * License:
00036  **************************************************************/
00037 
00038 #ifndef CLog_H
00039 #define CLog_H
00040 
00041 #include <mrpt/utils/utils_defs.h>
00042 #include <mrpt/utils/CStringList.h>
00043 #include <mrpt/synch/CCriticalSection.h>
00044 
00045 namespace mrpt
00046 {
00047         namespace utils
00048         {
00049                 /** A decorator of CStringList special for keeping logs.
00050                   * \note Class written by Vicente Arevalo
00051                   */
00052                 class BASE_IMPEXP CLog : protected mrpt::utils::CStringList
00053                 {
00054                 public:
00055                         CLog();
00056                         virtual ~CLog();
00057 
00058                         /** push a message
00059                         */
00060                         void pushMessages(std::string message);
00061 
00062                         /** push a list of messages
00063                         */
00064                         void pushMessages(mrpt::utils::CStringList messages);
00065 
00066                         /** pop the current unpublished message (clear the content of "message")
00067                         */
00068                         void popMessages(std::string& message);
00069 
00070                         /** pop all unpublished messages (clear the content of "messages")
00071                         */
00072                         void popMessages(mrpt::utils::CStringList& messages);
00073 
00074                         /** get messages from "begin" to "end" (clear the content of "messages")
00075                         */
00076                         void getMessages(size_t begin, size_t end, mrpt::utils::CStringList& messages);
00077 
00078                         /** save the current log
00079                         */
00080                         void saveLog(std::string name);
00081 
00082                         /** load a log (clear the previous content)
00083                         */
00084                         void loadLog(std::string name);
00085 
00086                         /** clear the log content
00087                         */
00088                         void clearLog();
00089 
00090                         /** change the last unpublished message. IMPORTANT: this function should
00091                                 not be used directly.
00092                         */
00093                         void setLastMessageIndex(size_t index);
00094 
00095                         /** get the current unpublished message index.
00096                         */
00097                         size_t getLastMessageIndex();
00098 
00099                 protected:
00100 
00101                         mrpt::synch::CCriticalSection semaphore;
00102 
00103                         size_t last;
00104                 };
00105         }
00106 }
00107 
00108 #endif // CLog_H
00109 



Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN:exported at Tue Jan 25 21:56:31 UTC 2011