Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Public Member Functions | Protected Member Functions | List of all members
net_instaweb::ManuallyRefCounted Class Reference

#include "manually_ref_counted.h"

Inheritance diagram for net_instaweb::ManuallyRefCounted:
net_instaweb::FileLoadMapping net_instaweb::FileLoadRule net_instaweb::FileLoadMappingLiteral net_instaweb::FileLoadMappingRegexp net_instaweb::FileLoadRuleLiteral net_instaweb::FileLoadRuleRegexp

Public Member Functions

void IncrementRefs ()
 
void DecrementRefs ()
 

Protected Member Functions

virtual ~ManuallyRefCounted ()
 

Detailed Description

Class that assists with manual reference counting. Other classes should inherit from this one, and users of those classes should call IncrementRefs when making copies and DecrementRefs when they finish with those copies.

Constructor & Destructor Documentation

virtual net_instaweb::ManuallyRefCounted::~ManuallyRefCounted ( )
inlineprotectedvirtual

The destructor isn't public because instances of ManuallyRefCounted subclasses should not be directly deleted. They should be released via DecrementRefs().

Member Function Documentation

void net_instaweb::ManuallyRefCounted::DecrementRefs ( )
inline

Call this when finished with a pointer to a subclass instance: class ExampleHolder { Example* e; ~ExampleHolder() { if (e != NULL) { // If e is the last pointer to *e then *e will be deleted. e->DecrementRefs(); } } }

void net_instaweb::ManuallyRefCounted::IncrementRefs ( )
inline

Call this when duplicating a pointer to subclass instances: Example* e = other->GetExample(); e->IncrementRefs();


The documentation for this class was generated from the following file: