rllib  1
rlmailbox.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                           rlmailbox.h  -  description
00003                              -------------------
00004     begin                : Tue Jan 02 2001
00005     copyright            : (C) 2001 by Rainer Lehrig
00006     email                : lehrig@t-online.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This library is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE as        *
00013  *   published by the Free Software Foundation                             *
00014  *                                                                         *
00015  ***************************************************************************/
00016 #ifndef _RL_MAILBOX_H_
00017 #define _RL_MAILBOX_H_
00018 
00019 #include "rldefine.h"
00020 
00029 class rlMailbox
00030 {
00031 public:
00032   enum MailboxEnum
00033   {
00035     MAILBOX_ERROR            = -1,
00036     MAILBOX_FULL             = -2,
00038     WAIT                     = 1,
00039     NOWAIT                   = 0,
00041     MAX_MAILBOX              = 256*256,
00043     OK                       = 2,
00044     COULD_NOT_CREATE_MAILBOX = 3,
00045     COULD_NOT_GET_KEY        = 4,
00046     COULD_NOT_GET_CHAN_ID    = 5
00047   };
00048 
00052   rlMailbox(const char *name);
00053 
00057   virtual ~rlMailbox();
00058 
00065   int write(const void *buf, int len);
00066 
00073   int printf(const char *format, ...);
00074 
00081   int read(void *buf, int maxlen, int wait=WAIT);
00082 
00086   void clear();
00087 
00093   int status;
00094 
00098   char *name;
00099 
00100 private:
00101   int chanid;
00102 };
00103 
00104 #endif