All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Public Types | Public Member Functions | Private Types | Private Member Functions | Private Attributes | Static Private Attributes | List of all members
util::MultipleChoiceSelection< typename > Class Template Reference

Helper to select one among multiple choices via strings. More...

#include <MultipleChoiceSelection.h>

Inheritance diagram for util::MultipleChoiceSelection< typename >:
util::MultipleChoiceSelectionBase

Public Types

using Choices_t = Choices
 Type of the underlying choice. More...
 
using Option_t = details::MultipleChoiceSelectionOption_t< Choices_t >
 

Public Member Functions

 MultipleChoiceSelection ()=default
 
template<typename... Options>
 MultipleChoiceSelection (std::initializer_list< Option_t > options)
 Constructor: adds the specified options. More...
 
template<typename... Aliases>
auto addOption (Choices_t value, std::string label, Aliases...aliases) -> Option_t const &
 
template<typename... Aliases>
auto addAlias (Choices_t value, Aliases...aliases) -> std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...>, Option_t const & >
 
template<typename... Aliases>
auto addAlias (Option_t const &option, Aliases...aliases) -> std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...>, Option_t const & >
 
template<typename... Aliases>
auto recordLabels (std::size_t index, std::string alias, Aliases...moreAliases) -> std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...>>
 
Option management
std::size_t size () const
 Returns the number of available options. More...
 
bool empty () const
 Returns whether there is no available option. More...
 
template<typename... Aliases>
Option_t const & addOption (Choices_t value, std::string label, Aliases...aliases)
 Adds a new option to the selector. More...
 
template<typename... Aliases>
std::enable_if_t
< details::AllConvertibleToStrings_v
< Aliases...>, Option_t const & > 
addAlias (Choices_t value, Aliases...aliases)
 Adds aliases to an existing option. More...
 
template<typename... Aliases>
std::enable_if_t
< details::AllConvertibleToStrings_v
< Aliases...>, Option_t const & > 
addAlias (Option_t const &option, Aliases...aliases)
 Adds labels to an existing option. More...
 
bool hasOption (Choices_t value) const
 Returns whether the selector has an option with the specified value. More...
 
bool hasOption (std::string const &label) const
 Returns whether the selector has an option with the specified label. More...
 
bool hasOption (Option_t const &option) const
 Returns if the specified option is present in the selector (by value). More...
 
Option access
Option_t const & get (Choices_t value) const
 Returns the specified option. More...
 
Option_t const & get (std::string const &label) const
 Returns the option with the specified label. More...
 
Option_t const & parse (std::string const &label) const
 Returns the option matching the specified label. More...
 
Presentation and dumping

— BEGIN -------------------------------------------------------------—

std::string optionListString (std::string const &sep=", ") const
 Returns a string with the (main) name of all options. More...
 
std::string optionListDump (std::string const &indent, std::string const &firstIndent) const
 Returns a string with all the options, one per line. More...
 
std::string optionListDump (std::string const &indent="") const
 Returns a string with all the options, one per line. More...
 

Private Types

using Selector_t = MultipleChoiceSelection< Choices >
 This type. More...
 
using OptionList_t = std::vector< Option_t >
 Type of collection of options. More...
 
using OptionLabelMap_t = std::map< std::string, std::size_t, details::SorterFrom< details::CaseInsensitiveComparer > >
 Type of label index (associative container: label to option index). More...
 

Private Member Functions

Option_t const & addOption (Option_t &&option)
 Moves the specified option into the list of registered options. More...
 
void recordLabel (std::string &&label, std::size_t index)
 
template<typename... Aliases>
std::enable_if_t
< details::AllConvertibleToStrings_v
< Aliases...> > 
recordLabels (std::size_t index, std::string alias, Aliases...moreAliases)
 
void unregisterLabel (std::string const &label)
 Removes the specified label from the register. More...
 
Option_tget (Choices_t value)
 
OptionList_t::const_iterator findOption (Choices_t value) const
 Returns an iterator to the option with label, or npos if none. More...
 
OptionList_t::iterator findOption (Choices_t value)
 Returns an iterator to the option with label, or npos if none. More...
 
std::size_t findOptionIndex (Choices_t value) const
 Returns the index of the option with label, or npos if none. More...
 
