00001 /* +---------------------------------------------------------------------------+ 00002 | The Mobile Robot Programming Toolkit (MRPT) C++ library | 00003 | | 00004 | http://www.mrpt.org/ | 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 * \ingroup mrpt_base_grp 00052 */ 00053 class BASE_IMPEXP CLog : protected mrpt::utils::CStringList 00054 { 00055 public: 00056 CLog(); 00057 virtual ~CLog(); 00058 00059 /** push a message 00060 */ 00061 void pushMessages(std::string message); 00062 00063 /** push a list of messages 00064 */ 00065 void pushMessages(mrpt::utils::CStringList messages); 00066 00067 /** pop the current unpublished message (clear the content of "message") 00068 */ 00069 void popMessages(std::string& message); 00070 00071 /** pop all unpublished messages (clear the content of "messages") 00072 */ 00073 void popMessages(mrpt::utils::CStringList& messages); 00074 00075 /** get messages from "begin" to "end" (clear the content of "messages") 00076 */ 00077 void getMessages(size_t begin, size_t end, mrpt::utils::CStringList& messages); 00078 00079 /** save the current log 00080 */ 00081 void saveLog(std::string name); 00082 00083 /** load a log (clear the previous content) 00084 */ 00085 void loadLog(std::string name); 00086 00087 /** clear the log content 00088 */ 00089 void clearLog(); 00090 00091 /** change the last unpublished message. IMPORTANT: this function should 00092 not be used directly. 00093 */ 00094 void setLastMessageIndex(size_t index); 00095 00096 /** get the current unpublished message index. 00097 */ 00098 size_t getLastMessageIndex(); 00099 00100 protected: 00101 00102 mrpt::synch::CCriticalSection semaphore; 00103 00104 size_t last; 00105 }; 00106 } 00107 } 00108 00109 #endif // CLog_H 00110
| Page generated by Doxygen 1.7.5 for MRPT 0.9.5 SVN: at Thu Oct 13 21:25:36 UTC 2011 |