Lucene++ - a full-featured, c++ search engine
API Documentation

Loading...
Searching...
No Matches
Static Public Member Functions | Static Protected Attributes
Lucene::MiscUtils Class Reference

`#include <MiscUtils.h>`

## Static Public Member Functions

static uint64_t | getTimeMillis (boost::posix_time::ptime time)
| Return given time in milliseconds.
static uint64_t | currentTimeMillis ()
| Returns the current time in milliseconds.
static int32_t | getNextSize (int32_t targetSize)
| This over-allocates proportional to the list size, making room for additional growth. The over-allocation is mild, but is enough to give linear-time amortized behavior over a long sequence of appends(). The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...
static int32_t | getShrinkSize (int32_t currentSize, int32_t targetSize)
| Only reallocate if we are "substantially" smaller. This saves us from "running hot" (constantly making a bit bigger then a bit smaller, over and over).
static int32_t | bytesDifference (uint8_t *bytes1, int32_t len1, uint8_t *bytes2, int32_t len2)
| Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.
template<typename TYPE>
static int32_t | hashLucene (TYPE type)
template<typename TYPE>
static int32_t | hashNumeric (TYPE type)
template<typename ITER, typename PRED>
static int32_t | hashCode (ITER first, ITER last, PRED pred)
static int32_t | hashCode (const wchar_t *array, int32_t start, int32_t end)
| Returns hash of chars in range start (inclusive) to end (inclusive).
static int32_t | hashCode (const uint8_t *array, int32_t start, int32_t end)
| Returns hash of bytes in range start (inclusive) to end (inclusive).
static int32_t | hashCode (bool value)
| Returns hash code of given boolean.
template<typename SOURCE, typename DEST>
static void | arrayCopy (SOURCE source, int32_t sourceOffset, DEST dest, int32_t destOffset, int32_t length)
| Copy elements from on buffer to another.
template<typename DEST, typename FILL>
static void | arrayFill (DEST dest, int32_t destFrom, int32_t destTo, FILL value)
| Fill buffer with given element.
static int32_t | doubleToIntBits (double value)
| Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.
static int32_t | doubleToRawIntBits (double value)
| Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.
static double | intBitsToDouble (int32_t bits)
| Returns the float value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single format" bit layout.
static int64_t | doubleToLongBits (double value)
| Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.
static int64_t | doubleToRawLongBits (double value)
| Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number (NaN) values.
static double | longBitsToDouble (int64_t bits)
| Returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.
static bool | isInfinite (double value)
| Returns true if the specified number is infinitely large in magnitude, false otherwise.
static bool | isNaN (double value)
| Returns true if this Double value is a Not-a-Number (NaN), false otherwise.
template<typename TYPE>
static bool | typeOf (const LuceneObjectPtr &object)
| Return whether given Lucene object is of a specified type.
static bool | equalTypes (const LuceneObjectPtr &first, const LuceneObjectPtr &second)
| Return whether given Lucene objects are of equal type.
static int64_t | unsignedShift (int64_t num, int64_t shift)
| Perform unsigned right-shift (left bits are zero filled).
static int32_t | unsignedShift (int32_t num, int32_t shift)
| Perform unsigned right-shift (left bits are zero filled).

## Static Protected Attributes

static const uint32_t | SINGLE_EXPONENT_MASK
static const uint32_t | SINGLE_MANTISSA_MASK
static const uint32_t | SINGLE_NAN_BITS
static const uint64_t | DOUBLE_SIGN_MASK
static const uint64_t | DOUBLE_EXPONENT_MASK
static const uint64_t | DOUBLE_MANTISSA_MASK
static const uint64_t | DOUBLE_NAN_BITS

## Member Function Documentation

## ◆ arrayCopy()

template<typename SOURCE, typename DEST>

void Lucene::MiscUtils::arrayCopy | ( | SOURCE | source,
|  | int32_t | sourceOffset,
|  | DEST | dest,
|  | int32_t | destOffset,
|  | int32_t | length )

inline static

Copy elements from on buffer to another.

Referenced by Lucene::TranslationResult< TYPE >::copyText().

## ◆ arrayFill()

template<typename DEST, typename FILL>

void Lucene::MiscUtils::arrayFill | ( | DEST | dest,
|  | int32_t | destFrom,
|  | int32_t | destTo,
|  | FILL | value )

inline static

Fill buffer with given element.

## ◆ bytesDifference()

int32_t Lucene::MiscUtils::bytesDifference | ( | uint8_t * | bytes1,
|  | int32_t | len1,
|  | uint8_t * | bytes2,
|  | int32_t | len2 )

static

Compares two byte[] arrays, element by element, and returns the number of elements common to both arrays.

Parameters

  bytes1 | The first byte[] to compare
  bytes2 | The second byte[] to compare

Returns
  The number of common elements.

## ◆ currentTimeMillis()

uint64_t Lucene::MiscUtils::currentTimeMillis | ( |  | ) |

static

Returns the current time in milliseconds.

## ◆ doubleToIntBits()

int32_t Lucene::MiscUtils::doubleToIntBits | ( | double | value | ) |

static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout.

## ◆ doubleToLongBits()

int64_t Lucene::MiscUtils::doubleToLongBits | ( | double | value | ) |

static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout.

Referenced by Lucene::VariantUtils::hashCode().

## ◆ doubleToRawIntBits()

