348 template<
typename Input_it>
349 explicit Shared_name(Input_it begin, Input_it end);
370 template<
typename Source>
430 const std::string&
str()
const;
583 template<
typename Source>
632 template<
typename Source>
666template<
typename Input_it>
668 m_raw_name(begin, end)
673template<
typename Source>
686template<
typename Source>
695template<
typename Source>
707template<
typename Source>
715template<
typename Source>
723template<
typename Source>
731template<
typename Source>
739template<
typename Persistent_
object,
typename Filter_func>
745 unsigned int count = 0;
747 Persistent_object::for_each_persistent([&](
const Shared_name& name)
749 if (filter_func(name))
751 Persistent_object::remove_persistent(logger_ptr, name, &err_code);
763template<
typename Persistent_
object>
769 FLOW_LOG_SET_CONTEXT(logger_ptr, Log_component::S_TRANSPORT);
770 FLOW_LOG_TRACE(
"Will attempt to remove-persistent objects (type [" <<
typeid(Persistent_object).name() <<
"]) with "
771 "prefix [" << name_prefix_or_empty.
str() <<
"] (<-- may be blank; then all are removed).");
774 const auto count = remove_each_persistent_if<Persistent_object>(get_logger(), [&](
const Shared_name& name)
776 return name_prefix_view.empty() ||
String_view(name.
str()).starts_with(name_prefix_view);
781 FLOW_LOG_INFO(
"Removed-persistent successfully [" << count <<
"] objects "
782 "(type [" <<
typeid(Persistent_object).name() <<
"]) with "
783 "prefix [" << name_prefix_or_empty <<
"] (<-- may be blank; then all were potentially removed). "
784 "Note this counts only successful removals (not ones that failed due to permissions, say). "
785 "Details potentially logged above (including any errors which are otherwise ignored).");
String-wrapping abstraction representing a name uniquely distinguishing a kernel-persistent entity fr...
bool sanitized() const
Returns true if and only if the contained name/fragment is sanitized according to length,...
const char * native_str() const
Returns (sans copying) pointer to NUL-terminated wrapped name string, suitable to pass into sys calls...
Shared_name & operator=(Shared_name &&src_moved)
Move-assigns from an existing Shared_name.
Shared_name & operator+=(const Shared_name &src_to_append)
Appends the given other Shared_name.
Shared_name(const Shared_name &src)
Copy-constructs from an existing Shared_name.
Shared_name()
Constructs empty() name.
static const Shared_name S_SENTINEL
A Shared_name fragment, with no S_SEPARATOR characters inside, that represents a path component that ...
static Shared_name ct(const Source &src)
Copy-constructs from a char-sequence container (including string, util::String_view,...
static const Shared_name S_RESOURCE_TYPE_ID_SHM
Relative-folder fragment (no separators) identifying the resource type for: SHM pools.
std::string m_raw_name
The name or name fragment; see str().
static const Shared_name S_RESOURCE_TYPE_ID_MUTEX
Relative-folder fragment (no separators) identifying the resource type for: boost....
static const Shared_name S_EMPTY
A (default-cted) Shared_name. May be useful for functions returning const Shared_name&.
static const char S_SEPARATOR
Character we use, by convention, to separate conceptual folders within str().
bool has_trailing_separator() const
Returns true if and only if !this->empty(), and str() ends with the S_SEPARATOR character.
Shared_name(Shared_name &&src_moved)
Move-constructs from an existing Shared_name, which is made empty() if not already so.
void clear()
Makes it so empty() == true.
bool empty() const
Returns true if and only if str().empty() == true.
Shared_name & operator/=(const Shared_name &src_to_append)
Appends a folder separator followed by the given other Shared_name.
friend void swap(Shared_name &val1, Shared_name &val2)
Swaps two objects.
static const Shared_name S_1ST_OR_ONLY
A Shared_name fragment, with no S_SEPARATOR characters inside, that represents a path component that ...
bool absolute() const
Returns true if and only if the first character is S_SEPARATOR.
Shared_name & operator=(const Shared_name &src)
Copy-assigns from an existing Shared_name.
bool sanitize()
Best-effort attempt to turn sanitized() from false to true, unless it is already true; returns the fi...
const std::string & str() const
Returns (sans copying) ref to immutable entire wrapped name string, suitable to pass into sys calls w...
static const Shared_name S_ROOT_MAGIC
A Shared_name fragment, with no S_SEPARATOR characters inside, to be used in any Shared_name maintain...
size_t size() const
Returns str().size().
static const size_t S_MAX_LENGTH
Max value of size() such that, if str() used to name a supported shared resource, sys call safely won...
util::Shared_name Shared_name
Convenience alias for the commonly used type util::Shared_name.
Flow-IPC module containing miscellaneous general-use facilities that ubiquitously used by ~all Flow-I...
unsigned int remove_each_persistent_if(flow::log::Logger *logger_ptr, const Filter_func &filter_func)
Utility that invokes Persistent_object::for_each_persistent(name_prefix_or_empty) and synchronously i...
Shared_name operator/(const Shared_name &src1, const char *raw_src2)
Returns new object equal to Shared_name(src1) /= raw_src2.
unsigned int remove_each_persistent_with_name_prefix(flow::log::Logger *logger_ptr, const Shared_name &name_prefix_or_empty)
Utility that invokes remove_each_persistent_if() with the filter that returns true (yes,...
flow::util::String_view String_view
Short-hand for Flow's String_view.
Shared_name operator+(const Shared_name &src1, const char *raw_src2)
Returns new object equal to Shared_name(src1) += raw_src2.
flow::Error_code Error_code
Short-hand for flow::Error_code which is very common.