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

vos/metaobjects/property/bufferedproperty.hh

Go to the documentation of this file.
00001 /*
00002     This file is part of the Virtual Object System of
00003     the Interreality project (http://interreality.org).
00004 
00005     Copyright (C) 2001, 2002 Peter Amstutz
00006 
00007     This library is free software; you can redistribute it and/or
00008     modify it under the terms of the GNU Lesser General Public
00009     License as published by the Free Software Foundation; either
00010     version 2 of the License, or (at your option) any later version.
00011 
00012     This library is distributed in the hope that it will be useful,
00013     but WITHOUT ANY WARRANTY; without even the implied warranty of
00014     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00015     Lesser General Public License for more details.
00016 
00017     You should have received a copy of the GNU Lesser General Public
00018     License along with this library; if not, write to the Free Software
00019     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307  USA
00020 
00021     Peter Amstutz <tetron@interreality.org>
00022     Additions by Reed Hedges <reed@zerohour.net> marked with initials "rh" and date.
00023 */
00024 #ifndef _BUFFFEREDPROPERTY_HH_
00025 #define _BUFFFEREDPROPERTY_HH_
00026 
00027 #include <typeinfo>
00028 #include <set>
00029 
00030 class BufferedLocalProperty;
00031 
00032 #include <vos/corelibs/vos/vos.hh>
00033 #include "property.hh"
00034 
00035 /** @class BufferedLocalProperty bufferedproperty.hh vos/metaobjects/property/bufferedproperty.hh
00036  *
00037  * This subclass of Property waits until you call flush() (or the static
00038  * method flushAll()) before actually sending any write or replace methods
00039  * to listeners.
00040  */
00041 class PROPERTY_API BufferedLocalProperty : public virtual LocalProperty
00042 {
00043 protected:
00044     static set<BufferedLocalProperty*> allblps;
00045     bool changed;
00046     int changestart;
00047     int changelen;
00048 public:
00049     BufferedLocalProperty(MetaObject* superobject);
00050     BufferedLocalProperty(MetaObject* superobject, const string& d, const string& dt = "?");
00051     virtual ~BufferedLocalProperty();
00052     static MetaObject* new_BufferedLocalProperty(MetaObject* superobject, const string& type);
00053     static void registerExtenders();
00054 
00055     /** Flush pending changes for all BufferedLocalProperty objects created
00056      *  in this process so far.
00057      */
00058     static void flushAll();
00059 
00060     virtual void write(int start, const string& newdata);
00061     virtual void replace(const string& newdata, const string& newtype = "?");
00062 
00063     /** Flush pending changes for this property. */
00064     virtual void flush();
00065 };
00066 
00067 /** @class BufferedRemoteProperty bufferedproperty.hh vos/metaobjects/property/bufferedproperty.hh
00068  */
00069 class PROPERTY_API BufferedRemoteProperty : public virtual RemoteProperty
00070 {
00071 protected:
00072     static set<BufferedRemoteProperty*> allbrps;
00073     bool changed;
00074     int changestart;
00075     int changelen;
00076     bool lastmsgsuccess;
00077     string lastnonce;
00078 
00079 public:
00080     BufferedRemoteProperty(MetaObject* superobject);
00081     ~BufferedRemoteProperty();
00082     static MetaObject* new_BufferedRemoteProperty(MetaObject* superobject, const string& type);
00083     static void registerExtenders();
00084     static void flushAll();
00085 
00086     virtual void write(int start, const string& newdata);
00087     virtual void replace(const string& newdata, const string& newtype = "?");
00088     virtual void flush();
00089     virtual void sendUpdateMessage(Message* m);
00090 };
00091 
00092 #endif

Generated on Tue Aug 12 03:55:45 2003 for Interreality Project - VOS by doxygen 1.3.2