std::size_t findOptionIndex (std::string const &label) const
 Returns the index of the option with label, or npos if none. More...
 

Private Attributes

OptionList_t fOptions
 The list of registered objects. More...
 
OptionLabelMap_t fLabelToOptionIndex
 Map from labels to option index in fOptions. More...
 

Static Private Attributes

static constexpr auto npos = std::numeric_limits<std::size_t>::max()
 Special value. More...
 

Detailed Description

template<typename>
class util::MultipleChoiceSelection< typename >

Helper to select one among multiple choices via strings.

Template Parameters
Choicestype describing the choices
Note
If the type to describe the choice is a string, its value still need to be explicitly added as an option label.

Definition at line 204 of file MultipleChoiceSelection.h.

Member Typedef Documentation

template<typename >
using util::MultipleChoiceSelection< typename >::Choices_t = Choices

Type of the underlying choice.

Definition at line 222 of file MultipleChoiceSelection.h.

Definition at line 224 of file MultipleChoiceSelection.h.

template<typename >
using util::MultipleChoiceSelection< typename >::OptionLabelMap_t = std::map< std::string, std::size_t, details::SorterFrom<details::CaseInsensitiveComparer> >
private

Type of label index (associative container: label to option index).

Definition at line 388 of file MultipleChoiceSelection.h.

template<typename >
using util::MultipleChoiceSelection< typename >::OptionList_t = std::vector<Option_t>
private

Type of collection of options.

— END ------------------------------------------------------------——

Definition at line 382 of file MultipleChoiceSelection.h.

template<typename >
using util::MultipleChoiceSelection< typename >::Selector_t = MultipleChoiceSelection<Choices>
private

This type.

Definition at line 217 of file MultipleChoiceSelection.h.

Constructor & Destructor Documentation

template<typename >
util::MultipleChoiceSelection< typename >::MultipleChoiceSelection ( )
default

Default constructor: flags are set to DefaultFlags, options may be added later.

template<typename Choices >
template<typename... Options>
util::MultipleChoiceSelection< Choices >::MultipleChoiceSelection ( std::initializer_list< Option_t options)

Constructor: adds the specified options.

Template Parameters
Optionsa number of Option_t objects
Parameters
optionsa list of options to add to the selector

All specified options are added as with addOption().

Definition at line 806 of file MultipleChoiceSelection.h.

807 {
808  for (Option_t option: options) addOption(std::move(option));
809 } // util::MultipleChoiceSelection<>::MultipleChoiceSelection()
Option_t const & addOption(Choices_t value, std::string label, Aliases...aliases)
Adds a new option to the selector.
then echo echo For and will not be changed by echo further linking echo echo B echo The symbol is in the uninitialized data multiple common symbols may appear with the echo same name If the symbol is defined the common echo symbols are treated as undefined references For more echo details on common see the discussion of warn common echo in *Note Linker options
echo Invalid option
Definition: TrainMVA.sh:17
details::MultipleChoiceSelectionOption_t< Choices_t > Option_t

Member Function Documentation

template<typename >
template<typename... Aliases>
std::enable_if_t<details::AllConvertibleToStrings_v<Aliases...>, Option_t const&> util::MultipleChoiceSelection< typename >::addAlias ( Choices_t  value,
Aliases...  aliases 
)

Adds aliases to an existing option.

Template Parameters
Argsany number of std::string
Parameters
valuethe value of the option to assign labels to
aliasesthe additional alias(es) to assign to this option
Returns
the option being changed
Exceptions
UnknownOptionErrorif no option with value is registered yet
template<typename >
template<typename... Aliases>
std::enable_if_t<details::AllConvertibleToStrings_v<Aliases...>, Option_t const&> util::MultipleChoiceSelection< typename >::addAlias ( Option_t const &  option,
Aliases...  aliases 
)

Adds labels to an existing option.

Template Parameters
Aliasesany number of std::string
Parameters
optionthe option to assign labels to
aliasesthe additional alias(es) to assign to this option
Returns
the option being changed
Exceptions
UnknownOptionErrorif no option with value is registered yet

The option with the same value as the option argument is assigned the specified aliases.

template<typename >
template<typename... Aliases>
auto util::MultipleChoiceSelection< typename >::addAlias ( Choices_t  value,
Aliases...  aliases 
) -> std::enable_if_t <details::AllConvertibleToStrings_v<Aliases...>, Option_t const&>

