Loading [MathJax]/extensions/tex2jax.js
LSST Applications g0fba68d861+05816baf74,g1ec0fe41b4+f536777771,g1fd858c14a+a9301854fb,g35bb328faa+fcb1d3bbc8,g4af146b050+a5c07d5b1d,g4d2262a081+6e5fcc2a4e,g53246c7159+fcb1d3bbc8,g56a49b3a55+9c12191793,g5a012ec0e7+3632fc3ff3,g60b5630c4e+ded28b650d,g67b6fd64d1+ed4b5058f4,g78460c75b0+2f9a1b4bcd,g786e29fd12+cf7ec2a62a,g8352419a5c+fcb1d3bbc8,g87b7deb4dc+7b42cf88bf,g8852436030+e5453db6e6,g89139ef638+ed4b5058f4,g8e3bb8577d+d38d73bdbd,g9125e01d80+fcb1d3bbc8,g94187f82dc+ded28b650d,g989de1cb63+ed4b5058f4,g9d31334357+ded28b650d,g9f33ca652e+50a8019d8c,gabe3b4be73+1e0a283bba,gabf8522325+fa80ff7197,gb1101e3267+d9fb1f8026,gb58c049af0+f03b321e39,gb665e3612d+2a0c9e9e84,gb89ab40317+ed4b5058f4,gcf25f946ba+e5453db6e6,gd6cbbdb0b4+bb83cc51f8,gdd1046aedd+ded28b650d,gde0f65d7ad+941d412827,ge278dab8ac+d65b3c2b70,ge410e46f29+ed4b5058f4,gf23fb2af72+b7cae620c0,gf5e32f922b+fcb1d3bbc8,gf67bdafdda+ed4b5058f4,w.2025.16
LSST Data Management Base Package
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
lsst::modelfit::parameters Namespace Reference

Namespaces

namespace  detail
 

Classes

class  Limits
 Range-based limits for parameter values. More...
 
class  Object
 A generic object from the parameters library. More...
 
class  Parameter
 A parameter with values and metadata. More...
 
class  ParameterBase
 Interface for parameters with values and metadata. More...
 
class  Transform
 A reversible transformation of a real scalar value. More...
 
class  Unit
 A generic interface for physical units described by strings. More...
 
class  UnitTransform
 

Functions

template<typename T>
constexpr std::string_view type_name ()
 Get a string representation of an arbitrary C++ type.
 
template<>
constexpr std::string_view type_name< void > ()
 
template<typename T>
std::string type_name_str (bool strip_namespace=false, const std::string_view &namespace_str=detail::NAMESPACE_SEPARATOR)
 Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.
 

Function Documentation

◆ type_name()

template<typename T>
std::string_view lsst::modelfit::parameters::type_name ( )
constexpr

Get a string representation of an arbitrary C++ type.

Template Parameters
TThe type to stringify
Returns
A string representation of the type's name
Note
Adapted from https://stackoverflow.com/a/64490578

Definition at line 81 of file type_name.h.

81 {
82 constexpr auto wrapped_name = detail::wrapped_type_name<T>();
83 constexpr auto prefix_length = detail::wrapped_type_name_prefix_length();
84 constexpr auto suffix_length = detail::wrapped_type_name_suffix_length();
85 constexpr auto type_name_length = wrapped_name.length() - prefix_length - suffix_length;
86 return wrapped_name.substr(prefix_length, type_name_length);
87}
constexpr std::string_view wrapped_type_name()
Definition type_name.h:46
constexpr std::size_t wrapped_type_name_suffix_length()
Definition type_name.h:62
constexpr std::size_t wrapped_type_name_prefix_length()
Definition type_name.h:58

◆ type_name< void >()

template<>
std::string_view lsst::modelfit::parameters::type_name< void > ( )
constexpr

Definition at line 37 of file type_name.h.

37 {
38 return "void";
39}

◆ type_name_str()

template<typename T>
std::string lsst::modelfit::parameters::type_name_str ( bool strip_namespace = false,
const std::string_view & namespace_str = detail::NAMESPACE_SEPARATOR )

Get a string representation of an arbitrary C++ type, potentially modifying its namespace prefix.

Template Parameters
TThe type to stringify.
Parameters
strip_namespaceWhether to strip the namespace prefix entirely.
namespace_strA string to replace the standard C++ namespace separator (i.e. ::) with; generally . for Python.
Returns
A string representation of the type's name, with modified namespace prefix.

Definition at line 101 of file type_name.h.

102 {
104 if (strip_namespace) {
105 return name.substr(name.find_last_of(':') + 1, std::string::npos);
106 } else if (namespace_str != detail::NAMESPACE_SEPARATOR) {
107 auto pos = name.find(detail::NAMESPACE_SEPARATOR, 0);
108 const auto n_replace = namespace_str.size();
109 while (pos != std::string::npos) {
110 name.replace(pos, detail::NAMESPACE_SEPARATOR_LEN, namespace_str);
111 pos += n_replace;
112 pos = name.find(detail::NAMESPACE_SEPARATOR, pos);
113 }
114 }
115 return name;
116}
constexpr auto NAMESPACE_SEPARATOR_LEN
Definition type_name.h:68
constexpr std::string_view NAMESPACE_SEPARATOR
Definition type_name.h:67
constexpr std::string_view type_name()
Get a string representation of an arbitrary C++ type.
Definition type_name.h:81