Skip to content

Commit

Permalink
replaced some char* with std::string
Browse files Browse the repository at this point in the history
  • Loading branch information
jodyxha committed Mar 11, 2024
1 parent 175050e commit 3b34c5d
Show file tree
Hide file tree
Showing 95 changed files with 577 additions and 353 deletions.
4 changes: 2 additions & 2 deletions QHG4/actions/ATanDeath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "ATanDeath.h"

template<typename T>
const char *ATanDeath<T>::asNames[] = {
const std::string ATanDeath<T>::asNames[] = {
ATTR_ATANDEATH_MAXAGE_NAME,
ATTR_ATANDEATH_RANGE_NAME,
ATTR_ATANDEATH_SLOPE_NAME,
Expand All @@ -28,7 +28,7 @@ ATanDeath<T>::ATanDeath(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, W
m_dRange(0),
m_dSlope(0) {

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/ATanDeath.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ class ATanDeath : public Action<T> {
double m_dRange;
double m_dSlope;
double m_dScale;

static const char *asNames[];
public:
static const std::string asNames[];

};

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AgentBinSplitter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
#include "AgentBinSplitter.h"

template<typename T>
const char *AgentBinSplitter<T>::asNames[] = {
const std::string AgentBinSplitter<T>::asNames[] = {
ATTR_ABS_BIN_MIN_NAME,
ATTR_ABS_BIN_MAX_NAME,
ATTR_ABS_NUM_BINS_NAME,
Expand Down Expand Up @@ -54,7 +54,7 @@ AgentBinSplitter<T>::AgentBinSplitter(SPopulation<T> *pPop, SCellGrid *pCG, std
m_pvLBCs = new std::vector<LBController *>[m_iNumThreads];
m_pvLBs = new std::vector<LayerBuf<T>>[m_iNumThreads];

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));
}


Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/AgentBinSplitter.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ class AgentBinSplitter : public Action<T> {
std::vector<LayerBuf<T>> *m_pvLBs; // numthread array of LB vectors

bool m_bVerbose;
static const char *asNames[];
public:
static const std::string asNames[];
};


Expand Down
2 changes: 1 addition & 1 deletion QHG4/actions/AgentEnv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

template<typename T>
const stringvec AgentEnv<T>::s_vNames = {
};
ATTR_AGENTENV_REQUIREMENTS_NAME};


//-----------------------------------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions QHG4/actions/AgentEnv.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class AgentEnv : public Action<T> , public Observer {
double *m_pFoodAvailable;
int *m_pAgentCounts;

public:
static const stringvec s_vNames;


Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AnimalReproducer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "AnimalReproducer.h"

template<typename T>
const char *AnimalReproducer<T>::asNames[] = {
const std::string AnimalReproducer<T>::asNames[] = {
ATTR_ANIMALREP_MASS_FERT_NAME,
ATTR_ANIMALREP_MASS_BABY_NAME,
ATTR_ANIMALREP_BIRTH_PROB_NAME,
Expand All @@ -28,7 +28,7 @@ AnimalReproducer<T>::AnimalReproducer(SPopulation<T> *pPop, SCellGrid *pCG, std:
m_dMassBaby(0),
m_dBirthProb(0) {

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AnimalReproducer.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ class AnimalReproducer : public Action<T> {
double m_dMassFert;
double m_dMassBaby;
double m_dBirthProb;

static const char *asNames[];
public:
static const std::string asNames[];

};

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AssortativePair.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
#include "ProteomeComparator.h"

template<typename T, class U>
const char *AssortativePair<T,U>::asNames[] = {
const std::string AssortativePair<T,U>::asNames[] = {
ATTR_ASSPAIR_PERMUTE,
ATTR_ASSPAIR_CUTOFF};

Expand Down Expand Up @@ -46,7 +46,7 @@ AssortativePair<T,U>::AssortativePair(SPopulation<T> *pPop, SCellGrid *pCG, std:
omp_init_lock(&m_aMLocks[i]);
}

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AssortativePair.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ class AssortativePair : public Action<T> {

omp_lock_t* m_aFLocks;
omp_lock_t* m_aMLocks;

static const char *asNames[];
public:
static const std::string asNames[];
};


Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/AssortativePairHam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "RankTable.h"

template<typename T, class U>
const char *AssortativePairHam<T,U>::asNames[] = {
const std::string AssortativePairHam<T,U>::asNames[] = {
ATTR_ASSPAIRHAM_CUTOFF,
ATTR_ASSPAIRHAM_PERMUTE};

Expand Down Expand Up @@ -44,7 +44,7 @@ AssortativePairHam<T,U>::AssortativePairHam(SPopulation<T> *pPop, SCellGrid *pCG
omp_init_lock(&m_aMLocks[i]);
}

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));
}


Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/AssortativePairHam.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ class AssortativePairHam : public Action<T> {
omp_lock_t* m_aFLocks;
omp_lock_t* m_aMLocks;

static const char *asNames[];
public:
static const std::string asNames[];
};


Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/BirthDeathRel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ template<typename T>
int BirthDeathRel<T>::NUM_BIRTHDEATHREL_PARAMS = 3;

template<typename T>
const char *BirthDeathRel<T>::asNames[] = {
const std::string BirthDeathRel<T>::asNames[] = {
ATTR_BIRTHDEATHREL_B0_NAME,
ATTR_BIRTHDEATHREL_D0_NAME,
ATTR_BIRTHDEATHREL_THETA_NAME};
Expand All @@ -46,7 +46,7 @@ BirthDeathRel<T>::BirthDeathRel(SPopulation<T> *pPop, SCellGrid *pCG, std::strin
m_dD0 = -1024;
m_dTheta = -1024;

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/BirthDeathRel.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ class BirthDeathRel : public Action<T> {
LinearDeathRel<T> *m_pLD;
ulong *m_pNumAgentsPerCell;

static const char *asNames[];
public:
static const std::string asNames[];
};

#endif
4 changes: 2 additions & 2 deletions QHG4/actions/BirthDeathRelComp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ template<typename T>
int BirthDeathRelComp<T>::NUM_BIRTHDEATHRELCOMP_PARAMS = 5;

template<typename T>
const char *BirthDeathRelComp<T>::asNames[] = {
const std::string BirthDeathRelComp<T>::asNames[] = {
ATTR_BIRTHDEATHRELCOMP_B0_NAME,
ATTR_BIRTHDEATHRELCOMP_D0_NAME,
ATTR_BIRTHDEATHRELCOMP_THETA_NAME,
Expand Down Expand Up @@ -51,7 +51,7 @@ BirthDeathRelComp<T>::BirthDeathRelComp(SPopulation<T> *pPop, SCellGrid *pCG, st
m_dD0 = -1024;
m_dTheta = -1024;

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/BirthDeathRelComp.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ class BirthDeathRelComp : public Action<T> {
ulong *m_pOtherCounts;
bool m_bReadDone;

static const char *asNames[];
public:
static const std::string asNames[];
};

#endif
4 changes: 2 additions & 2 deletions QHG4/actions/Birther.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include "Birther.h"

template<typename T>
const char *Birther<T>::asNames[] = {
const std::string Birther<T>::asNames[] = {
ATTR_BIRTHER_ADULTMASS_NAME,
ATTR_BIRTHER_BIRTHMASS_NAME,
ATTR_BIRTHER_UNCERTAINTY_NAME};
Expand All @@ -32,7 +32,7 @@ Birther<T>::Birther(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID, WELL5
m_dUncertainty(0),
m_pMI(NULL) {

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));
}


Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/Birther.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ class Birther : public Action<T> {
double m_dUncertainty;
MassInterface *m_pMI;

static const char *asNames[];
public:
static const std::string asNames[];
};

#endif
Expand Down
3 changes: 3 additions & 0 deletions QHG4/actions/CondWeightedMove.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,9 @@ class CondWeightedMove : public Action<T> {
MoveCondition *m_pMC;

Geography *m_pGeography;

public:
static const std::string asNames[];
};

#endif
4 changes: 2 additions & 2 deletions QHG4/actions/ConfinedMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "ConfinedMove.h"

template<typename T>
const char *ConfinedMove<T>::asNames[] = {
const std::string ConfinedMove<T>::asNames[] = {
ATTR_CONFINEDMOVE_X_NAME,
ATTR_CONFINEDMOVE_Y_NAME,
ATTR_CONFINEDMOVE_R_NAME};
Expand All @@ -29,7 +29,7 @@ ConfinedMove<T>::ConfinedMove(SPopulation<T> *pPop, SCellGrid *pCG, std::string
m_bAllowed(NULL),
m_bAbsorbing(false) {

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/ConfinedMove.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ class ConfinedMove : public Action<T> {
bool* m_bAllowed;
bool m_bAbsorbing;

static const char *asNames[];
public:
static const std::string asNames[];
};

#endif
4 changes: 2 additions & 2 deletions QHG4/actions/Fertility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "Fertility.h"

template<typename T>
const char *Fertility<T>::asNames[] = {
const std::string Fertility<T>::asNames[] = {
ATTR_FERTILITY_MIN_AGE_NAME,
ATTR_FERTILITY_MAX_AGE_NAME,
ATTR_FERTILITY_INTERBIRTH_NAME};
Expand All @@ -26,7 +26,7 @@ Fertility<T>::Fertility(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID)
m_fFertilityMaxAge(0),
m_fInterbirth(0) {

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));

}

Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/Fertility.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ class Fertility : public Action<T> {
float m_fFertilityMinAge;
float m_fFertilityMaxAge;
float m_fInterbirth;

static const char *asNames[];
public:
static const std::string asNames[];
};

#endif
4 changes: 2 additions & 2 deletions QHG4/actions/Genetics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ template<typename T, class U>
int Genetics<T,U>::NUM_GENETIC_PARAMS = 6;

template<typename T, class U>
const char *Genetics<T,U>::asNames[] = {
const std::string Genetics<T,U>::asNames[] = {
ATTR_GENETICS_GENOME_SIZE,
ATTR_GENETICS_NUM_CROSSOVER,
ATTR_GENETICS_MUTATION_RATE,
Expand Down Expand Up @@ -80,7 +80,7 @@ Genetics<T,U>::Genetics(SPopulation<T> *pPop, SCellGrid *pCG, std::string sID,
// GenomeCreator must exist before init() is called
m_pGenomeCreator = new GenomeCreator<U>(m_iNumParents);

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));
}


Expand Down
3 changes: 2 additions & 1 deletion QHG4/actions/Genetics.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,8 @@ class Genetics : public Action<T> {

SequenceIOUtils<ulong> *m_pSeqIO;

static const char *asNames[];
public:
static const std::string asNames[];
};


Expand Down
4 changes: 2 additions & 2 deletions QHG4/actions/GrassManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#include "GrassManager.h"

template<typename T>
const char *GrassManager<T>::asNames[] = {
const std::string GrassManager<T>::asNames[] = {
ATTR_GRASSMAN_MIN_MASS_NAME,
ATTR_GRASSMAN_MAX_MASS_NAME,
ATTR_GRASSMAN_GROWTH_RATE_NAME};
Expand All @@ -42,7 +42,7 @@ GrassManager<T>::GrassManager(SPopulation<T> *pPop, SCellGrid *pCG, std::string
omp_init_lock(&m_aGLocks[i]);
}

this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(char*));
this->m_vNames.insert(this->m_vNames.end(), asNames, asNames+sizeof(asNames)/sizeof(std::string));
}


Expand Down
5 changes: 3 additions & 2 deletions QHG4/actions/GrassManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,11 @@ class GrassManager : public Action<T> {

omp_lock_t* m_aGLocks;

static const char * asNames[];

int setAvailableMass();
int subtractMassConsumed();

public:
static const std::string asNames[];
};

#endif
4 changes: 3 additions & 1 deletion QHG4/actions/GroupMemberMove.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "QDFUtilsT.h"
#include "GroupMemberMove.h"


template<typename T>
const std::string GroupMemberMove<T>::asNames[] = {
ATTR_GROUPMEMBERMOVE_PROB_NAME,};
//-----------------------------------------------------------------------------
// constructor
//
Expand Down
4 changes: 3 additions & 1 deletion QHG4/actions/GroupMemberMove.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ class GroupMemberMove : public Action<T> {
WELL512 **m_apWELL;
AgentEnv<T> *m_pAE;
double m_dMoveProb;


public:
static const std::string asNames[];
};

#endif
Loading

0 comments on commit 3b34c5d

Please sign in to comment.