* Coding style cleanup.
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42981 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
parent
78faf579e3
commit
78fcc847a2
@ -1,19 +1,20 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku.
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
* Erik Jaesler (erik@cgsoftware.com)
|
||||
*/
|
||||
#ifndef LOOPERLIST_H
|
||||
#define LOOPERLIST_H
|
||||
#ifndef LOOPER_LIST_H
|
||||
#define LOOPER_LIST_H
|
||||
|
||||
|
||||
#include <vector>
|
||||
|
||||
#include <Locker.h>
|
||||
#include <OS.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <vector>
|
||||
|
||||
class BList;
|
||||
class BLooper;
|
||||
@ -21,64 +22,68 @@ class BLooper;
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class BLooperList {
|
||||
public:
|
||||
BLooperList();
|
||||
public:
|
||||
BLooperList();
|
||||
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
bool IsLocked();
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
bool IsLocked();
|
||||
|
||||
void AddLooper(BLooper* l);
|
||||
bool IsLooperValid(const BLooper* l);
|
||||
bool RemoveLooper(BLooper* l);
|
||||
void GetLooperList(BList* list);
|
||||
int32 CountLoopers();
|
||||
BLooper* LooperAt(int32 index);
|
||||
BLooper* LooperForThread(thread_id tid);
|
||||
BLooper* LooperForName(const char* name);
|
||||
BLooper* LooperForPort(port_id port);
|
||||
void AddLooper(BLooper* l);
|
||||
bool IsLooperValid(const BLooper* l);
|
||||
bool RemoveLooper(BLooper* l);
|
||||
void GetLooperList(BList* list);
|
||||
int32 CountLoopers();
|
||||
BLooper* LooperAt(int32 index);
|
||||
BLooper* LooperForThread(thread_id tid);
|
||||
BLooper* LooperForName(const char* name);
|
||||
BLooper* LooperForPort(port_id port);
|
||||
|
||||
private:
|
||||
struct LooperData {
|
||||
LooperData();
|
||||
LooperData(BLooper* looper);
|
||||
LooperData(const LooperData& rhs);
|
||||
LooperData& operator=(const LooperData& rhs);
|
||||
private:
|
||||
struct LooperData {
|
||||
LooperData();
|
||||
LooperData(BLooper* looper);
|
||||
LooperData(const LooperData& rhs);
|
||||
LooperData& operator=(const LooperData& rhs);
|
||||
|
||||
BLooper* looper;
|
||||
};
|
||||
BLooper* looper;
|
||||
};
|
||||
struct FindLooperPred {
|
||||
FindLooperPred(const BLooper* loop) : looper(loop) {}
|
||||
bool operator()(LooperData& Data);
|
||||
const BLooper* looper;
|
||||
};
|
||||
struct FindThreadPred {
|
||||
FindThreadPred(thread_id tid) : thread(tid) {}
|
||||
bool operator()(LooperData& Data);
|
||||
thread_id thread;
|
||||
};
|
||||
struct FindNamePred {
|
||||
FindNamePred(const char* n) : name(n) {}
|
||||
bool operator()(LooperData& Data);
|
||||
const char* name;
|
||||
};
|
||||
struct FindPortPred {
|
||||
FindPortPred(port_id pid) : port(pid) {}
|
||||
bool operator()(LooperData& Data);
|
||||
port_id port;
|
||||
};
|
||||
|
||||
static bool EmptySlotPred(LooperData& Data);
|
||||
struct FindLooperPred {
|
||||
FindLooperPred(const BLooper* loop) : looper(loop) {;}
|
||||
bool operator()(LooperData& Data);
|
||||
const BLooper* looper;
|
||||
};
|
||||
struct FindThreadPred {
|
||||
FindThreadPred(thread_id tid) : thread(tid) {;}
|
||||
bool operator()(LooperData& Data);
|
||||
thread_id thread;
|
||||
};
|
||||
struct FindNamePred {
|
||||
FindNamePred(const char* n) : name(n) {;}
|
||||
bool operator()(LooperData& Data);
|
||||
const char* name;
|
||||
};
|
||||
struct FindPortPred {
|
||||
FindPortPred(port_id pid) : port(pid) {;}
|
||||
bool operator()(LooperData& Data);
|
||||
port_id port;
|
||||
};
|
||||
static bool EmptySlotPred(LooperData& Data);
|
||||
void AssertLocked();
|
||||
|
||||
void AssertLocked();
|
||||
|
||||
BLocker fLock;
|
||||
std::vector<LooperData> fData;
|
||||
private:
|
||||
BLocker fLock;
|
||||
std::vector<LooperData> fData;
|
||||
};
|
||||
|
||||
|
||||
extern BLooperList gLooperList;
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
#endif // LOOPERLIST_H
|
||||
|
||||
#endif // LOOPER_LIST_H
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2001-2007, Haiku.
|
||||
* Copyright 2001-2011, Haiku.
|
||||
* Distributed under the terms of the MIT License.
|
||||
*
|
||||
* Authors:
|
||||
@ -10,13 +10,12 @@
|
||||
#define _TOKEN_SPACE_H
|
||||
|
||||
|
||||
#include <BeBuild.h>
|
||||
#include <Locker.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
#include <map>
|
||||
#include <stack>
|
||||
|
||||
#include <Locker.h>
|
||||
#include <SupportDefs.h>
|
||||
|
||||
|
||||
// token types as specified in targets
|
||||
#define B_PREFERRED_TOKEN -2 /* A little bird told me about this one */
|
||||
@ -30,38 +29,45 @@
|
||||
|
||||
namespace BPrivate {
|
||||
|
||||
|
||||
class BDirectMessageTarget;
|
||||
|
||||
|
||||
class BTokenSpace : public BLocker {
|
||||
public:
|
||||
BTokenSpace();
|
||||
~BTokenSpace();
|
||||
public:
|
||||
BTokenSpace();
|
||||
~BTokenSpace();
|
||||
|
||||
int32 NewToken(int16 type, void* object);
|
||||
bool SetToken(int32 token, int16 type, void* object);
|
||||
int32 NewToken(int16 type, void* object);
|
||||
bool SetToken(int32 token, int16 type, void* object);
|
||||
|
||||
bool RemoveToken(int32 token);
|
||||
bool CheckToken(int32 token, int16 type) const;
|
||||
status_t GetToken(int32 token, int16 type, void** _object) const;
|
||||
bool RemoveToken(int32 token);
|
||||
bool CheckToken(int32 token, int16 type) const;
|
||||
status_t GetToken(int32 token, int16 type,
|
||||
void** _object) const;
|
||||
|
||||
status_t SetHandlerTarget(int32 token, BDirectMessageTarget* target);
|
||||
status_t AcquireHandlerTarget(int32 token, BDirectMessageTarget** _target);
|
||||
status_t SetHandlerTarget(int32 token,
|
||||
BDirectMessageTarget* target);
|
||||
status_t AcquireHandlerTarget(int32 token,
|
||||
BDirectMessageTarget** _target);
|
||||
|
||||
private:
|
||||
struct token_info {
|
||||
int16 type;
|
||||
void* object;
|
||||
BDirectMessageTarget* target;
|
||||
};
|
||||
typedef std::map<int32, token_info> TokenMap;
|
||||
private:
|
||||
struct token_info {
|
||||
int16 type;
|
||||
void* object;
|
||||
BDirectMessageTarget* target;
|
||||
};
|
||||
typedef std::map<int32, token_info> TokenMap;
|
||||
|
||||
TokenMap fTokenMap;
|
||||
int32 fTokenCount;
|
||||
TokenMap fTokenMap;
|
||||
int32 fTokenCount;
|
||||
};
|
||||
|
||||
|
||||
extern BTokenSpace gDefaultTokens;
|
||||
|
||||
|
||||
} // namespace BPrivate
|
||||
|
||||
|
||||
#endif // _TOKEN_SPACE_H
|
||||
|
Loading…
Reference in New Issue
Block a user