## Public API Reference

- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- File List
- File Members

# iengine/sharevar.h

Go to the documentation of this file.

    00001 /*
    00002     Copyright (C) 2002 by Keith Fulton
    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_IENGINE_SHAREVAR_H__
    00020 #define __CS_IENGINE_SHAREVAR_H__
    00021
    00029 #include "csutil/scf.h"
    00030
    00031
    00032 struct iObject;
    00033 struct iSharedVariableListener;
    00034
    00035 class csColor;
    00036 class csVector3;
    00037
    00038
    00043 struct iSharedVariable : public virtual iBase
    00044 {
    00045   SCF_INTERFACE(iSharedVariable, 2,0,0);
    00047   virtual iObject* QueryObject () = 0;
    00048
    00050   virtual void SetName (const char *name) = 0;
    00051
    00053   virtual const char *GetName () const = 0;
    00054
    00056   virtual void Set(float val) = 0;
    00057
    00059   virtual float Get () const = 0;
    00060
    00062   virtual void SetColor (const csColor& col) = 0;
    00063
    00065   virtual const csColor& GetColor () const = 0;
    00066
    00068   virtual void SetVector (const csVector3& v) = 0;
    00069
    00071   virtual const csVector3& GetVector () const = 0;
    00072
    00074   enum SharedVariableType
    00075   {
    00076     SV_UNKNOWN = 0,
    00077     SV_FLOAT   = 1,
    00078     SV_COLOR   = 2,
    00079     SV_VECTOR  = 3
    00080   };
    00081
    00083   virtual int GetType () const = 0;
    00084
    00086   virtual void AddListener (iSharedVariableListener* listener) = 0;
    00087
    00089   virtual void RemoveListener (iSharedVariableListener* listener) = 0;
    00090 };
    00091
    00092
    00097 struct iSharedVariableListener : public virtual iBase
    00098 {
    00099   SCF_INTERFACE(iSharedVariableListener,2,0,0);
    00103   virtual void VariableChanged (iSharedVariable* var) = 0;
    00104 };
    00105
    00106
    00110 struct iSharedVariableList : public virtual iBase
    00111 {
    00112   SCF_INTERFACE(iSharedVariableList, 2,0,0);
    00114   virtual int GetCount () const = 0;
    00115
    00117   virtual iSharedVariable *Get (int n) const = 0;
    00118
    00120   virtual int Add (iSharedVariable *obj) = 0;
    00121
    00123   virtual bool Remove (iSharedVariable *obj) = 0;
    00124
    00126   virtual bool Remove (int n) = 0;
    00127
    00129   virtual void RemoveAll () = 0;
    00130
    00132   virtual int Find (iSharedVariable *obj) const = 0;
    00133
    00135   virtual iSharedVariable *FindByName (const char *Name) const = 0;
    00136
    00138   virtual csPtr<iSharedVariable> New() const = 0;
    00139 };
    00140
    00143 #endif // __CS_IENGINE_SHAREVAR_H__