CrystalSpace

Public API Reference

cstool/userrndbuf.h

Go to the documentation of this file.
00001 /*
00002     Copyright (C) 2003 by Philipp Aumayr
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_CSTOOL_USERRNDBUF_H__
00020 #define __CS_CSTOOL_USERRNDBUF_H__
00021 
00026 #include "csextern.h"
00027 
00028 #include "csutil/scf.h"
00029 #include "csutil/strset.h"
00030 
00031 struct iRenderBuffer;
00032 
00036 struct iUserRenderBufferIterator : public virtual iBase
00037 {
00038   SCF_INTERFACE(iUserRenderBufferIterator, 2,0,0);
00040   virtual bool HasNext() = 0;
00042   virtual csStringID Next (csRef<iRenderBuffer>* buf = 0) = 0;
00044   virtual void Reset() = 0;
00045 };
00046 
00051 class CS_CRYSTALSPACE_EXPORT csUserRenderBufferManager
00052 {
00053   struct userbuffer
00054   {
00055     csRef<iRenderBuffer> buf;
00056     csStringID name;
00057   };
00058   class UserBufArrayCmp : public csArrayCmp<userbuffer, csStringID>
00059   {
00060     static int BufKeyCompare (userbuffer const& b, csStringID const& k)
00061     { 
00062       return b.name - k;
00063     }
00064   public:
00065     UserBufArrayCmp (csStringID key) : 
00066       csArrayCmp<userbuffer, csStringID> (key, &BufKeyCompare)
00067     {
00068     }
00069   };
00070   static int BufCompare (userbuffer const& r, userbuffer const& k);
00071 
00072   csArray<userbuffer> userBuffers;
00073 public:
00075   iRenderBuffer* GetRenderBuffer (csStringID name) const;
00080   bool AddRenderBuffer (csStringID name, iRenderBuffer* buffer);
00085   bool RemoveRenderBuffer (csStringID name);
00086 
00087   csRef<iUserRenderBufferIterator> GetBuffers() const;
00088 };
00089 
00090 #endif // __CS_CSTOOL_USERRNDBUF_H__

Generated for Crystal Space by doxygen 1.4.7