CppLogging  1.0.4.0
C++ Logging Library
Public Member Functions | Static Public Member Functions | List of all members
CppLogging::HashLayout Class Reference

Hash layout. More...

#include <hash_layout.h>

Inheritance diagram for CppLogging::HashLayout:
CppLogging::Layout CppLogging::Element

Public Member Functions

 HashLayout ()=default
 
 HashLayout (const HashLayout &)=delete
 
 HashLayout (HashLayout &&)=delete
 
virtual ~HashLayout ()=default
 
HashLayoutoperator= (const HashLayout &)=delete
 
HashLayoutoperator= (HashLayout &&)=delete
 
void LayoutRecord (Record &record) override
 Layout the given logging record into a raw buffer. More...
 
- Public Member Functions inherited from CppLogging::Element
virtual bool IsStarted () const noexcept
 Is the logging element started? More...
 
virtual bool Start ()
 Start the logging element. More...
 
virtual bool Stop ()
 Stop the logging element. More...
 

Static Public Member Functions

static uint32_t Hash (std::string_view message)
 Hash the given string message using FNV-1a hashing algorithm. More...
 

Detailed Description

Hash layout.

Hash layout performs simple memory copy operation to convert the given logging record into the plane raw buffer. Logging message is stored as a 32-bit hash of the message string.

Hash algorithm is 32-bit FNV-1a string hashing.

Thread-safe.

Definition at line 26 of file hash_layout.h.

Constructor & Destructor Documentation

◆ HashLayout() [1/3]

CppLogging::HashLayout::HashLayout ( )
default

◆ HashLayout() [2/3]

CppLogging::HashLayout::HashLayout ( const HashLayout )
delete

◆ HashLayout() [3/3]

CppLogging::HashLayout::HashLayout ( HashLayout &&  )
delete

◆ ~HashLayout()

virtual CppLogging::HashLayout::~HashLayout ( )
virtualdefault

Member Function Documentation

◆ Hash()

uint32_t CppLogging::HashLayout::Hash ( std::string_view  message)
static

Hash the given string message using FNV-1a hashing algorithm.

FNV-1a string hashing is the fast non-cryptographic hash function created by Glenn Fowler, Landon Curt Noll, and Kiem-Phong Vo.

https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function

Parameters
message- Message string
Returns
Calculated 32-bit hash value of the message

Definition at line 16 of file hash_layout.cpp.

◆ LayoutRecord()

void CppLogging::HashLayout::LayoutRecord ( Record record)
overridevirtual

Layout the given logging record into a raw buffer.

This method will update the raw filed of the given logging record.

Parameters
record- Logging record

Implements CppLogging::Layout.

Definition at line 30 of file hash_layout.cpp.

◆ operator=() [1/2]

HashLayout& CppLogging::HashLayout::operator= ( const HashLayout )
delete

◆ operator=() [2/2]

HashLayout& CppLogging::HashLayout::operator= ( HashLayout &&  )
delete

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