|
SObjectizer
5.8
|
Helper class for holding agent's identity (name or pointer). More...
#include <agent_identity.hpp>
Classes | |
| struct | actual_name_t |
| Type for case when agent has user-provided name. More... | |
| struct | pointer_only_t |
| Type for case when agent has no user-provided name. More... | |
| struct | to_ostream_visitor_t |
| struct | to_string_visitor_t |
Public Member Functions | |
| bool | has_actual_name () const noexcept |
| Does agent have an actual name? | |
| std::string_view | actual_name () const noexcept |
| Attempt to get an agent name. | |
| std::string | to_string () const |
| Transform identity into a string. | |
Private Types | |
| using | value_t = std::variant< pointer_only_t, actual_name_t > |
| Type of identity holder. | |
Private Member Functions | |
| agent_identity_t (const agent_t *pointer) noexcept | |
| Initializing constructor for case when agent has no user specified name. | |
| agent_identity_t (std::string_view name) noexcept | |
| Initializing constructor for case when agent has a user specified name. | |
Private Attributes | |
| value_t | m_value |
| Agent's identity. | |
Friends | |
| class | agent_t |
| std::ostream & | operator<< (std::ostream &to, const agent_identity_t &what) |
Helper class for holding agent's identity (name or pointer).
Since v.5.8.2 agents may have an optional name. If a name is set for agent a reference to this name can be returned by agent_t::so_agent_name(). But if a name is not specified then only a pointer to agent (agent_t's this value) can be used as agent's identity.
This type is intended to be used as a thin wrapper that covers cases described above. It holds a reference to agent's name if the name is specified or just pointer to an agent if there is no name. This type can be seen as a more convenient version of:
std::string objects returned by to_string() methods instead of agent_identity_t objects.Definition at line 48 of file agent_identity.hpp.
|
private |
Type of identity holder.
Definition at line 133 of file agent_identity.hpp.
|
inlineprivatenoexcept |
Initializing constructor for case when agent has no user specified name.
Definition at line 139 of file agent_identity.hpp.
|
inlineprivatenoexcept |
Initializing constructor for case when agent has a user specified name.
Definition at line 144 of file agent_identity.hpp.
|
inlinenodiscardnoexcept |
Attempt to get an agent name.
Definition at line 163 of file agent_identity.hpp.
|
inlinenodiscardnoexcept |
Does agent have an actual name?
Definition at line 152 of file agent_identity.hpp.
|
inlinenodiscard |
Transform identity into a string.
Definition at line 174 of file agent_identity.hpp.
|
friend |
Definition at line 50 of file agent_identity.hpp.
|
friend |
Definition at line 179 of file agent_identity.hpp.
|
private |
Agent's identity.
Definition at line 136 of file agent_identity.hpp.