Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
OpenWalnut
OpenWalnut Core
Commits
02f7ed2f
Commit
02f7ed2f
authored
May 14, 2010
by
Sebastian Eichelbaum
Browse files
[CHANGE] - shared object read-tickets now enforce constness
parent
697a1e65
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
10 deletions
+24
-10
src/common/WSharedObjectTicket.h
src/common/WSharedObjectTicket.h
+2
-10
src/common/WSharedObjectTicketRead.h
src/common/WSharedObjectTicketRead.h
+12
-0
src/common/WSharedObjectTicketWrite.h
src/common/WSharedObjectTicketWrite.h
+10
-0
No files found.
src/common/WSharedObjectTicket.h
View file @
02f7ed2f
...
...
@@ -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".
...
...
src/common/WSharedObjectTicketRead.h
View file @
02f7ed2f
...
...
@@ -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:
/**
...
...
src/common/WSharedObjectTicketWrite.h
View file @
02f7ed2f
...
...
@@ -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:
/**
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment