MCPcopy Create free account
hub / github.com/ComputationalRobotics/XM-code / HostDnVecPtrdiff_t

Class HostDnVecPtrdiff_t

XM/include/Utils/memory.h:883–908  ·  view source on GitHub ↗

dense vector wrapper on host: ptrdiff_t type

Source from the content-addressed store, hash-verified

881
882// dense vector wrapper on host: ptrdiff_t type
883class HostDnVecPtrdiff_t {
884 public:
885 size_t size;
886 ptrdiff_t* vals;
887
888 HostDnVecPtrdiff_t(): size(0), vals(nullptr) {}
889 HostDnVecPtrdiff_t(const size_t size): size(size), vals(nullptr) {
890 this->allocate(this->size);
891 }
892
893 inline void allocate(const size_t size) {
894 if (this->vals == nullptr) {
895 this->size = size;
896 this->vals = (ptrdiff_t*) malloc(sizeof(ptrdiff_t) * size);
897 }
898 return;
899 }
900
901 ~HostDnVecPtrdiff_t() {
902 if (this->vals != nullptr) {
903 free(this->vals);
904 this->vals = nullptr;
905 }
906 // std::cout << "HostDnVecPtrdiff_t destructor called!" << std::endl;
907 }
908};
909
910// dense vector wrapper on device: double type
911class DeviceDnVecDouble {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected