Initial commit
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
#ifndef CREATOR_FUNCTION_EQUIVALENT_H
|
||||
#define CREATOR_FUNCTION_EQUIVALENT_H
|
||||
|
||||
|
||||
#include "creatorOne.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(Equivalent)
|
||||
|
||||
class Creator : public One::Creator
|
||||
{
|
||||
public:
|
||||
virtual const Product &create() const override {
|
||||
return Product::getInstance();
|
||||
}
|
||||
};
|
||||
|
||||
END_NAMESPACE // Equivalent
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !CREATOR_FUNCTION_EQUIVALENT_H
|
||||
@@ -0,0 +1,27 @@
|
||||
#ifndef CREATOR_FUNCTION_ONE_H
|
||||
#define CREATOR_FUNCTION_ONE_H
|
||||
|
||||
#include "../creatorAbstract.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(One)
|
||||
|
||||
class Creator : public Abstract::Creator
|
||||
{
|
||||
protected:
|
||||
Creator()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
virtual const Product &create() const = 0;
|
||||
};
|
||||
|
||||
END_NAMESPACE // One
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !CREATOR_FUNCTION_ONE_H
|
||||
@@ -0,0 +1,24 @@
|
||||
#ifndef CREATOR_FUNCTION_STANDART_H
|
||||
#define CREATOR_FUNCTION_STANDART_H
|
||||
|
||||
#include "creatorOne.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(Standart)
|
||||
|
||||
class Creator : public One::Creator
|
||||
{
|
||||
public:
|
||||
virtual const Product &create() const override {
|
||||
return Product::getInstance();
|
||||
}
|
||||
};
|
||||
|
||||
END_NAMESPACE // Standart
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !CREATOR_FUNCTION_FNV1a_H
|
||||
@@ -0,0 +1,35 @@
|
||||
#ifndef FUNCTION_EQUIVALENT_H
|
||||
#define FUNCTION_EQUIVALENT_H
|
||||
|
||||
#include "one.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(Equivalent)
|
||||
|
||||
using Singleton = BusinessLogic::Pattern::Singleton<Product>;
|
||||
|
||||
class Product final : public One::Product, public Singleton
|
||||
{
|
||||
private:
|
||||
friend const Product &Singleton::getInstance();
|
||||
Product() :
|
||||
One::Product(
|
||||
[](size_t value) -> size_t {
|
||||
return value;
|
||||
}
|
||||
)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
using Singleton::getInstance;
|
||||
};
|
||||
|
||||
END_NAMESPACE // Equivalent
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !FUNCTION_EQUIVALENT_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef FUNCTION_ONE_H
|
||||
#define FUNCTION_ONE_H
|
||||
|
||||
#include "../abstract.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(One)
|
||||
|
||||
using function_type = std::function<size_t(size_t)>;
|
||||
|
||||
class Product : public Abstract::Product
|
||||
{
|
||||
protected:
|
||||
const function_type m_function;
|
||||
|
||||
protected:
|
||||
Product(const function_type& function) : m_function(function)
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
const function_type& to_std() const {
|
||||
return m_function;
|
||||
}
|
||||
size_t getHash(size_t value) const {
|
||||
return m_function(value);
|
||||
}
|
||||
};
|
||||
|
||||
END_NAMESPACE // One
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !FUNCTION_ONE_H
|
||||
@@ -0,0 +1,37 @@
|
||||
#ifndef FUNCTION_STANDART_H
|
||||
#define FUNCTION_STANDART_H
|
||||
|
||||
#include "one.h"
|
||||
|
||||
BEGIN_NAMESPACE(BusinessLogic)
|
||||
BEGIN_NAMESPACE(Hash)
|
||||
BEGIN_NAMESPACE(Function)
|
||||
BEGIN_NAMESPACE(Standart)
|
||||
|
||||
using Singleton = BusinessLogic::Pattern::Singleton<Product>;
|
||||
|
||||
class Product final : public One::Product, public Singleton
|
||||
{
|
||||
private:
|
||||
std::hash<size_t> m_standartHashFunction;
|
||||
|
||||
private:
|
||||
friend const Product &Singleton::getInstance();
|
||||
Product()
|
||||
: One::Product(
|
||||
std::bind(&std::hash<size_t>::operator(), &m_standartHashFunction, std::placeholders::_1)
|
||||
)
|
||||
, m_standartHashFunction()
|
||||
{
|
||||
}
|
||||
|
||||
public:
|
||||
using Singleton::getInstance;
|
||||
};
|
||||
|
||||
END_NAMESPACE // Standart
|
||||
END_NAMESPACE // Function
|
||||
END_NAMESPACE // Hash
|
||||
END_NAMESPACE // BusinessLogic
|
||||
|
||||
#endif // !FUNCTION_FNV1a_H
|
||||
Reference in New Issue
Block a user