Revert commit 14dfd3876a which walked-back
the NULL->nullptr changes for lib/awpmd. Then, hand-applied a minor cleanup to comments, ala Axel's changes to the rest of the codebase.
This commit is contained in:
@ -129,7 +129,7 @@ public:
|
||||
|
||||
message_logger(const string &descriptor_="", int out_level=vblALLBAD|vblMESS1,
|
||||
int stop_level=vblFATAL, int throw_exceptions=0, int use_globally=0)
|
||||
:descriptor(descriptor_),prev(NULL),next(NULL){
|
||||
:descriptor(descriptor_),prev(nullptr),next(nullptr){
|
||||
set_throw(throw_exceptions);
|
||||
set_levels(out_level,stop_level);
|
||||
extra_levels(0,0);
|
||||
@ -157,8 +157,8 @@ public:
|
||||
return -1;
|
||||
glogp=prev;
|
||||
if(glogp)
|
||||
glogp->next=NULL;
|
||||
prev=NULL;
|
||||
glogp->next=nullptr;
|
||||
prev=nullptr;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
@ -244,7 +244,7 @@ public:
|
||||
FILE *out=stdout, FILE *err=stderr,
|
||||
int out_level=vblALLBAD|vblMESS1,int stop_level=vblFATAL,
|
||||
int use_globally=0)
|
||||
: message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(NULL), ferr(NULL){
|
||||
: message_logger(descriptor_,out_level,stop_level,throw_exceptions,use_globally),fout(nullptr), ferr(nullptr){
|
||||
set_out(out);
|
||||
set_err(err);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ public:
|
||||
public:
|
||||
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
|
||||
}
|
||||
iterator():ptr(NULL),incr(0){}
|
||||
iterator():ptr(nullptr),incr(0){}
|
||||
iterator &operator++(){ // prefix
|
||||
ptr+=incr;
|
||||
return *this;
|
||||
@ -173,13 +173,13 @@ public:
|
||||
size_t sizex, sizey;
|
||||
|
||||
//e default constructor
|
||||
recmatrix(): parr(NULL,1) {
|
||||
recmatrix(): parr(nullptr,1) {
|
||||
sizey=sizex=0;
|
||||
arr=NULL;
|
||||
arr=nullptr;
|
||||
}
|
||||
|
||||
//e copy constructor: makes a managed copy
|
||||
recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(NULL){
|
||||
recmatrix(const recmatrix &other):sizex(0),sizey(0),arr(nullptr){
|
||||
*this=other;
|
||||
}
|
||||
|
||||
@ -222,7 +222,7 @@ public:
|
||||
virtual int init(size_t nx, size_t ny, int smanaged=-1){
|
||||
int managed=parr.managed();
|
||||
if(managed && (sizex!=nx || sizey!=ny)){
|
||||
parr.reset(NULL,0);
|
||||
parr.reset(nullptr,0);
|
||||
}
|
||||
if(smanaged>=0){ // for changing the managed flag?
|
||||
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
|
||||
@ -355,7 +355,7 @@ public:
|
||||
public:
|
||||
iterator(const iterator &other):ptr(other.ptr),incr(other.incr){
|
||||
}
|
||||
iterator():ptr(NULL),incr(0){}
|
||||
iterator():ptr(nullptr),incr(0){}
|
||||
iterator &operator++(){ // prefix
|
||||
ptr+=incr;
|
||||
return *this;
|
||||
@ -382,13 +382,13 @@ public:
|
||||
size_t size;
|
||||
|
||||
//e default constructor
|
||||
sqmatrix(): parr(NULL,1) {
|
||||
sqmatrix(): parr(nullptr,1) {
|
||||
size=0;
|
||||
arr=NULL;
|
||||
arr=nullptr;
|
||||
}
|
||||
|
||||
//e copy constructor: makes a managed copy
|
||||
sqmatrix(const sqmatrix &other):size(0),arr(NULL){
|
||||
sqmatrix(const sqmatrix &other):size(0),arr(nullptr){
|
||||
*this=other;
|
||||
}
|
||||
|
||||
@ -430,7 +430,7 @@ public:
|
||||
virtual int init(size_t n, int smanaged=-1){
|
||||
int managed=parr.managed();
|
||||
if(managed && size!=n){
|
||||
parr.reset(NULL,0);
|
||||
parr.reset(nullptr,0);
|
||||
}
|
||||
if(smanaged>=0){ // for changing the managed flag?
|
||||
parr.reset(parr.ptr(),smanaged ? smanaged|0x8 : 0 );
|
||||
@ -600,9 +600,9 @@ class PairHash{
|
||||
public:
|
||||
//e find the value with indexes i, j
|
||||
//e @return 0 if not found, 1 otherwise
|
||||
//e if retval is not NULL, puts the found value there
|
||||
virtual int Find(long i, long j, T *retval=NULL)=0;
|
||||
virtual int Find(long i, long j, T **retval=NULL)=0;
|
||||
//e if retval is not a null pointer, puts the found value there
|
||||
virtual int Find(long i, long j, T *retval=nullptr)=0;
|
||||
virtual int Find(long i, long j, T **retval=nullptr)=0;
|
||||
virtual int Del(long i, long j)=0;
|
||||
virtual int Put(long i, long j, const T *value)=0;
|
||||
virtual int Put(long i, long j, const T& value)=0;
|
||||
@ -621,7 +621,7 @@ public:
|
||||
indm.Set(-1);
|
||||
arr= new T[n*(n+1)/2];
|
||||
}
|
||||
int Find(long i, long j, T *retval=NULL){
|
||||
int Find(long i, long j, T *retval=nullptr){
|
||||
long ind=indm(i,j);
|
||||
if(ind>=0){
|
||||
if(retval){
|
||||
|
||||
@ -158,7 +158,7 @@ public:
|
||||
using base_t::second;
|
||||
using base_t::first;
|
||||
|
||||
mngptr(T* ptr=NULL, int managed=0): pair<T*,int>(ptr,managed){
|
||||
mngptr(T* ptr=nullptr, int managed=0): pair<T*,int>(ptr,managed){
|
||||
//if(managed==2)ptr= new T(*ptr);
|
||||
}
|
||||
mngptr(const mngarg<T> &arg): pair<T*,int>(arg.first,arg.second){}
|
||||
@ -166,7 +166,7 @@ public:
|
||||
reset(arg.first,arg.second);
|
||||
return *this;
|
||||
}
|
||||
void reset(T* ptr=NULL, int managed=0){
|
||||
void reset(T* ptr=nullptr, int managed=0){
|
||||
if(second && first && first!=ptr){
|
||||
if(second&0x8)delete [] first;
|
||||
else delete first;
|
||||
@ -313,7 +313,7 @@ template<class T, class delete_t=delete_ptr<T> >
|
||||
class shptr{
|
||||
template<class Y, class Z> friend class shptr;
|
||||
T *p;
|
||||
int *num; //if num==NULL than p is not managed (as in mngptr)
|
||||
int *num; //if num==nullptr than p is not managed (as in mngptr)
|
||||
|
||||
void set(T *p_, int managed){
|
||||
p=p_;
|
||||
@ -321,7 +321,7 @@ class shptr{
|
||||
num=new int;
|
||||
*num=1;
|
||||
}
|
||||
else num=NULL;
|
||||
else num=nullptr;
|
||||
}
|
||||
template<class Y>
|
||||
void set(const Y &other){
|
||||
@ -330,7 +330,7 @@ class shptr{
|
||||
num=other.num;
|
||||
if(num)(*num)++;
|
||||
}
|
||||
else num=NULL;
|
||||
else num=nullptr;
|
||||
}
|
||||
void set(const shptr &other){
|
||||
p=other.p;
|
||||
@ -338,11 +338,11 @@ class shptr{
|
||||
num=other.num;
|
||||
if(num)(*num)++;
|
||||
}
|
||||
else num=NULL;
|
||||
else num=nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
shptr(T* p=NULL, int managed=1){
|
||||
shptr(T* p=nullptr, int managed=1){
|
||||
set(p,managed);
|
||||
}
|
||||
shptr(const mngarg<T> &arg){
|
||||
@ -398,14 +398,14 @@ public:
|
||||
delete_t()(p);
|
||||
delete num;
|
||||
}
|
||||
num=NULL;
|
||||
num=nullptr;
|
||||
}
|
||||
p=NULL;
|
||||
p=nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
bool valid() const {
|
||||
return p!=NULL;
|
||||
return p!=nullptr;
|
||||
}
|
||||
|
||||
T* ptr() const {
|
||||
|
||||
@ -374,7 +374,7 @@ struct Vector_Nt {
|
||||
}
|
||||
|
||||
|
||||
T maxcoord(int *ind=NULL) const {
|
||||
T maxcoord(int *ind=nullptr) const {
|
||||
int im=0;
|
||||
T vv=v[0];
|
||||
for (int i=1; i<N; i++) {
|
||||
@ -389,7 +389,7 @@ struct Vector_Nt {
|
||||
|
||||
|
||||
//e returns the corrd having maximal absolute value
|
||||
T maxabscoord(int *ind=NULL) const {
|
||||
T maxabscoord(int *ind=nullptr) const {
|
||||
int im=0;
|
||||
T vv=fabs(v[0]);
|
||||
for (int i=1; i<N; i++) {
|
||||
@ -403,7 +403,7 @@ struct Vector_Nt {
|
||||
}
|
||||
|
||||
//e returns the corrd having minimal absolute value
|
||||
T minabscoord(int *ind=NULL) const {
|
||||
T minabscoord(int *ind=nullptr) const {
|
||||
int im=0;
|
||||
T vv=fabs(v[0]);
|
||||
for (int i=1; i<N; i++) {
|
||||
@ -417,7 +417,7 @@ struct Vector_Nt {
|
||||
}
|
||||
|
||||
|
||||
T mincoord(int *ind=NULL) const {
|
||||
T mincoord(int *ind=nullptr) const {
|
||||
int im=0;
|
||||
T vv=v[0];
|
||||
for (int i=1; i<N; i++) {
|
||||
@ -485,7 +485,7 @@ vec_type dist_av(Vector_3 *va1,Vector_3 *va2,int n);
|
||||
|
||||
//e finds the average difference norm between two vector sets of the same length
|
||||
/*e optionally gives the indexes for maximal and minimal difference
|
||||
va2 can be NULL, then the norm of va1 is used */
|
||||
va2 can be nullptr, then the norm of va1 is used */
|
||||
|
||||
vec_type diff_av(Vector_3 *va1,Vector_3 *va2,int n, int *minind=0, int *maxind=0);
|
||||
|
||||
@ -615,9 +615,9 @@ inline Vector_3 randdir(){
|
||||
|
||||
///\en Calculates extent of the vector container.
|
||||
/// \return the center of the vector set, optionally
|
||||
/// (if arguments are not NULL) fills the bounding box in \a box_min, \a box_max.
|
||||
/// (if arguments are not null pointers) fills the bounding box in \a box_min, \a box_max.
|
||||
template<class vec_inp_it>
|
||||
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=NULL,Vector_3* box_max=NULL){
|
||||
Vector_3 get_extent(vec_inp_it beg,vec_inp_it end, Vector_3* box_min=nullptr,Vector_3* box_max=nullptr){
|
||||
if(beg==end)
|
||||
return Vector_3();
|
||||
Vector_3 center(*beg++);
|
||||
|
||||
Reference in New Issue
Block a user