/usr/include/Data.h is in libhypre-dev 2.8.0b-1build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | #ifndef _Data_h_
#define _Data_h_
#include <string.h>
#include <stdlib.h>
/**
This is a very simple class for passing stuff around
in a void pointer. It has the ability to store and query
a type name, so at least there can be user-enforced
type safety.
When setTypeName is called, a char* is created and a copy
of the input argument is taken. This char* is later destroyed
by the Data destructor. The void* dataPtr_ member is not
destroyed, it is just a copy of a pointer.
*/
class Data {
public:
/** Default constructor. */
Data() {typeName_ = NULL; dataPtr_ = NULL;};
/** Default destructor. */
virtual ~Data() {if (typeName_) delete [] typeName_;};
/** Set a string representing the type of the object stored in
'getDataPtr()'. */
void setTypeName(const char* name) {if (typeName_) delete [] typeName_;
int len = strlen(name);
typeName_ = new char[len+1];
strcpy(typeName_, name);
typeName_[len] = '\0';};
/** Query the string representing the type of the object stored in
'getDataPtr()'. */
char* getTypeName() const {return(typeName_);};
/** Set the contents of the data pointer. */
void setDataPtr(void* ptr) {dataPtr_ = ptr;};
/** Retrieve the contents of the data pointer. */
void* getDataPtr() const {return(dataPtr_);};
private:
char* typeName_;
void* dataPtr_;
};
#endif
|