It is accomplished ...

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@10 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
ejakowatz
2002-07-09 12:24:59 +00:00
commit 52a3801208
2025 changed files with 472889 additions and 0 deletions
+43
View File
@@ -0,0 +1,43 @@
#ifndef _PORTLINK_H_
#define _PORTLINK_H_
#include <Errors.h>
#include <OS.h>
#include <SupportDefs.h>
#include <Rect.h>
#ifndef _PORTLINK_BUFFERSIZE
#define _PORTLINK_MAX_ATTACHMENTS 50
#endif
class PortLinkData;
class PortLink
{
public:
PortLink(port_id port);
~PortLink(void);
void SetOpCode(int32 code);
void SetPort(port_id port);
port_id GetPort(void);
void Flush(bigtime_t timeout=B_INFINITE_TIMEOUT);
int8* FlushWithReply(int32 *code, status_t *status, ssize_t *buffersize,
bigtime_t timeout=B_INFINITE_TIMEOUT);
void Attach(void *data, size_t size);
void Attach(int32 data);
void Attach(int16 data);
void Attach(int8 data);
void Attach(float data);
void Attach(bool data);
void Attach(BRect data);
void Attach(BPoint data);
void MakeEmpty(void);
protected:
void FlattenData(int8 **buffer,int32 *size);
port_id target, replyport;
int32 opcode, bufferlength;
int num_attachments;
PortLinkData *attachments[_PORTLINK_MAX_ATTACHMENTS];
};
#endif
+89
View File
@@ -0,0 +1,89 @@
//------------------------------------------------------------------------------
// TokenSpace.h
//
//------------------------------------------------------------------------------
#ifndef TOKENSPACE_H
#define TOKENSPACE_H
// Standard Includes -----------------------------------------------------------
#include <map>
#include <stack>
// System Includes -------------------------------------------------------------
#include <BeBuild.h>
#include <Locker.h>
#include <SupportDefs.h>
// Project Includes ------------------------------------------------------------
// Local Includes --------------------------------------------------------------
// Local Defines ---------------------------------------------------------------
#define B_NULL_TOKEN -1
#define B_ANY_TOKEN 0
#define B_HANDLER_TOKEN 1
// Globals ---------------------------------------------------------------------
namespace BPrivate {
typedef void (*new_token_callback)(int16, void*);
typedef void (*remove_token_callback)(int16, void*);
typedef bool (*get_token_callback)(int16, void*);
class BTokenSpace
{
public:
BTokenSpace();
~BTokenSpace();
int32 NewToken(int16 type, void* object,
new_token_callback callback= NULL);
bool RemoveToken(int32 token, remove_token_callback callback = NULL);
bool CheckToken(int32, int16) const;
status_t GetToken(int32, int16, void**,
get_token_callback callback = NULL) const;
// Possible expansion
// void Dump(BDataIO&, bool) const;
// int32 NewToken(void*, BDirectMessageTarget*, void (*)(short, void*));
// bool SetTokenTarget(uint32, BDirectMessageTarget*);
// BDirectMessageTarget* TokenTarget(uint32 token, int16 type);
private:
struct TTokenInfo
{
int16 type;
void* object;
};
typedef std::map<int32, TTokenInfo> TTokenMap;
TTokenMap fTokenMap;
std::stack<int32> fTokenBin;
int32 fTokenCount;
BLocker fLocker;
};
// Possible expansion
//_delete_tokens_();
//_init_tokens_();
//get_handler_token(short, void*);
//get_token_list(long, long*);
//new_handler_token(short, void*);
//remove_handler_token(short, void*);
extern _IMPEXP_BE BTokenSpace gDefaultTokens;
} // namespace BPrivate
#endif //TOKENSPACE_H
/*
* $Log $
*
* $Id $
*
*/