/*
 * Go2Log.h
 * 
 * Gocator system communication library
 * Copyright (C) 2010 by LMI Technologies Inc.
 * 
 * Licensed under The MIT License.
 * Redistributions of files must retain the above copyright notice.
 */
#ifndef LMITECH_GO2_LOG_H_INCLUDED
#define LMITECH_GO2_LOG_H_INCLUDED

#include <Go2Object.h>
#include <Go2ApiBegin.h>

typedef Go2Object Go2Log;         // Represents a log file for health or data messages. 

GO2_EXPORT(Go2Status) Go2Log_Construct(Go2Log* log, const Go2Char* path, Go2Bool read); //
//
//  Description:
//      Constructs a Go2Log object.
//  Arguments:
//      log - Receives a handle to the constructed object. 
//      path - Path to the log file. 
//      read - If true, log file is opened for reading; else, log file is opened for writing.
//  Returns: 
//      Operation status.

GO2_EXPORT(Go2Status) Go2Log_Destroy(Go2Log log); //
//
//  Description:
//      Destroys a Go2Log object. 
//  Arguments:
//      log - Go2Log object. 
//  Returns: 
//      Operation status.
//  Remarks: 
//      Destroying the log will close the underlying file. 

GO2_EXPORT(Go2Status) Go2Log_Write(Go2Log log, Go2Object message); //
//
//  Description:
//      Writes a health message or data message to the log file.
//  Arguments:
//      log - Go2Log object that was opened for writing.
//      message - Go2Health or Go2Data object.
//  Returns: 
//      Operation status.

GO2_EXPORT(Go2Status) Go2Log_Read(Go2Log log, Go2Object* message); //
//
//  Description:
//      Reads a health message or data message from the log file.
//  Arguments:
//      log - Go2Log object that was opened for reading.
//      message - Receives a Go2Health or Go2Data object.
//  Returns: 
//      Operation status.
//  Remarks:
//      Use the Go2Object_Destroy method to free the message object. 

GO2_EXPORT(Go2UInt64) Go2Log_Position(Go2Log log); //
//
//  Description:
//      Reports the current position, in bytes, of the log file read/write pointer. 
//  Arguments:
//      log - Go2Log object.
//  Returns: 
//      Current read/write position, in bytes.

GO2_EXPORT(Go2UInt64) Go2Log_Length(Go2Log log); //
//
//  Description:
//      Reports the length of the log file, in bytes. 
//  Arguments:
//      log - Go2Log object.
//  Returns: 
//      Log file length, in bytes.

#include <Go2ApiEnd.h>

#endif      /* #ifndef LMITECH_GO2_LOG_H_INCLUDED */

