00001 /*************** <auto-copyright.pl BEGIN do not edit this line> ************** 00002 * 00003 * VR Juggler is (C) Copyright 1998-2003 by Iowa State University 00004 * 00005 * Original Authors: 00006 * Allen Bierbaum, Christopher Just, 00007 * Patrick Hartling, Kevin Meinert, 00008 * Carolina Cruz-Neira, Albert Baker 00009 * 00010 * This library is free software; you can redistribute it and/or 00011 * modify it under the terms of the GNU Library General Public 00012 * License as published by the Free Software Foundation; either 00013 * version 2 of the License, or (at your option) any later version. 00014 * 00015 * This library is distributed in the hope that it will be useful, 00016 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00017 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00018 * Library General Public License for more details. 00019 * 00020 * You should have received a copy of the GNU Library General Public 00021 * License along with this library; if not, write to the 00022 * Free Software Foundation, Inc., 59 Temple Place - Suite 330, 00023 * Boston, MA 02111-1307, USA. 00024 * 00025 * ----------------------------------------------------------------- 00026 * File: $RCSfile: DeviceFactory.h,v $ 00027 * Date modified: $Date: 2003/07/10 23:59:00 $ 00028 * Version: $Revision: 1.35 $ 00029 * ----------------------------------------------------------------- 00030 * 00031 *************** <auto-copyright.pl END do not edit this line> ***************/ 00032 00033 #ifndef _GADGET_DEVICE_FACTORY_H_ 00034 #define _GADGET_DEVICE_FACTORY_H_ 00035 //#pragma once 00036 00037 #include <gadget/gadgetConfig.h> 00038 #include <vector> 00039 #include <jccl/Config/ConfigElementPtr.h> 00040 #include <vpr/Util/Singleton.h> 00041 00042 #include <gadget/Type/DeviceConstructorBase.h> 00043 00044 #include <vpr/Util/Assert.h> 00045 00046 namespace gadget 00047 { 00048 00053 class GADGET_CLASS_API DeviceFactory 00054 { 00055 private: 00056 // Singleton so must be private 00057 DeviceFactory() 00058 { 00059 mConstructors = std::vector<DeviceConstructorBase*>(0); 00060 vprASSERT(mConstructors.size() == 0); 00061 } 00062 00070 void loadKnownDevices(); 00071 00072 public: 00073 void registerDevice(DeviceConstructorBase* constructor); 00074 00081 bool recognizeDevice(jccl::ConfigElementPtr element); 00082 00090 Input* loadDevice(jccl::ConfigElementPtr element); 00091 00092 private: 00098 int findConstructor(jccl::ConfigElementPtr element); 00099 00100 void debugDump(); 00101 00102 00103 private: 00104 std::vector<DeviceConstructorBase*> mConstructors; 00106 vprSingletonHeaderWithInitFunc(DeviceFactory, loadKnownDevices); 00107 }; 00108 00109 } // end namespace gadget 00110 00111 #endif
1.2.14 written by Dimitri van Heesch,
© 1997-2002