#ifndef inventory_H #define inventory_H #include #include #include #include #include #include #include #include #include #include #include // An inventory of stuff class inventoryObj : virtual public x::obj { public: // This is the inventory, key product name, int is the number in stock. std::map stock; // uuid of this object in the repository x::uuid uuid; // Default constructor inventoryObj() {} // Destructor ~inventoryObj() {} // Copy constructor inventoryObj(const inventoryObj &o) : stock(o.stock), uuid(o.uuid) { } // Serialization function template void serialize(iter_type &iter) { iter(stock); } // Construct from an object in the repository inventoryObj(const x::uuid &uuidArg, const x::fd &fd) : uuid(uuidArg) { x::fdinputiter b(fd), e; x::deserialize::iterator iter(b, e); serialize(iter); } // The above constructor threw an exception, so the manager calls this // one. We should report an error somehow, the inventory object must be // corrupted, but this is just an example. inventoryObj(const x::uuid &uuidArg) : uuid(uuidArg) { } }; typedef x::ref inventory; typedef x::ptr inventoryptr; #endif