_Task Student { void main(); public: Student( Printer & prt, NameServer & nameServer, WATCardOffice & cardOffice, Groupoff & groupoff, unsigned int id, unsigned int maxPurchases ); }; class WATCard { WATCard( const WATCard & ) = delete; // prevent copying WATCard( const WATCard && ) = delete; WATCard & operator=( const WATCard & ) = delete; WATCard & operator=( const WATCard && ) = delete; public: typedef Future_ISM FWATCard; // future watcard pointer WATCard(); void deposit( unsigned int amount ); void withdraw( unsigned int amount ); unsigned int getBalance(); }; _Task WATCardOffice { struct Job { // marshalled arguments and return future Args args; // call arguments (YOU DEFINE "Args") WATCard::FWATCard result; // return future Job( Args args ) : args( args ) {} }; _Task Courier { ... }; // communicates with bank void main(); public: _Exception Lost {}; // lost WATCard WATCardOffice( Printer & prt, Bank & bank, unsigned int numCouriers ); WATCard::FWATCard create( unsigned int sid, unsigned int amount ) __attribute__(( warn_unused_result )); WATCard::FWATCard transfer( unsigned int sid, unsigned int amount, WATCard * card ) __attribute__(( warn_unused_result )); Job * requestWork() __attribute__(( warn_unused_result )); }; _Monitor Bank { public: Bank( unsigned int numStudents ); void deposit( unsigned int id, unsigned int amount ); void withdraw( unsigned int id, unsigned int amount ); }; _Task Parent { void main(); public: Parent( Printer & prt, Bank & bank, unsigned int numStudents, unsigned int parentalDelay ); }; _Task Groupoff { void main(); public: Groupoff( Printer & prt, unsigned int numStudents, unsigned int sodaCost, unsigned int groupoffDelay ); WATCard::FWATCard giftCard( unsigned int id ); }; _Task VendingMachine { void main(); public: _Exception Funds {}; // insufficient funds _Exception Stock {}; // flavour out of stock _Exception Free {}; // free, advertisement VendingMachine( Printer & prt, NameServer & nameServer, unsigned int id, unsigned int sodaCost ); void buy( BottlingPlant::Flavours flavour, WATCard & card ); unsigned int * inventory() __attribute__(( warn_unused_result )); void restocked(); _Nomutex unsigned int cost() const; _Nomutex unsigned int getId() const; }; _Task NameServer { void main(); public: NameServer( Printer & prt, unsigned int numVendingMachines, unsigned int numStudents ); void VMregister( VendingMachine * vendingmachine ); VendingMachine * getMachine( unsigned int id ) __attribute__(( warn_unused_result )); VendingMachine ** getMachineList() __attribute__(( warn_unused_result )); }; _Task BottlingPlant { void main(); public: enum Flavours { ..., NUM_OF_FLAVOURS }; // flavours of soda (YOU DEFINE) _Exception Shutdown {}; // shutdown plant BottlingPlant( Printer & prt, NameServer & nameServer, unsigned int numVendingMachines, unsigned int maxShippedPerFlavour, unsigned int maxStockPerFlavour, unsigned int timeBetweenShipments ); void getShipment( unsigned int cargo[] ); }; _Task Truck { void main(); public: Truck( Printer & prt, NameServer & nameServer, BottlingPlant & plant, unsigned int numVendingMachines, unsigned int maxStockPerFlavour ); }; _Monitor / _Cormonitor Printer { public: enum Kind { Parent, Groupoff, WATCardOffice, NameServer, Truck, BottlingPlant, Student, Vending, Courier }; Printer( unsigned int numStudents, unsigned int numVendingMachines, unsigned int numCouriers ); void print( Kind kind, char state ); void print( Kind kind, char state, unsigned int value1 ); void print( Kind kind, char state, unsigned int value1, unsigned int value2 ); void print( Kind kind, unsigned int lid, char state ); void print( Kind kind, unsigned int lid, char state, unsigned int value1 ); void print( Kind kind, unsigned int lid, char state, unsigned int value1, unsigned int value2 ); };