vtf-logo

shells/materials/MaterialFactory.h

Go to the documentation of this file.
00001 /* -*- C++ -*- */
00002 /*
00003  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00004  *
00005  *                                   Fehmi Cirak
00006  *                        California Institute of Technology
00007  *                           (C) 2005 All Rights Reserved
00008  *
00009  * <LicenseText>
00010  *
00011  * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
00012 */
00013 #ifndef MATERIALFACTORY
00014 #define MATERIALFACTORY
00015 #include <map>
00016 #include <cassert>
00017 #include <string>
00018 
00019 
00020 namespace shells {
00021     class MaterialFactory;
00022     class MaterialBase;
00023 }
00024 
00025 
00026 class shells::MaterialFactory { 
00027 public:
00028     typedef MaterialBase* (*CreateMaterialCallBack)();
00029     
00030 private:
00031     typedef std::map<std::string, CreateMaterialCallBack> _CallBackMap;
00032     
00033 public:
00034     bool registerMaterial(std::string materialType, CreateMaterialCallBack cb);    
00035     MaterialBase* createMaterial(std::string& materialType) const;
00036     
00037 // this is a singleton class
00038     static MaterialFactory * instance();
00039     void destroy(); 
00040 
00041 private:
00042     MaterialFactory(){};
00043     ~MaterialFactory(){};
00044     static MaterialFactory *_instance;
00045     
00046 // copy constructor and assignment operator
00047 private:
00048     MaterialFactory (const MaterialFactory &);
00049     const MaterialFactory & operator=(const MaterialFactory &);
00050     
00051 private:
00052     _CallBackMap     _callBacks;
00053 };
00054 
00055 #endif

Generated on Fri Aug 24 13:00:24 2007 for SFC Thin-Shell Finite Element Solver by  doxygen 1.4.7