mCRL2
Loading...
Searching...
No Matches
mcrl2::data::xyz_identifier_generator Class Reference

Identifier generator that generates names from the range X, Y, Z, X0, Y0, Z0, X1, ... More...

#include <xyz_identifier_generator.h>

Inheritance diagram for mcrl2::data::xyz_identifier_generator:
mcrl2::data::multiset_identifier_generator mcrl2::data::identifier_generator< Generator >

Public Member Functions

 xyz_identifier_generator ()
 Constructor.
 
 xyz_identifier_generator (const std::set< core::identifier_string > &ids)
 Constructor.
 
core::identifier_string operator() (const std::string &hint, bool add_to_context=true)
 Returns hint if it isn't in the context yet. Else the next available identifier in the range X, Y, Z, X0, Y0, Z0, X1, ... is returned.
 
- Public Member Functions inherited from mcrl2::data::multiset_identifier_generator
 multiset_identifier_generator ()=default
 Constructor.
 
void clear_context () override
 Clears the context.
 
void add_identifier (const core::identifier_string &s) override
 Adds the identifier s to the context.
 
void remove_identifier (const core::identifier_string &s) override
 Removes one occurrence of the identifier s from the context.
 
bool has_identifier (const core::identifier_string &s) const override
 Returns true if the identifier s appears in the context.
 
const std::multiset< core::identifier_string > & context () const
 Returns the context.
 
- Public Member Functions inherited from mcrl2::data::identifier_generator< Generator >
 identifier_generator ()=default
 Constructor.
 
virtual ~identifier_generator ()=default
 Destructor.
 
virtual void clear_context ()=0
 Clears the context.
 
virtual void add_identifier (const core::identifier_string &s)=0
 Adds the identifier s to the context.
 
virtual void remove_identifier (const core::identifier_string &s)=0
 Removes the identifier s from the context.
 
void add_identifiers (const std::set< core::identifier_string > &ids)
 Add a set of identifiers to the context.
 
void remove_identifiers (const std::set< core::identifier_string > &ids)
 Remove a set of identifiers from the context.
 
virtual bool has_identifier (const core::identifier_string &s) const =0
 Returns true if the identifier s appears in the context.
 
virtual core::identifier_string operator() (const std::string &hint, bool add_to_context=true)
 Returns a fresh identifier, with the given hint as prefix. The returned identifier is added to the context.
 

Protected Member Functions

std::string next ()
 Returns the next name in the range X, Y, Z, X0, Y0, Z0, X1, ...
 

Protected Attributes

int m_index
 The index of the last generated identifier.
 
char m_char
 The character of the last generated identifier.
 
- Protected Attributes inherited from mcrl2::data::multiset_identifier_generator
std::multiset< core::identifier_stringm_identifiers
 The context of the identifier generator.
 
- Protected Attributes inherited from mcrl2::data::identifier_generator< Generator >
Generator m_generator
 

Detailed Description

Identifier generator that generates names from the range X, Y, Z, X0, Y0, Z0, X1, ...

Definition at line 24 of file xyz_identifier_generator.h.

Constructor & Destructor Documentation

◆ xyz_identifier_generator() [1/2]

mcrl2::data::xyz_identifier_generator::xyz_identifier_generator ( )
inline

Constructor.

Definition at line 61 of file xyz_identifier_generator.h.

◆ xyz_identifier_generator() [2/2]

mcrl2::data::xyz_identifier_generator::xyz_identifier_generator ( const std::set< core::identifier_string > &  ids)
inline

Constructor.

Parameters
idsa set of identifiers to use as context

Definition at line 67 of file xyz_identifier_generator.h.

Member Function Documentation

◆ next()

std::string mcrl2::data::xyz_identifier_generator::next ( )
inlineprotected

Returns the next name in the range X, Y, Z, X0, Y0, Z0, X1, ...

Returns
The next name in the range X, Y, Z, X0, Y0, Z0, X1, ...

Definition at line 35 of file xyz_identifier_generator.h.

◆ operator()()

core::identifier_string mcrl2::data::xyz_identifier_generator::operator() ( const std::string &  hint,
bool  add_to_context = true 
)
inlinevirtual

Returns hint if it isn't in the context yet. Else the next available identifier in the range X, Y, Z, X0, Y0, Z0, X1, ... is returned.

Parameters
hintA string
add_to_contextIf true, the generated identifier is added to the context, it is not added otherwise.
Returns
A fresh identifier.

Reimplemented from mcrl2::data::identifier_generator< Generator >.

Definition at line 79 of file xyz_identifier_generator.h.

Member Data Documentation

◆ m_char

char mcrl2::data::xyz_identifier_generator::m_char
protected

The character of the last generated identifier.

Definition at line 31 of file xyz_identifier_generator.h.

◆ m_index

int mcrl2::data::xyz_identifier_generator::m_index
protected

The index of the last generated identifier.

Definition at line 28 of file xyz_identifier_generator.h.


The documentation for this class was generated from the following file: