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

ltiClassName.h

00001 /*
00002  * Copyright (C) 1999, 2000, 2001, 2002, 2003, 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 .......: ltiClassName.h
00027  * authors ....: Jochen Wickel
00028  * organization: LTI, RWTH Aachen
00029  * creation ...: 01.04.99
00030  * revisions ..: $Id: ltiClassName.h,v 1.4 2006/02/07 18:07:19 ltilib Exp $
00031  */
00032 
00033 #ifndef _LTI_CLASSNAME_H_
00034 #define _LTI_CLASSNAME_H_
00035 
00036 #include "ltiObject.h"
00037 #include <string>
00038 
00039 namespace lti {
00040   /**
00041    * Provides methods for getting the class names of lti::objects
00042    */
00043   class className : public object {
00044   public:
00045     /**
00046      * default constructor
00047      */
00048     className();
00049 
00050     /**
00051      * destructor
00052      */
00053     ~className();
00054 
00055     /**
00056      * returns the name of this type
00057      * (obtained by using the std::typeinfo functions).
00058      * The returned string considers the template arguments and
00059      * is usually fully qualified.
00060      * The implementation should ensure that the returned name has
00061      * the following format:
00062      * <namespace>::<classname>::<innerclassname>::...
00063      * Example:
00064      * <pre>
00065      * lti::boundingBox<double>::parameters
00066      * </pre>
00067      * WARNING: The function returns a pointer to an internal class
00068      * member. So, the pointer is only valid for the lifetime of this
00069      * object or until the next time get is called, whatever occurs
00070      * first.
00071      */
00072     const char* get(const object* o) const;
00073 
00074     /**
00075      * @see get(object*)
00076      */
00077     const char* get(const object& o) const {
00078       return get(&o);
00079     }
00080 
00081     /**
00082      * returns the name of this type
00083      * (obtained by using the std::typeinfo functions).
00084      * The returned string considers the template arguments and
00085      * is usually fully qualified.
00086      * @see get(object*)
00087      * The name is returned in the result parameter. This is a much
00088      * safer method than the method returning a pointer.
00089      */
00090     void get(const object& o, std::string& result) const {
00091       result=get(o);
00092     }
00093 
00094     /**
00095      * returns the name of this type (obtained by using the
00096      * std::typeinfo functions).  The returned string considers the
00097      * template arguments and is usually fully qualified. 
00098      * @see get(object*)
00099      * The name is returned in the result parameter. This
00100      * is a much safer method than the method returning a pointer.
00101      */
00102     void get(const object* o, std::string& result) const {
00103       result=get(o);
00104     }
00105     
00106     /**
00107      * decodes a typename returned by typeid().
00108      * You can use this to get decoded names for objects that are
00109      * not derived from lti::object
00110      * @see get(object*)
00111      */
00112     std::string decode(const std::string& name) const;
00113     
00114 
00115   protected:
00116     /**
00117      * implementation of the native-to-readable decoding of
00118      * class names.
00119      */
00120     void decode(char* dest, int& dpos, const char *src, int& spos) const;
00121 
00122     mutable char* buffer;
00123 
00124   };
00125 
00126 }
00127 
00128 #endif
00129 
00130 
00131 
00132 
00133 
00134 
00135 /// Unix

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