Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Private Types | Private Attributes | List of all members
testing::GeometryTesterEnvironment< ConfigurationClass > Class Template Reference

Environment for a geometry test. More...

#include <geometry_unit_test_base.h>

Inheritance diagram for testing::GeometryTesterEnvironment< ConfigurationClass >:
testing::TesterEnvironment< ConfigurationClass > testing::TesterEnvironment< ConfigurationClass > testing::BasicTesterEnvironment< ConfigurationClass > testing::BasicTesterEnvironment< ConfigurationClass > testing::BasicTesterEnvironment< ConfigurationClass > testing::BasicTesterEnvironment< ConfigurationClass > testing::details::CommandLineArguments testing::details::CommandLineArguments testing::details::CommandLineArguments testing::details::CommandLineArguments GeometryCRMChannelMappingTestFixture GeometryGeoIDTestFixture GeometryIteratorTestFixture GeometryStandardChannelMappingTestFixture

Public Types

using SharedGeoPtr_t = GeoResources_t::ResourcePtr_t
 
using SharedGeoPtr_t = GeoResources_t::ResourcePtr_t
 
- Public Types inherited from testing::BasicTesterEnvironment< ConfigurationClass >
using Configuration_t = ConfigurationClass
 
using Configuration_t = ConfigurationClass
 

Public Member Functions

 GeometryTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~GeometryTesterEnvironment ()
 Destructor: closing remarks. More...
 
 GeometryTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~GeometryTesterEnvironment ()
 Destructor: closing remarks. More...
 
 GeometryTesterEnvironment (ConfigurationClass const &cfg_obj, bool bSetup=true)
 Setup from a configuration. More...
 
 GeometryTesterEnvironment (ConfigurationClass &&cfg_obj, bool bSetup=true)
 
gar::geo::GeometryCore const * Geometry () const
 Returns a pointer to the geometry. More...
 
SharedGeoPtr_t SharedGeometry () const
 
 GeometryTesterEnvironment (ConfigurationClass const &cfg_obj, bool bSetup=true)
 Setup from a configuration. More...
 
 GeometryTesterEnvironment (ConfigurationClass &&cfg_obj, bool bSetup=true)
 
geo::GeometryCore const * Geometry () const
 Returns a pointer to the geometry. More...
 
SharedGeoPtr_t SharedGeometry () const
 
- Public Member Functions inherited from testing::TesterEnvironment< ConfigurationClass >
template<typename Prov , typename... Args>
Prov * SetupProvider (Args...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * SetupProviderFromService (std::string name)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * AcquireProvider (std::unique_ptr< Prov > &&prov)
 Acquires a service provider. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFor (Args...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * SetupProviderFromServiceFor (std::string name)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * AcquireProviderFor (std::unique_ptr< Prov > &&prov)
 Acquires a service provider implementing an interface. More...
 
template<typename Prov >
Prov * SimpleProviderSetup ()
 Oversimplified provider setup. More...
 
template<typename Prov >
void DropProvider ()
 Removes and destroys the specified provider. More...
 
template<typename Prov >
Prov const * Provider () const
 Return the specified provider (throws if not available) More...
 
template<typename... Provs>
void FillProviderPack (gar::ProviderPack< Provs... > &pack) const
 Fills the specified provider pack with providers. More...
 
template<typename Prov >
Prov::providers_type ProviderPackFor () const
 Returns a provider pack for the specified provider. More...
 
template<typename Prov , typename... Args>
Prov * SetupProvider (Args &&...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov , typename... Args>
Prov * SetupProviderFromService (std::string name, Args &&...args)
 Sets a service provider up by calling its testing::setupProvider() More...
 
template<typename Prov >
Prov * AcquireProvider (std::unique_ptr< Prov > &&prov)
 Acquires a service provider. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFor (Args &&...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov , typename... Args>
Prov * SetupProviderFromServiceFor (std::string name, Args &&...args)
 Sets a provider up, recording it as implementation of Interface. More...
 
template<typename Interface , typename Prov >
Prov * AcquireProviderFor (std::unique_ptr< Prov > &&prov)
 Acquires a service provider implementing an interface. More...
 
template<typename Prov >
Prov * SimpleProviderSetup ()
 Oversimplified provider setup. More...
 
template<typename Prov >
void DropProvider ()
 Removes and destroys the specified provider. More...
 
template<typename Prov >
Prov const * Provider () const
 Return the specified provider (throws if not available) More...
 
template<typename... Provs>
void FillProviderPack (lar::ProviderPack< Provs... > &pack) const
 Fills the specified provider pack with providers. More...
 
template<typename Prov >
Prov::providers_type ProviderPackFor () const
 Returns a provider pack for the specified provider. More...
 
- Public Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
 BasicTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~BasicTesterEnvironment ()
 Destructor: closing remarks. More...
 
 BasicTesterEnvironment (bool bSetup=true)
 Constructor: sets everything up and declares the test started. More...
 
virtual ~BasicTesterEnvironment ()
 Destructor: closing remarks. More...
 
 BasicTesterEnvironment (Configuration_t const &cfg_obj, bool bSetup=true)
 Setup from a configuration. More...
 
 BasicTesterEnvironment (Configuration_t &&cfg_obj, bool bSetup=true)
 
fhicl::ParameterSet const & Parameters () const
 Returns the full configuration. More...
 
fhicl::ParameterSet ServiceParameters (std::string service_name) const
 Returns the configuration of the specified service. More...
 
fhicl::ParameterSet TesterParameters (std::string test_name) const
 Returns the configuration of the specified test. More...
 
fhicl::ParameterSet TesterParameters () const
 Returns the configuration of the main test (undefined if no main test) More...
 
fhicl::ParameterSet const & Parameters () const
 Returns the full configuration. More...
 
fhicl::ParameterSet ServiceParameters (std::string service_name) const
 Returns the configuration of the specified service. More...
 
fhicl::ParameterSet TesterParameters (std::string test_name) const
 Returns the configuration of the specified test. More...
 
fhicl::ParameterSet TesterParameters () const
 Returns the configuration of the main test (undefined if no main test) More...
 
 BasicTesterEnvironment (Configuration_t const &configurer, bool bSetup=true)
 Setup from a configuration. More...
 
 BasicTesterEnvironment (Configuration_t &&configurer, bool bSetup=true)
 

Static Public Member Functions

static gar::geo::GeometryCore const * GlobalGeometry ()
 
static SharedGeoPtr_t SharedGlobalGeometry ()
 Returns the current global geometry instance (may be nullptr if none) More...
 
static geo::GeometryCore const * GlobalGeometry ()
 
static SharedGeoPtr_t SharedGlobalGeometry ()
 Returns the current global geometry instance (may be nullptr if none) More...
 
- Static Public Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
static fhicl::ParameterSet CompileParameterSet (std::string cfg)
 Compiles a parameter set from a string. More...
 
static fhicl::ParameterSet CompileParameterSet (std::string cfg)
 

Protected Types

using ChannelMapClass = typename ConfigurationClass::ChannelMapClass
 
using ChannelMapClass = typename ConfigurationClass::ChannelMapClass
 

Protected Member Functions

virtual void Setup ()
 The complete initialization, ran at construction by default. More...
 
virtual std::unique_ptr< gar::geo::GeometryCoreCreateNewGeometry () const
 Creates a new geometry. More...
 
virtual void SetupGeometry ()
 Sets up the geometry (creates and registers it) More...
 
virtual void Setup ()
 The complete initialization, ran at construction by default. More...
 
virtual std::unique_ptr< geo::GeometryCoreCreateNewGeometry () const
 Creates a new geometry. More...
 
virtual void SetupGeometry ()
 Sets up the geometry (creates and registers it) More...
 
virtual void RegisterGeometry (SharedGeoPtr_t new_geom)
 Get ownership of the specified geometry and registers it as global. More...
 
virtual void RegisterGeometry (gar::geo::GeometryCore const *new_geom)
 
virtual void RegisterGeometry (SharedGeoPtr_t new_geom)
 Get ownership of the specified geometry and registers it as global. More...
 
virtual void RegisterGeometry (geo::GeometryCore const *new_geom)
 
- Protected Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
Configuration_t const & Config () const
 Returns a read-only version of the configuration. More...
 
virtual void Configure ()
 Reads and translates the configuration. More...
 
virtual fhicl::ParameterSet DefaultParameters () const
 Creates a full configuration for the test. More...
 
Configuration_t const & Config () const
 Returns a read-only version of the configuration. More...
 
virtual void Configure ()
 Reads and translates the configuration. More...
 
virtual fhicl::ParameterSet DefaultParameters () const
 Creates a full configuration for the test. More...
 
virtual void SetupMessageFacility (fhicl::ParameterSet const &pset, std::string appl_name="") const
 Sets up the message facility. More...
 
virtual void SetupMessageFacility () const
 
virtual void SetupMessageFacility (fhicl::ParameterSet const &pset, std::string appl_name="") const
 Sets up the message facility. More...
 
virtual void SetupMessageFacility () const
 

Private Types

using TesterEnvironment_t = TesterEnvironment< ConfigurationClass >
 Base class. More...
 
using GeoResources_t = TestSharedGlobalResource< gar::geo::GeometryCore const >
 this implements the singleton interface More...
 
using TesterEnvironment_t = TesterEnvironment< ConfigurationClass >
 Base class. More...
 
using GeoResources_t = TestSharedGlobalResource< geo::GeometryCore const >
 this implements the singleton interface More...
 

Private Attributes

ConfigurationClass config
 instance of the configurer More...
 
SharedGeoPtr_t geom
 pointer to the geometry More...
 

Additional Inherited Members

- Static Protected Member Functions inherited from testing::BasicTesterEnvironment< ConfigurationClass >
static fhicl::ParameterSet ParseParameters (std::string config_path)
 Fills the test configuration from file or from default. More...
 
static fhicl::ParameterSet ParseParameters (std::string config_path)
 Fills the test configuration from file or from default. More...
 
- Protected Attributes inherited from testing::TesterEnvironment< ConfigurationClass >
ProviderList providers
 list of available providers More...
 

Detailed Description

template<typename ConfigurationClass>
class testing::GeometryTesterEnvironment< ConfigurationClass >

Environment for a geometry test.


Template Parameters
ConfigurationClassa class providing compile-time configuration

The test environment is set up on construction.

The environment provides:

This class or a derived one can be used as global fixture for unit tests that require the presence of geometry (in the form of gar::geo::GeometryCore instance).

Unfortunately Boost does not give any control on the initialization of the object, so everything must be ready to go as hard coded. The ConfigurationClass class tries to alleviate that. That is another, small static class that GeometryTesterEnvironment uses to get its parameters.

The requirements for the ConfigurationClass are:

Whether the configuration comes from a file or from the two provided defaults, it is always expected within the parameter set paths: the default configuration must also contain that path.

Note that there is no room for polymorphism here since the setup happens on construction. Some methods are declared virtual in order to allow to tweak some steps of the set up, but it's not trivial to create a derived class that works correctly: the derived class must declare a new default constructor, and that default constructor must call the protected constructor (GeometryTesterEnvironment<ConfigurationClass>(no_setup))


Template Parameters
ConfigurationClassa class providing compile-time configuration

The test environment is set up on construction.

The environment provides:

This class or a derived one can be used as global fixture for unit tests that require the presence of geometry (in the form of geo::GeometryCore instance).

Unfortunately Boost does not give any control on the initialization of the object, so everything must be ready to go as hard coded. The ConfigurationClass class tries to alleviate that. That is another, small static class that GeometryTesterEnvironment uses to get its parameters.

The requirements for the ConfigurationClass are:

Whether the configuration comes from a file or from the two provided defaults, it is always expected within the parameter set paths: the default configuration must also contain that path.

Note that there is no room for polymorphism here since the setup happens on construction. Some methods are declared virtual in order to allow to tweak some steps of the set up, but it's not trivial to create a derived class that works correctly: the derived class must declare a new default constructor, and that default constructor must call the protected constructor (GeometryTesterEnvironment<ConfigurationClass>(no_setup))

Definition at line 191 of file geometry_unit_test_base.h.

Member Typedef Documentation

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::ChannelMapClass = typename ConfigurationClass::ChannelMapClass
protected

Definition at line 258 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::ChannelMapClass = typename ConfigurationClass::ChannelMapClass
protected

Definition at line 258 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::GeoResources_t = TestSharedGlobalResource<gar::geo::GeometryCore const>
private

this implements the singleton interface

Definition at line 199 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::GeoResources_t = TestSharedGlobalResource<geo::GeometryCore const>
private

this implements the singleton interface

Definition at line 199 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGeoPtr_t = GeoResources_t::ResourcePtr_t

Definition at line 202 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGeoPtr_t = GeoResources_t::ResourcePtr_t

Definition at line 202 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::TesterEnvironment_t = TesterEnvironment<ConfigurationClass>
private

Base class.

Definition at line 196 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
using testing::GeometryTesterEnvironment< ConfigurationClass >::TesterEnvironment_t = TesterEnvironment<ConfigurationClass>
private

Base class.

Definition at line 196 of file geometry_unit_test_base.h.

Constructor & Destructor Documentation

template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( bool  bSetup = true)
inline

Constructor: sets everything up and declares the test started.

The configuration is from a default-constructed ConfigurationClass. This is suitable for use as Boost unit test fixture.

Definition at line 210 of file geometry_unit_test_base.h.

211  : TesterEnvironment_t(false)
212  { if (bSetup) Setup(); }
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( ConfigurationClass const &  cfg_obj,
bool  bSetup = true 
)
inline

Setup from a configuration.

Parameters
configureran instance of ConfigurationClass

The configuration is from the specified configurer class.

This constructor allows to use a non-default-constructed configuration. This can't be used (at best of my knowledge) when using this class as Boost unit test fixture.

In the r-value-reference constructor, the configurer is moved.

Definition at line 228 of file geometry_unit_test_base.h.

229  : TesterEnvironment_t(cfg_obj, false)
230  { if (bSetup) Setup(); }
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( ConfigurationClass &&  cfg_obj,
bool  bSetup = true 
)
inline

Definition at line 231 of file geometry_unit_test_base.h.

232  : TesterEnvironment_t(std::move(cfg_obj), false)
233  { if (bSetup) Setup(); }
def move(depos, offset)
Definition: depos.py:107
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass >
testing::GeometryTesterEnvironment< ConfigurationClass >::~GeometryTesterEnvironment ( )
virtual

Destructor: closing remarks.

Definition at line 289 of file geometry_unit_test_base.h.

289  {
290 
291  mf::LogInfo("Test") << config.ApplicationName() << " completed.";
292 
293  } // GeometryTesterEnvironment<>::~GeometryTesterEnvironment()
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ConfigurationClass config
instance of the configurer
template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( bool  bSetup = true)
inline

Constructor: sets everything up and declares the test started.

The configuration is from a default-constructed ConfigurationClass. This is suitable for use as Boost unit test fixture.

Definition at line 210 of file geometry_unit_test_base.h.

211  : TesterEnvironment_t(false)
212  { if (bSetup) Setup(); }
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( ConfigurationClass const &  cfg_obj,
bool  bSetup = true 
)
inline

Setup from a configuration.

Parameters
configureran instance of ConfigurationClass

The configuration is from the specified configurer class.

This constructor allows to use a non-default-constructed configuration. This can't be used (at best of my knowledge) when using this class as Boost unit test fixture.

In the r-value-reference constructor, the configurer is moved.

Definition at line 228 of file geometry_unit_test_base.h.

229  : TesterEnvironment_t(cfg_obj, false)
230  { if (bSetup) Setup(); }
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass>
testing::GeometryTesterEnvironment< ConfigurationClass >::GeometryTesterEnvironment ( ConfigurationClass &&  cfg_obj,
bool  bSetup = true 
)
inline

Definition at line 231 of file geometry_unit_test_base.h.

232  : TesterEnvironment_t(std::move(cfg_obj), false)
233  { if (bSetup) Setup(); }
def move(depos, offset)
Definition: depos.py:107
virtual void Setup()
The complete initialization, ran at construction by default.
TesterEnvironment< ConfigurationClass > TesterEnvironment_t
Base class.
template<typename ConfigurationClass>
virtual testing::GeometryTesterEnvironment< ConfigurationClass >::~GeometryTesterEnvironment ( )
virtual

Destructor: closing remarks.

Member Function Documentation

template<typename ConfigurationClass >
std::unique_ptr< geo::GeometryCore > testing::GeometryTesterEnvironment< ConfigurationClass >::CreateNewGeometry ( ) const
protectedvirtual

Creates a new geometry.

Sets the geometry of the standard detector up.


This function sets up the geometry according to the provided information:

  • the configuration must contain enough information to locate the geometry description file
  • we trust that that geometry works well with the ChannelMapClass specified in ConfigurationClass

Definition at line 308 of file geometry_unit_test_base.h.

309  {
310 
311  std::string ProviderParameterSetPath
312  = this->Config().GeometryParameterSetPath();
313 
314  //
315  // create the new geometry service provider
316  //
317  fhicl::ParameterSet ProviderConfig
318  = this->Parameters().template get<fhicl::ParameterSet>
319  (ProviderParameterSetPath);
320  auto new_geom = std::make_unique<gar::geo::GeometryCore>(ProviderConfig);
321 
322  std::string RelativePath
323  = ProviderConfig.get< std::string>("RelativePath", "");
324 
326  GDMLFileName = RelativePath + ProviderConfig.get<std::string>("GDML"),
327  ROOTFileName = RelativePath + ProviderConfig.get<std::string>("ROOT");
328 
329  // Search all reasonable locations for the geometry file;
330  // we see if by any chance art's FW_SEARCH_PATH directory is set and try
331  // there;
332  // if not, we do expect the path to be complete enough for ROOT to cope.
333  cet::search_path sp("FW_SEARCH_PATH");
334 
335  std::string ROOTfile;
336  if (!sp.find_file(ROOTFileName, ROOTfile)) ROOTfile = ROOTFileName;
337 
338  // we really don't care of GDML file, since we are not going to run Geant4
339  std::string GDMLfile;
340  if (!sp.find_file(GDMLFileName, GDMLfile))
341  mf::LogWarning("CreateNewGeometry") << "GDML file not found.";
342 
343  // initialize the geometry with the files we have found
344  new_geom->LoadGeometryFile(GDMLfile, ROOTfile);
345 
346 
347  //
348  // create the new channel map
349  //
350  fhicl::ParameterSet SortingParameters
351  = ProviderConfig.get<fhicl::ParameterSet>("SortingParameters", {});
352  std::shared_ptr<gar::geo::seg::ChannelMapAlg> pChannelMap
353  (new ChannelMapClass(SortingParameters));
354 
355  // connect the channel map with the geometry, that shares ownsership
356  // (we give up ours at the end of this method)
357  new_geom->ApplyChannelMap(pChannelMap);
358 
359  return new_geom;
360  } // GeometryTesterEnvironment<>::CreateNewGeometry()
fhicl::ParameterSet const & Parameters() const
Returns the full configuration.
std::string string
Definition: nybbler.cc:12
Configuration_t const & Config() const
Returns a read-only version of the configuration.
typename ConfigurationClass::ChannelMapClass ChannelMapClass
T get(std::string const &key) const
Definition: ParameterSet.h:271
template<typename ConfigurationClass>
virtual std::unique_ptr<geo::GeometryCore> testing::GeometryTesterEnvironment< ConfigurationClass >::CreateNewGeometry ( ) const
protectedvirtual

Creates a new geometry.

template<typename ConfigurationClass>
geo::GeometryCore const* testing::GeometryTesterEnvironment< ConfigurationClass >::Geometry ( ) const
inline

Returns a pointer to the geometry.

Definition at line 242 of file geometry_unit_test_base.h.

242 { return geom.get(); }
SharedGeoPtr_t geom
pointer to the geometry
template<typename ConfigurationClass>
gar::geo::GeometryCore const* testing::GeometryTesterEnvironment< ConfigurationClass >::Geometry ( ) const
inline

Returns a pointer to the geometry.

Definition at line 242 of file geometry_unit_test_base.h.

242 { return geom.get(); }
SharedGeoPtr_t geom
pointer to the geometry
template<typename ConfigurationClass>
static gar::geo::GeometryCore const* testing::GeometryTesterEnvironment< ConfigurationClass >::GlobalGeometry ( )
inlinestatic

Returns the current global geometry instance

Exceptions
std::out_of_rangeif not present

Definition at line 249 of file geometry_unit_test_base.h.

250  { return &GeoResources_t::Resource(); }
template<typename ConfigurationClass>
static geo::GeometryCore const* testing::GeometryTesterEnvironment< ConfigurationClass >::GlobalGeometry ( )
inlinestatic

Returns the current global geometry instance

Exceptions
std::out_of_rangeif not present

Definition at line 249 of file geometry_unit_test_base.h.

250  { return &GeoResources_t::Resource(); }
template<typename ConfigurationClass>
virtual void testing::GeometryTesterEnvironment< ConfigurationClass >::RegisterGeometry ( SharedGeoPtr_t  new_geom)
protectedvirtual

Get ownership of the specified geometry and registers it as global.

template<typename ConfigurationClass >
void testing::GeometryTesterEnvironment< ConfigurationClass >::RegisterGeometry ( SharedGeoPtr_t  new_geom)
protectedvirtual

Get ownership of the specified geometry and registers it as global.

Definition at line 365 of file geometry_unit_test_base.h.

366  {
367  // update the current geometry, that becomes owner;
368  // also update the global one if it happens to be already our previous
369  // (in this case, it becomes co-owner)
370  SharedGeoPtr_t my_old_geom = geom;
371  geom = new_geom;
372  // if the global geometry is already the one we register, don't bother
373  if (SharedGlobalGeometry() != new_geom)
374  GeoResources_t::ReplaceDefaultSharedResource(my_old_geom, new_geom);
375  } // GeometryTesterEnvironment<>::RegisterGeometry()
SharedGeoPtr_t geom
pointer to the geometry
static SharedGeoPtr_t SharedGlobalGeometry()
Returns the current global geometry instance (may be nullptr if none)
GeoResources_t::ResourcePtr_t SharedGeoPtr_t
template<typename ConfigurationClass>
virtual void testing::GeometryTesterEnvironment< ConfigurationClass >::RegisterGeometry ( geo::GeometryCore const *  new_geom)
inlineprotectedvirtual

Definition at line 270 of file geometry_unit_test_base.h.

271  { RegisterGeometry(SharedGeoPtr_t(new_geom)); }
virtual void RegisterGeometry(SharedGeoPtr_t new_geom)
Get ownership of the specified geometry and registers it as global.
GeoResources_t::ResourcePtr_t SharedGeoPtr_t
template<typename ConfigurationClass>
virtual void testing::GeometryTesterEnvironment< ConfigurationClass >::RegisterGeometry ( gar::geo::GeometryCore const *  new_geom)
inlineprotectedvirtual

Definition at line 270 of file geometry_unit_test_base.h.

271  { RegisterGeometry(SharedGeoPtr_t(new_geom)); }
virtual void RegisterGeometry(SharedGeoPtr_t new_geom)
Get ownership of the specified geometry and registers it as global.
GeoResources_t::ResourcePtr_t SharedGeoPtr_t
template<typename ConfigurationClass >
void testing::GeometryTesterEnvironment< ConfigurationClass >::Setup ( )
protectedvirtual

The complete initialization, ran at construction by default.

Reimplemented from testing::BasicTesterEnvironment< ConfigurationClass >.

Definition at line 395 of file geometry_unit_test_base.h.

395  {
396 
397  //
398  // parse configuration, set up message facility
399  //
400  TesterEnvironment_t::Setup();
401 
402  //
403  // set up the geometry
404  //
405  SetupGeometry();
406 
407  mf::LogInfo("Test")
408  << config.ApplicationName() << " Geometry setup complete.";
409 
410  } // GeometryTesterEnvironment<>::Setup()
MaybeLogger_< ELseverityLevel::ELsev_info, false > LogInfo
ConfigurationClass config
instance of the configurer
virtual void SetupGeometry()
Sets up the geometry (creates and registers it)
template<typename ConfigurationClass>
virtual void testing::GeometryTesterEnvironment< ConfigurationClass >::Setup ( )
protectedvirtual

The complete initialization, ran at construction by default.

Reimplemented from testing::BasicTesterEnvironment< ConfigurationClass >.

template<typename ConfigurationClass >
void testing::GeometryTesterEnvironment< ConfigurationClass >::SetupGeometry ( )
protectedvirtual

Sets up the geometry (creates and registers it)

Definition at line 380 of file geometry_unit_test_base.h.

380  {
381  //
382  // horrible, shameful hack to support the "new" testing environment
383  // while the old one, informally deprecated, is still around;
384  // we will have TWO versions of GeometryCore around.
385  // Ugh.
386  //
388  // new
389  this->template AcquireProvider<gar::geo::GeometryCore>(CreateNewGeometry());
390  } // GeometryTesterEnvironment<>::SetupGeometry()
virtual void RegisterGeometry(SharedGeoPtr_t new_geom)
Get ownership of the specified geometry and registers it as global.
virtual std::unique_ptr< gar::geo::GeometryCore > CreateNewGeometry() const
Creates a new geometry.
template<typename ConfigurationClass>
virtual void testing::GeometryTesterEnvironment< ConfigurationClass >::SetupGeometry ( )
protectedvirtual

Sets up the geometry (creates and registers it)

template<typename ConfigurationClass>
SharedGeoPtr_t testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGeometry ( ) const
inline

Definition at line 243 of file geometry_unit_test_base.h.

243 { return geom; }
SharedGeoPtr_t geom
pointer to the geometry
template<typename ConfigurationClass>
SharedGeoPtr_t testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGeometry ( ) const
inline

Definition at line 243 of file geometry_unit_test_base.h.

243 { return geom; }
SharedGeoPtr_t geom
pointer to the geometry
template<typename ConfigurationClass>
static SharedGeoPtr_t testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGlobalGeometry ( )
inlinestatic

Returns the current global geometry instance (may be nullptr if none)

Definition at line 253 of file geometry_unit_test_base.h.

254  { return GeoResources_t::ShareResource(); }
template<typename ConfigurationClass>
static SharedGeoPtr_t testing::GeometryTesterEnvironment< ConfigurationClass >::SharedGlobalGeometry ( )
inlinestatic

Returns the current global geometry instance (may be nullptr if none)

Definition at line 253 of file geometry_unit_test_base.h.

254  { return GeoResources_t::ShareResource(); }

Member Data Documentation

template<typename ConfigurationClass>
ConfigurationClass testing::GeometryTesterEnvironment< ConfigurationClass >::config
private

instance of the configurer

Definition at line 279 of file geometry_unit_test_base.h.

template<typename ConfigurationClass>
SharedGeoPtr_t testing::GeometryTesterEnvironment< ConfigurationClass >::geom
private

pointer to the geometry

Definition at line 281 of file geometry_unit_test_base.h.


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