libsemigroups
Protected Member Functions | List of all members
libsemigroups::ElementWithVectorDataDefaultHash< TValueType, TSubclass > Class Template Reference

Abstract base class for elements using a vector to store their defining data and the default hash function for that underlying vector. More...

#include <elements.h>

Inheritance diagram for libsemigroups::ElementWithVectorDataDefaultHash< TValueType, TSubclass >:
Inheritance graph
Collaboration diagram for libsemigroups::ElementWithVectorDataDefaultHash< TValueType, TSubclass >:
Collaboration graph

Protected Member Functions

void cache_hash_value () const override
 This method implements the default hash function for an ElementWithVectorData, which uses ElementWithVectorData::vector_hash. Derive from this class if you are defining a class derived from ElementWithVectorData and there is a specialization of std::hash for the template parameter TValueType, and you do not want to define a hash function explicitly in your derived class. More...
 
- Protected Member Functions inherited from libsemigroups::Element
void reset_hash_value () const
 Reset the cached value used by Element::hash_value. More...
 

Additional Inherited Members

- Public Types inherited from libsemigroups::Element
enum  elm_t { RWSE = 0, NOT_RWSE = 1 }
 This enum contains some different types of Element. More...
 
- Public Member Functions inherited from libsemigroups::ElementWithVectorData< TValueType, TSubclass >
 ElementWithVectorData ()
 A constructor. More...
 
 ElementWithVectorData (std::vector< TValueType > *vector)
 A constructor. More...
 
 ElementWithVectorData (std::vector< TValueType > const &vector)
 A constructor. More...
 
TValueType at (size_t pos) const
 Returns the pos entry in the vector containing the defining data. More...
 
std::vector< TValueType >::iterator begin () const
 Returns an iterator. More...
 
std::vector< TValueType >::iterator cbegin () const
 Returns a const iterator. More...
 
std::vector< TValueType >::iterator cend () const
 Returns a const iterator. More...
 
void copy (Element const *x) override
 Copy another Element into this. More...
 
std::vector< TValueType >::iterator end () const
 Returns an iterator. More...
 
bool operator< (Element const &that) const override
 Returns true if this is less than that. More...
 
bool operator== (Element const &that) const override
 Returns true if this equals that. More...
 
TValueType operator[] (size_t pos) const
 Returns the pos entry in the vector containing the defining data. More...
 
Elementreally_copy (size_t increase_deg_by=0) const override
 Returns a pointer to a copy of this. More...
 
void really_delete () override
 Deletes the defining data of an ElementWithVectorData. More...
 
void swap (Element *x) override
 Swap another Element with this. More...
 
- Public Member Functions inherited from libsemigroups::Element
 Element (elm_t type=Element::elm_t::NOT_RWSE)
 A constructor. More...
 
virtual ~Element ()
 A default destructor. More...
 
virtual size_t complexity () const =0
 Returns the approximate time complexity of multiplying two Element objects in a given subclass. More...
 
virtual size_t degree () const =0
 Returns the degree of an Element. More...
 
elm_t get_type () const
 Returns the type libsemigroups::Element::elm_t of an Element object. More...
 
size_t hash_value () const
 Return the hash value of an Element. More...
 
virtual Elementidentity () const =0
 Returns a new copy of the identity element. More...
 
virtual void redefine (Element const *x, Element const *y)
 Multiplies x and y and stores the result in this. More...
 
virtual void redefine (Element const *x, Element const *y, size_t const &thread_id)
 Multiplies x and y and stores the result in this. More...
 
- Static Protected Member Functions inherited from libsemigroups::ElementWithVectorData< TValueType, TSubclass >
template<typename T >
static size_t vector_hash (std::vector< T > const *vec)
 Returns a hash value for a vector provided there is a specialization of std::hash for the template type T. More...
 
- Protected Attributes inherited from libsemigroups::ElementWithVectorData< TValueType, TSubclass >
std::vector< TValueType > * _vector
 The vector containing the defining data of this. More...
 
- Static Protected Attributes inherited from libsemigroups::Element
static size_t const UNDEFINED = std::numeric_limits<size_t>::max()
 UNDEFINED value. More...
 

Detailed Description

template<typename TValueType, class TSubclass>
class libsemigroups::ElementWithVectorDataDefaultHash< TValueType, TSubclass >

Abstract base class for elements using a vector to store their defining data and the default hash function for that underlying vector.

This class is almost the same as ElementWithVectorData, except that it also implements a method for cache_hash_value, which uses ElementWithVectorData::vector_hash.

Member Function Documentation

◆ cache_hash_value()

template<typename TValueType, class TSubclass>
void libsemigroups::ElementWithVectorDataDefaultHash< TValueType, TSubclass >::cache_hash_value ( ) const
inlineoverrideprotectedvirtual

This method implements the default hash function for an ElementWithVectorData, which uses ElementWithVectorData::vector_hash. Derive from this class if you are defining a class derived from ElementWithVectorData and there is a specialization of std::hash for the template parameter TValueType, and you do not want to define a hash function explicitly in your derived class.

Implements libsemigroups::Element.


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