#ifndef _NSRABSTSSDEV_ //-*-c++-*-
#define _NSRABSTSSDEV_

//----------------------------------------------------------------------
//  nsrASSdv.h
//   This is the definition of the abstract base SS device class.
//
//      Unpublished Confidential Information of Hewlett-Packard
//      Company. Do not disclose.  Copyright (c) Hewlett-Packard
//      Company 1995. All rights reserved
// 
// The contents of this software are proprietary and confidential to
// the Hewlett- Packard Company, and are limited in distribution to
// those with a direct need to know.  Individuals having access to
// this software are responsible for maintaining the confidentiality
// of the content and for keeping the software secure when not in use.
// Transfer to any party is strictly forbidden other than as expressly
// permitted in writing by Hewlett-Packard Company.  Unauthorized
// transfer to or possession by any unauthorized party may be a
// criminal offense.
//
//                  RESTRICTED RIGHTS LEGEND
//
//      Use,  duplication,  or disclosure by the U. S. Government is
//      subject to restrictions as set forth in subparagraph (c) (1)
//      (ii) in the Rights in Technical Data and Computer Software
//      clause in DFARS 252.227-7013 or any other successor clause.
//
//                      HEWLETT-PACKARD COMPANY
//                      3000 Hanover St.
//                      Palo Alto, CA  94304 U.S.A.
//
//      Rights for non-DOD U.S. Government Departments and Agencies
//      are as set forth in FAR 52.227-19 (c) (1,2) or any other
//      successor clause.
//
//  CLASSES:
//   SSDevice
//  
//----------------------------------------------------------------------
// $Source: /projects/HMS/nsr/udfCore/devs/nsrASSdv.h,v $
// $Revision: 1.35 $    $Author: hmgr $
// $State: Exp $        $Locker:  $
// $Date: 96/01/15 11:13:02 $
//

//----------------------------------------------------------------------
// ENUM: MediaType
//
//  Type of media, for use with mediaType() method in SSDevice and MSDevice.
//
// DEFINITIONS:
//  media_Rewritable     Rewritable magneto-optical media
//  Media_Worm           Write-once read-many magneto-optical media
//----------------------------------------------------------------------

enum MediaType {
    media_Rewritable,
    media_Worm
};

//-----------------------------------------------------------------------------
// CLASS:  SSDevice
//
// The SSDevice class handles the low-level details for reading and writing
// sectors to and from a disk device.  It is an abstract base class from which
// true implementations should be derived.
//
// Public Methods:
//
// DriveDevice():  Constructor.  Takes device file pathname as argument.
// ~DriveDevice():  Destructor.  Closes device.
// numSectors():  Returns the number of sectors on the device.
// sectorSize():  Returns the size, in bytes, of a sector on the device.
// read():  Read bytes into argument ByteArray from the given ExtentList.
// write():  Write bytes from argument ByteArray into the given ExtentList.
// writeWOE():  As write(), but does a write-without-erase.
// verifyMode():  Setter: puts DriveDevice in write-with-verify mode.
// verifyMode():  Getter: returns write-with-verify mode flag.
// erase():  Erases the sectors specified by the given PhysExtent.
// checkValidity():  Returns whether the DriveDevice is in a valid state.
// error():  Returns the error state of the DriveDevice object.
//-----------------------------------------------------------------------------

class SSDevice 
{
public:

    virtual             ~SSDevice() {} 
    virtual UINT32      numSectors() const = 0;
    virtual UINT32      sectorSize() const = 0;
    virtual INT32       read(UINT32 startsector,UINT32 nsectors,
                             const ByteArrayRef& arr,Error& err) = 0;
    virtual INT32       read(UINT32 startsector,UINT32 nbytes,BYTE_PTR buf,
                             Error& err) = 0;
    virtual INT32       write(UINT32 startsector,UINT32 nsectors,
                              const ByteArrayRef& arr,Error& err) = 0;
    virtual INT32       write(UINT32 startsector,UINT32 numsectors,CONST_BYTE_PTR buf,
                              Error& err) = 0;
    virtual INT32       writeWOE(UINT32 startsector,UINT32 nsectors,
                                 const ByteArrayRef& arr,Error& err) = 0;
    virtual INT32       writeWOE(UINT32 startsector,UINT32 nbytes,CONST_BYTE_PTR buf,
                                 Error& err) = 0;
    virtual INT32       verifyMode(INT32 newmode)  = 0;
    virtual INT32       verifyMode(void) = 0;
    virtual INT32       erase(UINT32 start,UINT32 nsectors,Error& err) = 0;
    virtual Error       error(void) const = 0;
    virtual Error       checkValidity(void) const = 0;
    virtual MediaType   mediaType(void) { return NSR::media_Rewritable; }
    virtual Boolean     verifyBlank(UINT32 start,UINT32 nsectors,
                                    UINT32 *which) { return True; }

};

#endif // _NSRABSTSSDEV_
