helper.hh

Go to the documentation of this file.
00001 // ----------------------------------------------------------------------------
00002 // CERTI - HLA RunTime Infrastructure
00003 // Copyright (C) 2004, 2006  ONERA
00004 //
00005 // This file is part of CERTI-libCERTI
00006 //
00007 // CERTI-libCERTI is free software ; you can redistribute it and/or
00008 // modify it under the terms of the GNU Lesser General Public License
00009 // as published by the Free Software Foundation ; either version 2 of
00010 // the License, or (at your option) any later version.
00011 //
00012 // CERTI-libCERTI is distributed in the hope that it will be useful, but
00013 // WITHOUT ANY WARRANTY ; without even the implied warranty of
00014 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00015 // 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 this program ; if not, write to the Free Software
00019 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
00020 // USA
00021 //
00022 // $Id: helper.hh,v 3.1 2006/03/09 19:54:28 breholee Exp $
00023 // ----------------------------------------------------------------------------
00024 
00025 #ifndef LIBCERTI_HELPER_HH
00026 #define LIBCERTI_HELPER_HH
00027 
00028 #include <string>
00029 
00030 namespace certi {
00031 
00035 template<class T>
00036 class HandleComparator
00037 {
00038 public:
00039     HandleComparator(Handle h) : handle(h) { };
00040     bool operator()(const T *op) const { return op->getHandle() == handle ; };
00041     bool operator()(const T &op) const { return op.getHandle() == handle ; };
00042 private:
00043     Handle handle ;
00044 };
00045 
00049 template<class T>
00050 class NameComparator
00051 {
00052 public:
00053     NameComparator(std::string h) : name(h) { };
00054     bool operator()(const T *op) const { return name == op->getName(); };
00055     bool operator()(const T &op) const { return name == op.getName(); };
00056 private:
00057     std::string name ;
00058 };
00059 
00060 } // certi
00061 
00062 #endif // LIBCERTI_HELPER_HH
00063 
00064 // $Id: helper.hh,v 3.1 2006/03/09 19:54:28 breholee Exp $

Generated on Thu Apr 30 15:53:49 2009 for CERTIDeveloperDocumentation by doxygen 1.5.5