beautypg.com

HP Integrity NonStop J-Series User Manual

Page 233

background image

Client::binaryStoreSize() const {
return name_->binaryStoreSize();
}

int
Client::compareTo(const RWCollectable* c) const {
return name_.compareTo(((Client*)c)->name_);
}

RWBoolean
Client::isEqual(const RWCollectable* c) const {
return name_ == *(Client*)c;
}

unsigned
Client::hash() const {
return name_.hash();
}

void
Client::restoreGuts(RWFile& f) {
f >> name_;
}

void
Client::restoreGuts(RWvistream& vis) {
vis >> name_;
}

void
Client::saveGuts(RWFile& f) const {
f << name_;
}

void
Client::saveGuts(RWvostream& vos) const {
vos << name_;
}

main() {
Bus theBus(1, "Kesey");
theBus.addPassenger("Frank");
theBus.addPassenger("Paula");
theBus.addCustomer("Dan");
theBus.addCustomer("Chris");

{ // block controls lifetime of stream
ofstream f("bus.str");
RWpostream stream(f);
stream << theBus; // Persist theBus to an ASCII stream
}

This manual is related to the following products: