PARTONS  
PARtonic Tomography Of Nucleon Software
Public Member Functions | Static Public Attributes | Private Attributes | List of all members
PARTONS::CryptographicHashService Class Reference

Service for generation of hash values. More...

Inheritance diagram for PARTONS::CryptographicHashService:
PARTONS::ServiceObject PARTONS::BaseObject

Public Member Functions

 CryptographicHashService (const std::string &className)
 Constructor. More...
 
virtual ~CryptographicHashService ()
 Destructor. More...
 
virtual void computeTask (Task &task)
 Method used in automation to compute given tasks. More...
 
std::string generateSHA1HashSum (const std::string &string) const
 Generate SHA-1 hash value for a given string of characters. More...
 
- Public Member Functions inherited from PARTONS::ServiceObject
 ServiceObject (const std::string &className)
 Default constructor. More...
 
virtual ~ServiceObject ()
 Default destructor. More...
 
virtual void resolveObjectDependencies ()
 Because of the initialization step order of the program, objects are registered in a total random order and some objects depend on others. More...
 
void addTasks (const List< ElemUtils::Packet > &tasks)
 Add task to queue. More...
 
bool isEmptyTaskQueue ()
 Check if queue is empty. More...
 
ElemUtils::Packet popTaskFormQueue ()
 Pop task from queue. More...
 
void initComputationalThread (ModuleObject *pModuleObject)
 Initialize all threads. More...
 
void launchAllThreadAndWaitingFor ()
 Lunch all threads. More...
 
void clearAllThread ()
 Clear all threads. More...
 
std::string generateSQLQueryForPlotFile (const std::string &tableName, const ElemUtils::Parameters &selectParams, const ElemUtils::Parameters &whereParams) const
 Generate SQL query to create a plot file. More...
 
void generatePlotFile (const std::string &filePath, const std::string &sqlQuery, const char splitChar) const
 Generate a plot file. More...
 
- Public Member Functions inherited from PARTONS::BaseObject
 BaseObject (const std::string &className)
 Constructor. More...
 
virtual ~BaseObject ()
 Default destructor. More...
 
virtual BaseObjectclone () const
 Virtual clone function to allow the factory to clone all derived members object stored in the BaseObjectRegistry. More...
 
virtual std::string toString () const
 Return a pre-formatted characters string for output visualization of class member's values. More...
 
void serialize (ElemUtils::Packet &packet) const
 Used to split a complex C++ object into a concatenation of simple types. More...
 
void unserialize (ElemUtils::Packet &packet)
 Used to rebuild a complex C++ object from a concatenation of simple type. More...
 
bool operator< (const BaseObject &other) const
 Overload of < operator to sort BaseObject object by its indexId value. More...
 
const std::string & getClassName () const
 
unsigned int getObjectId () const
 
int getIndexId () const
 
void setIndexId (int indexId)
 

Static Public Attributes

static const unsigned int classId
 Unique ID to automatically register the class in the registry. More...
 

Private Attributes

CryptographicHashIm_pCryptographicHashI
 Pointer to object used to generate hash values. More...
 

Additional Inherited Members

- Protected Member Functions inherited from PARTONS::ServiceObject
std::string generateSQLQueryForPlotFileTask (Task &task, const std::string &tableName) const
 Generate SQL query from a task. More...
 
std::string getOutputFilePathForPlotFileTask (Task &task) const
 Get path to a plot file from a task. More...
 
List< GPDTypegetGPDTypeListFromTask (Task &task) const
 Get list of GPD types to be computed from a task. More...
 
List< CollinearDistributionTypegetCollinearDistributionTypeListFromTask (Task &task) const
 Get list of Collinear Distribution types to be computed from a task. More...
 
void errorUnknownMethod (const Task &task) const
 Throw exception if unknown method. More...
 
- Protected Member Functions inherited from PARTONS::BaseObject
 BaseObject (const BaseObject &other)
 Copy constructor. More...
 
void info (const std::string &functionName, const std::string &message) const
 Print info message into logger. More...
 
void debug (const std::string &functionName, const std::string &message) const
 Print debug message into logger. More...
 
void warn (const std::string &functionName, const std::string &message) const
 Print warning message into logger. More...
 
void errorMissingParameter (const std::string &parameterName) const
 Use in automation process to throw exception when a parameter is missing from the XML scenario file. More...
 
- Protected Attributes inherited from PARTONS::ServiceObject
ModuleObjectFactorym_pModuleObjectFactory
 Pointer to ModuleObjectFactory. More...
 
AutomationServicem_pAutomationService
 Pointer to AutomationService. More...
 

Detailed Description

Service for generation of hash values.

This service is used to generate hash values for input strings of characters. The default generator is based on Qt4 library, see Qt4CryptographicHash class. The usage of this service is demonstrated by the following example:

//retrieve CryptographicHashService
//generate hash value for given string of characters
std::string inputString = "the quick brown fox jumps over the lazy dog";
std::string hashValue = pCryptographicHashService->generateSHA1HashSum(inputString);
//print result
Partons::getInstance()->getLoggerManager()->info("example", __func__, ElemUtils::Formatter() << "SHA1 hash sum for string '" << inputString << "' is " << hashValue);
std::string generateSHA1HashSum(const std::string &string) const
Generate SHA-1 hash value for a given string of characters.
Definition: CryptographicHashService.cpp:31
CryptographicHashService(const std::string &className)
Constructor.
Definition: CryptographicHashService.cpp:15
ElemUtils::LoggerManager * getLoggerManager() const
Definition: Partons.cpp:191
static Partons * getInstance()
Share a unique pointer of this class.
Definition: Partons.cpp:27
ServiceObjectRegistry * getServiceObjectRegistry() const
Definition: Partons.cpp:179
CryptographicHashService * getCryptographicHashService() const
Definition: ServiceObjectRegistry.cpp:115

which gives via Logger:

14-06-2017 09:54:08 [INFO] (example::main) SHA1 hash sum for string 'the quick brown fox jumps over the lazy dog' is 16312751ef9307c3fd1afbcb993cdc80464ba0f1

Constructor & Destructor Documentation

◆ CryptographicHashService()

PARTONS::CryptographicHashService::CryptographicHashService ( const std::string &  className)

Constructor.

Parameters
classNameName of class.

◆ ~CryptographicHashService()

PARTONS::CryptographicHashService::~CryptographicHashService ( )
virtual

Destructor.

Member Function Documentation

◆ computeTask()

void PARTONS::CryptographicHashService::computeTask ( Task task)
virtual

Method used in automation to compute given tasks.

Implemented in child classes.

Parameters
taskAutomation task to compute.

Implements PARTONS::ServiceObject.

◆ generateSHA1HashSum()

std::string PARTONS::CryptographicHashService::generateSHA1HashSum ( const std::string &  string) const

Generate SHA-1 hash value for a given string of characters.

Parameters
stringInput string.

Member Data Documentation

◆ classId

const unsigned int PARTONS::CryptographicHashService::classId
static
Initial value:
=
new CryptographicHashService("CryptographicHashService"))
unsigned int registerBaseObject(BaseObject *pBaseObject)
Store a unique instance of a module identified by a unique string character key.
Definition: BaseObjectRegistry.cpp:45
BaseObjectRegistry * getBaseObjectRegistry() const
Definition: Partons.cpp:175

Unique ID to automatically register the class in the registry.

◆ m_pCryptographicHashI

CryptographicHashI* PARTONS::CryptographicHashService::m_pCryptographicHashI
private

Pointer to object used to generate hash values.


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