Commit 5a778be1 authored by Vedran Miletić's avatar Vedran Miletić

Replace NULL with nullptr

parent c179f115
......@@ -108,7 +108,7 @@ void OccupancyTest::testFlexAtomFactoryReceptor() {
// mode 1 is fixed receptor
for (int mode = 0; mode < 2; ++mode) {
if (mode == 1) {
spReceptor->SetFlexData(NULL);
spReceptor->SetFlexData(nullptr);
}
RbtFlexAtomFactory flexAtomFactory(spReceptor);
RbtAtomRList fixedAtomList = flexAtomFactory.GetFixedAtomList();
......
......@@ -103,12 +103,12 @@ double RbtChromTest::rmsd(const RbtCoordList &rc, const RbtCoordList &c) {
}
void RbtChromTest::testChromFactory() {
CPPUNIT_ASSERT(m_chrom_1koc.Ptr() != NULL);
CPPUNIT_ASSERT(m_chrom_1koc.Ptr() != nullptr);
}
void RbtChromTest::testCloneDestructor() {
RbtChromElementPtr clone = m_chrom_1koc->clone();
CPPUNIT_ASSERT(m_chrom_1koc.Ptr() != NULL);
CPPUNIT_ASSERT(m_chrom_1koc.Ptr() != nullptr);
}
void RbtChromTest::testCloneLengthEquals() {
......@@ -322,13 +322,13 @@ void RbtChromTest::testPopulationConstructorZeroSize() {
void RbtChromTest::testPopulationConstructorNullChromosome() {
setupWorkSpace();
int popSize = 100;
RbtPopulationPtr pop = new RbtPopulation(NULL, popSize, m_SF);
RbtPopulationPtr pop = new RbtPopulation(nullptr, popSize, m_SF);
}
void RbtChromTest::testPopulationConstructorNullSF() {
setupWorkSpace();
int popSize = 100;
RbtPopulationPtr pop = new RbtPopulation(m_chrom_1koc, popSize, NULL);
RbtPopulationPtr pop = new RbtPopulation(m_chrom_1koc, popSize, nullptr);
}
void RbtChromTest::testPopulationRWFitness() {
......@@ -404,8 +404,8 @@ void RbtChromTest::testRbtModelGetChromUndefinedFlexData() {
}
void RbtChromTest::testRbtModelGetChromNullFlexData() {
m_lig_1koc->SetFlexData(NULL);
m_recep_1koc->SetFlexData(NULL);
m_lig_1koc->SetFlexData(nullptr);
m_recep_1koc->SetFlexData(nullptr);
RbtChromElementPtr chrom = new RbtChrom();
chrom->Add(m_lig_1koc->GetChrom());
chrom->Add(m_recep_1koc->GetChrom());
......
......@@ -177,7 +177,7 @@ public:
// ModelPtr - pointer to the parent model
RbtModel *GetModelPtr() const { return m_pModel; }
void SetModelPtr(RbtModel *pModel = NULL) { m_pModel = pModel; }
void SetModelPtr(RbtModel *pModel = nullptr) { m_pModel = pModel; }
// DM 04 Dec 1998 Add functions to handle bond map
// Returns number of bonds in map
......
......@@ -52,7 +52,7 @@ public:
// Aggregate methods
// Appends a new chromosome element to the vector
// RbtChrom destructor is responsible for deleting the new element
// Null operation if pChromElement is NULL
// Null operation if pChromElement is nullptr
virtual void Add(RbtChromElement *pChromElement);
protected:
......
......@@ -32,7 +32,7 @@ public:
protected:
RbtFlexData(RbtDockingSite *pDockSite)
: m_pModel(NULL), m_pDockSite(pDockSite) {}
: m_pModel(nullptr), m_pDockSite(pDockSite) {}
private:
RbtModel *m_pModel;
......
......@@ -23,8 +23,8 @@
class RbtInteractionCenter {
public:
enum eLP { NONE, PLANE, LONEPAIR };
RbtInteractionCenter(RbtAtom *pAtom1 = NULL, RbtAtom *pAtom2 = NULL,
RbtAtom *pAtom3 = NULL, eLP LP = NONE)
RbtInteractionCenter(RbtAtom *pAtom1 = nullptr, RbtAtom *pAtom2 = nullptr,
RbtAtom *pAtom3 = nullptr, eLP LP = NONE)
: m_pAtom1(pAtom1), m_pAtom2(pAtom2), m_pAtom3(pAtom3), m_LP(LP) {
_RBTOBJECTCOUNTER_CONSTR_("RbtInteractionCenter");
}
......
......@@ -141,7 +141,7 @@ public:
void SetInteractionLists(T *pIntn, double radius) {
RbtAtom *pAtom = pIntn->GetProperty().atom;
if (NULL == pAtom)
if (nullptr == pAtom)
return;
const RbtCoord &c = pAtom->GetCoords();
RbtUIntList sphereIndices;
......
......@@ -182,14 +182,14 @@ public:
// DM 19 Oct 2005 - new chromosome handling
// Sets the flexibility type for this model
// To revert to a rigid model, call SetFlexData(NULL)
// To revert to a rigid model, call SetFlexData(nullptr)
void SetFlexData(RbtFlexData *pFlexData);
// Gets the flexibility type of this model
// Returns NULL for a rigid model
// Returns nullptr for a rigid model
RbtFlexData *GetFlexData() const;
// Returns a clone of the current chromosome for this model
// The caller has the responsibility for mem management of the clone
// Returns NULL for a rigid model
// Returns nullptr for a rigid model
RbtChromElement *GetChrom() const;
bool isFlexible() const;
......
......@@ -28,7 +28,8 @@
//
// To do: Should probably throw some other exception than std::exception if
// assert fails
// NOTE: it's a BAD idea to pass a NULL pointer to the SmartPtr<T> constructor
// NOTE: it's a BAD idea to pass a nullptr pointer to the SmartPtr<T>
// constructor
#ifndef _RBTSMARTPOINTER_H_
#define _RBTSMARTPOINTER_H_
......@@ -48,7 +49,7 @@ public:
// CONSTRUCTORS, DESTRUCTORS, ASSIGNMENT
// Default constructor, initialise both pointers to 0
SmartPtr() : m_pT(NULL), m_pCount(NULL) {}
SmartPtr() : m_pT(nullptr), m_pCount(nullptr) {}
// Parameterised constructor
// Create new counter, initialise to 1
......@@ -112,7 +113,7 @@ public:
// Tests if smart pointer is empty (i.e. does it have a counter?)
// Doesn't actually tell you if the underlying pointer is null
bool Null() const { return m_pCount == NULL; }
bool Null() const { return m_pCount == nullptr; }
// Returns pointer to counter
unsigned *GetCountPtr() const { return m_pCount; }
......@@ -167,8 +168,8 @@ private:
delete m_pT;
delete m_pCount;
}
m_pT = NULL;
m_pCount = NULL;
m_pT = nullptr;
m_pCount = nullptr;
}
T *m_pT; // Pointer to the underlying object
......
......@@ -5,7 +5,7 @@ template <class singleton_type> class Singleton {
protected:
enum action { DESTROY, CREATE, GET };
static singleton_type *object(const action &a) {
static singleton_type *obj = NULL;
static singleton_type *obj = nullptr;
switch (a) {
case DESTROY:
delete obj;
......@@ -15,12 +15,12 @@ protected:
case CREATE:
return (obj = new singleton_type);
}
return NULL;
return nullptr;
}
public:
inline static singleton_type &instance() {
if (object(GET) != NULL) {
if (object(GET) != nullptr) {
return *object(GET);
} else {
return *object(CREATE);
......
......@@ -27,7 +27,7 @@
// GetRbtRoot - returns value of RBT_ROOT env variable
std::string Rbt::GetRbtRoot() {
char *szRbtRoot = getenv("RBT_ROOT");
if (szRbtRoot != (char *)NULL) {
if (szRbtRoot != (char *)nullptr) {
return std::string(szRbtRoot);
} else {
return GetCurrentDirectory();
......@@ -40,11 +40,11 @@ std::string Rbt::GetRbtRoot() {
// If HOME is undefined, returns current working directory
std::string Rbt::GetRbtHome() {
char *szRbtHome = getenv("RBT_HOME");
if (szRbtHome != (char *)NULL) {
if (szRbtHome != (char *)nullptr) {
return std::string(szRbtHome);
} else {
szRbtHome = getenv("HOME");
if (szRbtHome != (char *)NULL) {
if (szRbtHome != (char *)nullptr) {
return std::string(szRbtHome);
} else {
return GetCurrentDirectory();
......@@ -62,7 +62,7 @@ std::string Rbt::GetBuild() { return IDS_BUILDNUM; }
std::string Rbt::GetProduct() { return IDS_PRODUCT; }
// GetTime - returns current time as an RbtString
std::string Rbt::GetTime() {
time_t t = ::time(NULL); // Get time in seconds since 1970
time_t t = ::time(nullptr); // Get time in seconds since 1970
tm *pLocalTime = ::localtime(&t); // Convert to local time struct
return std::string(::asctime(pLocalTime)); // Convert to ascii string
}
......@@ -70,7 +70,7 @@ std::string Rbt::GetTime() {
std::string Rbt::GetCurrentDirectory() {
std::string strCwd(".");
char *szCwd = new char[PATH_MAX + 1]; // Allocate a temp char* array
if (::getcwd(szCwd, PATH_MAX) != (char *)NULL) { // Get the cwd
if (::getcwd(szCwd, PATH_MAX) != (char *)nullptr) { // Get the cwd
strCwd = szCwd;
// strCwd += "/";
}
......@@ -147,7 +147,7 @@ RbtStringList Rbt::GetDirList(const std::string &strDir,
0); // Check if we need to match on file type (suffix)
DIR *pDir = opendir(strDir.c_str()); // Open directory
if (pDir != NULL) {
if (pDir != nullptr) {
// DM 6 Dec 1999 - dirent_t appears to be SGI MIPSPro specific
// At least on Linux g++, it is called dirent
......@@ -157,7 +157,7 @@ RbtStringList Rbt::GetDirList(const std::string &strDir,
dirent *pEntry;
#endif
while ((pEntry = readdir(pDir)) != NULL) { // Read each entry
while ((pEntry = readdir(pDir)) != nullptr) { // Read each entry
std::string strFile = pEntry->d_name;
if ((strFile == ".") || (strFile == ".."))
continue; // Don't need to consider . and ..
......
......@@ -28,7 +28,7 @@ RbtAtom::RbtAtom()
m_eState(UNDEFINED), // DM 8 Dec 1998 Changed from SP3 to UNDEFINED
m_nHydrogens(0), m_nFormalCharge(0), m_coord(0.0, 0.0, 0.0),
m_dPartialCharge(0.0), m_dGroupCharge(0.0), m_dAtomicMass(0.0),
m_dVdwRadius(0.0), m_strFFType(""), m_pModel(NULL), m_bCyclic(false),
m_dVdwRadius(0.0), m_strFFType(""), m_pModel(nullptr), m_bCyclic(false),
m_bSelected(false), m_bUser1(false),
m_dUser1(1.0), // DM 27 Jul 2000 - initialise user values to 1 as they are
// commonly used as weightings
......@@ -52,7 +52,7 @@ RbtAtom::RbtAtom(int nAtomId, int nAtomicNo /*= 6*/,
m_strSegmentName(strSegmentName), m_eState(eState),
m_nHydrogens(nHydrogens), m_nFormalCharge(nFormalCharge),
m_coord(0.0, 0.0, 0.0), m_dPartialCharge(0.0), m_dGroupCharge(0.0),
m_dAtomicMass(0.0), m_dVdwRadius(0.0), m_strFFType(""), m_pModel(NULL),
m_dAtomicMass(0.0), m_dVdwRadius(0.0), m_strFFType(""), m_pModel(nullptr),
m_bCyclic(false), m_bSelected(false), m_bUser1(false),
m_dUser1(1.0), // DM 27 Jul 2000 - initialise user values to 1 as they are
// commonly used as weightings
......@@ -87,8 +87,8 @@ RbtAtom::RbtAtom(const RbtAtom &atom) {
m_dUser2 = atom.m_dUser2;
m_nPMFType = atom.m_nPMFType;
m_triposType = atom.m_triposType;
// Copied atoms no longer belong to the model so set to NULL here
SetModelPtr(NULL);
// Copied atoms no longer belong to the model so set to nullptr here
SetModelPtr(nullptr);
// Copied atoms no longer belong to the bonds so erase the bond map
ClearBondMap();
// Set the cyclic flag to false as the atom isn't bonded to anything
......@@ -122,8 +122,8 @@ RbtAtom &RbtAtom::operator=(const RbtAtom &atom) {
m_dUser2 = atom.m_dUser2;
m_nPMFType = atom.m_nPMFType;
m_triposType = atom.m_triposType;
// Copied atoms no longer belong to the model so set to NULL here
SetModelPtr(NULL);
// Copied atoms no longer belong to the model so set to nullptr here
SetModelPtr(nullptr);
// Copied atoms no longer belong to the bonds so erase the bond map
ClearBondMap();
// Set the cyclic flag to false as the atom isn't bonded to anything
......@@ -148,7 +148,7 @@ std::ostream &operator<<(std::ostream &s, const RbtAtom &atom) {
std::ostream &RbtAtom::Print(std::ostream &s) const {
// Get owning model name (if any)
std::string strModelName = "Orphan";
if (m_pModel != NULL)
if (m_pModel != nullptr)
strModelName = m_pModel->GetName();
RbtTriposAtomType triposType;
......@@ -616,7 +616,7 @@ unsigned int Rbt::GetNumBondedAtoms(const RbtAtom *pAtom) {
// Attempt the dynamic cast (on the regular pointer)
RbtPseudoAtom *pPseudoAtom =
dynamic_cast<RbtPseudoAtom *>(const_cast<RbtAtom *>(pAtom));
if (pPseudoAtom != NULL)
if (pPseudoAtom != nullptr)
return pPseudoAtom->GetNumAtoms();
else
return Rbt::GetNumBondedAtoms(pAtom->GetBondMap());
......@@ -626,7 +626,7 @@ RbtAtomList Rbt::GetBondedAtomList(const RbtAtom *pAtom) {
// Attempt the dynamic cast (on the regular pointer)
RbtPseudoAtom *pPseudoAtom =
dynamic_cast<RbtPseudoAtom *>(const_cast<RbtAtom *>(pAtom));
if (pPseudoAtom != NULL)
if (pPseudoAtom != nullptr)
return pPseudoAtom->GetAtomList();
else
return Rbt::GetBondedAtomList(pAtom->GetBondMap());
......
......@@ -25,7 +25,7 @@ std::string RbtBaseObject::_TRACE("TRACE");
// Constructors/destructors
RbtBaseObject::RbtBaseObject(const std::string &strClass,
const std::string &strName)
: m_workspace(NULL), m_enabled(true), m_trace(0) {
: m_workspace(nullptr), m_enabled(true), m_trace(0) {
// Add parameters
AddParameter(_CLASS, strClass);
AddParameter(_NAME, strName);
......@@ -101,7 +101,7 @@ void RbtBaseObject::Unregister() {
#endif //_DEBUG
m_workspace->Detach(this);
}
m_workspace = NULL;
m_workspace = nullptr;
}
// Get workspace pointer
......
......@@ -23,7 +23,7 @@ std::string RbtBaseSF::_INTRA_SF("SCORE.INTRA");
////////////////////////////////////////
// Constructors/destructors
RbtBaseSF::RbtBaseSF(const std::string &strClass, const std::string &strName)
: RbtBaseObject(strClass, strName), m_parent(NULL), m_weight(1.0),
: RbtBaseObject(strClass, strName), m_parent(nullptr), m_weight(1.0),
m_range(10.0) {
#ifdef _DEBUG
std::cout << _CT << " parameterised constructor for " << strClass
......
......@@ -21,7 +21,7 @@ std::string RbtBaseTransform::_CT("RbtBaseTransform");
// Constructors/destructors
RbtBaseTransform::RbtBaseTransform(const std::string &strClass,
const std::string &strName)
: RbtBaseObject(strClass, strName), m_parent(NULL) {
: RbtBaseObject(strClass, strName), m_parent(nullptr) {
#ifdef _DEBUG
std::cout << _CT << " parameterised constructor" << std::endl;
#endif //_DEBUG
......@@ -101,10 +101,10 @@ void RbtBaseTransform::ClearSFRequests() { m_SFRequests.clear(); }
void RbtBaseTransform::SendSFRequests() {
// Get the current scoring function from the workspace
RbtWorkSpace *pWorkSpace = GetWorkSpace();
if (pWorkSpace == NULL) // Return if this transform is not registered
if (pWorkSpace == nullptr) // Return if this transform is not registered
return;
RbtBaseSF *pSF = pWorkSpace->GetSF();
if (pSF == NULL) // Return if workspace does not have a scoring function
if (pSF == nullptr) // Return if workspace does not have a scoring function
return;
// Send each request to the scoring function
for (RbtRequestListConstIter iter = m_SFRequests.begin();
......
......@@ -122,9 +122,9 @@ void RbtCavityGridSF::ParameterUpdated(const std::string &strName) {
RbtCavityGridSF::HeavyAtomFactory::HeavyAtomFactory(RbtModelList modelList) {
for (RbtModelListConstIter iter = modelList.begin(); iter != modelList.end();
iter++) {
if ((*iter).Ptr() != NULL) {
if ((*iter).Ptr() != nullptr) {
RbtFlexData *pFlexData = (*iter)->GetFlexData();
if (pFlexData != NULL) {
if (pFlexData != nullptr) {
pFlexData->Accept(*this);
}
}
......
......@@ -26,9 +26,9 @@ RbtFlexAtomFactory::RbtFlexAtomFactory(RbtModelList modelList) {
}
void RbtFlexAtomFactory::Visit(RbtModel *pModel) {
if (pModel != NULL) {
if (pModel != nullptr) {
RbtFlexData *pFlexData = pModel->GetFlexData();
if (pFlexData != NULL) {
if (pFlexData != nullptr) {
pFlexData->Accept(*this);
} else {
// If flex data is null, then model is rigid by default
......
......@@ -51,11 +51,11 @@ void RbtGATransform::SetupTransform() {}
void RbtGATransform::Execute() {
RbtWorkSpace *pWorkSpace = GetWorkSpace();
if (pWorkSpace == NULL) {
if (pWorkSpace == nullptr) {
return;
}
RbtBaseSF *pSF = pWorkSpace->GetSF();
if (pSF == NULL) {
if (pSF == nullptr) {
return;
}
RbtPopulationPtr pop = pWorkSpace->GetPopulation();
......
......@@ -44,7 +44,7 @@ RbtGenome::~RbtGenome() {
RbtGenome *RbtGenome::clone() const { return new RbtGenome(*this); }
void RbtGenome::SetScore(RbtBaseSF *pSF) {
if (pSF != NULL) {
if (pSF != nullptr) {
m_chrom->SyncToModel();
m_score = -pSF->Score();
} else {
......
......@@ -196,7 +196,7 @@ void RbtInteractionGrid::SetInteractionLists(RbtInteractionCenter *pIntn,
double radius) {
// Index using atom 1 coords - check if atom 1 is present
RbtAtom *pAtom1 = pIntn->GetAtom1Ptr();
if (pAtom1 == NULL)
if (pAtom1 == nullptr)
return;
// DM 27 Oct 2000 - GetCoords now returns by reference
......
......@@ -29,7 +29,8 @@ RbtModel::RbtModel(RbtBaseMolecularFileSource *pMolSource)
//(Fairly) temporary constructor taking arbitrary atom and bond lists
// Use with caution
RbtModel::RbtModel(RbtAtomList &atomList, RbtBondList &bondList)
: m_pFlexData(NULL), m_pChrom(NULL), m_occupancy(1.0), m_enabled(true) {
: m_pFlexData(nullptr), m_pChrom(nullptr), m_occupancy(1.0),
m_enabled(true) {
AddAtoms(atomList); // Register atoms with model
m_bondList = bondList;
// Rbt::FindRings(m_atomList,m_bondList,m_ringList);
......@@ -532,11 +533,11 @@ void RbtModel::SetFlexData(RbtFlexData *pFlexData) {
// the same RbtFlexData object before deleting the old one
if (m_pFlexData && (m_pFlexData != pFlexData)) {
delete m_pFlexData;
m_pFlexData = NULL;
m_pFlexData = nullptr;
}
if (m_pChrom) {
delete m_pChrom;
m_pChrom = NULL;
m_pChrom = nullptr;
}
m_pFlexData = pFlexData;
if (m_pFlexData) {
......@@ -553,7 +554,7 @@ RbtFlexData *RbtModel::GetFlexData() const { return m_pFlexData; }
// Returns a clone of the current chromosome for this model
// The caller has the responsibility for mem management of the clone
RbtChromElement *RbtModel::GetChrom() const {
return (m_pChrom) ? m_pChrom->clone() : NULL;
return (m_pChrom) ? m_pChrom->clone() : nullptr;
}
bool RbtModel::isFlexible() const { return !m_spMutator.Null(); }
......@@ -862,11 +863,11 @@ void RbtModel::Clear() {
m_strName = "";
m_titleList.clear();
// Set the parent model pointer to NULL for each atom, before
// Set the parent model pointer to nullptr for each atom, before
// clearing the atom list, in case someone has copies of the atom list
RbtAtomListIter iter;
for (iter = m_atomList.begin(); iter != m_atomList.end(); iter++)
(*iter)->SetModelPtr(NULL);
(*iter)->SetModelPtr(nullptr);
m_atomList.clear();
m_bondList.clear();
......@@ -880,14 +881,14 @@ void RbtModel::Clear() {
m_coordNames.clear(); // Clear map of named coords
m_dataMap.clear(); // DM 12 May 1999 - clear associated data
ClearPseudoAtoms();
SetFlexData(NULL);
SetFlexData(nullptr);
}
// Helper function for the constructor
// Create a new model from a data source
void RbtModel::Create(RbtBaseMolecularFileSource *pMolSource) {
m_pFlexData = NULL;
m_pChrom = NULL;
m_pFlexData = nullptr;
m_pChrom = nullptr;
Clear(); // Clear previous model, if any
try {
......@@ -943,7 +944,7 @@ void RbtModel::Create(RbtBaseMolecularFileSource *pMolSource) {
// 31 Oct 2000 (DM) Hack to disable ring detection
// if $RBT_NORINGS is defined
char *szRbtNoRings = getenv("RBT_NORINGS");
if (szRbtNoRings == (char *)NULL) {
if (szRbtNoRings == (char *)nullptr) {
Rbt::FindRings(m_atomList, m_bondList, m_ringList);
// than set aromatic type for pi atoms. m_ringList is RbtAtomListList
for (RbtAtomListListIter rIter = m_ringList.begin();
......
......@@ -31,7 +31,7 @@ void PrintAtomList(RbtAtomRListConstIter i1, RbtAtomRListConstIter i2) {
RbtModelMutator::RbtModelMutator(RbtModel *pModel, const RbtBondList &rotBonds,
const RbtAtomList &tetheredAtoms)
: m_pModel(pModel), m_rotBonds(rotBonds), m_tetheredAtoms(tetheredAtoms) {
if (m_pModel != NULL) {
if (m_pModel != nullptr) {
Setup();
}
_RBTOBJECTCOUNTER_CONSTR_("RbtModelMutator");
......@@ -66,7 +66,7 @@ void RbtModelMutator::Setup() {
m_rotAtoms.clear();
m_flexIntns.clear();
if (m_pModel == NULL)
if (m_pModel == nullptr)
return;
int nAtoms = m_pModel->GetNumAtoms();
......
......@@ -55,7 +55,7 @@ void RbtNullTransform::Execute() {
// does not exist, in which case same as level 1
else if (iTrace > 5) {
RbtPopulationPtr pop = GetWorkSpace()->GetPopulation();
if (pop.Ptr() == NULL) {
if (pop.Ptr() == nullptr) {
GetWorkSpace()->SaveHistory(true);
} else {
const RbtGenomeList &genList = pop->GetGenomeList();
......
......@@ -36,7 +36,7 @@ const std::string &RbtPRMFactory::_SOLV_SECTION = "SOLVENT";
const std::string &RbtPRMFactory::_SOLV_FILE = "FILE";
RbtPRMFactory::RbtPRMFactory(RbtParameterFileSource *pParamSource)
: m_pParamSource(pParamSource), m_pDS(NULL), m_iTrace(0) {}
: m_pParamSource(pParamSource), m_pDS(nullptr), m_iTrace(0) {}
RbtPRMFactory::RbtPRMFactory(RbtParameterFileSource *pParamSource,
RbtDockingSite *pDS)
......
......@@ -422,12 +422,13 @@ double RbtPolarSF::PolarScore(const RbtInteractionCenter *pIC1,
RbtAtom *pAtom1_2 = pIC1->GetAtom2Ptr();
RbtAtom *pAtom1_3 = pIC1->GetAtom3Ptr();
RbtInteractionCenter::eLP eLP1 = pIC1->LP();
bool bAngle1 = ((pAtom1_2 != NULL) && (pAtom1_3 == NULL)) ? true : false;
bool bPlane1 = ((pAtom1_2 != NULL) && (pAtom1_3 != NULL) &&
bool bAngle1 =
((pAtom1_2 != nullptr) && (pAtom1_3 == nullptr)) ? true : false;
bool bPlane1 = ((pAtom1_2 != nullptr) && (pAtom1_3 != nullptr) &&
(eLP1 == RbtInteractionCenter::NONE))
? true
: false;
bool bLP1 = ((pAtom1_2 != NULL) && (pAtom1_3 != NULL) &&
bool bLP1 = ((pAtom1_2 != nullptr) && (pAtom1_3 != nullptr) &&
(eLP1 != RbtInteractionCenter::NONE))
? true
: false;
......@@ -452,12 +453,13 @@ double RbtPolarSF::PolarScore(const RbtInteractionCenter *pIC1,
RbtAtom *pAtom2_2 = (*IC2Iter)->GetAtom2Ptr();
RbtAtom *pAtom2_3 = (*IC2Iter)->GetAtom3Ptr();
RbtInteractionCenter::eLP eLP2 = (*IC2Iter)->LP();
bool bAngle2 = ((pAtom2_2 != NULL) && (pAtom2_3 == NULL)) ? true : false;
bool bPlane2 = ((pAtom2_2 != NULL) && (pAtom2_3 != NULL) &&
bool bAngle2 =
((pAtom2_2 != nullptr) && (pAtom2_3 == nullptr)) ? true : false;
bool bPlane2 = ((pAtom2_2 != nullptr) && (pAtom2_3 != nullptr) &&
(eLP2 == RbtInteractionCenter::NONE))
? true
: false;
bool bLP2 = ((pAtom2_2 != NULL) && (pAtom2_3 != NULL) &&
bool bLP2 = ((pAtom2_2 != nullptr) && (pAtom2_3 != nullptr) &&
(eLP2 != RbtInteractionCenter::NONE))
? true
: false;
......
......@@ -20,7 +20,7 @@ std::string RbtPopulation::_CT("RbtPopulation");
RbtPopulation::RbtPopulation(RbtChromElement *pChr, int size, RbtBaseSF *pSF)
: m_size(size), m_c(2.0), m_pSF(pSF), m_rand(Rbt::GetRbtRand()),
m_scoreMean(0.0), m_scoreVariance(0.0) {
if (pChr == NULL) {
if (pChr == nullptr) {
throw RbtBadArgument(
_WHERE_, "Null chromosome element passed to RbtPopulation constructor");
} else if (size <= 0) {
......@@ -45,7 +45,7 @@ RbtPopulation::~RbtPopulation() { _RBTOBJECTCOUNTER_DESTR_(_CT); }
// Sets the scoring function used for ranking genomes
void RbtPopulation::SetSF(RbtBaseSF *pSF) {
if (pSF == NULL) {
if (pSF == nullptr) {
throw RbtBadArgument(_WHERE_, "Null scoring function passed to SetSF");
}
m_pSF = pSF;
......
......@@ -40,7 +40,7 @@ RbtRand::~RbtRand() { _RBTOBJECTCOUNTER_DESTR_("RbtRand"); }
void RbtRand::Seed(int seed) { m_rand.seed(seed); }
// Seed the random number generator from the system clock
void RbtRand::SeedFromClock() { m_rand.seed(::time(NULL)); }
void RbtRand::SeedFromClock() { m_rand.seed(::time(nullptr)); }
// Returns current seed
int RbtRand::GetSeed() { return m_rand.GetSeed(); }
......
......@@ -48,11 +48,11 @@ void RbtRandPopTransform::SetupTransform() {
// Pure virtual in RbtBaseTransform
// Actually apply the transform
void RbtRandPopTransform::Execute() {
if (m_chrom.Ptr() == NULL) {
if (m_chrom.Ptr() == nullptr) {
return;
}
RbtBaseSF *pSF = GetWorkSpace()->GetSF();
if (pSF == NULL) {
if (pSF == nullptr) {
return;
}
int popSize = GetParameter(_POP_SIZE);
......
......@@ -27,7 +27,7 @@ RbtRealGrid::RbtRealGrid(const RbtCoord &gridMin, const RbtCoord &gridStep,
unsigned int NX, unsigned int NY, unsigned int NZ,
unsigned int NPad)
: RbtBaseGrid(gridMin, gridStep, NX, NY, NZ, NPad), m_tol(0.001),
m_grid(NULL), m_data(NULL) {
m_grid(nullptr), m_data(nullptr) {
CreateArrays();
// Initialise the grid to zero
SetAllValues(0.0);
......@@ -37,7 +37,7 @@ RbtRealGrid::RbtRealGrid(const RbtCoord &gridMin, const RbtCoord &gridStep,
// Constructor reading params from binary stream
RbtRealGrid::RbtRealGrid(std::istream &istr)
: RbtBaseGrid(istr), m_grid(NULL), m_data(NULL) {
: RbtBaseGrid(istr), m_grid(nullptr), m_data(nullptr) {
// Base class constructor has already read the grid dimensions
// etc, so all we have to do here is created the array
// and read in the grid values
......@@ -54,7 +54,7 @@ RbtRealGrid::~RbtRealGrid() {
// Copy constructor
RbtRealGrid::RbtRealGrid(const RbtRealGrid &grid)
: RbtBaseGrid(grid), m_grid(NULL), m_data(NULL) {
: RbtBaseGrid(grid), m_grid(nullptr), m_data(nullptr) {
// Base class constructor has already been called
// so we just need to create the array and copy the array values
CreateArrays();
......@@ -65,7 +65,7 @@ RbtRealGrid::RbtRealGrid(const RbtRealGrid &grid)
// Copy constructor taking a base class argument
// Sets up the grid dimensions, then creates an empty data array
RbtRealGrid::RbtRealGrid(const RbtBaseGrid &grid)
: RbtBaseGrid(grid), m_grid(NULL), m_data(NULL) {
: RbtBaseGrid(grid), m_grid(nullptr), m_data(nullptr) {
CreateArrays();
SetAllValues(0.0);
_RBTOBJECTCOUNTER_COPYCONSTR_("RbtRealGrid");
......@@ -524,7 +524,7 @@ void RbtRealGrid::SetValues(const RbtUIntList &iXYZList, double val,
}
void RbtRealGrid::CreateArrays() {
if (m_grid != NULL) { // Clear existing grid
if (m_grid != nullptr) { // Clear existing grid
ClearArrays();
}
int nX = GetNX();
......@@ -551,8 +551,8 @@ void RbtRealGrid::ClearArrays() {
delete m_grid[1][1];
delete m_grid[1];
delete m_grid;
m_grid = NULL;
m_data = NULL;
m_grid = nullptr;
m_data = nullptr;
}
// Helper function called by copy constructor and assignment operator
......
......@@ -113,8 +113,8 @@ void RbtSFAgg::Remove(RbtBaseSF *pSF) {
<< GetName() << std::endl;
#endif //_DEBUG
m_sf.erase(iter);
pSF->m_parent =
NULL; // Nullify the parent pointer of the child that has been removed
pSF->m_parent = nullptr; // Nullify the parent pointer of the child that has
// been removed
}
}
......
......@@ -126,10 +126,10 @@ void RbtSimAnnTransform::SetupTransform() {
void RbtSimAnnTransform::Execute() {
// Get the current scoring function from the workspace
RbtWorkSpace *pWorkSpace = GetWorkSpace();
if (pWorkSpace == NULL) // Return if this transform is not registered
if (pWorkSpace == nullptr) // Return if this transform is not registered
return;
RbtBaseSF *pSF = pWorkSpace->GetSF();
if (pSF == NULL) // Return if workspace does not have a scoring function
if (pSF == nullptr) // Return if workspace does not have a scoring function
return;
int iTrace = GetTrace();
......
......@@ -77,10 +77,10 @@ void RbtSimplexTransform::SetupTransform() {
void RbtSimplexTransform::Execute() {
// Get the current scoring function from the workspace
RbtWorkSpace *pWorkSpace = GetWorkSpace();
if (pWorkSpace == NULL) // Return if this transform is not registered
if (pWorkSpace == nullptr) // Return if this transform is not registered
return;
RbtBaseSF *pSF = pWorkSpace->GetSF();
if (pSF == NULL) // Return if workspace does not have a scoring function
if (pSF == nullptr) // Return if workspace does not have a scoring function
return;
int iTrace = GetTrace();
......
......@@ -78,8 +78,8 @@ void RbtTransformAgg::Remove(RbtBaseTransform *pTransform) {
<< " from " << GetName() << std::endl;
#endif //_DEBUG
m_transforms.erase(iter);
pTransform->m_parent =
NULL; // Nullify the parent pointer of the child that has been removed
pTransform->m_parent = nullptr; // Nullify the parent pointer of the child
// that has been removed
}
}
......
......@@ -57,7 +57,7 @@ void RbtVdwGridSF::SetupReceptor() {
// Read grids