Definition at line 838 of file MultipleChoiceSelection.h.

841 {
842  std::size_t const index = findOptionIndex(value);
843  if (index >= fOptions.size())
844  throw UnknownOptionError(Option_t::value_as_string(value, ""));
845  recordLabels(index, aliases...);
846  return fOptions[index].addAlias(std::move(aliases)...);
847 } // util::MultipleChoiceSelection<>::addAlias()
std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...> > recordLabels(std::size_t index, std::string alias, Aliases...moreAliases)
std::size_t findOptionIndex(Choices_t value) const
Returns the index of the option with label, or npos if none.
temporary value
OptionList_t fOptions
The list of registered objects.
template<typename >
template<typename... Aliases>
auto util::MultipleChoiceSelection< typename >::addAlias ( Option_t const &  option,
Aliases...  aliases 
) -> std::enable_if_t <details::AllConvertibleToStrings_v<Aliases...>, Option_t const&>

Definition at line 854 of file MultipleChoiceSelection.h.

857 {
858  return addAlias(option.value(), std::move(aliases)...);
859 } // util::MultipleChoiceSelection<>::addAlias()
echo Invalid option
Definition: TrainMVA.sh:17
std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...>, Option_t const & > addAlias(Choices_t value, Aliases...aliases)
Adds aliases to an existing option.
template<typename >
template<typename... Aliases>
Option_t const& util::MultipleChoiceSelection< typename >::addOption ( Choices_t  value,
std::string  label,
Aliases...  aliases 
)

Adds a new option to the selector.

Template Parameters
Aliasesany number of std::string
Parameters
valuethe value of the new option
labelthe first label to associate to the option
aliasesadditional aliases for this option
Returns
the newly created option
Exceptions
OptionAlreadyExistsErrorif there is already an option with value
See Also
addAlias()

An option must always have a label; aliases are instead optional. There must be no existing option with the specified value, otherwise an exception will be thrown with the label of the existing option. To add aliases to an existing option, use addAlias() instead. Currently, it is not possible to change a label after having added it.

template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::addOption ( Option_t &&  option)
private

Moves the specified option into the list of registered options.

Parameters
optionthe option to move
Returns
the newly added option
Exceptions
OptionAlreadyExistsErrorif there is already an option with the same value or any of the labels; in that case, label() method of the exception will report the offending label of option or its name if it is the value to be duplicated

Definition at line 966 of file MultipleChoiceSelection.h.

968 {
969  std::size_t const newOptionIndex = size();
970 
971  fOptions.push_back(std::move(option));
972  Option_t const& newOption = fOptions.back();
973  auto const& labels = newOption.labels();
974  for (auto iLabel = labels.begin(); iLabel != labels.end(); ++iLabel) {
975  try {
976  recordLabel(std::string{ *iLabel }, newOptionIndex);
977  }
978  catch (OptionAlreadyExistsError const&) {
979  // we attempt to offer a strong guarantee here,
980  // that the object is restored in the state it was before the call
981 
982  // remove the new entries from the index
983  // (*iLabel was not inserted, and all labels before it were new)
984  for (auto iNewLabel = labels.begin(); iNewLabel != iLabel; ++iNewLabel)
985  unregisterLabel(*iNewLabel);
986 
987  // remove the new option from the list
988  fOptions.pop_back();
989 
990  // let the caller handle the rest
991  throw;
992  } // try ... catch
993  } // for labels
994 
995  return newOption;
996 } // util::MultipleChoiceSelection<>::addOption()
* labels
void recordLabel(std::string &&label, std::size_t index)
void unregisterLabel(std::string const &label)
Removes the specified label from the register.
echo Invalid option
Definition: TrainMVA.sh:17
std::size_t size() const
Returns the number of available options.
details::MultipleChoiceSelectionOption_t< Choices_t > Option_t
OptionList_t fOptions
The list of registered objects.
template<typename >
template<typename... Aliases>
auto util::MultipleChoiceSelection< typename >::addOption ( Choices_t  value,
std::string  label,
Aliases...  aliases 
) -> Option_t const&

Definition at line 828 of file MultipleChoiceSelection.h.

829 {
830  return addOption({ value, std::move(label), std::move(aliases)... });
831 } // util::MultipleChoiceSelection<>::addOption()
Option_t const & addOption(Choices_t value, std::string label, Aliases...aliases)
Adds a new option to the selector.
temporary value
template<typename Choices >
bool util::MultipleChoiceSelection< Choices >::empty ( ) const

Returns whether there is no available option.

Definition at line 820 of file MultipleChoiceSelection.h.

821  { return fOptions.empty(); }
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::findOption ( Choices_t  value) const
private

Returns an iterator to the option with label, or npos if none.

Definition at line 1052 of file MultipleChoiceSelection.h.

1054 {
1055  auto const matchValue
1056  = [value](Option_t const& option){ return option.value() == value; };
1057  return std::find_if(fOptions.begin(), fOptions.end(), matchValue);
1058 } // util::MultipleChoiceSelection<>::findOption(value) const
echo Invalid option
Definition: TrainMVA.sh:17
temporary value
details::MultipleChoiceSelectionOption_t< Choices_t > Option_t
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::findOption ( Choices_t  value)
private

Returns an iterator to the option with label, or npos if none.

Definition at line 1063 of file MultipleChoiceSelection.h.

1065 {
1066  auto const matchValue
1067  = [value](Option_t const& option){ return option.value() == value; };
1068  return std::find_if(fOptions.begin(), fOptions.end(), matchValue);
1069 } // util::MultipleChoiceSelection<>::findOption(value)
echo Invalid option
Definition: TrainMVA.sh:17
temporary value
details::MultipleChoiceSelectionOption_t< Choices_t > Option_t
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
std::size_t util::MultipleChoiceSelection< Choices >::findOptionIndex ( Choices_t  value) const
private

Returns the index of the option with label, or npos if none.

Definition at line 1075 of file MultipleChoiceSelection.h.

1076 {
1077  auto const d = static_cast<std::size_t>
1078  (std::distance(fOptions.begin(), findOption(value)));
1079  return (d >= size())? npos: d;
1080 } // util::MultipleChoiceSelection<>::findOptionIndex(value) const
static constexpr auto npos
Special value.
double distance(geo::Point_t const &point, CathodeDesc_t const &cathode)
Returns the distance of a point from the cathode.
OptionList_t::const_iterator findOption(Choices_t value) const
Returns an iterator to the option with label, or npos if none.
std::size_t size() const
Returns the number of available options.
temporary value
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
std::size_t util::MultipleChoiceSelection< Choices >::findOptionIndex ( std::string const &  label) const
private

Returns the index of the option with label, or npos if none.

Definition at line 1086 of file MultipleChoiceSelection.h.

1087 {
1088  auto const iOption = fLabelToOptionIndex.find(label);
1089  return (iOption == fLabelToOptionIndex.end())? npos: iOption->second;
1090 } // util::MultipleChoiceSelection<>::findOptionIndex(string) const
OptionLabelMap_t fLabelToOptionIndex
Map from labels to option index in fOptions.
static constexpr auto npos
Special value.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::get ( Choices_t  value) const

Returns the specified option.

Parameters
valuevalue of the requested option
Returns
the requested option
Exceptions
UnknownOptionErrorif there is no available option with value (the string of the exception is empty)

Definition at line 886 of file MultipleChoiceSelection.h.

888 {
889  auto const iOption = findOption(value);
890  if (iOption == fOptions.end())
891  throw UnknownOptionError(Option_t::value_as_string(value).value_or(""));
892  return *iOption;
893 } // util::MultipleChoiceSelection<>::get(value)
OptionList_t::const_iterator findOption(Choices_t value) const
Returns an iterator to the option with label, or npos if none.
temporary value
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::get ( std::string const &  label) const

Returns the option with the specified label.

Parameters
labellabel of the requested option
Returns
the requested option
Exceptions
UnknownOptionErrorif there is no available option with label (the string of the exception shows label value)

Definition at line 898 of file MultipleChoiceSelection.h.

900 {
901  auto const iLabelIndexPair = fLabelToOptionIndex.find(label);
902  if (iLabelIndexPair == fLabelToOptionIndex.end()) {
903  throw UnknownOptionError(label);
904  }
905  assert(iLabelIndexPair->second < fOptions.size());
906  return fOptions[iLabelIndexPair->second];
907 } // util::MultipleChoiceSelection<>::get(string)
OptionLabelMap_t fLabelToOptionIndex
Map from labels to option index in fOptions.
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::get ( Choices_t  value)
private

