HP Integrity NonStop J-Series User Manual
Page 232
void
Bus::saveGuts(RWvostream& strm) const {
RWCollectable::saveGuts(strm); // Save base class
strm << busNumber_; // Write primitives directly
strm << driver_ << customers_; // Use Rogue Wave
// provided versions
strm << passengers_; // Will detect nil pointer automatically
}
void Bus::restoreGuts(RWFile& f) {
RWCollectable::restoreGuts(f); // Restore base class
f.Read(busNumber_); // Restore primitive
f >> driver_ >> customers_; // Uses Rogue Wave
// provided versions
delete passengers_; // Delete old RWSet
f >> passengers_; // Replace with a new one
}
void Bus::restoreGuts(RWvistream& strm) {
RWCollectable::restoreGuts(strm); // Restore base class
strm >> busNumber_ >> driver_ >> customers_;
delete passengers_; // Delete old RWSet
strm >> passengers_; // Replace with a new one
}
void
Bus::addPassenger(const char* name) {
Client* s = new Client(name);
customers_.insert( s );
if (!passengers_)
passengers_ = new RWSet;
passengers_->insert(s);
}
void
Bus::addCustomer(const char* name) {
customers_.insert( new Client(name) );
}
/////////////// Here are Client methods //////////////
RWDEFINE_NAMED_COLLECTABLE(Client,"client")
Client::Client() {} // Uses RWCString default constructor
Client::Client(const char* name) : name_(name) {}
RWspace