All pastes #804082 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-12-03 02:32 UTC
rendered paste body
class Disk {

public:
        Disk(const char *, size_t, size_t, size_t);
        ~Disk();
        void appendPartition(Partition *);
        List<Partition> *getPartitions();
        const char *getDevPath();
        size_t getCylinders(); 
        size_t getHeads();
        size_t getCylinderSize();

private:
        const char *devPath;
        size_t cylinders;
        size_t heads;
        size_t cylinderSize;
        List<Partition> *partitions;

};


------- IMPLEMENTATION ----------------------

void describeDisk(Disk *d) {
        cout << "Disk " << d->getDevPath() << ":\n";
        cout << "\tCylinders: " << d->getCylinders() << "\n";
        cout << "\tHeads: " << d->getHeads() << "\n";
        cout << "\tCylinder Size: " << d->getCylinderSize() << "(bytes)\n";
        cout << "\tSize: " << (d->getCylinders() * d->getCylinderSize()) / (1024 * 1024) << "(MB)\n\n";
}


---------- OUTPUT -------------------------

Disk /dev/sda:
        Cylinders: 9729
        Heads: 255
        Cylinder Size: 8225280(bytes)
        Size: 2588(MB)