/home/tetron/hack/vos/libs/vos/vos/basiclocalproperty.hh
Go to the documentation of this file.00001 #ifndef _BASICLOCALPROPERTY_HH_
00002 #define _BASICLOCALPROPERTY_HH_
00003
00004 #include <vos/vos/localproperty.hh>
00005 #include <vos/vos/propertylistener.hh>
00006
00007
00008 namespace VOS {
00009
00010
00011
00012
00013
00014 class VOS_API BasicLocalProperty : public LocalProperty, public PersistBlockListener
00015 {
00016 private:
00017 boost::recursive_mutex data_mutex;
00018
00019 std::string data;
00020 std::string datatype;
00021
00022 VUtil::ListenerBase<PropertyListener, PropertyEvent> propertyListeners;
00023
00024 protected:
00025 BasicLocalProperty(VobjectBase* superobject);
00026
00027 public:
00028
00029 static MetaObject* new_BasicLocalProperty(VobjectBase* superobject, const std::string& calledtype);
00030
00031
00032 virtual int getLength();
00033
00034
00035
00036
00037 virtual void read(std::string& target);
00038
00039
00040
00041
00042
00043
00044
00045 virtual void read(std::string& target, int start, int length);
00046
00047
00048
00049
00050 virtual std::string read();
00051
00052
00053
00054
00055 virtual std::string read(int start, int length);
00056
00057 virtual void write(int start, const std::string& newdata)
00058 { write(0, start, newdata); }
00059
00060 virtual void replace(const std::string& newdata, const std::string& newtype = "?")
00061 { replace(0, newdata, newtype); }
00062
00063
00064 virtual void write(Vobject* initiator, int start, const std::string& newdata);
00065
00066
00067
00068
00069
00070
00071 virtual void replace(Vobject* initiator, const std::string& newdata, const std::string& newtype = "?");
00072
00073
00074 virtual const std::string getDataType();
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086 static VUtil::vRef<ParentChildRelation> setProperty(Vobject& on,
00087 const std::string& propname,
00088 const std::string& propval,
00089 const std::string& valtype,
00090 const std::string& pac,
00091 bool letErrorThrough = false);
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101 virtual void addPropertyListener(PropertyListener* pl, bool refresh = true);
00102
00103
00104
00105
00106
00107 virtual void removePropertyListener(PropertyListener* pl);
00108
00109
00110 virtual const std::string getVOSType();
00111
00112
00113 virtual bool getAsynchronousEvents() {
00114 return propertyListeners.getAsynchronousEvents();
00115 }
00116
00117 virtual void setAsynchronousEvents(bool b) {
00118 propertyListeners.setAsynchronousEvents(b);
00119 }
00120
00121 virtual void notifyBlockChanging(const std::string& key, const std::string& data);
00122 virtual void notifyBlockChanged(const std::string& key, const std::string& data);
00123 };
00124
00125 }
00126
00127 #endif