<commit_before>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
#ifndef _ELM_CORE_PCL_POINT_TRAITS_H_
#define _ELM_CORE_PCL_POINT_TRAITS_H_

#ifdef __WITH_PCL // the following traits require PCL support

#include <pcl/common/io.h>      // getFields()

namespace  elm {

/**
 * @brief template class to for wrapping PCL point traits
 */
template <class TPoint>
class PCLPointTraits_
{
public:

    /** @brief get no. of fields of a pcl point type.
     * This does not account for SSE alignment or mixed types
     * @return field count
     */
    static size_t FieldCount()
    {
        std::vector<pcl::PCLPointField> fields;
        pcl::getFields<TPoint>(fields);

//        for(size_t i=0; i<fields.size(); i++)
//        {
//            pcl::PCLPointField f = fields[i];
//            std::cout<<f.name<<",";
//        }
//        std::cout<<std::endl;

        return fields.size();
    }

    /** @brief Get no. of floats occupied by Point struct
     * @return no. of floats occupied by point struct
     */
    static size_t NbFloats()
    {
        static_assert(sizeof(TPoint) % sizeof(float) == 0, "This point type has non-float components");
        return sizeof(TPoint) / sizeof(float);
    }
};

} // namespace elm

#else // __WITH_PCL
    #warning "Unable to define additional point_traits without PCL support."
#endif // __WITH_PCL

#endif // _ELM_CORE_PCL_POINT_TRAITS_H_<commit_msg>replace static assert with exception<commit_after>/*M///////////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2015, <NAME>
// Copyright (c) 2015, ELM Library Project
// 3-clause BSD License
//
//M*/
#ifndef _ELM_CORE_PCL_POINT_TRAITS_H_
#define _ELM_CORE_PCL_POINT_TRAITS_H_

#ifdef __WITH_PCL // the following traits require PCL support

#include <pcl/common/io.h>      // getFields()

#include "elm/core/exception.h"

namespace  elm {

/**
 * @brief template class to for wrapping PCL point traits
 */
template <class TPoint>
class PCLPointTraits_
{
public:

    /** @brief get no. of fields of a pcl point type.
     * This does not account for SSE alignment or mixed types
     * @return field count
     */
    static size_t FieldCount()
    {
        std::vector<pcl::PCLPointField> fields;
        pcl::getFields<TPoint>(fields);

//        for(size_t i=0; i<fields.size(); i++)
//        {
//            pcl::PCLPointField f = fields[i];
//            std::cout<<f.name<<",";
//        }
//        std::cout<<std::endl;

        return fields.size();
    }

    /** @brief Get no. of floats occupied by Point struct
     * @return no. of floats occupied by point struct
     */
    static size_t NbFloats()
    {
        ELM_THROW_BAD_DIMS_IF(sizeof(TPoint) % sizeof(float) != 0, "This point type has non-float components");
        return sizeof(TPoint) / sizeof(float);
    }
};

} // namespace elm

#endif // __WITH_PCL

#endif // _ELM_CORE_PCL_POINT_TRAITS_H_
{'fraction_non_alphanumeric': 0.17907052323691908, 'fraction_numerical': 0.007149821254468639, 'mean_word_length': 2.1601642710472277, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 13, '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': '1991071', 'n_tokens_mistral': 1006, 'n_tokens_neox': 971, 'n_words': 266}