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

Class HostDnVecLongInt

XM/include/Utils/memory.h:855–880  ·  view source on GitHub ↗

dense vector wrapper on host: size_t type

Source from the content-addressed store, hash-verified

853
854// dense vector wrapper on host: size_t type
855class HostDnVecLongInt {
856 public:
857 int size;
858 size_t* vals;
859
860 HostDnVecLongInt(): size(0), vals(nullptr) {}
861 HostDnVecLongInt(const int size): size(size), vals(nullptr) {
862 this->allocate(this->size);
863 }
864
865 inline void allocate(const int size) {
866 if (this->vals == nullptr) {
867 this->size = size;
868 this->vals = (size_t*) malloc(sizeof(size_t) * size);
869 }
870 return;
871 }
872
873 ~HostDnVecLongInt() {
874 if (this->vals != nullptr) {
875 free(this->vals);
876 this->vals = nullptr;
877 }
878 // std::cout << "HostDnVecLongInt destructor called!" << std::endl;
879 }
880};
881
882// dense vector wrapper on host: ptrdiff_t type
883class HostDnVecPtrdiff_t {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected