Commit 02f7ed2f authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] - shared object read-tickets now enforce constness

parent 697a1e65
......@@ -36,6 +36,8 @@ class WSharedObject;
/**
* Class which represents granted access to a locked object. It contains a reference to the object and a lock. The lock is freed after the ticket
* has been destroyed.
*
* \note This class does not provide any member to actually get the contained value/instance. This is done in read and write tickets.
*/
template < typename Data >
class WSharedObjectTicket
......@@ -56,16 +58,6 @@ public:
}
};
/**
* Returns the protected data. As long as you own the ticket, you are allowed to use it.
*
* \return the data
*/
Data& get() const
{
return m_data;
};
/**
* If called, the unlock will NOT fire the condition. This is useful in some situations if you find out "hey there actually was nothing
* changed".
......
......@@ -50,6 +50,18 @@ public:
unlock();
};
/**
* Returns the protected data. As long as you own the ticket, you are allowed to use it.
*
* \note making it const enforces const correctness for contained types!
*
* \return the data (const!)
*/
const Data& get() const
{
return WSharedObjectTicket< Data >::m_data;
};
protected:
/**
......
......@@ -50,6 +50,16 @@ public:
unlock();
};
/**
* Returns the protected data. As long as you own the ticket, you are allowed to use it.
*
* \return the data
*/
Data& get() const
{
return WSharedObjectTicket< Data >::m_data;
};
protected:
/**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment