Flexiport 2.0.0

logreaderport.h

Go to the documentation of this file.
00001 /* Flexiport
00002  *
00003  * Header file for the LogReaderPort class.
00004  *
00005  * Copyright 2008-2011 Geoffrey Biggs geoffrey.biggs@aist.go.jp
00006  *     RT-Synthesis Research Group
00007  *     Intelligent Systems Research Institute,
00008  *     National Institute of Advanced Industrial Science and Technology (AIST),
00009  *     Japan
00010  *     All rights reserved.
00011  *
00012  * This file is part of Flexiport.
00013  *
00014  * Flexiport is free software; you can redistribute it and/or modify it
00015  * under the terms of the GNU Lesser General Public License as published
00016  * by the Free Software Foundation; either version 2.1 of the License,
00017  * or (at your option) any later version.
00018  *
00019  * Flexiport is distributed in the hope that it will be useful, but
00020  * WITHOUT ANY WARRANTY; without even the implied warranty of
00021  * 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
00025  * License along with Flexiport. If not, see
00026  * <http://www.gnu.org/licenses/>.
00027  */
00028 
00029 #ifndef __LOGREADERPORT_H
00030 #define __LOGREADERPORT_H
00031 
00032 #include <flexiport/port.h>
00033 
00034 #include <map>
00035 #include <string>
00036 
00041 namespace flexiport
00042 {
00043 
00044 class LogFile;
00045 
00082 class FLEXIPORT_EXPORT LogReaderPort : public Port
00083 {
00084     public:
00085         LogReaderPort (std::map<std::string, std::string> options);
00086         ~LogReaderPort ();
00087 
00089         void Open ();
00091         void Close ();
00093         ssize_t Read (void * const buffer, size_t count);
00095         ssize_t ReadFull (void * const buffer, size_t count);
00097         ssize_t BytesAvailable ();
00099         ssize_t BytesAvailableWait ();
00101         ssize_t Write (const void * const buffer, size_t count);
00103         void Flush ();
00105         void Drain ();
00107         std::string GetStatus () const;
00109         void SetTimeout (Timeout timeout);
00111         void SetCanRead (bool canRead);
00113         void SetCanWrite (bool canWrite);
00115         bool IsOpen () const;
00116 
00117     private:
00118         LogFile *_logFile;
00119         std::string _logFileName;
00120         unsigned int _strictness;
00121         int _jitter;
00122         bool _ignoreTimes;
00123         bool _open;
00124 
00125         bool ProcessOption (const std::string &option, const std::string &value);
00126         void CheckPort (bool read);
00127 };
00128 
00129 } // namespace flexiport
00130 
00133 #endif // __LOGREADERPORT_H
00134 
 All Classes Namespaces Files Functions Variables Defines