Flexiport 2.0.0
Public Member Functions

flexiport::LogReaderPort Class Reference

Simulated port using a log file. More...

#include <flexiport/logreaderport.h>

Inheritance diagram for flexiport::LogReaderPort:
Inheritance graph
[legend]
Collaboration diagram for flexiport::LogReaderPort:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 LogReaderPort (std::map< std::string, std::string > options)
 ~LogReaderPort ()
void Open ()
 Open the port.
void Close ()
 Close the port.
ssize_t Read (void *const buffer, size_t count)
 Read from the port.
ssize_t ReadFull (void *const buffer, size_t count)
 Read the requested quantity of data from the port.
ssize_t BytesAvailable ()
 Get the number of bytes waiting to be read at the port. Returns immediatly.
ssize_t BytesAvailableWait ()
 Get the number of bytes waiting after blocking for the timeout.
ssize_t Write (const void *const buffer, size_t count)
 Write data to the port.
void Flush ()
 Flush the port's input and output buffers, discarding all data.
void Drain ()
 Drain the port's input and output buffers.
std::string GetStatus () const
 Get the status of the port (type, device, etc).
void SetTimeout (Timeout timeout)
 Set the timeout value in milliseconds.
void SetCanRead (bool canRead)
 Set the read permissions of the port.
void SetCanWrite (bool canWrite)
 Set the write permissions of the port.
bool IsOpen () const
 Check if the port is open.

Detailed Description

Simulated port using a log file.

Uses a log file created by the LogWriterPort port type to simulate the data transfer over a Port object.

Note:
Log files greater than 2GB in size are not supported.
The timer resolution under Windows is milliseconds, not microseconds. This may result in inaccurate replay when using a log file created on a POSIX-compatible operating system.

See the Port class documentation for how to use the common API.

Options
  • file <string>
    • File name to read the log from. Two files will be created using this name and a suffix.
    • Default: port.log
  • ignoretimes
    • Ignore time stamps in the log files. This means that all readable data is available instantly. It also overrides strictness level 2, if set, essentially turning it into strictness level 1.
    • Default: false
  • strictness <integer>
    • Level of strictness to require:
      • 0: Writes are not checked against the log file.
      • 1: Writes are checked against the log file, but timing is not checked.
      • 2: Writes are checked against the log file. Timing is checked; if a write occurs earlier than did in the log file, it will cause an error. Jitter can be set to allow a margin of error.
    • Default: 0
  • jitter <integer>
    • Margin of error (in milliseconds) to allow for write checking with strictness = 2.
    • Default: 100

Definition at line 82 of file logreaderport.h.


Constructor & Destructor Documentation

flexiport::LogReaderPort::LogReaderPort ( std::map< std::string, std::string >  options)
flexiport::LogReaderPort::~LogReaderPort ( )

Member Function Documentation

ssize_t flexiport::LogReaderPort::BytesAvailable ( ) [virtual]

Get the number of bytes waiting to be read at the port. Returns immediatly.

Implements flexiport::Port.

ssize_t flexiport::LogReaderPort::BytesAvailableWait ( ) [virtual]

Get the number of bytes waiting after blocking for the timeout.

Implements flexiport::Port.

void flexiport::LogReaderPort::Close ( ) [virtual]

Close the port.

Implements flexiport::Port.

void flexiport::LogReaderPort::Drain ( ) [virtual]

Drain the port's input and output buffers.

Implements flexiport::Port.

void flexiport::LogReaderPort::Flush ( ) [virtual]

Flush the port's input and output buffers, discarding all data.

Implements flexiport::Port.

std::string flexiport::LogReaderPort::GetStatus ( ) const [virtual]

Get the status of the port (type, device, etc).

Reimplemented from flexiport::Port.

bool flexiport::LogReaderPort::IsOpen ( ) const [virtual]

Check if the port is open.

Implements flexiport::Port.

void flexiport::LogReaderPort::Open ( ) [virtual]

Open the port.

Implements flexiport::Port.

ssize_t flexiport::LogReaderPort::Read ( void *const  buffer,
size_t  count 
) [virtual]

Read from the port.

Implements flexiport::Port.

ssize_t flexiport::LogReaderPort::ReadFull ( void *const  buffer,
size_t  count 
) [virtual]

Read the requested quantity of data from the port.

Implements flexiport::Port.

void flexiport::LogReaderPort::SetCanRead ( bool  canRead) [virtual]

Set the read permissions of the port.

Implements flexiport::Port.

void flexiport::LogReaderPort::SetCanWrite ( bool  canWrite) [virtual]

Set the write permissions of the port.

Implements flexiport::Port.

void flexiport::LogReaderPort::SetTimeout ( Timeout  timeout) [virtual]

Set the timeout value in milliseconds.

Implements flexiport::Port.

ssize_t flexiport::LogReaderPort::Write ( const void *const  buffer,
size_t  count 
) [virtual]

Write data to the port.

Implements flexiport::Port.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Defines