00001 #ifndef VR_DVDEVICES_H
00002 #define VR_DVDEVICES_H
00003 #include <Device/DVVirtualDevice.h>
00004 #include <vector>
00005
00006 namespace Spr {
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016 class SPR_DLL DVVirtualDevicePool: std::vector< UTRef<DVVirtualDevice> >{
00017 public:
00018
00019 #ifdef __BORLANDC__
00020 template <class CT> bool Rent(CT*& t);
00021 #else
00022 template <class CT> bool Rent(CT*& t){
00023 CT* pt = (CT*)Rent(CT::TypeS());
00024 t = pt;
00025 return t != NULL;
00026 }
00027 #endif
00028
00029 DVVirtualDevice* Rent(const char* type, const char* name=NULL);
00030
00031 bool Return(DVVirtualDevice* dev);
00032
00033 void Register(DVVirtualDevice* dev){ push_back(dev); }
00034
00035 void Print(std::ostream& o) const;
00036
00037 void Clear(){ clear(); }
00038 };
00039 #ifdef __BORLANDC__
00040 template <class CT> bool DVVirtualDevicePool::Rent(CT*& t){
00041 CT* pt = (CT*)Rent(CT::TypeS());
00042 t = pt;
00043 return t != NULL;
00044 }
00045 #endif
00046 inline std::ostream& operator << (std::ostream& o, const DVVirtualDevicePool& d){
00047 d.Print(o);
00048 return o;
00049 }
00050
00051 }
00052
00053 #endif