Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | Related Pages

ArLogFileConnection Class Reference

For connecting through a log file. More...

#include <ArLogFileConnection.h>

Inheritance diagram for ArLogFileConnection:

ArDeviceConnection List of all members.

Public Types

enum  Open { OPEN_FILE_NOT_FOUND = 1, OPEN_NOT_A_LOG_FILE }

Public Member Functions

 ArLogFileConnection ()
 Constructor.
virtual bool close (void)
 Closes the connection.
const char * getLogFile (void)
 Gets the name of the host connected to.
virtual const char * getOpenMessage (int messageNumber)
 Gets the string of the message associated with opening the device.
virtual int getStatus (void)
 Gets the status of the connection, which is one of the enum status.
virtual ArTime getTimeRead (int index)
 Gets the time data was read in.
int internalOpen (void)
 Internal function used by open and openSimple.
virtual bool isTimeStamping (void)
 sees if timestamping is really going on or not
int open (const char *fname=NULL)
 Opens a connection to the given host and port.
virtual bool openSimple (void)
 Opens the connection again, using the values from setLocation or.
virtual int read (const char *data, unsigned int size, unsigned int msWait=0)
 Reads data from connection.
void setLogFile (const char *fname=NULL)
virtual int write (const char *data, unsigned int size)
 Writes data to connection.
virtual ~ArLogFileConnection ()
 Destructor also closes connection.

Public Attributes

bool havePose
char myName [100]
ArPose myPose
char mySubtype [20]
char myType [20]

Protected Member Functions

void buildStrMap (void)

Protected Attributes

FILE * myFD
const char * myLogFile
int myStatus
ArStrMap myStrMap
int stopAfter

Detailed Description

For connecting through a log file.

Definition at line 37 of file ArLogFileConnection.h.


Member Enumeration Documentation

enum ArLogFileConnection::Open
 

Enumeration values:
OPEN_FILE_NOT_FOUND  Can't find the file.
OPEN_NOT_A_LOG_FILE  Doesn't look like a log file.

Definition at line 70 of file ArLogFileConnection.h.


Member Function Documentation

bool ArLogFileConnection::close void   )  [virtual]
 

Closes the connection.

Returns:
whether the close succeeded or not

Reimplemented from ArDeviceConnection.

Definition at line 144 of file ArLogFileConnection.cpp.

Referenced by read().

const char * ArLogFileConnection::getLogFile void   ) 
 

Gets the name of the host connected to.

Returns:
the name of the log file

Definition at line 249 of file ArLogFileConnection.cpp.

const char * ArLogFileConnection::getOpenMessage int  messageNumber  )  [virtual]
 

Gets the string of the message associated with opening the device.

Each class inherited from this one has an open method which returns 0 for success or an integer which can be passed into this function to obtain a string describing the reason for failure

Parameters:
messageNumber the number returned from the open
Returns:
the error description associated with the messageNumber

Implements ArDeviceConnection.

Definition at line 139 of file ArLogFileConnection.cpp.

int ArLogFileConnection::getStatus void   )  [virtual]
 

Gets the status of the connection, which is one of the enum status.

Gets the status of the connection, which is one of the enum status. If you want to get a string to go along with the number, use getStatusMessage

Returns:
the status of the connection
See also:
getStatusMessage

Implements ArDeviceConnection.

Definition at line 254 of file ArLogFileConnection.cpp.

Referenced by read().

ArTime ArLogFileConnection::getTimeRead int  index  )  [virtual]
 

Gets the time data was read in.

Parameters:
index looks like this is the index back in the number of bytes last read in
Returns:
the time the last read data was read in

Implements ArDeviceConnection.

Definition at line 264 of file ArLogFileConnection.cpp.

References ArTime::setToNow().

bool ArLogFileConnection::isTimeStamping void   )  [virtual]
 

sees if timestamping is really going on or not

Returns:
true if real timestamping is happening, false otherwise

Implements ArDeviceConnection.

Definition at line 259 of file ArLogFileConnection.cpp.

int ArLogFileConnection::open const char *  fname = NULL  ) 
 

Opens a connection to the given host and port.

Parameters:
fname the file to connect to, if NULL (default) then robot.log
Returns:
0 for success, otherwise one of the open enums
See also:
getOpenMessage

Definition at line 74 of file ArLogFileConnection.cpp.

References internalOpen().

int ArLogFileConnection::read const char *  data,
unsigned int  size,
unsigned int  msWait = 0
[virtual]
 

Reads data from connection.

Reads data from connection

Parameters:
data pointer to a character array to read the data into
size maximum number of bytes to read
msWait read blocks for this many milliseconds (not at all for == 0)
Returns:
number of bytes read, or -1 for failure
See also:
write, writePacket

Implements ArDeviceConnection.

Definition at line 153 of file ArLogFileConnection.cpp.

References ArTime::addMSec(), close(), getStatus(), ArLog::log(), and ArTime::setToNow().

int ArLogFileConnection::write const char *  data,
unsigned int  size
[virtual]
 

Writes data to connection.

Writes data to connection

Parameters:
data pointer to a character array to write the data from
size number of bytes to write
Returns:
number of bytes read, or -1 for failure
See also:
read, writePacket

Implements ArDeviceConnection.

Definition at line 240 of file ArLogFileConnection.cpp.

Referenced by ArRobot::asyncConnectHandler().


The documentation for this class was generated from the following files:
Generated on Wed Oct 19 12:56:49 2005 for Aria by  doxygen 1.4.0