ROSE 0.11.145.275
Public Member Functions | Static Public Member Functions | List of all members
Rose::Combinatorics::Hasher::HasherFactory Class Reference

Description

A singleton that creates and returns Hashers by name.

HasherFactory contains a map of names to HasherMaker . When createHasher is passed a name, it will attempt to create the correct Hasher and pass it back. Users can add hashers to HasherFactory using HasherMaker. HasherFactory is created when instance is first called. Generally this is done at module initialization time.

Definition at line 308 of file Combinatorics.h.

#include <roseSupport/Combinatorics.h>

Public Member Functions

void registerMaker (const std::string &hashType, IHasherMaker *createHasherPtr)
 Adds a new @HasherMaker to the HasherFactory.
 
std::shared_ptr< HashercreateHasher (const std::string &hashType) const
 Creates a registered Hasher by type from the map.
 

Static Public Member Functions

static HasherFactoryinstance ()
 Returns a reference to the HasherFactory singleton.
 
static HasherFactoryInstance ()
 

Member Function Documentation

◆ instance()

static HasherFactory & Rose::Combinatorics::Hasher::HasherFactory::instance ( )
static

Returns a reference to the HasherFactory singleton.

Creates a HasherFactory if necessary

◆ registerMaker()

void Rose::Combinatorics::Hasher::HasherFactory::registerMaker ( const std::string &  hashType,
IHasherMaker createHasherPtr 
)

Adds a new @HasherMaker to the HasherFactory.

Usually called by the HasherMaker constructor.

◆ createHasher()

std::shared_ptr< Hasher > Rose::Combinatorics::Hasher::HasherFactory::createHasher ( const std::string &  hashType) const

Creates a registered Hasher by type from the map.

Parameters
[in]hashTypeThe type of the Hasher to create. e.g. FNV.
Returns
A Hasher of the correct type in an std::shared_ptr.
Exceptions

ref Rose::Combinatorics::Exception if hashType names an unsupported type.


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