ESLA

Embeddable Scriting LAnguage

frantz@pangea.stanford.edu

Stanford University, Rock Fracture Project research group

© 2003

gen_static_repository.h

Go to the documentation of this file.
00001 /*************************************************************************
00002  *              ESLA: Embeddable Scripting LAnguage
00003  *                  Copyright (C) 2003 Frantz Maerten
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 as
00007  *   published  by  the Free Software Foundation; either version 2 of the
00008  *   License, or (at your option) any later version.
00009  *
00010  *   If  you modify this software, you should contact the author, include
00011  *   a  notice giving the name of the person performing the modification,
00012  *   the date of modification, and the reason for such modification.
00013  *
00014  *   Note   that   the   GNU  General  Public  License  does  not  permit
00015  *   incorporating the Software into proprietary programs.
00016  *
00017  *  Contact: Frantz Maerten
00018  *     frantz@pangea.stanford.edu
00019  *
00020  *     Dept. of Geological & Environmental Sciences
00021  *     Stanford University 
00022  *     Stanford, CA 94305-2115
00023  *     USA
00024  *************************************************************************/
00025 
00026 
00027 #ifndef _GENERIC_GEN_STATIC_REPOSITORY_H
00028 #define _GENERIC_GEN_STATIC_REPOSITORY_H
00029 #ifdef __GNUC__
00030 #pragma interface
00031 #endif
00032 
00033 
00034 #include "../esla_namespace.h"
00035 #include <map>
00036 #include <string>
00037 
00038 #if defined(_WIN32) || defined(WIN32)
00039   #pragma warning ( disable : 4786 )
00040 #endif
00041 
00042 BEGIN_LIB_NAMESPACE
00043 
00044 template <class T>
00045 class GenStaticRepository {
00046 public:
00047   static void bind(T* s, const std::string& name) ;
00048   static T* resolve(const std::string& name) ;
00049   static void unbind(const std::string& name) ;
00050 
00051   typedef std::map<std::string, T*> Map ;
00052   static typename Map::const_iterator begin() ;
00053   static typename Map::const_iterator end() ;
00054   static int size() ;
00055   static typename Map::const_iterator find(const std::string& name) ;
00056   static GenStaticRepository* instance() ;
00057 
00058 private:
00059   GenStaticRepository() ;
00060   GenStaticRepository(const GenStaticRepository&) ;
00061   static GenStaticRepository* instance_ ;
00062   static Map map_ ;
00063 } ;
00064 
00065 END_LIB_NAMESPACE
00066 
00067 #if defined(__GNUC__) || defined(WIN32)
00068 #include "gen_static_repository.cc"
00069 #elif defined(__xlC__)
00070 #pragma implementation("gen_static_repository.cc")
00071 #endif
00072 
00073 #endif

Generated on Wed May 14 11:42:31 2003 for Esla-lib by doxygen1.3-rc1