mCRL2
Loading...
Searching...
No Matches
atermpp::function_symbol_generator Class Reference

Generates unique function symbols with a given prefix. More...

#include <function_symbol_generator.h>

Public Member Functions

 function_symbol_generator (const std::string &prefix)
 Constructor.
 
void clear ()
 Restores the index back to the value that was initially assigned in the constructor.
 
 ~function_symbol_generator ()
 
function_symbol operator() (std::size_t arity=0)
 Generates a unique function symbol with the given prefix followed by a number.
 

Protected Attributes

std::string m_prefix
 
std::size_t m_initial_index
 Cache the value that is set in the constructor.
 
std::string m_string_buffer
 A local string cache to prevent allocating new strings for every function symbol generated.
 
std::size_t m_index
 A reference to the index as present in the function symbol generator.
 
std::shared_ptr< std::size_t > m_central_index
 The address of the central index for this prefix.
 

Detailed Description

Generates unique function symbols with a given prefix.

Definition at line 35 of file function_symbol_generator.h.

Constructor & Destructor Documentation

◆ function_symbol_generator()

atermpp::function_symbol_generator::function_symbol_generator ( const std::string &  prefix)
inline

Constructor.

Parameters
[in]prefixThe prefix of the generated generated strings.
Precondition
The prefix may not be empty, and it may not have trailing digits

Definition at line 56 of file function_symbol_generator.h.

◆ ~function_symbol_generator()

atermpp::function_symbol_generator::~function_symbol_generator ( )
inline

Definition at line 81 of file function_symbol_generator.h.

Member Function Documentation

◆ clear()

void atermpp::function_symbol_generator::clear ( )
inline

Restores the index back to the value that was initially assigned in the constructor.

Definition at line 76 of file function_symbol_generator.h.

◆ operator()()

function_symbol atermpp::function_symbol_generator::operator() ( std::size_t  arity = 0)
inline

Generates a unique function symbol with the given prefix followed by a number.

Definition at line 89 of file function_symbol_generator.h.

Member Data Documentation

◆ m_central_index

std::shared_ptr<std::size_t> atermpp::function_symbol_generator::m_central_index
protected

The address of the central index for this prefix.

Definition at line 50 of file function_symbol_generator.h.

◆ m_index

std::size_t atermpp::function_symbol_generator::m_index
protected

A reference to the index as present in the function symbol generator.

Definition at line 47 of file function_symbol_generator.h.

◆ m_initial_index

std::size_t atermpp::function_symbol_generator::m_initial_index
protected

Cache the value that is set in the constructor.

Definition at line 41 of file function_symbol_generator.h.

◆ m_prefix

std::string atermpp::function_symbol_generator::m_prefix
protected

Definition at line 38 of file function_symbol_generator.h.

◆ m_string_buffer

std::string atermpp::function_symbol_generator::m_string_buffer
protected

A local string cache to prevent allocating new strings for every function symbol generated.

Definition at line 44 of file function_symbol_generator.h.


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