00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef __SEAL_PROPERTY_H__
00030 #define __SEAL_PROPERTY_H__
00031 
00032 #ifndef NULL
00033 #define NULL 0
00034 #endif 
00035 
00036 namespace seal
00037 {
00038 
00044 template <typename DataType, typename ParentType>
00045 class Property
00046 {
00047 
00048 public:
00049 
00056     Property(ParentType *parentPtr, void (ParentType::*fptr)(DataType))
00057         : _parentPtr(parentPtr), _fptr(fptr)
00058     {}
00059 
00064     inline Property<DataType, ParentType>& operator=(const DataType &val)
00065     {
00066         if (val == _val)
00067             return *this;
00068         
00069         _val = val;
00070 
00071         if (_parentPtr != NULL)
00072             (_parentPtr->*_fptr)(val);
00073 
00074         return *this;
00075     }
00076 
00077     inline operator DataType() { return _val; }
00078 
00079 private:
00080     DataType _val;
00081     void (ParentType::*_fptr)(DataType);
00082     ParentType *_parentPtr;
00083 
00084     Property(void) {} 
00085                       
00086 };
00087 
00088 } 
00089 
00090 #endif // __SEAL_PROPERTY_H__
00091