INTRODUCTION
Overview
Download and Install
Documentation
Publications

REPOSITORY
Libraries

DEVELOPER
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         
logreaderport.h
1 /*
2  * GearBox Project: Peer-Reviewed Open-Source Libraries for Robotics
3  * http://gearbox.sf.net/
4  * Copyright (c) 2008 Geoffrey Biggs
5  *
6  * flexiport flexible hardware data communications library.
7  *
8  * This distribution is licensed to you under the terms described in the LICENSE file included in
9  * this distribution.
10  *
11  * This work is a product of the National Institute of Advanced Industrial Science and Technology,
12  * Japan. Registration number: H20PRO-881
13  *
14  * This file is part of flexiport.
15  *
16  * flexiport is free software: you can redistribute it and/or modify it under the terms of the GNU
17  * Lesser General Public License as published by the Free Software Foundation, either version 3 of
18  * the License, or (at your option) any later version.
19  *
20  * flexiport is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without
21  * even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22  * Lesser General Public License for more details.
23  *
24  * You should have received a copy of the GNU Lesser General Public License along with flexiport.
25  * If not, see <http://www.gnu.org/licenses/>.
26  */
27 
28 #ifndef __LOGREADERPORT_H
29 #define __LOGREADERPORT_H
30 
31 #include "port.h"
32 
33 #include <map>
34 #include <string>
35 
40 namespace flexiport
41 {
42 
43 class LogFile;
44 
75 class FLEXIPORT_EXPORT LogReaderPort : public Port
76 {
77  public:
78  LogReaderPort (std::map<std::string, std::string> options);
79  ~LogReaderPort ();
80 
82  void Open ();
84  void Close ();
86  ssize_t Read (void * const buffer, size_t count);
88  ssize_t ReadFull (void * const buffer, size_t count);
90  ssize_t BytesAvailable ();
92  ssize_t BytesAvailableWait ();
94  ssize_t Write (const void * const buffer, size_t count);
96  void Flush ();
98  void Drain ();
100  std::string GetStatus () const;
102  void SetTimeout (Timeout timeout);
104  void SetCanRead (bool canRead);
106  void SetCanWrite (bool canWrite);
108  bool IsOpen () const;
109 
110  private:
111  LogFile *_logFile;
112  std::string _logFileName;
113  unsigned int _strictness;
114  int _jitter;
115  bool _ignoreTimes;
116  bool _open;
117 
118  bool ProcessOption (const std::string &option, const std::string &value);
119  void CheckPort (bool read);
120 };
121 
122 } // namespace flexiport
123 
126 #endif // __LOGREADERPORT_H
void Drain()
Drain the port's input and output buffers.
Definition: logreaderport.cpp:250
FlexiPort data communications library.
void SetCanWrite(bool canWrite)
Set the write permissions of the port.
Definition: logreaderport.cpp:284
void Flush()
Flush the port's input and output buffers, discarding all data.
Definition: logreaderport.cpp:242
Exception thrown by the Port class and its derivatives.
Definition: flexiport.h:55
void SetCanRead(bool canRead)
Set the read permissions of the port.
Definition: logreaderport.cpp:279
ssize_t BytesAvailable()
Get the number of bytes waiting to be read at the port. Returns immediatly.
Definition: logreaderport.cpp:169
void Close()
Close the port.
Definition: logreaderport.cpp:84
An object used to represent timeouts.
Definition: timeout.h:63
ssize_t ReadFull(void *const buffer, size_t count)
Read the requested quantity of data from the port.
Definition: logreaderport.cpp:117
ssize_t Read(void *const buffer, size_t count)
Read from the port.
Definition: logreaderport.cpp:99
void Open()
Open the port.
Definition: logreaderport.cpp:71
void SetTimeout(Timeout timeout)
Set the timeout value in milliseconds.
Definition: logreaderport.cpp:274
ssize_t Write(const void *const buffer, size_t count)
Write data to the port.
Definition: logreaderport.cpp:198
bool IsOpen() const
Check if the port is open.
Definition: logreaderport.cpp:289
std::string GetStatus() const
Get the status of the port (type, device, etc).
Definition: logreaderport.cpp:261
Simulated port using a log file.
Definition: logreaderport.h:76
Base Port class.
Definition: port.h:80
ssize_t BytesAvailableWait()
Get the number of bytes waiting after blocking for the timeout.
Definition: logreaderport.cpp:182
 

Generated for GearBox by  doxygen 1.4.5