MADARA  3.2.3
madara::knowledge::rcw::Tracked< T > Class Template Reference

Tracks the modification status of a wrapped object of the given type. More...

#include <Tracked.h>

Inheritance diagram for madara::knowledge::rcw::Tracked< T >:
madara::knowledge::rcw::TrackedExtra< T, Tracked< T > >

Public Member Functions

 Tracked ()
 Default constructor; default constructs wrapped object. More...
 
 Tracked (T val)
 Create a Tracked version of the given object, which is copied. More...
 
void clear_dirty ()
 Resets modification status. More...
 
const T & get () const
 Get a const ref to the underlying object. More...
 
T & get_mut ()
 Get a non-const ref to underlying object. More...
 
T & get_mutable ()
 Get a non-const ref to underlying object. More...
 
bool is_dirty () const
 Get modification status. More...
 
void modify ()
 Treat object as modified, even if it isn't. More...
 
 operator bool ()
 Cast to bool as appropriate. More...
 
 operator const T & () const
 Cast to const ref as appropriate. More...
 
template<class U , typename std::enable_if< std::is_convertible< T, U >::value, void * >::type = nullptr>
 operator Tracked< U > () const
 Support conversion to Tracked<U> if U can convert from T. More...
 
const T & operator* () const
 Dereference to underlying object. More...
 
const T * operator-> () const
 Pass through to underlying object. More...
 
Trackedoperator= (T val)
 Assignment writes to the underlying object. More...
 
Trackedoperator= (const Tracked &)=delete
 Delete default assignment so we don't accidentally use it. More...
 
void set (T val)
 Set the underlying object, and mark as modified. More...
 

Private Types

typedef TrackedExtra< T, Tracked< T > > Base
 Flag for modification status. More...
 

Private Attributes

char dirty_
 Wrapped value. More...
 
val_
 

Friends

void swap (Tracked &lhs, Tracked &rhs)
 Implement swap between two tracked objects of same type. More...
 
void swap (Tracked &lhs, T &rhs)
 Implement swap between tracked object, and object of underlying type. More...
 
void swap (T &lhs, Tracked &rhs)
 Implement swap between tracked object, and object of underlying type. More...
 
class TrackedCollection< T, Tracked< T > >
 
class TrackedCollection< T, TrackedExtra< T, Tracked< T > > >
 
class TrackedExtra< T, Tracked< T > >
 

Detailed Description

template<class T>
class madara::knowledge::rcw::Tracked< T >

Tracks the modification status of a wrapped object of the given type.

See https://sourceforge.net/p/madara/wiki/ReadComputeWrite/ for details.

Template Parameters
Ttype of the underlying object

Definition at line 75 of file Tracked.h.

Member Typedef Documentation

template<class T>
typedef TrackedExtra<T, Tracked<T> > madara::knowledge::rcw::Tracked< T >::Base
private

Flag for modification status.

Definition at line 81 of file Tracked.h.

Constructor & Destructor Documentation

template<class T>
madara::knowledge::rcw::Tracked< T >::Tracked ( )
inline

Default constructor; default constructs wrapped object.

Definition at line 88 of file Tracked.h.

template<class T>
madara::knowledge::rcw::Tracked< T >::Tracked ( val)
inlineexplicit

Create a Tracked version of the given object, which is copied.

Parameters
valthe object to copy and track

Definition at line 92 of file Tracked.h.

Member Function Documentation

template<class T>
void madara::knowledge::rcw::Tracked< T >::clear_dirty ( )
inline

Resets modification status.

Definition at line 168 of file Tracked.h.

template<class T>
const T& madara::knowledge::rcw::Tracked< T >::get ( ) const
inline

Get a const ref to the underlying object.

Definition at line 95 of file Tracked.h.

template<class T>
T& madara::knowledge::rcw::Tracked< T >::get_mut ( )
inline

Get a non-const ref to underlying object.

