void PreRead(shared_ptr<T> p) { std::string key(boost::lexical_cast<std::string>(p->cuid_) + p->uid_); shared_ptr<C> cs_info(new C(key)); DHT::Instance().get_pair(cs_info); const std::string hostname = cs_info->get_mapped(); Client::Instance().retrieve_chunk(hostname, p); }
int main() { int n; char cn[20]; list l; customer c; date d1, d2; printf("Welcome to hotel GRAND :\n"); printf("Total rooms in hotel are: 500\n"); printf("Single rooms are: 300\nDouble rooms are: 200"); printf("Cost for one day:\nSingle room stay is:'350'\nDouble room stay is:'600'\n"); while(1) { n = options(); switch(n) { case 1: cs_info(&c); printf("Entry Date:\n"); date_info(&d1); printf("Exit Date:\n"); date_info(&d2); checkin(&l, &c, &d1, &d2); traverse(&l); break; case 2: printf("Enter the name of Customer who want to Checkout\n"); scanf("%s", cn); checkout(&l, &c, &d1, &d2, cn); traverse(&l); break; case 3: total_bill(&c, &d1, &d2); printf("Your total bill is:%d\n",c.total_bill); break; case 4: rooms(); break; default: printf("SORRY we don't get you\nPlease enter the valid option\n"); } } return 0; }