LArSoft
v06_85_00
Liquid Argon Software toolkit - http://larsoft.org/
|
Utility class providing singleton objects to the derived classes. More...
#include "unit_test_base.h"
Public Types | |
using | ResourcePtr_t = std::shared_ptr< Resource_t > |
Static Public Member Functions | |
template<typename... Args> | |
static ResourcePtr_t | CreateResource (std::string res_name, Args &&...args) |
Constructs and registers a new resource with a specified name. More... | |
template<typename... Args> | |
static void | CreateDefaultResource (Args &&...args) |
Constructs and registers a new resource with no name. More... | |
template<typename... Args> | |
static ResourcePtr_t | ProposeSharedResource (std::string res_name, Args &&...args) |
Creates a shared resource only if none exists yet. More... | |
template<typename... Args> | |
static ResourcePtr_t | ProposeDefaultSharedResource (Args &&...args) |
Creates a shared resource as default only if none exists yet. More... | |
static Resource_t & | DestroyResource (std::string name="") |
Destroys the specified resource (does nothing if no such resource) More... | |
Add and share resources | |
static void | AddSharedResource (std::string res_name, ResourcePtr_t res_ptr) |
Adds a shared resource to the resource registry. More... | |
static void | AddDefaultSharedResource (ResourcePtr_t res_ptr) |
Adds a shared resource to the resource registry (empty name) More... | |
template<typename... Args> | |
static ResourcePtr_t | ProvideSharedResource (std::string res_name, ResourcePtr_t res_ptr) |
Registers a shared resource only if none exists yet. More... | |
template<typename... Args> | |
static ResourcePtr_t | ProvideDefaultSharedResource (ResourcePtr_t res_ptr) |
Creates a shared resource as default only if none exists yet. More... | |
static bool | ReplaceSharedResource (std::string res_name, Resource_t const *old_res_ptr, ResourcePtr_t res_ptr) |
Adds a shared resource only if it is old_res_ptr. More... | |
static bool | ReplaceSharedResource (std::string res_name, ResourcePtr_t old_res_ptr, ResourcePtr_t res_ptr) |
Adds a shared resource to the resource registry. More... | |
static bool | ReplaceDefaultSharedResource (Resource_t const *old_res_ptr, ResourcePtr_t res_ptr) |
Adds a shared resource as default resource only if it is old_res_ptr. More... | |
static bool | ReplaceDefaultSharedResource (ResourcePtr_t old_res_ptr, ResourcePtr_t res_ptr) |
Adds a shared resource as default resource only if it is old_res_ptr. More... | |
Resource access | |
static bool | hasResource (std::string name="") |
static ResourcePtr_t | ShareResource (std::string name="") |
Retrieves the specified resource for sharing (nullptr if none) More... | |
static Resource_t & | Resource (std::string name="") |
Retrieves the specified resource, or throws if not available. More... | |
Private Types | |
using | Resource_t = RES |
Static Private Attributes | |
static std::map< std::string, ResourcePtr_t > | Resources |
Utility class providing singleton objects to the derived classes.
RES | the type of object (include constantness if needed) |
The object is expected to be shared.
Definition at line 389 of file unit_test_base.h.
|
private |
Definition at line 390 of file unit_test_base.h.
using testing::TestSharedGlobalResource< RES >::ResourcePtr_t = std::shared_ptr<Resource_t> |
Definition at line 393 of file unit_test_base.h.
|
inlinestatic |
Adds a shared resource to the resource registry (empty name)
Definition at line 403 of file unit_test_base.h.
|
inlinestatic |
|
inlinestatic |
Constructs and registers a new resource with no name.
Definition at line 459 of file unit_test_base.h.
References testing::details::CommandLineArguments::args.
|
inlinestatic |
Constructs and registers a new resource with a specified name.
Definition at line 450 of file unit_test_base.h.
References testing::details::CommandLineArguments::args.
|
inlinestatic |
Destroys the specified resource (does nothing if no such resource)
Definition at line 508 of file unit_test_base.h.
|
inlinestatic |
Returns whether a resource exists
std::out_of_range | if not available |
Definition at line 488 of file unit_test_base.h.
|
inlinestatic |
Creates a shared resource as default only if none exists yet.
Definition at line 475 of file unit_test_base.h.
References testing::details::CommandLineArguments::args.
|
inlinestatic |
Creates a shared resource only if none exists yet.
Definition at line 466 of file unit_test_base.h.
References testing::details::CommandLineArguments::args.
|
inlinestatic |
Creates a shared resource as default only if none exists yet.
Definition at line 418 of file unit_test_base.h.
|
inlinestatic |
Registers a shared resource only if none exists yet.
Definition at line 409 of file unit_test_base.h.
|
inlinestatic |
Adds a shared resource as default resource only if it is old_res_ptr.
Definition at line 441 of file unit_test_base.h.
|
inlinestatic |
Adds a shared resource as default resource only if it is old_res_ptr.
Definition at line 444 of file unit_test_base.h.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Retrieves the specified resource, or throws if not available.
Definition at line 502 of file unit_test_base.h.
|
inlinestatic |
Retrieves the specified resource for sharing (nullptr if none)
Definition at line 495 of file unit_test_base.h.
|
staticprivate |
Definition at line 512 of file unit_test_base.h.