// NullPolicy.h #ifndef NullPolicy_H #define NullPolicy_H // This policy provides no management. #include // Include the PolicyPtr header if template members are not allowed. #ifdef DEFECT_NO_MEMBER_TEMPLATES_AT_ALL #include "ptr/AbsPolicy.h" #endif class SharedPolicyTable; class NullPolicy #ifdef AbsPolicy_H : public AbsPolicy #endif { private: // Output stream. void ostr(std::ostream& stream) const; public: // Default constructor. NullPolicy(const void* ptr) { }; // Constructor from another policy. #ifndef AbsPolicy_H template #endif NullPolicy(const void* ptr, const AbsPolicy& pol) { } // Has management. bool has_management() const { return false; } // Request to take management. bool take_management() { return false; } // Request to give up management. bool give_management() { return true; } // Return true if this is the last policy for the object. bool has_last_management() const { return false; } // Policy is always valid. bool is_valid() const { return true; } // Policy is not shared. SharedPolicyTable* get_shared_policy_table() { return 0; }; // Delete if managing pointer. // We never manage. template void delete_if_managing(T* pt) { } // Output stream. friend std::ostream& operator<<(std::ostream& stream, const NullPolicy& rhs); }; #endif