<commit_before>/**
 *	\file Buffer.hpp
 *	\brief Defines a wrapper for OpenGL buffer objects.
 */

#ifndef ATLAS_INCLUDE_ATLAS_GL_BUFFER_HPP
#define ATLAS_INCLUDE_ATLAS_GL_BUFFER_HPP

#pragma once

#include "GL.hpp"

#include <memory>

namespace atlas
{
    namespace gl
    {
        /**
         * Computes a pointer offset into a buffer that holds data of the 
         * specified type.
         * 
         * \tparam GenType The data type that is contained in the buffer.
         * \param[in] offset The offset into the buffer.
         * 
         * \return A pointer into the buffer that is offset by the provided 
         * amount.
         */
        template <typename GenType>
        constexpr void* bufferOffset(std::size_t offset)
        {
            return (void*)(offset * sizeof(GenType));
        }

        /**
         * Computes the stride that separates one object from another in a 
         * buffer that holds data of the specified type.
         * 
         * \tparam GenType The data type that is contained in the buffer.
         * \param[in] step The distance between objects.
         * 
         * \return The distance (in bytes) between objects.
         */
        template <typename GenType>
        constexpr std::size_t stride(std::size_t step)
        {
            return step * sizeof(GenType);
        }

        /**
         * 
         * Computes the size of the specified number of objects.
         * 
         * \tparam GenType The data type for which we are computing the size.
         * \param[in] num The number of elements.
         * 
         * \return THe size (in bytes) of the elements.
         */
        template <typename GenType>
        constexpr std::size_t size(std::size_t num)
        {
            return stride<GenType>(num);
        }

        /**
         *	\class Buffer
         *	\brief A container for OpenGL buffer objects.
         *	
         *	This class encapsulates the handle for the buffer object, 
         *	thereby providing simplified access to the most common buffer
         *	functions.
         */
        class Buffer : public Object
        {
        public:<commit_msg>[brief] Corrects the return type for the stride function.<commit_after>/**
 *	\file Buffer.hpp
 *	\brief Defines a wrapper for OpenGL buffer objects.
 */

#ifndef ATLAS_INCLUDE_ATLAS_GL_BUFFER_HPP
#define ATLAS_INCLUDE_ATLAS_GL_BUFFER_HPP

#pragma once

#include "GL.hpp"

#include <memory>

namespace atlas
{
    namespace gl
    {
        /**
         * Computes a pointer offset into a buffer that holds data of the 
         * specified type.
         * 
         * \tparam GenType The data type that is contained in the buffer.
         * \param[in] offset The offset into the buffer.
         * 
         * \return A pointer into the buffer that is offset by the provided 
         * amount.
         */
        template <typename GenType>
        constexpr void* bufferOffset(std::size_t offset)
        {
            return (void*)(offset * sizeof(GenType));
        }

        /**
         * Computes the stride that separates one object from another in a 
         * buffer that holds data of the specified type.
         * 
         * \tparam GenType The data type that is contained in the buffer.
         * \param[in] step The distance between objects.
         * 
         * \return The distance (in bytes) between objects.
         */
        template <typename GenType>
        constexpr GLsizei stride(std::size_t step)
        {
            return (GLsizei)(step * sizeof(GenType));
        }

        /**
         * 
         * Computes the size of the specified number of objects.
         * 
         * \tparam GenType The data type for which we are computing the size.
         * \param[in] num The number of elements.
         * 
         * \return THe size (in bytes) of the elements.
         */
        template <typename GenType>
        constexpr std::size_t size(std::size_t num)
        {
            return stride<GenType>(num);
        }

        /**
         *	\class Buffer
         *	\brief A container for OpenGL buffer objects.
         *	
         *	This class encapsulates the handle for the buffer object, 
         *	thereby providing simplified access to the most common buffer
         *	functions.
         */
        class Buffer : public Object
        {
        public:
{'fraction_non_alphanumeric': 0.07418397626112759, 'fraction_numerical': 0.0, 'mean_word_length': 1.6982758620689655, 'pattern_counts': {'":': 0, '<': 13, '<?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': '3715071', 'n_tokens_mistral': 1192, 'n_tokens_neox': 1135, 'n_words': 427}