Retrieves the option with the specified value.

Exceptions
UnknownOptionErrorif there is no available option with value

Definition at line 1095 of file MultipleChoiceSelection.h.

1095  {
1096  auto const iOption = findOption(value);
1097  if (iOption == fOptions.end()) {
1098  throw UnknownOptionError(Option_t::value_as_string(value).value_or(""));
1099  }
1100  return *iOption;
1101 } // util::MultipleChoiceSelection<>::get()
OptionList_t::const_iterator findOption(Choices_t value) const
Returns an iterator to the option with label, or npos if none.
temporary value
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
bool util::MultipleChoiceSelection< Choices >::hasOption ( Choices_t  value) const

Returns whether the selector has an option with the specified value.

Definition at line 864 of file MultipleChoiceSelection.h.

865  { return findOption(value) != fOptions.end(); }
OptionList_t::const_iterator findOption(Choices_t value) const
Returns an iterator to the option with label, or npos if none.
temporary value
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
bool util::MultipleChoiceSelection< Choices >::hasOption ( std::string const &  label) const

Returns whether the selector has an option with the specified label.

Definition at line 871 of file MultipleChoiceSelection.h.

872 {
873  return fLabelToOptionIndex.find(label) != fLabelToOptionIndex.end();
874 } // util::MultipleChoiceSelection<>::hasOption(string)
OptionLabelMap_t fLabelToOptionIndex
Map from labels to option index in fOptions.
template<typename Choices >
bool util::MultipleChoiceSelection< Choices >::hasOption ( Option_t const &  option) const

Returns if the specified option is present in the selector (by value).

Definition at line 880 of file MultipleChoiceSelection.h.

881  { return hasOption(option.value()); }
bool hasOption(Choices_t value) const
Returns whether the selector has an option with the specified value.
echo Invalid option
Definition: TrainMVA.sh:17
template<typename Choices >
std::string util::MultipleChoiceSelection< Choices >::optionListDump ( std::string const &  indent,
std::string const &  firstIndent 
) const

Returns a string with all the options, one per line.

Definition at line 943 of file MultipleChoiceSelection.h.

944 {
945  using namespace std::string_literals;
946 
947  auto iOption = fOptions.begin();
948  auto const oend = fOptions.end();
949 
950  if (iOption == oend) return firstIndent + "<no options>\n"s;
951 
952  std::string s { firstIndent };
953  s += iOption->dump();
954  s += '\n';
955  while (++iOption != oend) {
956  s += indent;
957  s += iOption->dump();
958  s += '\n';
959  } // while
960  return s;
961 } // util::MultipleChoiceSelection<>::optionListDump()
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
OptionList_t fOptions
The list of registered objects.
template<typename >
std::string util::MultipleChoiceSelection< typename >::optionListDump ( std::string const &  indent = "") const
inline

Returns a string with all the options, one per line.

Definition at line 372 of file MultipleChoiceSelection.h.

373  { return optionListDump(indent, indent); }
std::string optionListDump(std::string const &indent, std::string const &firstIndent) const
Returns a string with all the options, one per line.
template<typename Choices >
std::string util::MultipleChoiceSelection< Choices >::optionListString ( std::string const &  sep = ", ") const

Returns a string with the (main) name of all options.

Definition at line 922 of file MultipleChoiceSelection.h.

923 {
924  using namespace std::string_literals;
925 
926  auto iOption = fOptions.begin();
927  auto const oend = fOptions.end();
928 
929  if (iOption == oend) return "<no options>"s;
930 
931  std::string s { *iOption };
932  while (++iOption != oend) {
933  s += sep;
934  s += *iOption;
935  } // while
936  return s;
937 } // util::MultipleChoiceSelection<>::optionListString()
then echo File list $list not found else cat $list while read file do echo $file sed s
Definition: file_to_url.sh:60
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
auto util::MultipleChoiceSelection< Choices >::parse ( std::string const &  label) const

Returns the option matching the specified label.

Parameters
labellabel of the requested option
Returns
the requested option
Exceptions
UnknownOptionErrorif there is no available option with label (the string of the exception shows label value)

Definition at line 913 of file MultipleChoiceSelection.h.

