The class resource has the following interface :
interface resource { resource(double a); // constructor int report(histogram* h,double interval = 0); // generate report void reset(); // reset amount left to initial void release(double a = 1); // release amount left by a void acquire(double a = 1); // acquire a from amount left int available(double a = 1); // is an amount a available ? int full(); // is full ? int empty(); // is empty ? double left(); // how much left ? double used(); // how much used ? double occupied(); // returns occupation (%). friend ostream& operator<<(ostream& os,resource& r); };
The resource class also has a report method. When invoked a histogram is filled with samples of the occupation of the resource.