Rename mjBuffer to mjByteVec.

PiperOrigin-RevId: 664872558
Change-Id: I7b003374c390958667635fb21089faf2ece54b14
This commit is contained in:
Yuval Tassa
2024-08-19 10:37:50 -07:00
committed by Copybara-Service
parent 4aab00fa2d
commit 5d91231d31
9 changed files with 14 additions and 14 deletions
+3 -3
View File
@@ -1393,7 +1393,7 @@ Alternative orientation specifiers.
.. _ArrayHandles:
.. _mjBuffer:
.. _mjByteVec:
.. _mjString:
@@ -1419,7 +1419,6 @@ C handles for C++ strings and vector types. When using from C, use the provided
#ifdef __cplusplus
// C++: defined to be compatible with corresponding std types
using mjBuffer = std::vector<std::byte>;
using mjString = std::string;
using mjStringVec = std::vector<std::string>;
using mjIntVec = std::vector<int>;
@@ -1427,9 +1426,9 @@ C handles for C++ strings and vector types. When using from C, use the provided
using mjFloatVec = std::vector<float>;
using mjFloatVecVec = std::vector<std::vector<float>>;
using mjDoubleVec = std::vector<double>;
using mjByteVec = std::vector<std::byte>;
#else
// C: opaque types
typedef void mjBuffer;
typedef void mjString;
typedef void mjStringVec;
typedef void mjIntVec;
@@ -1437,6 +1436,7 @@ C handles for C++ strings and vector types. When using from C, use the provided
typedef void mjFloatVec;
typedef void mjFloatVecVec;
typedef void mjDoubleVec;
typedef void mjByteVec;
#endif
+2 -2
View File
@@ -2028,7 +2028,7 @@ typedef struct mjsTexture_ { // texture specification
mjStringVec* cubefiles; // different file for each side of the cube
// method 4: from buffer read by user
mjBuffer* data; // texture data
mjByteVec* data; // texture data
// flip options
mjtByte hflip; // horizontal flip
@@ -3588,7 +3588,7 @@ mjsHField* mjs_asHField(mjsElement* element);
mjsSkin* mjs_asSkin(mjsElement* element);
mjsTexture* mjs_asTexture(mjsElement* element);
mjsMaterial* mjs_asMaterial(mjsElement* element);
void mjs_setBuffer(mjBuffer* dest, const void* array, int size);
void mjs_setBuffer(mjByteVec* dest, const void* array, int size);
void mjs_setString(mjString* dest, const char* text);
void mjs_setStringVec(mjStringVec* dest, const char* text);
mjtByte mjs_setInStringVec(mjStringVec* dest, int i, const char* text);
+3 -3
View File
@@ -33,7 +33,6 @@ extern "C" {
#ifdef __cplusplus
// C++: defined to be compatible with corresponding std types
using mjBuffer = std::vector<std::byte>;
using mjString = std::string;
using mjStringVec = std::vector<std::string>;
using mjIntVec = std::vector<int>;
@@ -41,9 +40,9 @@ extern "C" {
using mjFloatVec = std::vector<float>;
using mjFloatVecVec = std::vector<std::vector<float>>;
using mjDoubleVec = std::vector<double>;
using mjByteVec = std::vector<std::byte>;
#else
// C: opaque types
typedef void mjBuffer;
typedef void mjString;
typedef void mjStringVec;
typedef void mjIntVec;
@@ -51,6 +50,7 @@ extern "C" {
typedef void mjFloatVec;
typedef void mjFloatVecVec;
typedef void mjDoubleVec;
typedef void mjByteVec;
#endif
@@ -515,7 +515,7 @@ typedef struct mjsTexture_ { // texture specification
mjStringVec* cubefiles; // different file for each side of the cube
// method 4: from buffer read by user
mjBuffer* data; // texture data
mjByteVec* data; // texture data
// flip options
mjtByte hflip; // horizontal flip
+1 -1
View File
@@ -1630,7 +1630,7 @@ MJAPI mjsMaterial* mjs_asMaterial(mjsElement* element);
//---------------------------------- Attribute setters ---------------------------------------------
// Copy buffer.
MJAPI void mjs_setBuffer(mjBuffer* dest, const void* array, int size);
MJAPI void mjs_setBuffer(mjByteVec* dest, const void* array, int size);
// Copy text to string.
MJAPI void mjs_setString(mjString* dest, const char* text);
+1 -1
View File
@@ -10253,7 +10253,7 @@ FUNCTIONS: Mapping[str, FunctionDecl] = dict([
FunctionParameterDecl(
name='dest',
type=PointerType(
inner_type=ValueType(name='mjBuffer'),
inner_type=ValueType(name='mjByteVec'),
),
),
FunctionParameterDecl(
+1 -1
View File
@@ -10014,7 +10014,7 @@ STRUCTS: Mapping[str, StructDecl] = dict([
StructFieldDecl(
name='data',
type=PointerType(
inner_type=ValueType(name='mjBuffer'),
inner_type=ValueType(name='mjByteVec'),
),
doc='texture data',
),
@@ -148,7 +148,7 @@ def _ptr_binding_code(
self.{fullvarname}->push_back(py::cast<{vartype}>(val));
}}
}}, py::return_value_policy::reference_internal);"""
elif vartype == 'mjBuffer': # C++ buffer -> Python list
elif vartype == 'mjByteVec': # C++ buffer -> Python list
return f"""\
{classname}.def_property(
"{varname}",
+1 -1
View File
@@ -885,7 +885,7 @@ mjsMaterial* mjs_asMaterial(mjsElement* element) {
// copy buffer to destination buffer
void mjs_setBuffer(mjBuffer* dest, const void* array, int size) {
void mjs_setBuffer(mjByteVec* dest, const void* array, int size) {
const std::byte* buffer = static_cast<const std::byte*>(array);
dest->clear();
dest->reserve(size);
+1 -1
View File
@@ -303,7 +303,7 @@ MJAPI mjsMaterial* mjs_asMaterial(mjsElement* element);
//---------------------------------- Attribute setters ---------------------------------------------
// Copy buffer.
MJAPI void mjs_setBuffer(mjBuffer* dest, const void* array, int size);
MJAPI void mjs_setBuffer(mjByteVec* dest, const void* array, int size);
// Copy text to string.
MJAPI void mjs_setString(mjString* dest, const char* text);