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

Class HostDnVecInt

XM/include/Utils/memory.h:827–852  ·  view source on GitHub ↗

dense vector wrapper on host: int type

Source from the content-addressed store, hash-verified

825
826// dense vector wrapper on host: int type
827class HostDnVecInt {
828 public:
829 int size;
830 int* vals;
831
832 HostDnVecInt(): size(0), vals(nullptr) {}
833 HostDnVecInt(const int size): size(size), vals(nullptr) {
834 this->allocate(this->size);
835 }
836
837 inline void allocate(const int size) {
838 if (this->vals == nullptr) {
839 this->size = size;
840 this->vals = (int*) malloc(sizeof(int) * size);
841 }
842 return;
843 }
844
845 ~HostDnVecInt() {
846 if (this->vals != nullptr) {
847 free(this->vals);
848 this->vals = nullptr;
849 }
850 // std::cout << "HostDnVecInt destructor called!" << std::endl;
851 }
852};
853
854// dense vector wrapper on host: size_t type
855class HostDnVecLongInt {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected