LArSoft  v09_90_00
Liquid Argon Software toolkit - https://larsoft.org/
fhicl::detail::TableMemberRegistry Class Reference

#include "TableMemberRegistry.h"

Private Types

using base_ptr = cet::exempt_ptr< ParameterBase >
 
using table_members_t = std::vector< base_ptr >
 

Static Private Member Functions

static TableMemberRegistryinstance_ ()
 
static std::vector< base_ptrrelease_members ()
 
static void emplace_table_member (ParameterBase *pb)
 
static void new_table ()
 

Private Attributes

std::stack< table_members_ttables_
 

Friends

class TableBase
 
class RegisterIfTableMember
 

Detailed Description

Definition at line 47 of file TableMemberRegistry.h.

Member Typedef Documentation

Definition at line 49 of file TableMemberRegistry.h.

Definition at line 50 of file TableMemberRegistry.h.

Member Function Documentation

void fhicl::detail::TableMemberRegistry::emplace_table_member ( ParameterBase pb)
staticprivate

Definition at line 31 of file TableMemberRegistry.cc.

References instance_(), and tables_.

Referenced by fhicl::detail::RegisterIfTableMember::RegisterIfTableMember().

32  {
33  instance_().tables_.top().emplace_back(pb);
34  }
static TableMemberRegistry & instance_()
std::stack< table_members_t > tables_
TableMemberRegistry & fhicl::detail::TableMemberRegistry::instance_ ( )
staticprivate

Definition at line 8 of file TableMemberRegistry.cc.

References fhicl::detail::per_thread_holder< T >::slot_for_current_thread().

Referenced by emplace_table_member(), new_table(), and release_members().

9  {
10  // The use of the registry is restricted to the construction
11  // of fhiclcpp types. As construction happens on only one
12  // thread, it is sufficient for each thread to have its own
13  // copy. Although a thread-local static would be appropriate
14  // here, not all implementations adequately support
15  // thread-local variables for the use case here. We thus use
16  // a custom-built per-thread cache.
17  static per_thread_holder<TableMemberRegistry> registry;
18  return registry.slot_for_current_thread();
19  }
void fhicl::detail::TableMemberRegistry::new_table ( )
staticprivate

Definition at line 37 of file TableMemberRegistry.cc.

References instance_(), and tables_.

Referenced by fhicl::detail::RegisterIfTableMember::RegisterIfTableMember().

38  {
39  instance_().tables_.emplace();
40  }
static TableMemberRegistry & instance_()
std::stack< table_members_t > tables_
std::vector< cet::exempt_ptr< ParameterBase > > fhicl::detail::TableMemberRegistry::release_members ( )
staticprivate

Definition at line 22 of file TableMemberRegistry.cc.

References instance_(), and tables_.

Referenced by fhicl::detail::TableBase::finalize_members().

23  {
24  auto& tables = instance_().tables_;
25  auto result = std::exchange(tables.top(), {});
26  tables.pop();
27  return result;
28  }
static TableMemberRegistry & instance_()
std::stack< table_members_t > tables_

Friends And Related Function Documentation

friend class RegisterIfTableMember
friend

Definition at line 61 of file TableMemberRegistry.h.

friend class TableBase
friend

Definition at line 56 of file TableMemberRegistry.h.

Member Data Documentation

std::stack<table_members_t> fhicl::detail::TableMemberRegistry::tables_
private

Definition at line 51 of file TableMemberRegistry.h.

Referenced by emplace_table_member(), new_table(), and release_members().


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