pipe.h
Go to the documentation of this file.00001 /* 00002 * 00003 * D-Bus++ - C++ bindings for D-Bus 00004 * 00005 * Copyright (C) 2005-2007 Paolo Durante <shackan@gmail.com> 00006 * 00007 * 00008 * This library is free software; you can redistribute it and/or 00009 * modify it under the terms of the GNU Lesser General Public 00010 * License as published by the Free Software Foundation; either 00011 * version 2.1 of the License, or (at your option) any later version. 00012 * 00013 * This library is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00016 * Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public 00019 * License along with this library; if not, write to the Free Software 00020 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00021 * 00022 */ 00023 00024 #ifndef DBUSXX_PIPE_H 00025 #define DBUSXX_PIPE_H 00026 00027 /* Project */ 00028 #include "api.h" 00029 00030 /* STD */ 00031 #include <cstdlib> 00032 00033 namespace DBus 00034 { 00035 00036 class DXXAPI Pipe 00037 { 00038 public: 00045 void write(const void *buffer, unsigned int nbytes); 00046 00047 ssize_t read(void *buffer, unsigned int &nbytes); 00048 00053 void signal(); 00054 00055 private: 00056 void(*_handler)(const void *data, void *buffer, unsigned int nbyte); 00057 int _fd_write; 00058 int _fd_read; 00059 const void *_data; 00060 00061 // allow construction only in BusDispatcher 00062 Pipe(void(*handler)(const void *data, void *buffer, unsigned int nbyte), const void *data); 00063 ~Pipe() {}; 00064 00065 friend class BusDispatcher; 00066 }; 00067 00068 } /* namespace DBus */ 00069 00070 #endif // DBUSXX_PIPE_H