CrystalSpace

Public API Reference

Main Page   Modules   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

iutil/objreg.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2001 by Jorrit Tyberghein
00003 
00004     This library is free software; you can redistribute it and/or
00005     modify it under the terms of the GNU Library General Public
00006     License as published by the Free Software Foundation; either
00007     version 2 of the License, or (at your option) any later version.
00008 
00009     This library is distributed in the hope that it will be useful,
00010     but WITHOUT ANY WARRANTY; without even the implied warranty of
00011     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012     Library General Public License for more details.
00013 
00014     You should have received a copy of the GNU Library General Public
00015     License along with this library; if not, write to the Free
00016     Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
00017 */
00018 
00019 #ifndef __CS_IUTIL_OBJREG_H__
00020 #define __CS_IUTIL_OBJREG_H__
00021 
00029 #include "csutil/scf.h"
00030 #include "csutil/ref.h"
00031 
00032 #define CS_QUERY_REGISTRY_TAG(Reg, Tag)       \
00033   csPtr<iBase> ((iBase*) (CS_IMPLICIT_PTR_CAST(iObjectRegistry, Reg)->Get (Tag)))
00034 #define CS_QUERY_REGISTRY(Reg,Interface)      \
00035   csPtr<Interface> ((Interface*)(CS_IMPLICIT_PTR_CAST(iObjectRegistry, Reg)->Get (#Interface, \
00036     scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion())))
00037 #define CS_QUERY_REGISTRY_TAG_INTERFACE(Reg, Tag, Interface)  \
00038   csPtr<Interface> ((Interface*)(CS_IMPLICIT_PTR_CAST(iObjectRegistry, Reg)->Get (Tag,    \
00039     scfInterface<Interface>::GetID(), scfInterface<Interface>::GetVersion())))
00040 
00041 struct iObjectRegistryIterator;
00042 
00043 SCF_VERSION (iObjectRegistry, 0, 0, 4);
00044 
00062 struct iObjectRegistry : public iBase
00063 {
00064   // Allow implicit casts through static function.
00065   CS_IMPLEMENT_IMPLICIT_PTR_CAST (iObjectRegistry);
00066 
00070   virtual void Clear () = 0;
00071 
00088   virtual bool Register (iBase* obj, char const* tag = 0) = 0;
00089 
00101   virtual void Unregister (iBase* obj, char const* tag = 0) = 0;
00102 
00109   virtual iBase* Get (char const* tag) = 0;
00110 
00118   virtual iBase* Get (char const* tag, scfInterfaceID id, int version) = 0;
00119 
00126   virtual csPtr<iObjectRegistryIterator> Get (
00127         scfInterfaceID id, int version) = 0;
00128 
00135   virtual csPtr<iObjectRegistryIterator> Get () = 0;
00136 };
00137 
00138 SCF_VERSION (iObjectRegistryIterator, 0, 1, 0);
00139 
00144 struct iObjectRegistryIterator : public iBase
00145 {
00150   virtual bool Reset () = 0;
00151 
00155   virtual const char* GetCurrentTag () = 0;
00156 
00160   virtual bool HasNext () = 0;
00161 
00165   virtual iBase* Next () = 0;
00166 };
00167 
00170 #endif // __CS_IUTIL_OBJREG_H__
00171 

Generated for Crystal Space by doxygen 1.2.18