C:/Users/Mike/Documents/Visual Studio Projects/GameEngine/include/EventType.h

Go to the documentation of this file.
00001 /*
00002 -----------------------------------------------------------------------------
00003 Copyright (C) 2006 Michael Harnetty
00004 
00005 This program is free software; you can redistribute it and/or
00006 modify it under the terms of the GNU General Public License
00007 as published by the Free Software Foundation; either version 2
00008 of the License, or (at your option) any later version.
00009 
00010 This program is distributed in the hope that it will be useful,
00011 but WITHOUT ANY WARRANTY; without even the implied warranty of
00012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013 GNU General Public License for more details.
00014 
00015 You should have received a copy of the GNU General Public License
00016 along with this program; if not, write to the Free Software
00017 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018 -----------------------------------------------------------------------------
00019 */
00020 
00021 #ifndef EVENTTYPE_H
00022 #define EVENTTYPE_H
00023 
00024 #include "GameEnginePrerequisites.h"
00025 
00026 namespace GameEngine {
00027 
00028         char const * const wildcardEventType = "*";
00029 
00033         class ENGINE_DECL EventType {
00034         public:
00035                 EventType(char const * const identStr)
00036                         :       mIdent( hash_name(identStr) ), mIdentStr(identStr)
00037                 {
00038 
00039                 }
00040 
00041                 unsigned long getIdent() const {
00042                         return reinterpret_cast<unsigned long>(mIdent);
00043                 }
00044 
00045                 char const * const getStr() const {
00046                         return mIdentStr;
00047                 }
00048 
00049                 bool operator< ( EventType const & o ) const {
00050                         bool r = ( getIdent() < o.getIdent() );
00051                         return r;
00052                 }
00053 
00054                 bool operator== ( EventType const & o ) const {
00055                         bool r = ( getIdent() == o.getIdent() );
00056                         return r;
00057                 }
00058 
00059                 static void* hash_name( char const*  identStr );
00060 
00061 
00062         private:
00063                 void* mIdent;
00064                 char const* mIdentStr;
00065         };
00066 
00067 }
00068 
00069 #endif

Generated on Thu Apr 19 09:47:02 2007 for GameEngine by  doxygen 1.5.2