10#ifndef IMPACTX_ELEMENTS_MIXIN_NAMED_H
11#define IMPACTX_ELEMENTS_MIXIN_NAMED_H
36 std::string
const & new_name
46 if (new_name.size() > 0) {
47 m_name =
new char[new_name.size() + 1];
48 std::strcpy(
m_name, new_name.c_str());
58 std::optional<std::string>
name
61 if (
name.has_value()) {
102 std::swap(this->
m_name, other.m_name);
103 other.m_name =
nullptr;
111 std::swap(this->
m_name, other.m_name);
112 other.m_name =
nullptr;
125 throw std::runtime_error(
"Name not set on element!");
127 return std::string(
m_name);
#define AMREX_FORCE_INLINE
#define AMREX_IF_ON_HOST(CODE)
#define AMREX_GPU_HOST_DEVICE
Definition alignment.H:23
AMREX_FORCE_INLINE bool has_name() const
Definition named.H:135
AMREX_GPU_HOST Named(std::optional< std::string > name)
Definition named.H:57
AMREX_GPU_HOST_DEVICE Named & operator=(Named &&other) noexcept
Definition named.H:108
AMREX_GPU_HOST Named & operator=(Named const &other)
Definition named.H:87
AMREX_GPU_HOST void set_name(std::string const &new_name)
Definition named.H:35
AMREX_GPU_HOST Named(Named const &other)
Definition named.H:78
AMREX_GPU_HOST_DEVICE Named(Named &&other) noexcept
Definition named.H:99
char * m_name
Definition named.H:148
AMREX_GPU_HOST_DEVICE ~Named()
Definition named.H:67
AMREX_FORCE_INLINE std::string name() const
Definition named.H:122