/home/tetron/hack/vos/libs/vos/vos/localproperty.hh
Go to the documentation of this file.00001 #ifndef _LOCALPROPERTY_HH_
00002 #define _LOCALPROPERTY_HH_
00003
00004 #include <vos/vos/property.hh>
00005
00006 namespace VOS {
00007
00008
00009
00010 class VOS_API LocalProperty : public Property
00011 {
00012 private:
00013 void getLengthHandler(Message* m);
00014 void getDatatypeHandler(Message* m);
00015 void readHandler(Message* m);
00016 void writeHandler(Message* m);
00017 void replaceHandler(Message* m);
00018 void startListeningHandler(Message* m);
00019 void stopListeningHandler(Message* m);
00020
00021 protected:
00022 LocalProperty(VobjectBase* superobject);
00023
00024 template<class T> void setupHandlers()
00025 {
00026 VobjectBase::addMessageHandler<T>("property:get-length", &T::getLengthHandler);
00027 VobjectBase::addMessageHandler<T>("property:get-datatype", &T::getDatatypeHandler);
00028 VobjectBase::addMessageHandler<T>("property:read", &T::readHandler);
00029 VobjectBase::addMessageHandler<T>("property:write", &T::writeHandler);
00030 VobjectBase::addMessageHandler<T>("property:replace", &T::replaceHandler);
00031 VobjectBase::addMessageHandler<T>("property:start-listening", &T::startListeningHandler);
00032 VobjectBase::addMessageHandler<T>("property:stop-listening", &T::stopListeningHandler);
00033 }
00034
00035 public:
00036 virtual bool validatePropertyAccess(PropertyEvent& e, std::string& message);
00037
00038 virtual void write(Vobject* initiator, int start, const std::string& newdata) = 0;
00039 virtual void replace(Vobject* initiator, const std::string& newdata, const std::string& newtype = "?") = 0;
00040
00041 virtual void write(int start, const std::string& newdata)
00042 { write(0, start, newdata); }
00043
00044 virtual void replace(const std::string& newdata, const std::string& newtype = "?")
00045 { replace(0, newdata, newtype); }
00046
00047
00048 virtual bool getAsynchronousEvents() = 0;
00049
00050
00051 virtual void setAsynchronousEvents(bool b) = 0;
00052 };
00053
00054 }
00055
00056 #endif