Immediately treat it as modified, since we don't know what the caller will do with it.

Definition at line 108 of file Tracked.h.

template<class T>
T& madara::knowledge::rcw::Tracked< T >::get_mutable ( )
inline

Get a non-const ref to underlying object.

Immediately treat it as modified, since we don't know what the caller will do with it. Synonmym for

Definition at line 117 of file Tracked.h.

template<class T>
bool madara::knowledge::rcw::Tracked< T >::is_dirty ( ) const
inline

Get modification status.

Returns
true if object has been modified; false if not

Definition at line 162 of file Tracked.h.

template<class T>
void madara::knowledge::rcw::Tracked< T >::modify ( void  )
inline

Treat object as modified, even if it isn't.

Definition at line 155 of file Tracked.h.

template<class T>
madara::knowledge::rcw::Tracked< T >::operator bool ( )
inlineexplicit

Cast to bool as appropriate.

Definition at line 181 of file Tracked.h.

template<class T>
madara::knowledge::rcw::Tracked< T >::operator const T & ( ) const
inlineexplicit

Cast to const ref as appropriate.

Definition at line 101 of file Tracked.h.

template<class T>
template<class U , typename std::enable_if< std::is_convertible< T, U >::value, void * >::type = nullptr>
madara::knowledge::rcw::Tracked< T >::operator Tracked< U > ( ) const
inline

Support conversion to Tracked<U> if U can convert from T.

Template Parameters
Uother type to potentially convert to

Definition at line 190 of file Tracked.h.

template<class T>
const T& madara::knowledge::rcw::Tracked< T >::operator* ( void  ) const
inline

Dereference to underlying object.

Only supports const version. To get a non-const reference, use get_mut().

Definition at line 132 of file Tracked.h.

template<class T>
const T* madara::knowledge::rcw::Tracked< T >::operator-> ( ) const
inline

Pass through to underlying object.

Only supports const version. To get a non-const reference, use get_mut().

Definition at line 139 of file Tracked.h.

template<class T>
Tracked& madara::knowledge::rcw::Tracked< T >::operator= ( val)
inline

Assignment writes to the underlying object.

Definition at line 145 of file Tracked.h.

template<class T>
Tracked& madara::knowledge::rcw::Tracked< T >::operator= ( const Tracked< T > &  )
delete

Delete default assignment so we don't accidentally use it.

template<class T>
void madara::knowledge::rcw::Tracked< T >::set ( val)
inline

Set the underlying object, and mark as modified.

Definition at line 124 of file Tracked.h.

Friends And Related Function Documentation

template<class T>
void swap ( Tracked< T > &  lhs,
Tracked< T > &  rhs 
)
friend

Implement swap between two tracked objects of same type.

Definition at line 198 of file Tracked.h.

template<class T>
void swap ( Tracked< T > &  lhs,
T &  rhs 
)
friend

Implement swap between tracked object, and object of underlying type.

Definition at line 206 of file Tracked.h.

template<class T>
void swap ( T &  lhs,
Tracked< T > &  rhs 
)
friend

Implement swap between tracked object, and object of underlying type.

Definition at line 214 of file Tracked.h.

template<class T>
friend class TrackedCollection< T, Tracked< T > >
friend

Definition at line 84 of file Tracked.h.

template<class T>
friend class TrackedCollection< T, TrackedExtra< T, Tracked< T > > >
friend

Definition at line 85 of file Tracked.h.

template<class T>
friend class TrackedExtra< T, Tracked< T > >
friend

Definition at line 83 of file Tracked.h.

Member Data Documentation

template<class T>
char madara::knowledge::rcw::Tracked< T >::dirty_
private

Wrapped value.

Definition at line 79 of file Tracked.h.

template<class T>
T madara::knowledge::rcw::Tracked< T >::val_
private

Definition at line 78 of file Tracked.h.


The documentation for this class was generated from the following file: