home *** CD-ROM | disk | FTP | other *** search
/ James Briskly's Game Magazine 2 / JBGM002S.ZIP / SOURCE / PRIMPART.H < prev    next >
C/C++ Source or Header  |  1995-08-22  |  2KB  |  84 lines

  1. /*
  2.     FIPS - the First nondestructive Interactive Partition Splitting program
  3.  
  4.     Module hdstruct.h
  5.  
  6.     RCS - Header:
  7.     $Id$
  8.  
  9.     Copyright (C) 1993 Arno Schaefer
  10.  
  11.     This program is free software; you can redistribute it and/or modify
  12.     it under the terms of the GNU General Public License as published by
  13.     the Free Software Foundation; either version 2 of the License, or
  14.     (at your option) any later version.
  15.  
  16.     This program is distributed in the hope that it will be useful,
  17.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.     GNU General Public License for more details.
  20.  
  21.     You should have received a copy of the GNU General Public License
  22.     along with this program; if not, write to the Free Software
  23.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  
  25.  
  26.     Report problems and direct all questions to:
  27.  
  28.     schaefer@rbg.informatik.th-darmstadt.de
  29. */
  30.  
  31. /* ----------------------------------------------------------------------- */
  32. /* Partition Class, derived from logical_drive and raw_partition           */
  33. /* Represents one primary DOS partition. Read_sector() and write_sector()  */
  34. /* are instances of the virtual functions in the logical_drive class       */
  35. /* ----------------------------------------------------------------------- */
  36.  
  37. #ifndef PRIMPART_H
  38. #define PRIMPART_H
  39.  
  40. #include "types.h"
  41. #include "disk_io.h"
  42. #include "logdr_st.h"
  43. #include "hdstruct.h"
  44.  
  45. class partition:public logical_drive
  46. {
  47. public:
  48.     int number;
  49.     physical_drive *drive;
  50.     partition_info *partition_info;
  51.  
  52.     int read_sector (dword number, sector *sector)
  53.     {
  54.         return (drive->read_sector
  55.         (
  56.             sector,
  57.             partition_info->start_sector_abs
  58.             + number
  59.         ));
  60.     }
  61.     int write_sector (dword number, sector *sector)
  62.     {
  63.         return (drive->write_sector
  64.         (
  65.             sector,
  66.             partition_info->start_sector_abs
  67.             + number
  68.         ));
  69.     }
  70.  
  71.     partition (class harddrive *drive, int number)
  72.     {
  73.         partition::number = number;
  74.         partition::drive = drive;
  75.         partition_info =
  76.             &(drive->partition_table().partition_info[number]);
  77.  
  78.         boot_sector = new class boot_sector (this);
  79.     }
  80.     ~partition (void) { delete boot_sector; }
  81. };
  82.  
  83. #endif
  84.