simdjson  3.11.0
Ridiculously Fast JSON
simdjson::implementation Class Referenceabstract

An implementation of simdjson for a particular CPU architecture. More...

Public Member Functions

virtual std::string name () const
 The name of this implementation. More...
 
virtual std::string description () const
 The description of this implementation. More...
 
bool supported_by_runtime_system () const
 The instruction sets this implementation is compiled against and the current CPU match. More...
 
virtual simdjson_warn_unused bool validate_utf8 (const char *buf, size_t len) const noexcept=0
 Validate the UTF-8 string. More...
 

Detailed Description

An implementation of simdjson for a particular CPU architecture.

Also used to maintain the currently active implementation. The active implementation is automatically initialized on first use to the most advanced implementation supported by the host.

Definition at line 45 of file implementation.h.

Member Function Documentation

◆ description()

virtual std::string simdjson::implementation::description ( ) const
inlinevirtual

The description of this implementation.

const implementation *impl = simdjson::get_active_implementation();
cout << "simdjson is optimized for " << impl->name() << "(" << impl->description() << ")" << endl;
Returns
the description of the implementation, e.g. "Intel/AMD AVX2", "Intel/AMD SSE4.2", "ARM NEON".

Definition at line 66 of file implementation.h.

◆ name()

virtual std::string simdjson::implementation::name ( ) const
inlinevirtual

The name of this implementation.

const implementation *impl = simdjson::get_active_implementation();
cout << "simdjson is optimized for " << impl->name() << "(" << impl->description() << ")" << endl;
Returns
the name of the implementation, e.g. "haswell", "westmere", "arm64".

Definition at line 56 of file implementation.h.

◆ supported_by_runtime_system()

bool simdjson::implementation::supported_by_runtime_system ( ) const

The instruction sets this implementation is compiled against and the current CPU match.

This function may poll the current CPU/system and should therefore not be called too often if performance is a concern.

Returns
true if the implementation can be safely used on the current system (determined at runtime).

◆ validate_utf8()

virtual simdjson_warn_unused bool simdjson::implementation::validate_utf8 ( const char *  buf,
size_t  len 
) const
pure virtualnoexcept

Validate the UTF-8 string.

Overridden by each implementation.

Parameters
bufthe string to validate.
lenthe length of the string in bytes.
Returns
true if and only if the string is valid UTF-8.

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