|
Main Page
Class Hierarchy
Alphabetical List
Compound List
File List
Compound Members
|
00001 /********************************************************************************
00002 * *
00003 * IO Stream *
00004 * *
00005 *********************************************************************************
00006 * Copyright (C) 2003 by Mathew Robertson. All Rights Reserved. *
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 #ifndef FXIOSTREAM_H
00023 #define FXIOSTREAM_H
00024
00025 #ifndef FXSTREAM_H
00026 #include <fox/FXStream.h>
00027 using namespace FX;
00028 #endif
00029 namespace FXEX {
00030 class FXIOHandle;
00031
00032 /**
00033 * IO Stream's are used to read FXStream data from files, sockets, serial ports, etc.
00034 * eg you can serialise a FOX object to a socket, which is then se-serialised at the other end.
00035 */
00036 class FXAPI FXIOStream : public FXStream {
00037
00038 protected:
00039 FXIOHandle *iohandle; // handle to actual socket
00040 FXbool opened; // did this stream open the socket
00041
00042 protected:
00043 // serialisation
00044 FXIOStream(){}
00045
00046 /// save data to socket
00047 void saveItems(const void* buf,unsigned long n);
00048
00049 /// load data from socket
00050 void loadItems(void* buf,unsigned long n);
00051
00052 public:
00053 /// Create a socket stream based on a specific socket
00054 FXIOStream(const FXObject *cont=NULL);
00055
00056 /// open a socket stream - socket will be opened if not already opened
00057 FXbool open(FXIOHandle *handle,FXStreamDirection save_or_load);
00058
00059 /// close a socket stream
00060 FXbool close();
00061
00062 /// dtor
00063 virtual ~FXIOStream();
00064 };
00065
00066 } // namespace FXEX
00067 #endif // FXIOSTREAM_H