LSST Applications g04e9c324dd+8c5ae1fdc5,g134cb467dc+1b3060144d,g18429d2f64+f642bf4753,g199a45376c+0ba108daf9,g1fd858c14a+2dcf163641,g262e1987ae+7b8c96d2ca,g29ae962dfc+3bd6ecb08a,g2cef7863aa+aef1011c0b,g35bb328faa+8c5ae1fdc5,g3fd5ace14f+53e1a9e7c5,g4595892280+fef73a337f,g47891489e3+2efcf17695,g4d44eb3520+642b70b07e,g53246c7159+8c5ae1fdc5,g67b6fd64d1+2efcf17695,g67fd3c3899+b70e05ef52,g74acd417e5+317eb4c7d4,g786e29fd12+668abc6043,g87389fa792+8856018cbb,g89139ef638+2efcf17695,g8d7436a09f+3be3c13596,g8ea07a8fe4+9f5ccc88ac,g90f42f885a+a4e7b16d9b,g97be763408+ad77d7208f,g9dd6db0277+b70e05ef52,ga681d05dcb+a3f46e7fff,gabf8522325+735880ea63,gac2eed3f23+2efcf17695,gb89ab40317+2efcf17695,gbf99507273+8c5ae1fdc5,gd8ff7fe66e+b70e05ef52,gdab6d2f7ff+317eb4c7d4,gdc713202bf+b70e05ef52,gdfd2d52018+b10e285e0f,ge365c994fd+310e8507c4,ge410e46f29+2efcf17695,geaed405ab2+562b3308c0,gffca2db377+8c5ae1fdc5,w.2025.35
LSST Data Management Base Package
Loading...
Searching...
No Matches
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