Added a BTokenSpace::SetToken() to assign a specific token.

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15111 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2005-11-24 13:00:06 +00:00
parent 46b7964e5c
commit 45d4256f2d
2 changed files with 18 additions and 0 deletions
+2
View File
@@ -41,6 +41,8 @@ class BTokenSpace : public BLocker {
int32 NewToken(int16 type, void* object,
new_token_callback callback = NULL);
void SetToken(int32 token, int16 type, void* object);
bool RemoveToken(int32 token, remove_token_callback callback = NULL);
bool CheckToken(int32 token, int16 type) const;
status_t GetToken(int32 token, int16 type, void** object,
+16
View File
@@ -52,6 +52,22 @@ BTokenSpace::NewToken(int16 type, void* object,
}
/*!
Inserts the specified token into the token space. If that token
already exists, it will be overwritten.
Don't mix NewToken() and this method unless you know what you're
doing.
*/
void
BTokenSpace::SetToken(int32 token, int16 type, void* object)
{
BAutolock locker(this);
token_info tokenInfo = { type, object };
fTokenMap[token] = tokenInfo;
}
bool
BTokenSpace::RemoveToken(int32 token, remove_token_callback callback)
{