INTRODUCTION Overview Download and Install Documentation Publications REPOSITORY Libraries DEVELOPER Dev Guide Dashboard PEOPLE Contributors Users Project Download Mailing lists
|
logreaderport.h00001 /* 00002 * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics 00003 * http://gearbox.sf.net/ 00004 * Copyright (c) 2008 Geoffrey Biggs 00005 * 00006 * flexiport flexible hardware data communications library. 00007 * 00008 * This distribution is licensed to you under the terms described in the LICENSE file included in 00009 * this distribution. 00010 * 00011 * This work is a product of the National Institute of Advanced Industrial Science and Technology, 00012 * Japan. Registration number: H20PRO-881 00013 * 00014 * This file is part of flexiport. 00015 * 00016 * flexiport is free software: you can redistribute it and/or modify it under the terms of the GNU 00017 * Lesser General Public License as published by the Free Software Foundation, either version 3 of 00018 * the License, or (at your option) any later version. 00019 * 00020 * flexiport is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without 00021 * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00022 * Lesser General Public License for more details. 00023 * 00024 * You should have received a copy of the GNU Lesser General Public License along with flexiport. 00025 * If not, see <http://www.gnu.org/licenses/>. 00026 */ 00027 00028 #ifndef __LOGREADERPORT_H 00029 #define __LOGREADERPORT_H 00030 00031 #include "port.h" 00032 00033 #include <map> 00034 #include <string> 00035 00040 namespace flexiport 00041 { 00042 00043 class LogFile; 00044 00075 class FLEXIPORT_EXPORT LogReaderPort : public Port 00076 { 00077 public: 00078 LogReaderPort (std::map<std::string, std::string> options); 00079 ~LogReaderPort (); 00080 00082 void Open (); 00084 void Close (); 00086 ssize_t Read (void * const buffer, size_t count); 00088 ssize_t ReadFull (void * const buffer, size_t count); 00090 ssize_t BytesAvailable (); 00092 ssize_t BytesAvailableWait (); 00094 ssize_t Write (const void * const buffer, size_t count); 00096 void Flush (); 00098 void Drain (); 00100 std::string GetStatus () const; 00102 void SetTimeout (Timeout timeout); 00104 void SetCanRead (bool canRead); 00106 void SetCanWrite (bool canWrite); 00108 bool IsOpen () const; 00109 00110 private: 00111 LogFile *_logFile; 00112 std::string _logFileName; 00113 unsigned int _strictness; 00114 int _jitter; 00115 bool _ignoreTimes; 00116 bool _open; 00117 00118 bool ProcessOption (const std::string &option, const std::string &value); 00119 void CheckPort (bool read); 00120 }; 00121 00122 } // namespace flexiport 00123 00126 #endif // __LOGREADERPORT_H |