<commit_before>#include "allocore/graphics/al_BufferObject.hpp"

namespace al{

BufferObject::BufferObject(BufferType bufType, BufferUsage bufUsage)
:	mMapMode(READ_WRITE), mType(bufType), mUsage(bufUsage),
	mDataType(Graphics::FLOAT), mNumComps(0), mNumElems(0), mData(0)
{}

BufferObject::~BufferObject(){
	destroy();
}

int BufferObject::size() const {
	return mNumElems*mNumComps*Graphics::numBytes(mDataType);
}

void BufferObject::bufferType(BufferType v){ mType=v; }

void BufferObject::usage(BufferUsage v){ mUsage=v; }

void BufferObject::mapMode(AccessMode v){ mMapMode=v; }

void BufferObject::operator()(){
	//data(); onPointerFunc(); unbind();
	bind(); onPointerFunc();
}

void BufferObject::send(){
	(*this)();
}

void BufferObject::bind(){
	validate();
	glBindBuffer(mType, id());
}

void BufferObject::unbind() const {
	glBindBuffer(mType, 0);
}

#ifdef AL_GRAPHICS_USE_OPENGL
void * BufferObject::map(){
	bind();
	return glMapBuffer(mType, mMapMode);
}

bool BufferObject::unmap(){
	return glUnmapBuffer(mType)==GL_TRUE;
}
#endif

void BufferObject::resize(int numBytes){
	mData = NULL;
	mDataType = Graphics::BYTE;<commit_msg>move BufferObject::mapMode implementation to OpenGL section<commit_after>#include "allocore/graphics/al_BufferObject.hpp"

namespace al{

BufferObject::BufferObject(BufferType bufType, BufferUsage bufUsage)
:	mMapMode(READ_WRITE), mType(bufType), mUsage(bufUsage),
	mDataType(Graphics::FLOAT), mNumComps(0), mNumElems(0), mData(0)
{}

BufferObject::~BufferObject(){
	destroy();
}

int BufferObject::size() const {
	return mNumElems*mNumComps*Graphics::numBytes(mDataType);
}

void BufferObject::bufferType(BufferType v){ mType=v; }

void BufferObject::usage(BufferUsage v){ mUsage=v; }

void BufferObject::operator()(){
	//data(); onPointerFunc(); unbind();
	bind(); onPointerFunc();
}

void BufferObject::send(){
	(*this)();
}

void BufferObject::bind(){
	validate();
	glBindBuffer(mType, id());
}

void BufferObject::unbind() const {
	glBindBuffer(mType, 0);
}

#ifdef AL_GRAPHICS_USE_OPENGL
void BufferObject::mapMode(AccessMode v){ mMapMode=v; }

void * BufferObject::map(){
	bind();
	return glMapBuffer(mType, mMapMode);
}

bool BufferObject::unmap(){
	return glUnmapBuffer(mType)==GL_TRUE;
}
#endif

void BufferObject::resize(int numBytes){
	mData = NULL;
	mDataType = Graphics::BYTE;
{'fraction_non_alphanumeric': 0.1610968294772922, 'fraction_numerical': 0.003427592116538132, 'mean_word_length': 8.192913385826772, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1873847', 'n_tokens_mistral': 819, 'n_tokens_neox': 815, 'n_words': 152}