914 {
915  return get(label);
916 } // util::MultipleChoiceSelection<>::parse()
template<typename Choices >
void util::MultipleChoiceSelection< Choices >::recordLabel ( std::string &&  label,
std::size_t  index 
)
private

Associates label to the option at index.

Exceptions
OptionAlreadyExistsErrorif there is already an option with label

Definition at line 1002 of file MultipleChoiceSelection.h.

1003 {
1004 
1005  auto const iOption = fLabelToOptionIndex.lower_bound(label);
1006 
1007  // check for duplicate entries: if iOption is not `end()`, it points to an
1008  // element whose key is either greater or equal (equivalent) to `label`;
1009  // if the key is greater than `label`, we are good:
1010  // we check it by requiring that `label` is smaller than the key;
1011  // `key_compare(a, b)` comparison is equivalent to `a < b`,
1012  if ((iOption != fLabelToOptionIndex.end())
1013  && !OptionLabelMap_t::key_compare()(label, iOption->first))
1014  {
1015  throw OptionAlreadyExistsError(label); // maybe too terse?
1016  }
1017 
1018  // the actual recording, at last:
1019  fLabelToOptionIndex.emplace_hint(iOption, std::move(label), index);
1020 
1021 } // util::MultipleChoiceSelection<>::recordLabel()
OptionLabelMap_t fLabelToOptionIndex
Map from labels to option index in fOptions.
template<typename >
template<typename... Aliases>
std::enable_if_t<details::AllConvertibleToStrings_v<Aliases...> > util::MultipleChoiceSelection< typename >::recordLabels ( std::size_t  index,
std::string  alias,
Aliases...  moreAliases 
)
private

Associates all labels to the option at index.

Exceptions
OptionAlreadyExistsErrorif there is already an option with any of the aliases
template<typename >
template<typename... Aliases>
auto util::MultipleChoiceSelection< typename >::recordLabels ( std::size_t  index,
std::string  alias,
Aliases...  moreAliases 
) -> std::enable_if_t<details::AllConvertibleToStrings_v<Aliases...>>

Definition at line 1028 of file MultipleChoiceSelection.h.

1030 {
1031  try {
1032  recordLabel(std::move(alias), index);
1033  if constexpr(sizeof...(moreAliases) > 0U)
1034  recordLabels(index, std::move(moreAliases)...);
1035  }
1036  catch (OptionAlreadyExistsError const&) {
1037  unregisterLabel(alias); // if recordLabel() call threw alias is still intact
1038  throw;
1039  }
1040 } // util::MultipleChoiceSelection<>::recordLabels()
double std(const std::vector< short > &wf, const double ped_mean, size_t start, size_t nsample)
Definition: UtilFunc.cxx:42
void recordLabel(std::string &&label, std::size_t index)
std::enable_if_t< details::AllConvertibleToStrings_v< Aliases...> > recordLabels(std::size_t index, std::string alias, Aliases...moreAliases)
void unregisterLabel(std::string const &label)
Removes the specified label from the register.
template<typename Choices >
std::size_t util::MultipleChoiceSelection< Choices >::size ( ) const

Returns the number of available options.

Definition at line 814 of file MultipleChoiceSelection.h.

815  { return fOptions.size(); }
OptionList_t fOptions
The list of registered objects.
template<typename Choices >
void util::MultipleChoiceSelection< Choices >::unregisterLabel ( std::string const &  label)
private

Removes the specified label from the register.

Definition at line 1046 of file MultipleChoiceSelection.h.

1047  { fLabelToOptionIndex.erase(label); }
OptionLabelMap_t fLabelToOptionIndex
Map from labels to option index in fOptions.

Member Data Documentation

template<typename >
OptionLabelMap_t util::MultipleChoiceSelection< typename >::fLabelToOptionIndex
private

Map from labels to option index in fOptions.

Definition at line 394 of file MultipleChoiceSelection.h.

template<typename >
OptionList_t util::MultipleChoiceSelection< typename >::fOptions
private

The list of registered objects.

Definition at line 391 of file MultipleChoiceSelection.h.

template<typename >
constexpr auto util::MultipleChoiceSelection< typename >::npos = std::numeric_limits<std::size_t>::max()
staticprivate

Special value.

Definition at line 442 of file MultipleChoiceSelection.h.


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