/****************************************************************************/
/* Copyright (c) 2000 MBARI                                                 */
/* MBARI Proprietary Information. All rights reserved.                      */
/****************************************************************************/
/* Summary  :                                                               */
/* Filename : DriverOutput.cc                                               */
/* Author   :                                                               */
/* Project  :                                                               */
/* Version  : 1.0                                                           */
/* Created  : 02/07/2000                                                    */
/* Modified :                                                               */
/* Archived :                                                               */
/****************************************************************************/
/* Modification History:                                                    */
/****************************************************************************/
#include <malloc.h>
#include "DriverOutput.h"
#include "Exception.h"

DriverOutput::DriverOutput(const char *name,
			   Boolean serverSide,
			   int nDataBytes,
			   Access access,
			   Boolean init)
  : SharedData(name, nDataBytes, access, init)
{
  if (serverSide) {

    // Server sets status values to uninitialized
    void *dataBuf;

    if ((dataBuf = (void *)malloc(nDataBytes)) == 0) {
      throw Exception("DriverOutput::DriverOutput() - malloc() failed");
    }

    memset(dataBuf, 0, nDataBytes);

    Data *data = (Data *)dataBuf;
    data->deviceReady = False;
    write(data);
    free(dataBuf);
  }
}


DriverOutput::~DriverOutput()
{
}


