00001 /* 00002 * RulbusDeviceList.h - list to maintain device class -- handle relationship. 00003 * 00004 * This file is part of the Rulbus Device Class Library (RDCL). 00005 * 00006 * Copyright (C) 2003-2004, Leiden University. 00007 * 00008 * This library is free software; you can redistribute it and/or modify 00009 * it under the terms of the GNU General Public License as published by 00010 * the Free Software Foundation; either version 2 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * The library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU General Public License 00019 * along with mngdriver; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 * $Id: RulbusDeviceList.h 2 2004-10-12 11:54:15Z moene $ 00023 */ 00024 00025 #ifndef __RULBUSDEVICELIST_H 00026 #define __RULBUSDEVICELIST_H 00027 00028 #ifndef __COMMON_H 00029 #include "Common.h" 00030 #endif 00031 00032 #include "Singleton.h" // for template class Singleton 00033 #include "RulbusDeviceProxy.h" // for class RulbusDeviceProxy 00034 00035 #include <vector> // for std::vector<> 00036 00037 namespace WindowsUtils 00038 { 00039 DECLARE_CLASS( Semaphore ); 00040 } 00041 00042 namespace Rulbus 00043 { 00044 DECLARE_CLASS( RulbusDevice ); 00045 DECLARE_CLASS( TheRulbusDeviceList ); 00046 00047 typedef std::vector<RulbusDevicePtr> List; 00048 00073 class TheRulbusDeviceList : public Singleton<TheRulbusDeviceList> 00074 { 00075 friend class Singleton<TheRulbusDeviceList>; 00076 00077 public: // public methods 00078 void clear( ); 00079 void add( RulbusDevicePtr deviceptr ); 00080 void remove( RulbusDevicePtr deviceptr ); 00081 void remove( int handle ); 00082 00083 int open( Name aName ); 00084 void close( int handle ); 00085 RulbusDeviceProxy get( int handle ); 00086 00087 void check( ); 00088 bool printOn( std::ostream& stream ); 00089 00090 protected: // protected methods 00091 TheRulbusDeviceList(); 00092 ~TheRulbusDeviceList(); 00093 TheRulbusDeviceList( TheRulbusDeviceListCref rhs ); 00094 TheRulbusDeviceList operator= ( TheRulbusDeviceListCref rhs ); 00095 00096 private: // private data 00097 List theList; 00098 WindowsUtils::SemaphorePtr s; 00099 }; 00100 00101 } // namespace Rulbus 00102 00103 #endif // __RULBUSDEVICELIST_H 00104 00105 /* 00106 * end of file 00107 */ 00108