AXOM
Axom provides a robust, flexible software infrastructure for the development of multi-physics applications and computational tools.
axom::inlet::detail Namespace Reference

Classes

struct  arg_lists
 Generates the permutations of a parameter pack up to a certain length, including all shorter permutations. More...
 
struct  arg_lists< 0u, Ts... >
 
class  cleanup_function_signature
 Takes a Ret(Args...) signature and applies cvref qualifiers to applicable arguments. More...
 
struct  cleanup_function_signature< Ret(Args...)>
 
struct  Concat
 Helper structure used to concatenate parameter packs (lists) of TypeLists. More...
 
struct  Concat< TypeList< First... >, TypeList< Second... > >
 
struct  Concat< TypeList< First... >, TypeList< Second... >, Tail... >
 
struct  Concat< TypeList< Types... > >
 
struct  Concat<>
 
class  has_FromInlet_specialization
 A type trait for checking if a type has specialized FromInlet with the required T operator()(axom::inlet::Container&) More...
 
struct  has_FromInlet_specialization< T, typename std::enable_if< std::is_same< T, decltype(std::declval< FromInlet< T > & >()(std::declval< const Container & >()))>::value >::type >
 
class  inlet_function_arg_type
 A type trait for modifying function argument types to enforce const correctness and to avoid copies. More...
 
struct  is_inlet_array
 
struct  is_inlet_array< std::unordered_map< int, T > >
 
struct  is_inlet_dict
 
struct  is_inlet_dict< std::unordered_map< std::string, T > >
 
struct  is_inlet_dict< std::unordered_map< VariantKey, T > >
 
class  is_inlet_primitive
 A type trait for checking if a type is isomorphic to an Inlet primitive. More...
 
struct  is_inlet_primitive_array
 
struct  is_inlet_primitive_array< std::unordered_map< int, T > >
 
struct  is_inlet_primitive_dict
 
struct  is_inlet_primitive_dict< std::unordered_map< std::string, T > >
 
struct  is_inlet_primitive_dict< std::unordered_map< VariantKey, T > >
 
struct  is_primitive_std_vector
 
struct  is_primitive_std_vector< std::vector< T > >
 
struct  is_std_function
 
struct  is_std_function< std::function< T > >
 
struct  is_std_vector
 
struct  is_std_vector< std::vector< T > >
 
struct  list_prepend
 Adds a single type to a single TypeList via prepending. More...
 
struct  list_prepend< T, TypeList< Ts... > >
 
struct  list_to_inlet_signature
 Converts a list into a function signature. More...
 
struct  list_to_inlet_signature< TypeList< Ret, Args... > >
 
struct  lists_to_wrapper
 "Unwraps" a list of lists, converts the inner lists to function signatures, and defines a FunctionWrapper templated on those signatures More...
 
struct  lists_to_wrapper< TypeList< TypeLists... > >
 
struct  multi_list_prepend
 Adds a single type to a parameter pack of TypeLists. More...
 
struct  permutation_helper
 Recursive helper struct for enumerating permutations of a list of types. More...
 
struct  permutation_helper< 0u >
 
struct  std_function_signature
 
struct  std_function_signature< std::function< FuncType > >
 
struct  TypeList
 A lightweight type used to store a list of types. More...
 

Typedefs

template<std::size_t N, typename... Ts>
using type_permutations = decltype(permutation_helper< N - 1 >::get(std::declval< TypeList< Ts... > >(), std::declval< TypeList< TypeList< Ts >... > >()))
 Entry point for retrieving a permutation of types. More...
 
using ret_list = TypeList< FunctionType::Void, FunctionType::Vector, FunctionType::Double, FunctionType::String >
 
using arg_permutations = arg_lists< MAX_NUM_ARGS, FunctionType::Vector, FunctionType::Double, FunctionType::String >::type
 
using arg_permutations_with_returns = decltype(permutation_helper< 1u >::get(ret_list {}, std::declval< arg_permutations >()))
 
using no_arguments_with_returns = decltype(permutation_helper< 1u >::get(ret_list {}, TypeList< TypeList<> >()))
 
