Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

STR_ClassIdent.h

00001 #ifndef _STR_STR_ClassIdent_H_
00002 
00003 /*
00004  * Copyright (C) 1991-9 Eric M. Hopper <hopper@omnifarious.mn.org>
00005  * 
00006  *     This program is free software; you can redistribute it and/or modify it
00007  *     under the terms of the GNU Lesser General Public License as published
00008  *     by the Free Software Foundation; either version 2 of the License, or
00009  *     (at your option) any later version.
00010  * 
00011  *     This program is distributed in the hope that it will be useful, but
00012  *     WITHOUT ANY WARRANTY; without even the implied warranty of
00013  *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  *     Lesser General Public License for more details.
00015  * 
00016  *     You should have received a copy of the GNU Lesser General Public
00017  *     License along with this program; if not, write to the Free Software
00018  *     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00019  */
00020 
00021 #ifdef __GNUG__
00022 #  pragma interface
00023 #endif
00024 
00025 /* $Header: /home/hopper/src/cvs/C++/StrMod/StrMod/STR_ClassIdent.h,v 1.9 2002/11/25 05:40:05 hopper Exp $ */
00026 
00027 // For a log, see ../ChangeLog
00028 //
00029 // Revision 1.3  1999/03/05 15:30:32  hopper
00030 // Some lint cleanup changes, and also cleanups and fixes to the code
00031 // that handles interplug communication and notification.
00032 //
00033 // Revision 1.2  1996/02/12 05:50:04  hopper
00034 // Added operator == to work around g++ 2.7.2 bug.
00035 //
00036 // Revision 1.1.1.1  1995/07/22 04:46:51  hopper
00037 // Imported sources
00038 //
00039 // Revision 1.2  1995/04/05  04:52:07  hopper
00040 // Fixed a stupid mistake.
00041 //
00042 // Revision 1.1  1995/03/08  05:34:44  hopper
00043 // Initial revision
00044 //
00045 
00046 #include <LCore/HopClTypes.h>
00047 
00048 #define _STR_STR_ClassIdent_H_
00049 
00050 namespace strmod {
00051 namespace strmod {
00052 
00053 /** \class STR_ClassIdent STR_ClassIdent.h StrMod/STR_ClassIdent.h
00054  * The class identifier class that sets the library number section of the
00055  * class number to be correct for the classes in the StrMod library.
00056  */
00057 class STR_ClassIdent : public lcore::EH_ClassIdent {
00058    typedef lcore::U4Byte U4Byte;
00059  public:
00060    //! The unique class identifier for this class.
00061    static const STR_ClassIdent identifier;
00062 
00063    /** Construct a class identifier.
00064     * This class the base class constructor with the appropriate library
00065     * number.
00066     */
00067    inline STR_ClassIdent(U4Byte cnum);
00068 
00069    /**
00070     * Asks if a class is of a particular type, or publicly derived from that
00071     * type.
00072     *
00073     * Overriden in every derived class (with a static identifier member) to
00074     * compare against the identifier, then call the AreYouA methods of all the
00075     * superclasses.
00076     *
00077     * @param cid Usually &lt;class>::identifier for the class you want to ask if
00078     * the object is an instance of.
00079     */
00080    inline virtual int AreYouA(const ClassIdent &cid) const;
00081 
00082 //     inline bool operator ==(const ClassIdent &b) const;
00083 
00084  protected:
00085    /**
00086     * Returns the class identifier for the class the object actually is.
00087     *
00088     * Should <strong>always</strong> be overridden in any class that has a
00089     * static identifier member.
00090     */
00091    inline virtual const ClassIdent *i_GetIdent() const;
00092 };
00093 
00094 //---------------------------inline functions--------------------------------
00095 
00096 inline const lcore::ClassIdent *STR_ClassIdent::i_GetIdent() const
00097 {
00098    return(&identifier);
00099 }
00100 
00101 inline int STR_ClassIdent::AreYouA(const lcore::ClassIdent &cid) const
00102 {
00103    return((identifier == cid) || EH_ClassIdent::AreYouA(cid));
00104 }
00105 
00106 //  inline bool STR_ClassIdent::operator ==(const ClassIdent &b) const
00107 //  {
00108 //     return(EH_ClassIdent::operator ==(b));
00109 //  }
00110 
00111 inline STR_ClassIdent::STR_ClassIdent(U4Byte cnum) :
00112      lcore::EH_ClassIdent(lcore::EH_ClassNum(lcore::EH_ClassNum::StrMod, cnum))
00113 {
00114 }
00115 
00116 }  // namespace strmod
00117 }  // namespace strmod
00118 
00119 #endif

Generated on Wed Jan 29 00:32:44 2003 for libNet by doxygen1.3-rc1