<commit_before>/**
 * @file sf1r/search-manager/NumericPropertyTable.h
 * @author <NAME> <<EMAIL>>
 * @date Created <2011-08-31>
 * @brief Providing an interface to retrieve property values from cache.
 */
#ifndef NUMERIC_PROPERTY_TABLE_H
#define NUMERIC_PROPERTY_TABLE_H

#include <common/type_defs.h>

#include <string>

namespace sf1r{

class NumericPropertyTable
{
public:
    NumericPropertyTable(const std::string &name, PropertyDataType type, void *data)
        : name_(name)
        , type_(type)
        , data_(data)
    {}

    const std::string &getPropertyName() const
    {
        return name_;
    }

    PropertyDataType getPropertyType() const
    {
        return type_;
    }

    template <typename T>
    inline void getPropertyValue(const docid_t did, T &value) const
    {
        value = ((T *)data_)[did];
    }

    template <typename T>
    inline bool convertPropertyValue(const docid_t did, T &value) const
    {
        switch(type_)
        {
        case INT_PROPERTY_TYPE:
            value = ((int64_t *)data_)[did];
            break;

        case UNSIGNED_INT_PROPERTY_TYPE:
            value = ((uint64_t *)data_)[did];
            break;

        case FLOAT_PROPERTY_TYPE:
            value = ((float *)data_)[did];
            break;

        case DOUBLE_PROPERTY_TYPE:
            value = ((double *)data_)[did];
            break;<commit_msg>remove redundant interface in NumericPropertyTable<commit_after>/**
 * @file sf1r/search-manager/NumericPropertyTable.h
 * @author <NAME> <<EMAIL>>
 * @date Created <2011-08-31>
 * @brief Providing an interface to retrieve property values from cache.
 */
#ifndef NUMERIC_PROPERTY_TABLE_H
#define NUMERIC_PROPERTY_TABLE_H

#include <common/type_defs.h>

#include <string>

namespace sf1r{

class NumericPropertyTable
{
public:
    NumericPropertyTable(const std::string &name, PropertyDataType type, void *data)
        : name_(name)
        , type_(type)
        , data_(data)
    {}

    const std::string &getPropertyName() const
    {
        return name_;
    }

    PropertyDataType getPropertyType() const
    {
        return type_;
    }

    template <typename T>
    inline bool convertPropertyValue(const docid_t did, T &value) const
    {
        switch(type_)
        {
        case INT_PROPERTY_TYPE:
            value = ((int64_t *)data_)[did];
            break;

        case UNSIGNED_INT_PROPERTY_TYPE:
            value = ((uint64_t *)data_)[did];
            break;

        case FLOAT_PROPERTY_TYPE:
            value = ((float *)data_)[did];
            break;

        case DOUBLE_PROPERTY_TYPE:
            value = ((double *)data_)[did];
            break;
{'fraction_non_alphanumeric': 0.10386201724784402, 'fraction_numerical': 0.010498687664041995, 'mean_word_length': 2.4604409857328147, 'pattern_counts': {'":': 0, '<': 18, '<?xml version=': 0, '>': 18, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5894012', 'n_tokens_mistral': 830, 'n_tokens_neox': 811, 'n_words': 195}