proxygen
folly::SingletonVault::ScopedExpunger Struct Reference

#include <Singleton.h>

Public Member Functions

 ScopedExpunger (SingletonVault *v)
 
 ~ScopedExpunger ()
 
void expunge ()
 

Public Attributes

SingletonVaultvault
 

Detailed Description

Clears all singletons in the given vault at ctor and dtor times. Useful for unit-tests that need to clear the world.

This need can arise when a unit-test needs to swap out an object used by a singleton for a test-double, but the singleton needing its dependency to be swapped has a type or a tag local to some other translation unit and unavailable in the current translation unit.

Other, better approaches to this need are "plz 2 refactor" ....

Definition at line 393 of file Singleton.h.

Constructor & Destructor Documentation

folly::SingletonVault::ScopedExpunger::ScopedExpunger ( SingletonVault v)
inlineexplicit

Definition at line 395 of file Singleton.h.

395  : vault(v) {
396  expunge();
397  }
folly::SingletonVault::ScopedExpunger::~ScopedExpunger ( )
inline

Definition at line 398 of file Singleton.h.

398  {
399  expunge();
400  }

Member Function Documentation

void folly::SingletonVault::ScopedExpunger::expunge ( )
inline

Member Data Documentation

SingletonVault* folly::SingletonVault::ScopedExpunger::vault

Definition at line 394 of file Singleton.h.


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