94 {
return const_cast<Monitorable*
>(
this)->chgnotif_; }
96 {
return const_cast<Monitorable*
>(
this)->delnotif_; }
100 virtual void touch()
const { dirtycount_++; }
101 virtual DirtyCountType
dirtyCount()
const {
return dirtycount_; }
102 virtual ChangeType compareWith(
const Monitorable&)
const;
105 {
return ChangeData::cEntireObjectChgType(); }
107 {
return ChangeData::cNoChgType(); }
109 {
return ChangeData::cUnspecChgID(); }
111 {
return ChangeData::cUnspecChgID(); }
118 :
std::pair<ChangeType,IDType>(typ,id)
125 IDType
ID()
const {
return second; }
130 {
return ct == first || isEntireObject(); }
145 template<
class T>
inline 147 {
return static_cast<T*
>( auxdata_.
ptr() ); }
149 static ChangeType changeNotificationTypeOf(CallBacker*);
150 void sendChangeNotification(
const ChangeData&)
const;
151 void sendEntireObjectChangeNotification()
const;
153 const CallBacker* onlyfor=0)
const;
172 void sendChgNotif(
AccessLocker&,ChangeType,IDType)
const;
174 void sendDelNotif()
const;
176 { chgnotifblocklevel_++; }
177 void resumeChangeNotifications()
const;
180 inline T getMemberSimple(
const T&)
const;
181 template <
class TMember,
class TSetTo>
182 inline void setMemberSimple(TMember&,TSetTo,ChangeType,IDType);
198 ChangeType compareClassData(
const Monitorable&)
const;
203 #define mGetMonitoredChgData(cb,chgdata) \ 204 mCBCapsuleUnpack( Monitorable::ChangeData, chgdata, cb ) 206 #define mGetMonitoredChgDataWithAux(cb,chgdata,T,auxvar) \ 207 mCBCapsuleUnpack( Monitorable::ChangeData, chgdata, cb ); \ 208 T* auxvar = chgdata.auxDataAs<T>() 210 #define mGetMonitoredChgDataWithCaller(cb,chgdata,caller) \ 211 mCBCapsuleUnpackWithCaller( Monitorable::ChangeData, chgdata, caller, cb ) 213 #define mGetMonitoredChgDataWithAuxAndCaller(cb,chgdata,T,auxvar,caller) \ 214 mGetMonitoredChgDataWithCaller(cb,chgdata,caller); \ 215 T* auxvar = chgdata.auxDataAs<T>() 217 #define mGetMonitoredChgDataDoAll(cb,chgdata,doallact) \ 218 mGetMonitoredChgData(chgdata,cb); \ 219 if ( chgdata.changeType() == Monitored::cEntireObjectChange() ) \ 222 #define mGetIDFromChgData( typ, var, chgdata ) \ 223 const typ var = typ::get( (typ::IDType)chgdata.ID() ) 281 bool send_notif=
true);
316 template <
class Mon>
inline 320 const Mon* curptr = ref.
ptr();
321 if ( curptr == newptr )
325 if ( (newptr && !curptr) || (!newptr && curptr) )
327 else if ( curptr && newptr )
329 ct = curptr->compareWith( *newptr );
330 curptr->transferNotifsTo( *newptr, only_for );
337 template <
class Mon>
inline 344 template <
class Mon>
inline 351 template <
class Mon>
inline 359 template <
class Mon>
inline 366 template <
class Mon>
inline
#define mExpClass(module)
Definition: commondefs.h:157
Object that can be MT-safely monitored from cradle to grave.
Definition: monitorable.h:76
bool convertToWrite()
Definition: monitorable.h:159
#define mIsUdf(val)
Use mIsUdf to check for undefinedness of simple types.
Definition: undefval.h:285
Inherit from this class to be able to send and/or receive CallBacks.
Definition: callback.h:182
int ChangeType
Definition: monitorable.h:80
int64_t DirtyCountType
Definition: monitorable.h:84
A lock of a type that (hopefully) suits your needs. To use it, you need the Locker class...
Definition: threadlock.h:51
IDType ID() const
Definition: monitorable.h:125
bool operator==(const ArrayNDInfo &a1, const ArrayNDInfo &a2)
Definition: arrayndinfo.h:51
RefMan< AuxData > auxdata_
Definition: monitorable.h:144
virtual ~ChangeData()
Definition: monitorable.h:121
T * auxDataAs()
Definition: monitorable.h:146
virtual Monitorable * clone() const
Definition: monitorable.h:91
Monitorable::ChangeType replaceMonitoredRef(ConstRefMan< Mon > &ref, const Mon *newptr, CallBacker *only_for)
replaces a ref to a Monitorable with a new one.
Definition: monitorable.h:317
#define od_int64
Definition: plftypes.h:34
void stopChangeNotifications() const
Definition: monitorable.h:175
bool hasUnspecID() const
Definition: monitorable.h:128
bool isEntireObject() const
Definition: monitorable.h:126
static ChangeData NoChange()
Definition: monitorable.h:136
bool delalreadytriggered_
Definition: monitorable.h:193
Definition: fixedstreambuf.h:18
int64_t IDType
Definition: monitorable.h:83
protects a Monitorable against change.
Definition: monitorable.h:252
bool unblocked_
Definition: monitorable.h:290
ChangeData(ChangeType typ, IDType id)
Definition: monitorable.h:117
bool sendnotif_
Definition: monitorable.h:291
static IDType cUnspecChgID()
Definition: monitorable.h:108
#define mDeclInstanceCreatedNotifierAccess(clss)
Definition: notify.h:235
interface to threads that should be portable.
Definition: atomic.h:24
const T * ptr() const
Definition: ptrman.h:77
static ChangeType cEntireObjectChange()
Definition: monitorable.h:104
virtual Notifier< Monitorable > & objectToBeDeleted() const
Definition: monitorable.h:95
Definition: monitorable.h:138
ChangeType changeType() const
Definition: monitorable.h:124
Monitorable::AccessLocker locker_
Definition: monitorable.h:263
virtual ChangeDataNotifier & objectChanged() const
Definition: monitorable.h:93
static IDType cUnspecChgID()
Definition: monitorable.h:134
ChangeNotifyBlocker(const Monitorable &, bool send_notif=true)
DirtyCounter dirtycount_
Definition: monitorable.h:188
static ChangeType cNoChgType()
Definition: monitorable.h:133
Threads::Lock accesslock_
Definition: monitorable.h:167
virtual DirtyCountType dirtyCount() const
Definition: monitorable.h:101
bool isNoChange() const
Definition: monitorable.h:127
ChangeDataNotifier chgnotif_
Definition: monitorable.h:191
prevents change notifications coming out of a Monitorable.
Definition: monitorable.h:277
virtual void touch() const
Definition: monitorable.h:100
static ChangeData AllChanged()
Definition: monitorable.h:135
bool unlocked_
Definition: monitorable.h:264
Definition: monitorable.h:113
bool includes(ChangeType ct) const
Definition: monitorable.h:129
Definition: monitorable.h:155
const Monitorable & obj_
Definition: monitorable.h:289
Threads::Atomic< int > chgnotifblocklevel_
Definition: monitorable.h:189
static ChangeType cEntireObjectChgType()
Definition: monitorable.h:132
CNotifier< Monitorable, ChangeData > ChangeDataNotifier
Definition: monitorable.h:85
static IDType cEntireObjectChgID()
Definition: monitorable.h:110
Notifier< Monitorable > delnotif_
Definition: monitorable.h:192
Threads::Atomic< DirtyCountType > DirtyCounter
Definition: monitorable.h:184
const T * ptr() const
Definition: ptrman.h:95
static ChangeType cNoChange()
Definition: monitorable.h:106
virtual ~AuxData()
Definition: monitorable.h:141