LTI-Lib latest version v1.9 - last update 10 Apr 2010

ltiStatus.h

00001 /*
00002  * Copyright (C) 2004, 2005, 2006
00003  * Lehrstuhl fuer Technische Informatik, RWTH-Aachen, Germany
00004  *
00005  * This file is part of the LTI-Computer Vision Library (LTI-Lib)
00006  *
00007  * The LTI-Lib is free software; you can redistribute it and/or
00008  * modify it under the terms of the GNU Lesser General Public License (LGPL)
00009  * as published by the Free Software Foundation; either version 2.1 of
00010  * the License, or (at your option) any later version.
00011  *
00012  * The LTI-Lib is distributed in the hope that it will be
00013  * useful, but WITHOUT ANY WARRANTY; without even the implied warranty
00014  * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00015  * GNU Lesser General Public License for more details.
00016  *
00017  * You should have received a copy of the GNU Lesser General Public
00018  * License along with the LTI-Lib; see the file LICENSE.  If
00019  * not, write to the Free Software Foundation, Inc., 59 Temple Place -
00020  * Suite 330, Boston, MA 02111-1307, USA.
00021  */
00022 
00023 
00024 /*----------------------------------------------------------------
00025  * project ....: LTI Digital Image/Signal Processing Library
00026  * file .......: ltiStatus.h
00027  * authors ....: 
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 01.07.04
00030  * revisions ..: $Id: ltiStatus.h,v 1.3 2006/02/07 18:10:43 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_STATUS_H_
00034 #define _LTI_STATUS_H_
00035 
00036 #ifdef _LTI_MSC_6
00037 #pragma warning(disable:4786)
00038 #endif
00039 
00040 namespace lti {
00041   /**
00042    * Base class for all lti objects that can have a status text.
00043    * The original interface of this class was previously embedded
00044    * in the lti::functor class, but has been moved in a separate class
00045    * in order to allow objects other than functors to have a status.
00046    */
00047   class status {
00048   public:
00049     /**
00050      * default constructor
00051      */
00052     status();
00053 
00054     /**
00055      * destructor
00056      */
00057     virtual ~status();
00058     /**
00059      * return the last message set with setStatusString().  This will
00060      * never return 0.  If no status-string has been set yet an empty string
00061      * (pointer to a string with only the char(0)) will be returned.
00062      */
00063     virtual const char* getStatusString() const;
00064 
00065     /**
00066      * set a status string.
00067      *
00068      * @param msg the const string to be reported next time by
00069      * getStatusString(). The given string will be copied.
00070      * This message will be usually set within the apply methods to indicate
00071      * an error cause.
00072      *
00073      * Note that the change of the status string is not considered as
00074      * a change in the functor status.
00075      */
00076     virtual void setStatusString(const char* msg) const;
00077 
00078     /**
00079      * append a message to the current status string. Take care to
00080      * reset the status string by calling setStatusString() for each
00081      * call of an apply() or similar method. appendStatusString()
00082      * should only be used after setStatusString() has been called.
00083      *
00084      * @param msg message to be appended to the current status string.
00085      *
00086      * Note that the change of the status string is not considered as
00087      * a change in the functor status.
00088      */
00089     virtual void appendStatusString(const char* msg) const;
00090 
00091     /**
00092      * append an integer value to the current status string. Take care
00093      * to reset the status string by calling setStatusString() for
00094      * each call of an apply() or similar method. appendStatusString()
00095      * should only be used after setStatusString() has been called.
00096      *
00097      * @param msg integer value to be appended to the current status
00098      * string.
00099      *
00100      * Note that the change of the status string is not considered as
00101      * a change in the functor status.
00102      */
00103     virtual void appendStatusString(const int& msg) const;
00104 
00105     /**
00106      * append a double value to the current status string. Take care
00107      * to reset the status string by calling setStatusString() for
00108      * each call of an apply() or similar method. appendStatusString()
00109      * should only be used after setStatusString() has been called.
00110      *
00111      * @param msg double value to be appended to the current status
00112      * string.
00113      *
00114      * Note that the change of the status string is not considered as
00115      * a change in the functor status.
00116      */
00117     virtual void appendStatusString(const double&  msg) const;
00118 
00119     /**
00120      * Append the status string of another %functor to this functors
00121      * status string. To achieve better readability of the resulting
00122      * message a new line is started with the other functor's name and
00123      * the message.
00124      *
00125      * @param other %functor whose status string is to be append to this
00126      *        status string.
00127      *
00128      * Note that the change of the status string is not considered as
00129      * a change in the functor status.
00130      */
00131     virtual void appendStatusString(const status& other) const;
00132 
00133   private:
00134     /**
00135      * the status string written with setStatusString
00136      */
00137     mutable char* statusString;
00138 
00139     /**
00140      * the empty string returned if the statusString is empty
00141      */
00142     static const char *const emptyString;
00143 
00144   };
00145 }
00146 
00147 #endif

Generated on Sat Apr 10 15:26:15 2010 for LTI-Lib by Doxygen 1.6.1