using func_signature_lists = decltype(type_list_cat(std::declval< arg_permutations_with_returns >(), std::declval< no_arguments_with_returns >()))
 
using BasicFunctionWrapper = lists_to_wrapper< func_signature_lists >::type
 

Functions

std::string indexToString (const std::string &idx)
 An overloaded utility function for converting a type to a string. More...
 
std::string indexToString (const int idx)
 
std::string indexToString (const VariantKey &idx)
 
template<typename Result , typename From >
Result toIndex (const From &idx)
 An templated utility function for converting an index to the desired type. More...
 
template<>
int toIndex (const std::string &idx)
 
template<typename Key >
bool matchesKeyType (const VariantKey &key)
 Determines whether a variant key is convertible to another type. More...
 
std::vector< VariantKeycollectionIndices (const Container &container, bool trimAbsolute=true)
 This is an internal utility intended to be used with arrays/dicts of user-defined types that returns the indices as strings - integer indices will be converted to strings. More...
 
std::vector< std::pair< std::string, std::string > > collectionIndicesWithPaths (const Container &container, const std::string &name)
 This is an internal utility intended to be used with arrays of user-defined types that returns the a list of pairs, each of which contain an index (a number) and a fully qualified path within the input file to the array element at the corresponding index. More...
 
void updateUnexpectedNames (const std::string &accessedName, std::vector< std::string > &unexpectedNames)
 Updates the set of unexpected names to reflect an user-requested access. More...
 
template<typename... TypeLists>
Concat< TypeLists... >::type type_list_cat (TypeLists &&...)
 Implements concatenation functionality similar to std::tuple_cat. More...
 

Variables

static constexpr std::size_t MAX_NUM_ARGS = 2u
 The maximum number of user-specified arguments to a function. More...
 
const std::string COLLECTION_GROUP_NAME = "_inlet_collection"
 
const std::string COLLECTION_INDICES_NAME = "_inlet_collection_indices"
 
const std::string STRUCT_COLLECTION_FLAG = "_inlet_struct_collection"
 
const std::string REQUIRED_FLAG = "required"
 
const std::string STRICT_FLAG = "strict"
 

Typedef Documentation

◆ type_permutations

template<std::size_t N, typename... Ts>
using axom::inlet::detail::type_permutations = typedef decltype( permutation_helper<N - 1>::get(std::declval<TypeList<Ts...> >(), std::declval<TypeList<TypeList<Ts>...> >()))

Entry point for retrieving a permutation of types.

Template Parameters
NThe (1-indexed) permutation length
Ts...The types to permute
Note
This initializes the result by creating a list of lists of each type in the list, e.g., for Ts = <A, B, C>, the second declval will be TypeList<TypeList, TypeList, TypeList<C>> (the first will be just TypeList<A, B, C>)

The Python-like pseudocode for this function is roughly:

def type_permutations(Ts, N):
return permutation_helper(Ts, [(T) for T in Ts])

◆ ret_list

◆ arg_permutations

◆ arg_permutations_with_returns

using axom::inlet::detail::arg_permutations_with_returns = typedef decltype( permutation_helper<1u>::get(ret_list {}, std::declval<arg_permutations>()))

◆ no_arguments_with_returns

using axom::inlet::detail::no_arguments_with_returns = typedef decltype(permutation_helper<1u>::get(ret_list {}, TypeList<TypeList<> >()))

◆ func_signature_lists

◆ BasicFunctionWrapper

Function Documentation

◆ indexToString() [1/3]

std::string axom::inlet::detail::indexToString ( const std::string &  idx)
inline

An overloaded utility function for converting a type to a string.

Note
Needed as std::to_string doesn't implement an identity overload
Parameters
[in]idxThe index to convert to string

◆ indexToString() [2/3]

std::string axom::inlet::detail::indexToString ( const int  idx)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

◆ indexToString() [3/3]

std::string axom::inlet::detail::indexToString ( const VariantKey idx)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References axom::inlet::VariantKey::type().

Referenced by axom::inlet::Container::get().

◆ toIndex() [1/2]

