00001
00002
00003
00004
00005
00006
00007
00008
00014 #ifndef _FU_PARAMETERIZABLE_H_
00015 #define _FU_PARAMETERIZABLE_H_
00016
00017 #ifndef _FU_TRACKER_H_
00018 #include "FUtils/FUTracker.h"
00019 #endif // _FU_TRACKER_H_
00020
00021 class FUParameter;
00022
00028 #define DeclareFlag(flag_name, local_position) \
00029 static const uint32 FLAG_##flag_name = (1 << (Parent::nextAvailableBit + local_position)); \
00030 inline void Set##flag_name##Flag(bool value) { flags &= ~FLAG_##flag_name; flags |= FLAG_##flag_name * value; } \
00031 inline void Set##flag_name##Flag() { flags |= FLAG_##flag_name; } \
00032 inline void Reset##flag_name##Flag() { flags &= ~FLAG_##flag_name; } \
00033 inline bool Get##flag_name##Flag() const { return (flags & FLAG_##flag_name) != 0; }
00034
00038 #define DeclareFlagCount(count) \
00039 protected: \
00040 static const uint32 nextAvailableBit = Parent::nextAvailableBit + count;
00041
00042
00051 class FCOLLADA_EXPORT FUParameterizable : public FUTrackable
00052 {
00053 private:
00054 DeclareObjectType(FUTrackable);
00055
00056 protected:
00058 uint32 flags;
00059
00060 public:
00061 DeclareFlag(Dirty, 0);
00062 DeclareFlag(ValueChanged, 1);
00065 DeclareFlag(StructureChanged, 2);
00069 DeclareFlagCount(3);
00071 public:
00073 FUParameterizable();
00074
00076 virtual ~FUParameterizable();
00077
00081 inline void SetFlag(uint32 f, bool value) { flags &= ~f; flags |= f * value; }
00082
00086 inline void SetFlag(uint32 f) { flags |= f; }
00087
00091 inline uint32 TestFlag(uint32 f) const { return flags & f; }
00092
00096 inline void ClearFlag(uint32 f) { flags &= ~f; }
00097
00099 virtual void SetValueChange() {}
00100 };
00101
00102 #endif // _FU_PARAMETERIZABLE_H_