head 1.4; access; symbols; locks; strict; comment @# @; 1.4 date 2002.09.07.01.50.38; author curt; state Exp; branches; next 1.3; 1.3 date 2002.08.31.19.01.54; author curt; state Exp; branches; next 1.2; 1.2 date 2002.08.31.18.54.00; author curt; state Exp; branches; next 1.1; 1.1 date 2002.02.15.17.21.56; author curt; state Exp; branches; next ; desc @@ 1.4 log @Updated doxygen docs. @ text @
Main Page Class Hierarchy Compound List File List Compound Members File Members

# iochannel.hxx

Go to the documentation of this file.

    00001
    00006 // Written by Curtis Olson, started November 1999.
    00007 //
    00008 // Copyright (C) 1999  Curtis L. Olson - curt@@flightgear.org
    00009 //
    00010 // This program is free software; you can redistribute it and/or
    00011 // modify it under the terms of the GNU General Public License as
    00012 // published by the Free Software Foundation; either version 2 of the
    00013 // License, or (at your option) any later version.
    00014 //
    00015 // This program is distributed in the hope that it will be useful, but
    00016 // WITHOUT ANY WARRANTY; without even the implied warranty of
    00017 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    00018 // General Public License for more details.
    00019 //
    00020 // You should have received a copy of the GNU General Public License
    00021 // along with this program; if not, write to the Free Software
    00022 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
    00023 //
    00024 // $Id: iochannel.hxx,v 1.7 2001/11/12 04:47:59 curt Exp $
    00025
    00026
    00027 #ifndef _IOCHANNEL_HXX
    00028 #define _IOCHANNEL_HXX
    00029
    00030
    00031 #include <simgear/compiler.h>
    00032
    00033 // #include "protocol.hxx"
    00034
    00035 #include STL_STRING
    00036 #include <vector>
    00037
    00038 SG_USING_STD(vector);
    00039 SG_USING_STD(string);
    00040
    00041
    00042 #define SG_IO_MAX_MSG_SIZE 16384
    00043
    00048 enum SGProtocolDir {
    00049     SG_IO_NONE = 0,
    00050     SG_IO_IN = 1,
    00051     SG_IO_OUT = 2,
    00052     SG_IO_BI = 3
    00053 };
    00054
    00058 enum SGChannelType {
    00059     sgFileType = 0,
    00060     sgSerialType = 1,
    00061     sgSocketType = 2
    00062 };
    00063
    00064
    00076 class SGIOChannel {
    00077
    00078     SGChannelType type;
    00079     SGProtocolDir dir;
    00080     bool valid;
    00081
    00082 public:
    00083
    00085     SGIOChannel();
    00086
    00088     virtual ~SGIOChannel();
    00089
    00101     virtual bool open( const SGProtocolDir d );
    00102
    00115     virtual int read( char *buf, int length );
    00116
    00124     virtual int readline( char *buf, int length );
    00125
    00126
    00136     virtual int write( const char *buf, const int length );
    00137
    00145     virtual int writestring( const char *str );
    00146
    00153     virtual bool close();
    00154
    00155     inline void set_type( SGChannelType t ) { type = t; }
    00156     inline SGChannelType get_type() const { return type; }
    00157
    00158     inline void set_dir( const SGProtocolDir d ) { dir = d; }
    00159     inline SGProtocolDir get_dir() const { return dir; }
    00160     inline bool isvalid() const { return valid; }
    00161     inline void set_valid( const bool v ) { valid = v; }
    00162 };
    00163
    00164
    00165 #endif // _IOCHANNEL_HXX
    00166
    00167

@ 1.3 log @Oops, try again. @ text @d100 1 a100 1