// File: scope_detector.h // Author: Chris Gill // Purpose: header file for memory management profiling classes // (See exercise 2 of the basic memory management studio) #ifndef SCOPE_DETECTOR_H #define SCOPE_DETECTOR_H #include // Symbols used from standard namespace. using namespace std; class ScopeDetector { // note controlled violation of encapsulation: reference counted guard class and // ostream insertion operator are both designed to work closely with this class friend class SafeRefCountedGuard; friend ostream & operator << (ostream &, const ScopeDetector &); public: ScopeDetector (); // default constructor ScopeDetector (const ScopeDetector &sd); // copy constructor ~ScopeDetector (); // destructor ScopeDetector & operator= (const ScopeDetector &sd); // assignment operator bool operator== (const ScopeDetector &sd) const; // equivalence comparison operator bool operator< (const ScopeDetector &sd) const; // less than comparison operator private: static unsigned int count_; unsigned int i_; unsigned int ref_count_; }; ostream & operator << (ostream &, const ScopeDetector &); #endif /* SCOPE_DETECTOR_H */