template<typename Result , typename From >
Result axom::inlet::detail::toIndex ( const From &  idx)
inline

An templated utility function for converting an index to the desired type.

Parameters
[in]idxThe index to convert
Template Parameters
FromThe type of the idx parameter (converting from)
ResultThe type to convert to

◆ toIndex() [2/2]

template<>
int axom::inlet::detail::toIndex ( const std::string &  idx)
inline

This is an overloaded member function, provided for convenience. It differs from the above function only in what argument(s) it accepts.

References SLIC_ERROR_IF.

◆ matchesKeyType()

template<typename Key >
bool axom::inlet::detail::matchesKeyType ( const VariantKey key)

Determines whether a variant key is convertible to another type.

Template Parameters
KeyThe type to check the validity of the conversion to
Note
That is, returns true if the key holds an integer and Key is int, etc

References collectionIndices(), collectionIndicesWithPaths(), axom::inlet::VariantKey::type(), and updateUnexpectedNames().

◆ collectionIndices()

std::vector<VariantKey> axom::inlet::detail::collectionIndices ( const Container container,
bool  trimAbsolute = true 
)

This is an internal utility intended to be used with arrays/dicts of user-defined types that returns the indices as strings - integer indices will be converted to strings.

Parameters
[in]containerThe container to retrieve indices from
[in]trimAbsoluteWhether to only return the "basename" if the path is absolute, e.g., an absolute path foo/0/bar will be trimmed to "bar"

Referenced by axom::inlet::Container::get(), and matchesKeyType().

◆ collectionIndicesWithPaths()

std::vector<std::pair<std::string, std::string> > axom::inlet::detail::collectionIndicesWithPaths ( const Container container,
const std::string &  name 
)

This is an internal utility intended to be used with arrays of user-defined types that returns the a list of pairs, each of which contain an index (a number) and a fully qualified path within the input file to the array element at the corresponding index.

Parameters
[in]containerThe container to retrieve indices from
[in]nameThe name of the array object in the input file

Referenced by matchesKeyType().

◆ updateUnexpectedNames()

void axom::inlet::detail::updateUnexpectedNames ( const std::string &  accessedName,
std::vector< std::string > &  unexpectedNames 
)

Updates the set of unexpected names to reflect an user-requested access.

Parameters
[in]accessedNameThe path within the input file that will be accessed
[in,out]unexpectedNamesThe set of input file paths that have not yet been requested by the user
Note
To maintain consistency, this function should always be followed by an access to a Reader

Referenced by matchesKeyType().

◆ type_list_cat()

template<typename... TypeLists>
Concat<TypeLists...>::type axom::inlet::detail::type_list_cat ( TypeLists &&  ...)

Implements concatenation functionality similar to std::tuple_cat.

Template Parameters
TypeListsThe TypeLists to concatenate (in order)
Note
This function should only be used in unevaluated contexts (e.g., within a decltype expression)

Variable Documentation

◆ MAX_NUM_ARGS

constexpr std::size_t axom::inlet::detail::MAX_NUM_ARGS = 2u
static

The maximum number of user-specified arguments to a function.

Note
Be very cautious when increasing this, as it will result in exponential function generation - specifically, m^n where n is this MAX_NUM_ARGS and m is the number of elements in the FunctionTag enumeration

◆ COLLECTION_GROUP_NAME

const std::string axom::inlet::detail::COLLECTION_GROUP_NAME = "_inlet_collection"

Names of the internal collection data and collection index groups/fields used for managing arrays/dictionaries

Referenced by axom::inlet::Container::get(), and axom::inlet::isCollectionGroup().

◆ COLLECTION_INDICES_NAME

const std::string axom::inlet::detail::COLLECTION_INDICES_NAME = "_inlet_collection_indices"

◆ STRUCT_COLLECTION_FLAG

const std::string axom::inlet::detail::STRUCT_COLLECTION_FLAG = "_inlet_struct_collection"

◆ REQUIRED_FLAG

const std::string axom::inlet::detail::REQUIRED_FLAG = "required"

◆ STRICT_FLAG

const std::string axom::inlet::detail::STRICT_FLAG = "strict"