Main Page   Modules   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

Key.h

Go to the documentation of this file.
00001 /* SimData: Data Infrastructure for Simulations
00002  * Copyright (C) 2002 Mark Rose <tm2@stm.lbl.gov>
00003  * 
00004  * This file is part of SimData.
00005  * 
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  * 
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  * 
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
00019  */
00020 
00027 #ifndef __SIMDATA_KEY_H__
00028 #define __SIMDATA_KEY_H__
00029 
00030 #include <string>
00031 #include <SimData/BaseType.h>
00032 #include <SimData/HashUtility.h>
00033 
00034 
00035 NAMESPACE_SIMDATA
00036 
00046 class SIMDATA_EXPORT Key: public BaseType {
00047 protected:
00048         uint32 _key;
00049 
00050 public:
00051 
00054         Key(): _key(0) {}
00055 
00058         Key(std::string const &k) { *this = k; }
00059 
00062         Key(Key const &k): BaseType(k), _key(k._key) {}
00063 
00066         virtual ~Key() {}
00067 
00068 #ifndef SWIG
00069 
00071         const Key &operator=(std::string const &);
00072 
00075         inline const Key &operator=(Key const &k) { _key = k._key; return *this; }
00076 
00077 #endif // SWIG
00078 
00081         inline bool operator==(Key const &k) const { return _key == k._key; }
00082 
00085         inline bool operator!=(Key const &k) const { return _key != k._key; }
00086 
00089         bool operator==(std::string const &) const;
00090 
00093         bool operator!=(std::string const &k) const { return !(*this==k); }
00094         
00097         bool operator<(Key const &k) const { return _key < k._key; }
00098 
00101         virtual void serialize(Archive&);
00102         
00105         virtual std::string asString() const;
00106 
00109         virtual std::string typeString() const { return "type::Key"; }
00110 };
00111 
00112 NAMESPACE_SIMDATA_END
00113 
00114 
00115 #endif //__SIMDATA_KEY_H__
00116 

SimData version pre-0.4.0. For more information on SimData, visit the SimData Homepage.

Generated on Tue Oct 14 12:06:38 2003, using Doxygen 1.2.18.

[SF.net]