Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Examples  

FileHandleImplUNIX.h

Go to the documentation of this file.
00001 /****************** <VPR heading BEGIN do not edit this line> *****************
00002  *
00003  * VR Juggler Portable Runtime
00004  *
00005  * Original Authors:
00006  *   Allen Bierbaum, Patrick Hartling, Kevin Meinert, Carolina Cruz-Neira
00007  *
00008  * -----------------------------------------------------------------
00009  * File:          $RCSfile: FileHandleImplUNIX.h,v $
00010  * Date modified: $Date: 2003/11/05 21:13:24 $
00011  * Version:       $Revision: 1.41 $
00012  * -----------------------------------------------------------------
00013  *
00014  ****************** <VPR heading END do not edit this line> ******************/
00015 
00016 /*************** <auto-copyright.pl BEGIN do not edit this line> **************
00017  *
00018  * VR Juggler is (C) Copyright 1998-2003 by Iowa State University
00019  *
00020  * Original Authors:
00021  *   Allen Bierbaum, Christopher Just,
00022  *   Patrick Hartling, Kevin Meinert,
00023  *   Carolina Cruz-Neira, Albert Baker
00024  *
00025  * This library is free software; you can redistribute it and/or
00026  * modify it under the terms of the GNU Library General Public
00027  * License as published by the Free Software Foundation; either
00028  * version 2 of the License, or (at your option) any later version.
00029  *
00030  * This library is distributed in the hope that it will be useful,
00031  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00032  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00033  * Library General Public License for more details.
00034  *
00035  * You should have received a copy of the GNU Library General Public
00036  * License along with this library; if not, write to the
00037  * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
00038  * Boston, MA 02111-1307, USA.
00039  *
00040  *************** <auto-copyright.pl END do not edit this line> ***************/
00041 
00042 #ifndef _VPR_FILE_HANDLE_IMPL_UNIX_H_
00043 #define _VPR_FILE_HANDLE_IMPL_UNIX_H_
00044 
00045 #include <vpr/vprConfig.h>
00046 
00047 #include <string>
00048 #include <vector>
00049 
00050 #include <vpr/IO/IOSys.h>
00051 #include <vpr/Util/ReturnStatus.h>
00052 #include <vpr/Util/Interval.h>
00053 
00054 
00055 namespace vpr
00056 {
00057 
00061 class FileHandleImplUNIX
00062 {
00063 public:
00071    FileHandleImplUNIX();
00072 
00082    FileHandleImplUNIX(const std::string& file_name);
00083 
00089    ~FileHandleImplUNIX();
00090 
00091    // ========================================================================
00092    // vpr::BlockIO basics.
00093    // ========================================================================
00094 
00102    const std::string& getName() const
00103    {
00104       return mName;
00105    }
00106 
00119    vpr::ReturnStatus open();
00120 
00134    vpr::ReturnStatus close();
00135 
00145    bool isOpen() const
00146    {
00147       return mOpen;
00148    }
00149 
00164    vpr::ReturnStatus setBlocking(bool blocking);
00165 
00169    vpr::IOSys::Handle getHandle() const;
00170 
00179    bool isBlocking() const
00180    {
00181       return mBlocking;
00182    }
00183 
00184    // ========================================================================
00185    // vpr::FileHandle implementation.
00186    // ========================================================================
00187 
00196    void setOpenReadOnly();
00197 
00206    void setOpenWriteOnly();
00207 
00216    void setOpenReadWrite();
00217 
00232    vpr::ReturnStatus setAppend(bool flag);
00233 
00249    vpr::ReturnStatus setSynchronousWrite(bool flag);
00250 
00261    bool isReadOnly() const;
00262 
00273    bool isWriteOnly() const;
00274 
00285    bool isReadWrite() const;
00286 
00293    vpr::ReturnStatus getReadBufferSize(vpr::Int32& buffer) const;
00294 
00321    vpr::ReturnStatus read_i(void* buffer, const vpr::Uint32 length,
00322                             vpr::Uint32& bytes_read,
00323                             const vpr::Interval timeout = vpr::Interval::NoTimeout);
00324 
00350    vpr::ReturnStatus readn_i(void* buffer, const vpr::Uint32 length,
00351                              vpr::Uint32& bytes_read,
00352                              const vpr::Interval timeout = vpr::Interval::NoTimeout);
00353 
00380    vpr::ReturnStatus write_i(const void* buffer, const vpr::Uint32 length,
00381                              vpr::Uint32& bytes_written,
00382                              const vpr::Interval timeout = vpr::Interval::NoTimeout);
00383 
00392    vpr::Uint32 availableBytes() const;
00393 
00394 protected:
00395    // Friends.
00396    friend class SerialPortImplTermios;
00397    friend class SocketDatagramImplBSD;
00398    friend class SocketImplBSD;
00399    friend class SocketStreamImplBSD;
00400 
00411    int getFlags() const;
00412 
00423    int setFlags(const int flags);
00424 
00429    vpr::ReturnStatus isReadable(const vpr::Interval timeout) const;
00430 
00435    vpr::ReturnStatus isWriteable(const vpr::Interval timeout) const;
00436 
00437    std::string mName;           
00438    bool        mOpen;           
00439    bool        mOpenBlocking;
00440    bool        mBlocking;       
00442    int mFdesc;      
00443    int mOpenMode;   
00444 };
00445 
00446 } // End of vpr namespace
00447 
00448 
00449 #endif  /* _VPR_FILE_HANDLE_IMPL_UNIX_H_ */

Generated on Sun May 2 14:43:01 2004 for VR Juggler Portable Runtime by doxygen1.2.14 written by Dimitri van Heesch, © 1997-2002