Program Listing for File static-buffer.hpp
↰ Return to documentation for file (include/pinocchio/serialization/static-buffer.hpp
)
//
// Copyright (c) 2021 INRIA
//
#ifndef __pinocchio_serialization_static_buffer_hpp__
#define __pinocchio_serialization_static_buffer_hpp__
#include <vector>
namespace pinocchio
{
namespace serialization
{
struct StaticBuffer
{
explicit StaticBuffer(const size_t n)
: m_size(n)
{
m_data.reserve(n);
}
size_t size() const
{
return m_size;
}
char * data()
{
return m_data.data();
}
const char * data() const
{
return m_data.data();
}
void resize(const size_t new_size)
{
m_size = new_size;
m_data.reserve(new_size);
}
protected:
size_t m_size;
std::vector<char> m_data;
};
}
}
#endif // ifndef __pinocchio_serialization_static_buffer_hpp__