2002-07-09 16:24:59 +04:00
|
|
|
#ifndef _PORTLINK_H_
|
|
|
|
#define _PORTLINK_H_
|
|
|
|
|
|
|
|
#include <Errors.h>
|
|
|
|
#include <OS.h>
|
|
|
|
#include <SupportDefs.h>
|
|
|
|
#include <Rect.h>
|
2003-03-07 01:24:45 +03:00
|
|
|
#include <List.h>
|
2002-07-09 16:24:59 +04:00
|
|
|
|
|
|
|
class PortLinkData;
|
|
|
|
|
|
|
|
class PortLink
|
|
|
|
{
|
2002-11-19 03:31:58 +03:00
|
|
|
class ReplyData
|
2002-10-01 02:34:20 +04:00
|
|
|
{
|
2002-11-19 03:31:58 +03:00
|
|
|
public:
|
|
|
|
ReplyData(void) { code=0; buffersize=0; buffer=NULL; }
|
2003-03-12 21:00:51 +03:00
|
|
|
~ReplyData(void) { if(buffer) delete buffer; }
|
2002-10-01 02:34:20 +04:00
|
|
|
int32 code;
|
|
|
|
ssize_t buffersize;
|
|
|
|
int8 *buffer;
|
2002-11-19 03:31:58 +03:00
|
|
|
};
|
2002-07-09 16:24:59 +04:00
|
|
|
public:
|
|
|
|
PortLink(port_id port);
|
2002-10-01 02:34:20 +04:00
|
|
|
PortLink(const PortLink &link);
|
2002-07-09 16:24:59 +04:00
|
|
|
~PortLink(void);
|
|
|
|
void SetOpCode(int32 code);
|
|
|
|
void SetPort(port_id port);
|
|
|
|
port_id GetPort(void);
|
2002-10-01 02:34:20 +04:00
|
|
|
status_t Flush(bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2002-07-09 16:24:59 +04:00
|
|
|
int8* FlushWithReply(int32 *code, status_t *status, ssize_t *buffersize,
|
|
|
|
bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2002-10-01 02:34:20 +04:00
|
|
|
status_t FlushWithReply(PortLink::ReplyData *data,bigtime_t timeout=B_INFINITE_TIMEOUT);
|
2003-03-21 16:09:22 +03:00
|
|
|
status_t Attach(const void *data, size_t size);
|
2002-10-01 02:34:20 +04:00
|
|
|
status_t Attach(int32 data);
|
|
|
|
status_t Attach(int16 data);
|
|
|
|
status_t Attach(int8 data);
|
|
|
|
status_t Attach(float data);
|
|
|
|
status_t Attach(bool data);
|
|
|
|
status_t Attach(BRect data);
|
|
|
|
status_t Attach(BPoint data);
|
2002-07-09 16:24:59 +04:00
|
|
|
void MakeEmpty(void);
|
|
|
|
protected:
|
|
|
|
void FlattenData(int8 **buffer,int32 *size);
|
|
|
|
port_id target, replyport;
|
2002-10-01 02:34:20 +04:00
|
|
|
int32 opcode;
|
|
|
|
uint32 bufferlength,capacity;
|
|
|
|
bool port_ok;
|
2003-03-07 01:24:45 +03:00
|
|
|
BList *attachlist;
|
2002-07-09 16:24:59 +04:00
|
|
|
};
|
|
|
|
|
2003-03-07 01:24:45 +03:00
|
|
|
#endif
|