Skip to content

Commit

Permalink
lint cpp code
Browse files Browse the repository at this point in the history
  • Loading branch information
sgilmore10 committed May 14, 2024
1 parent ee0dc30 commit f4b97c5
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 38 deletions.
51 changes: 26 additions & 25 deletions matlab/src/cpp/arrow/matlab/c/proxy/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -23,35 +23,36 @@

namespace arrow::matlab::c::proxy {

struct ArrowArrayDeleter {
void operator()(ArrowArray* array) const {
if (array) {
free(array);
}
struct ArrowArrayDeleter {
void operator()(ArrowArray* array) const {
if (array) {
free(array);
}
};

Array::Array() : arrowArray{ArrowArrayPtr(new ArrowArray(), ArrowArrayDeleter())} {
REGISTER_METHOD(Array, getAddress);
}
};

Array::~Array() {
if (arrowArray && arrowArray->release != nullptr) {
arrowArray->release(arrowArray.get());
arrowArray->release = nullptr;
}
}
Array::Array() : arrowArray{ArrowArrayPtr(new ArrowArray(), ArrowArrayDeleter())} {
REGISTER_METHOD(Array, getAddress);
}

libmexclass::proxy::MakeResult Array::make(const libmexclass::proxy::FunctionArguments& constructor_arguments) {
return std::make_shared<Array>();
Array::~Array() {
if (arrowArray && arrowArray->release != nullptr) {
arrowArray->release(arrowArray.get());
arrowArray->release = nullptr;
}
}

void Array::getAddress(libmexclass::proxy::method::Context& context) {
namespace mda = ::matlab::data;

mda::ArrayFactory factory;
auto address = reinterpret_cast<uint64_t>(arrowArray.get());
context.outputs[0] = factory.createScalar(address);
}
libmexclass::proxy::MakeResult Array::make(
const libmexclass::proxy::FunctionArguments& constructor_arguments) {
return std::make_shared<Array>();
}

void Array::getAddress(libmexclass::proxy::method::Context& context) {
namespace mda = ::matlab::data;

mda::ArrayFactory factory;
auto address = reinterpret_cast<uint64_t>(arrowArray.get());
context.outputs[0] = factory.createScalar(address);
}

} // namespace arrow::matlab::c::proxy
} // namespace arrow::matlab::c::proxy
24 changes: 11 additions & 13 deletions matlab/src/cpp/arrow/matlab/c/proxy/array.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,23 +23,21 @@

namespace arrow::matlab::c::proxy {

using ArrowArrayPtr = std::shared_ptr<ArrowArray>;
using ArrowArrayPtr = std::shared_ptr<ArrowArray>;

class Array : public libmexclass::proxy::Proxy {
public:
Array();

class Array : public libmexclass::proxy::Proxy {
public:
Array();
~Array();

~Array();

static libmexclass::proxy::MakeResult make(
static libmexclass::proxy::MakeResult make(
const libmexclass::proxy::FunctionArguments& constructor_arguments);

protected:
void getAddress(libmexclass::proxy::method::Context& context);

ArrowArrayPtr arrowArray;
protected:
void getAddress(libmexclass::proxy::method::Context& context);

};
ArrowArrayPtr arrowArray;
};

} // namespace arrow::matlab::c::proxy
} // namespace arrow::matlab::c::proxy

0 comments on commit f4b97c5

Please sign in to comment.