int32_t Lucene::MiscUtils::doubleToRawIntBits | ( | double | value | ) |

static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "single format" bit layout, preserving Not-a-Number (NaN) values.

## ◆ doubleToRawLongBits()

int64_t Lucene::MiscUtils::doubleToRawLongBits | ( | double | value | ) |

static

Returns a representation of the specified floating-point value according to the IEEE 754 floating-point "double format" bit layout, preserving Not-a-Number (NaN) values.

## ◆ equalTypes()

bool Lucene::MiscUtils::equalTypes | ( | const LuceneObjectPtr & | first,
|  | const LuceneObjectPtr & | second )

static

Return whether given Lucene objects are of equal type.

References unsignedShift().

## ◆ getNextSize()

int32_t Lucene::MiscUtils::getNextSize | ( | int32_t | targetSize | ) |

static

This over-allocates proportional to the list size, making room for additional growth. The over-allocation is mild, but is enough to give linear-time amortized behavior over a long sequence of appends(). The growth pattern is: 0, 4, 8, 16, 25, 35, 46, 58, 72, 88, ...

## ◆ getShrinkSize()

int32_t Lucene::MiscUtils::getShrinkSize | ( | int32_t | currentSize,
|  | int32_t | targetSize )

static

Only reallocate if we are "substantially" smaller. This saves us from "running hot" (constantly making a bit bigger then a bit smaller, over and over).

## ◆ getTimeMillis()

uint64_t Lucene::MiscUtils::getTimeMillis | ( | boost::posix_time::ptime | time | ) |

static

Return given time in milliseconds.

## ◆ hashCode() [1/4]

int32_t Lucene::MiscUtils::hashCode | ( | bool | value | ) |

static

Returns hash code of given boolean.

## ◆ hashCode() [2/4]

int32_t Lucene::MiscUtils::hashCode | ( | const uint8_t * | array,
|  | int32_t | start,
|  | int32_t | end )

static

Returns hash of bytes in range start (inclusive) to end (inclusive).

## ◆ hashCode() [3/4]

int32_t Lucene::MiscUtils::hashCode | ( | const wchar_t * | array,
|  | int32_t | start,
|  | int32_t | end )

static

Returns hash of chars in range start (inclusive) to end (inclusive).

## ◆ hashCode() [4/4]

template<typename ITER, typename PRED>

int32_t Lucene::MiscUtils::hashCode | ( | ITER | first,
|  | ITER | last,
|  | PRED | pred )

inline static

## ◆ hashLucene()

template<typename TYPE>

int32_t Lucene::MiscUtils::hashLucene | ( | TYPE | type | ) |

inline static

## ◆ hashNumeric()

template<typename TYPE>

int32_t Lucene::MiscUtils::hashNumeric | ( | TYPE | type | ) |

inline static

## ◆ intBitsToDouble()

double Lucene::MiscUtils::intBitsToDouble | ( | int32_t | bits | ) |

static

Returns the float value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "single format" bit layout.

## ◆ isInfinite()

bool Lucene::MiscUtils::isInfinite | ( | double | value | ) |

static

Returns true if the specified number is infinitely large in magnitude, false otherwise.

## ◆ isNaN()

bool Lucene::MiscUtils::isNaN | ( | double | value | ) |

static

Returns true if this Double value is a Not-a-Number (NaN), false otherwise.

## ◆ longBitsToDouble()

double Lucene::MiscUtils::longBitsToDouble | ( | int64_t | bits | ) |

static

Returns the double value corresponding to a given bit representation. The argument is considered to be a representation of a floating-point value according to the IEEE 754 floating-point "double format" bit layout.

## ◆ typeOf()

template<typename TYPE>

bool Lucene::MiscUtils::typeOf | ( | const LuceneObjectPtr & | object | ) |

inline static

Return whether given Lucene object is of a specified type.

## ◆ unsignedShift() [1/2]

int32_t Lucene::MiscUtils::unsignedShift | ( | int32_t | num,
|  | int32_t | shift )

inline static

Perform unsigned right-shift (left bits are zero filled).

## ◆ unsignedShift() [2/2]

int64_t Lucene::MiscUtils::unsignedShift | ( | int64_t | num,
|  | int64_t | shift )

inline static

Perform unsigned right-shift (left bits are zero filled).

Referenced by equalTypes(), and Lucene::PriorityQueue< TYPE >::upHeap().

## Field Documentation

## ◆ DOUBLE_EXPONENT_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_EXPONENT_MASK

static protected

## ◆ DOUBLE_MANTISSA_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_MANTISSA_MASK

static protected

## ◆ DOUBLE_NAN_BITS

const uint64_t Lucene::MiscUtils::DOUBLE_NAN_BITS

static protected

## ◆ DOUBLE_SIGN_MASK

const uint64_t Lucene::MiscUtils::DOUBLE_SIGN_MASK

static protected

## ◆ SINGLE_EXPONENT_MASK

const uint32_t Lucene::MiscUtils::SINGLE_EXPONENT_MASK

static protected

## ◆ SINGLE_MANTISSA_MASK

const uint32_t Lucene::MiscUtils::SINGLE_MANTISSA_MASK

static protected

## ◆ SINGLE_NAN_BITS

const uint32_t Lucene::MiscUtils::SINGLE_NAN_BITS

static protected

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

- MiscUtils.h

clucene.sourceforge.net