[Avida-cvs] [avida-svn] r440 - in development: Avida.xcodeproj source/main source/script
brysonda@myxo.css.msu.edu
brysonda at myxo.css.msu.edu
Wed Jan 18 09:50:07 PST 2006
Author: brysonda
Date: 2006-01-18 12:50:07 -0500 (Wed, 18 Jan 2006)
New Revision: 440
Added:
development/source/script/cASLibrary.cc
development/source/script/cASLibrary.h
development/source/script/cASSymbol.cc
development/source/script/cASSymbol.h
development/source/script/cParser.cc
development/source/script/cParser.h
Modified:
development/Avida.xcodeproj/project.pbxproj
development/source/main/MyCodeArrayLessThan.h
development/source/main/cAvidaTriggers.h
development/source/main/cBirthChamber.h
development/source/main/cEnvironment.h
development/source/main/cFitnessMatrix.h
development/source/main/cGenome.h
development/source/main/cGenomeUtil.h
development/source/main/cInstLibBase.h
development/source/main/cInstSet.h
development/source/main/cInstUtil.h
development/source/main/cInstruction.h
development/source/main/cLandscape.h
development/source/main/cLocalMutations.cc
development/source/main/cLocalMutations.h
development/source/main/cMutation.h
development/source/main/cMutationLib.h
development/source/main/cMutationRates.h
development/source/main/cMxCodeArray.h
development/source/main/cOrgMessage.h
development/source/main/cOrganism.h
development/source/main/cPhenotype.h
development/source/main/cPopulation.h
development/source/main/cPopulationCell.h
development/source/main/cPopulationInterface.h
development/source/main/cReaction.h
development/source/main/cReactionLib.h
development/source/main/cReactionProcess.h
development/source/main/cReactionRequisite.h
development/source/main/cReactionResult.h
development/source/main/cResource.h
development/source/main/cResourceCount.h
development/source/main/cResourceLib.h
development/source/main/cSpatialCountElem.cc
development/source/main/cSpatialCountElem.h
development/source/main/cSpatialResCount.h
development/source/main/cStats.h
development/source/main/cTaskEntry.h
development/source/main/cTaskLib.h
development/source/main/cWorld.h
Log:
Update coding style, specifically addressing unimplemented default constructor, copy constructor and assignment operator, for all classes in main.
Add in some stub script classes.
Modified: development/Avida.xcodeproj/project.pbxproj
===================================================================
--- development/Avida.xcodeproj/project.pbxproj 2006-01-17 15:57:55 UTC (rev 439)
+++ development/Avida.xcodeproj/project.pbxproj 2006-01-18 17:50:07 UTC (rev 440)
@@ -80,6 +80,9 @@
706D32EB0854A39900D7DC8F /* organism.parasite in CopyFiles */ = {isa = PBXBuildFile; fileRef = DCC311980762539F008F7A48 /* organism.parasite */; };
706D330F0854A7B900D7DC8F /* organism.smt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 706D330E0854A7B900D7DC8F /* organism.smt */; };
706D33280854A90D00D7DC8F /* inst_set.smt in CopyFiles */ = {isa = PBXBuildFile; fileRef = 706D33270854A90D00D7DC8F /* inst_set.smt */; };
+ 7073165D097C6C8F00815164 /* cParser.cc in Sources */ = {isa = PBXBuildFile; fileRef = 7073165B097C6C8F00815164 /* cParser.cc */; };
+ 70731665097C6DF500815164 /* cASLibrary.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70731663097C6DF500815164 /* cASLibrary.cc */; };
+ 7073166B097C6E0C00815164 /* cASSymbol.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70731669097C6E0C00815164 /* cASSymbol.cc */; };
70B0865908F4974300FC65FE /* cLandscape.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0865108F4974300FC65FE /* cLandscape.cc */; };
70B0865C08F4974300FC65FE /* cLocalMutations.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0865408F4974300FC65FE /* cLocalMutations.cc */; };
70B0865E08F4974300FC65FE /* cMutationLib.cc in Sources */ = {isa = PBXBuildFile; fileRef = 70B0865608F4974300FC65FE /* cMutationLib.cc */; };
@@ -558,6 +561,12 @@
706D30CC0852328F00D7DC8F /* tInstLib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = tInstLib.h; sourceTree = "<group>"; };
706D330E0854A7B900D7DC8F /* organism.smt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = organism.smt; sourceTree = "<group>"; };
706D33270854A90D00D7DC8F /* inst_set.smt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = inst_set.smt; sourceTree = "<group>"; };
+ 7073165A097C6C8F00815164 /* cParser.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cParser.h; sourceTree = "<group>"; };
+ 7073165B097C6C8F00815164 /* cParser.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cParser.cc; sourceTree = "<group>"; };
+ 70731662097C6DF500815164 /* cASLibrary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cASLibrary.h; sourceTree = "<group>"; };
+ 70731663097C6DF500815164 /* cASLibrary.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cASLibrary.cc; sourceTree = "<group>"; };
+ 70731668097C6E0C00815164 /* cASSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cASSymbol.h; sourceTree = "<group>"; };
+ 70731669097C6E0C00815164 /* cASSymbol.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = cASSymbol.cc; sourceTree = "<group>"; };
707A687408E3750300576968 /* cHardwareTracer_SMT.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cHardwareTracer_SMT.h; sourceTree = "<group>"; };
70B0864808F4972600FC65FE /* cLandscape.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cLandscape.h; sourceTree = "<group>"; };
70B0864B08F4972600FC65FE /* cLocalMutations.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = cLocalMutations.h; sourceTree = "<group>"; };
@@ -1061,8 +1070,14 @@
isa = PBXGroup;
children = (
70DCAD1F097AF81A002F8733 /* AvidaScript.h */,
+ 70731662097C6DF500815164 /* cASLibrary.h */,
+ 70731663097C6DF500815164 /* cASLibrary.cc */,
+ 70731668097C6E0C00815164 /* cASSymbol.h */,
+ 70731669097C6E0C00815164 /* cASSymbol.cc */,
70DCAD20097AF81A002F8733 /* cLexer.h */,
70DCAD21097AF81A002F8733 /* cLexer.l */,
+ 7073165A097C6C8F00815164 /* cParser.h */,
+ 7073165B097C6C8F00815164 /* cParser.cc */,
70DCAD22097AF81A002F8733 /* FlexLexer.h */,
);
path = script;
@@ -2007,6 +2022,9 @@
70DCAD06097AF7CC002F8733 /* primitive.cc in Sources */,
70DCAD25097AF81A002F8733 /* cLexer.l in Sources */,
70DCAD2F097AF8BC002F8733 /* main.cc in Sources */,
+ 7073165D097C6C8F00815164 /* cParser.cc in Sources */,
+ 70731665097C6DF500815164 /* cASLibrary.cc in Sources */,
+ 7073166B097C6E0C00815164 /* cASSymbol.cc in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Modified: development/source/main/MyCodeArrayLessThan.h
===================================================================
--- development/source/main/MyCodeArrayLessThan.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/MyCodeArrayLessThan.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -15,12 +15,10 @@
#include "cMxCodeArray.h"
#endif
-class MyCodeArrayLessThan {
+class MyCodeArrayLessThan
+{
public:
- bool operator()(const cMxCodeArray &x, const cMxCodeArray &y) const
- {
- return x < y;
- }
+ bool operator()(const cMxCodeArray& x, const cMxCodeArray& y) const { return x < y; }
};
#endif
Modified: development/source/main/cAvidaTriggers.h
===================================================================
--- development/source/main/cAvidaTriggers.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cAvidaTriggers.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -22,16 +22,21 @@
* A small class that determines the correct triggers for the event list.
* Needed in order to separate the event business from the rest.
*/
-class cAvidaTriggers : public cEventTriggers {
+class cAvidaTriggers : public cEventTriggers
+{
private:
- cStats & stats;
-private:
- // disabled copy constructor.
- cAvidaTriggers(const cAvidaTriggers &);
+ cStats& m_stats;
+
+
+ cAvidaTriggers(); // @not_implemented
+ cAvidaTriggers(const cAvidaTriggers&); // @not_implemented
+ cAvidaTriggers& operator=(const cAvidaTriggers&); // @not_implemented
+
public:
- cAvidaTriggers(cStats & _stats) : stats(_stats) { ; }
- double GetUpdate() const { return (double) stats.GetUpdate(); }
- double GetGeneration() const { return stats.SumGeneration().Average(); }
+ cAvidaTriggers(cStats& stats) : m_stats(stats) { ; }
+
+ double GetUpdate() const { return (double) m_stats.GetUpdate(); }
+ double GetGeneration() const { return m_stats.SumGeneration().Average(); }
};
#endif
Modified: development/source/main/cBirthChamber.h
===================================================================
--- development/source/main/cBirthChamber.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cBirthChamber.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -56,46 +56,32 @@
tArray<int> swapped0;
tArray<int> swapped1;
+
// Private methods...
- bool RegionSwap(cCPUMemory & genome0,
- cCPUMemory & genome1,
- int start0, int end0,
- int start1, int end1);
+ bool RegionSwap(cCPUMemory& genome0, cCPUMemory& genome1, int start0, int end0, int start1, int end1);
+ bool GenomeSwap(cCPUMemory& genome0, cCPUMemory& genome1, double& merit0, double& merit1);
- bool GenomeSwap(cCPUMemory & genome0,
- cCPUMemory & genome1,
- double & merit0,
- double & merit1);
+ bool DoAsexBirth(const cGenome& child_genome, cOrganism& parent,
+ tArray<cOrganism*>& child_array, tArray<cMerit>& merit_array);
+ bool DoPairAsexBirth(const cBirthEntry& old_entry, const cGenome& new_genome, cOrganism& parent,
+ tArray<cOrganism*>& child_array, tArray<cMerit>& merit_array);
+ cBirthEntry* FindSexLocalWaiting(const cGenome& child_genome, cOrganism& parent);
+ cBirthEntry* FindSexDemeWaiting(const cGenome& child_genome, cOrganism& parent);
+ cBirthEntry* FindSexSizeWaiting(const cGenome & child_genome, cOrganism& parent);
+ cBirthEntry* FindSexMateSelectWaiting(const cGenome & child_genome, cOrganism& parent);
+ cBirthEntry* FindSexGlobalWaiting(const cGenome & child_genome, cOrganism& parent);
- bool DoAsexBirth(const cGenome & child_genome, cOrganism & parent,
- tArray<cOrganism *> & child_array, tArray<cMerit> & merit_array);
- bool DoPairAsexBirth(const cBirthEntry & old_entry,
- const cGenome & new_genome,
- cOrganism & parent,
- tArray<cOrganism *> & child_array,
- tArray<cMerit> & merit_array);
- cBirthEntry * FindSexLocalWaiting(const cGenome & child_genome,
- cOrganism & parent);
- cBirthEntry * FindSexDemeWaiting(const cGenome & child_genome,
- cOrganism & parent);
- cBirthEntry * FindSexSizeWaiting(const cGenome & child_genome,
- cOrganism & parent);
- cBirthEntry * FindSexMateSelectWaiting(const cGenome & child_genome,
- cOrganism & parent);
- cBirthEntry * FindSexGlobalWaiting(const cGenome & child_genome,
- cOrganism & parent);
+ void DoBasicRecombination(cCPUMemory& genome0, cCPUMemory& genome1, double& merit0, double& merit1);
+ void DoModularContRecombination(cCPUMemory& genome0, cCPUMemory& genome1, double& merit0, double& merit1);
+ void DoModularNonContRecombination(cCPUMemory& genome0, cCPUMemory& genome1, double& merit0, double& merit1);
+ void DoModularShuffleRecombination(cCPUMemory& genome0, cCPUMemory& genome1, double& merit0, double& merit1);
- void DoBasicRecombination(cCPUMemory & genome0, cCPUMemory & genome1,
- double & merit0, double & merit1);
- void DoModularContRecombination(cCPUMemory & genome0, cCPUMemory & genome1,
- double & merit0, double & merit1);
- void DoModularNonContRecombination(cCPUMemory &genome0, cCPUMemory &genome1,
- double & merit0, double & merit1);
- void DoModularShuffleRecombination(cCPUMemory &genome0, cCPUMemory &genome1,
- double & merit0, double & merit1);
+ void SetupGenotypeInfo(cOrganism* organism, cGenotype* parent0_genotype, cGenotype* parent1_genotype);
- void SetupGenotypeInfo(cOrganism * organism, cGenotype * parent0_genotype,
- cGenotype * parent1_genotype);
+ cBirthChamber(); // @not_implemented
+ cBirthChamber(const cBirthChamber&); // @not_implemented
+ cBirthChamber& operator=(const cBirthChamber&); // @not_implemented
+
public:
cBirthChamber(cWorld* world);
~cBirthChamber();
Modified: development/source/main/cEnvironment.h
===================================================================
--- development/source/main/cEnvironment.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cEnvironment.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -56,16 +56,11 @@
cInstSet inst_set;
cMutationRates mut_rates;
- static bool ParseSetting(cString entry, cString & var_name,
- cString & var_value, const cString & var_type);
- static bool AssertInputInt(const cString & input, const cString & name,
- const cString & type);
- static bool AssertInputDouble(const cString & input, const cString & name,
- const cString & type);
- static bool AssertInputBool(const cString & input, const cString & name,
- const cString & type);
- static bool AssertInputValid(void * input, const cString & name,
- const cString & type, const cString & value);
+ static bool ParseSetting(cString entry, cString& var_name, cString& var_value, const cString& var_type);
+ static bool AssertInputInt(const cString& input, const cString& name, const cString& type);
+ static bool AssertInputDouble(const cString& input, const cString& name, const cString& type);
+ static bool AssertInputBool(const cString& input, const cString& name, const cString& type);
+ static bool AssertInputValid(void* input, const cString& name, const cString& type, const cString& value);
bool LoadReactionProcess(cReaction * reaction, cString desc);
bool LoadReactionRequisite(cReaction * reaction, cString desc);
@@ -75,16 +70,14 @@
bool LoadSetActive(cString desc);
- bool TestRequisites(const tList<cReactionRequisite> & req_list,
- int task_count,
- const tArray<int> & reaction_count) const;
- void DoProcesses(const tList<cReactionProcess> & process_list,
- const tArray<double> & resource_count,
- const double task_quality,
- cReactionResult & result) const;
-private:
- // disabled copy constructor.
- cEnvironment(const cEnvironment &);
+ bool TestRequisites(const tList<cReactionRequisite>& req_list, int task_count, const tArray<int>& reaction_count) const;
+ void DoProcesses(const tList<cReactionProcess>& process_list, const tArray<double>& resource_count,
+ const double task_quality, cReactionResult& result) const;
+
+ cEnvironment(); // @not_implemented
+ cEnvironment(const cEnvironment&); // @not_implemented
+ cEnvironment& operator=(const cEnvironment&); // @not_implemented
+
public:
cEnvironment(cWorld* world) : m_world(world), inst_set(world), mut_rates(world) { ; }
~cEnvironment() { ; }
Modified: development/source/main/cFitnessMatrix.h
===================================================================
--- development/source/main/cFitnessMatrix.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cFitnessMatrix.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -47,7 +47,8 @@
class MyCodeArrayLessThan;
class cWorld;
-class cFitnessMatrix {
+class cFitnessMatrix
+{
private:
cWorld* m_world;
@@ -90,25 +91,23 @@
/* Methods for Diagonalization of Transition Matrix */
-
- double Diagonalize(std::vector<double>& randomVect, int hamDistThresh,
- double errorRate, std::ofstream& logfile);
+ double Diagonalize(std::vector<double>& randomVect, int hamDistThresh, double errorRate, std::ofstream& logfile);
void MakeRandomVector(std::vector<double>& newVect, int size);
void VectorDivideBy(std::vector<double>& vect, double div);
double VectorNorm(const std::vector<double> &vect);
void MatrixVectorMultiply(const std::vector<double>& vect, std::vector<double>& result);
- void MakeTransitionProbabilities(int hamDistThresh, double errorRate,
- std::ofstream& logfile);
+ void MakeTransitionProbabilities(int hamDistThresh, double errorRate, std::ofstream& logfile);
-
/* Data Output */
-
void PrintGenotypes(std::ostream& fp);
void PrintTransitionMatrix(std::ostream& fp, int hamDistThresh, double errorRate, double avg_fitness, bool printMatrix=false);
void PrintHammingVector(std::ostream& fp,const std::vector<double>& dataVect, double errProb, double avgFit);
void PrintFitnessVector(std::ostream& fp,const std::vector<double>& dataVect, double errProb, double avgFit, double maxFit, double step);
void PrintFullVector(std::ostream& fp, const std::vector<double>& dataVect, double errProb, double avgFit);
+ cFitnessMatrix(); // @not_implemented
+ cFitnessMatrix(const cFitnessMatrix&); // @not_implemented
+ cFitnessMatrix& operator=(const cFitnessMatrix&); // @not_implemented
public:
cFitnessMatrix(cWorld* world, const cGenome&, cInstSet* inst_set);
Modified: development/source/main/cGenome.h
===================================================================
--- development/source/main/cGenome.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cGenome.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -29,28 +29,26 @@
* before creating the genome. Keeping genome light-weight...
**/
-class cGenome {
+class cGenome
+{
protected:
tArray<cInstruction> genome;
int active_size;
public:
+ cGenome() { ; }
explicit cGenome(int _size);
- cGenome(const cGenome & in_genome);
- cGenome(const cString & in_string);
+ cGenome(const cGenome& in_genome);
+ cGenome(const cString& in_string);
virtual ~cGenome();
virtual void operator=(const cGenome & other_genome);
virtual bool operator==(const cGenome & other_genome) const;
- virtual bool operator!=(const cGenome & other_genome) const
- { return !(this->operator==(other_genome)); }
- virtual bool operator<(const cGenome & other_genome) const
- { return AsString() < other_genome.AsString(); }
+ virtual bool operator!=(const cGenome & other_genome) const { return !(this->operator==(other_genome)); }
+ virtual bool operator<(const cGenome & other_genome) const { return AsString() < other_genome.AsString(); }
- cInstruction & operator[](int index)
- { assert(index >= 0 && index < active_size); return genome[index]; }
- const cInstruction & operator[](int index) const
- { assert(index >= 0 && index < active_size); return genome[index]; }
+ cInstruction & operator[](int index) { assert(index >= 0 && index < active_size); return genome[index]; }
+ const cInstruction & operator[](int index) const { assert(index >= 0 && index < active_size); return genome[index]; }
virtual void Copy(int to, int from);
Modified: development/source/main/cGenomeUtil.h
===================================================================
--- development/source/main/cGenomeUtil.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cGenomeUtil.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -17,27 +17,30 @@
class cInstruction;
-class cGenomeUtil {
+class cGenomeUtil
+{
+private:
+ cGenomeUtil(); // @not_implemented
+
public:
// ========= Detection =========
- static int FindInst(const cGenome & gen, const cInstruction & inst,
- int start_index=0);
- static bool HasInst(const cGenome & gen, const cInstruction & inst)
- { return ( FindInst(gen, inst) >= 0 ) ? true : false; }
+ static int FindInst(const cGenome& gen, const cInstruction& inst, int start_index = 0);
+ static bool HasInst(const cGenome& gen, const cInstruction& inst)
+ {
+ return ( FindInst(gen, inst) >= 0 ) ? true : false;
+ }
// === Genetic distance tools ===
- static int FindOverlap(const cGenome & gen1, const cGenome & gen2,
- int offset = 0);
- static int FindHammingDistance(const cGenome & gen1, const cGenome & gen2,
- int offset = 0);
- static int FindBestOffset(const cGenome & gen1, const cGenome & gen2);
- static int FindSlidingDistance(const cGenome & gen1, const cGenome & gen2);
- static int FindEditDistance(const cGenome & gen1, const cGenome & gen2);
+ static int FindOverlap(const cGenome& gen1, const cGenome& gen2, int offset = 0);
+ static int FindHammingDistance(const cGenome& gen1, const cGenome& gen2, int offset = 0);
+ static int FindBestOffset(const cGenome& gen1, const cGenome& gen2);
+ static int FindSlidingDistance(const cGenome& gen1, const cGenome& gen2);
+ static int FindEditDistance(const cGenome& gen1, const cGenome& gen2);
// ===== Construction methods =====
- static cGenome Crop(const cGenome & genome, int start, int end);
- static cGenome Cut(const cGenome & genome, int start, int end);
- static cGenome Join(const cGenome & genome1, const cGenome & genome2);
+ static cGenome Crop(const cGenome& genome, int start, int end);
+ static cGenome Cut(const cGenome& genome, int start, int end);
+ static cGenome Join(const cGenome& genome1, const cGenome& genome2);
};
#endif
Modified: development/source/main/cInstLibBase.h
===================================================================
--- development/source/main/cInstLibBase.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cInstLibBase.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -17,8 +17,10 @@
class cString;
-class cInstLibBase {
+class cInstLibBase
+{
public:
+ cInstLibBase() { ; }
virtual ~cInstLibBase() { ; }
virtual const cString &GetName(const unsigned int id) = 0;
virtual const cString &GetNopName(const unsigned int id) = 0;
Modified: development/source/main/cInstSet.h
===================================================================
--- development/source/main/cInstSet.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cInstSet.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -38,7 +38,8 @@
class cWorld;
-class cInstSet {
+class cInstSet
+{
public:
cWorld* m_world;
cInstLibBase *m_inst_lib;
@@ -62,13 +63,16 @@
//static const cInstruction inst_error;
// static const cInstruction inst_none;
static const cInstruction inst_default;
+
+
+ cInstSet(); // @not_implemented
public:
cInstSet(cWorld* world);
- cInstSet(const cInstSet & in_inst_set);
+ cInstSet(const cInstSet& in_inst_set);
~cInstSet();
- cInstSet & operator=(const cInstSet & _in);
+ cInstSet& operator=(const cInstSet& _in);
bool OK() const;
Modified: development/source/main/cInstUtil.h
===================================================================
--- development/source/main/cInstUtil.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cInstUtil.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -20,7 +20,12 @@
class cInitFile;
class cInstSet;
class cString;
-class cInstUtil {
+
+class cInstUtil
+{
+private:
+ cInstUtil(); // @not_implemented
+
public:
// ========= Genome-File Interaction =========
Modified: development/source/main/cInstruction.h
===================================================================
--- development/source/main/cInstruction.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cInstruction.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -17,29 +17,27 @@
#include "defs.h"
#endif
-class cInstruction {
+class cInstruction
+{
private:
unsigned char operand;
public:
+ // Constructors and Destructor...
+ cInstruction() { operand = 0; }
+ cInstruction(const cInstruction& _inst) { *this = _inst; }
+ explicit cInstruction(int in_op) { SetOp(in_op); }
+ ~cInstruction() { ; }
+
// Accessors...
int GetOp() const { return (int) operand; }
void SetOp(int in_op) { assert(in_op < 256); operand = in_op; }
// Operators...
- void operator=(const cInstruction & inst)
- { if (this != &inst) operand = inst.operand; }
- bool operator==(const cInstruction & inst) const
- { return (operand == inst.operand); }
- bool operator!=(const cInstruction & inst) const
- { return !(operator==(inst)); }
+ void operator=(const cInstruction & inst) { if (this != &inst) operand = inst.operand; }
+ bool operator==(const cInstruction & inst) const { return (operand == inst.operand); }
+ bool operator!=(const cInstruction & inst) const { return !(operator==(inst)); }
- // Constructors and Destructor...
- cInstruction() { operand = 0; }
- cInstruction(const cInstruction & _inst) { *this = _inst; }
- explicit cInstruction(int in_op) { SetOp(in_op); }
- ~cInstruction() { ; }
-
// Some extra methods to convert too and from alpha-numeric symbols...
char GetSymbol() const;
void SetSymbol(char symbol);
Modified: development/source/main/cLandscape.h
===================================================================
--- development/source/main/cLandscape.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cLandscape.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -30,7 +30,8 @@
class cInstruction;
class cWorld;
-struct cLandscape {
+struct cLandscape
+{
private:
cWorld* m_world;
const cInstSet & inst_set;
@@ -82,36 +83,36 @@
double neut_max; // fitness to be counted as neutral mutations.
tMatrix<double> fitness_chart; // Chart of all one-step mutations.
-private:
+
void BuildFitnessChart();
- void ProcessGenome(cGenome & in_genome);
+ void ProcessGenome(cGenome& in_genome);
void ProcessBase();
- void Process_Body(cGenome & cur_genome, int cur_distance, int start_line);
+ void Process_Body(cGenome& cur_genome, int cur_distance, int start_line);
- void HillClimb_Body(std::ofstream& fp, cGenome & cur_genome, int & gen);
- void HillClimb_Print(std::ofstream& fp, const cGenome & _genome,
- const int gen) const;
+ void HillClimb_Body(std::ofstream& fp, cGenome& cur_genome, int& gen);
+ void HillClimb_Print(std::ofstream& fp, const cGenome& _genome, const int gen) const;
- double TestMutPair(cGenome & mod_genome, int line1, int line2,
- const cInstruction & mut1, const cInstruction & mut2, std::ostream& fp);
-private:
- // disabled copy constructor.
- cLandscape(const cLandscape &);
+ double TestMutPair(cGenome& mod_genome, int line1, int line2, const cInstruction& mut1,
+ const cInstruction& mut2, std::ostream& fp);
+
+ cLandscape(); // @not_implemented
+ cLandscape(const cLandscape &); // @not_implemented
+ cLandscape& operator=(const cLandscape&); // @not_implemented
+
public:
- cLandscape(cWorld* world, const cGenome & in_genome, const cInstSet & in_inst_set);
+ cLandscape(cWorld* world, const cGenome& in_genome, const cInstSet& in_inst_set);
~cLandscape();
- void Reset(const cGenome & in_genome);
+ void Reset(const cGenome& in_genome);
- void Process(int in_distance=1);
+ void Process(int in_distance = 1);
void ProcessDelete();
void ProcessInsert();
- void PredictWProcess(std::ostream& fp, int update=-1);
- void PredictNuProcess(std::ostream& fp, int update=-1);
+ void PredictWProcess(std::ostream& fp, int update = -1);
+ void PredictNuProcess(std::ostream& fp, int update = -1);
void SampleProcess(int in_trials);
- int RandomProcess(int in_trials, int in_distance=1, int min_found=0,
- int max_trials=0, bool print_if_found=false);
+ int RandomProcess(int in_trials, int in_distance = 1, int min_found = 0, int max_trials = 0, bool print_if_found = false);
void TestPairs(int in_trials, std::ostream& fp);
void TestAllPairs(std::ostream& fp);
@@ -120,7 +121,7 @@
void HillClimb_Neut(std::ofstream& fp);
void HillClimb_Rand(std::ofstream& fp);
- void PrintStats(std::ofstream& fp, int update=-1);
+ void PrintStats(std::ofstream& fp, int update = -1);
void PrintEntropy(std::ofstream& fp);
void PrintSiteCount(std::ofstream& fp);
void PrintBase(cString filename);
@@ -131,41 +132,57 @@
inline double GetAveSqrFitness() { return total_sqr_fitness / total_count; }
inline double GetPeakFitness() { return peak_fitness; }
- inline double GetProbDead() const { return ((double)dead_count)/total_count;}
- inline double GetProbNeg() const { return ((double)neg_count) /total_count;}
- inline double GetProbNeut() const { return ((double)neut_count)/total_count;}
- inline double GetProbPos() const { return ((double)pos_count) /total_count;}
- inline double GetAvPosSize() const {
- if (pos_count == 0) return 0;
- else return pos_size/pos_count;}
- inline double GetAvNegSize() const {
- if (neg_count == 0) return 0;
- else return neg_size/neg_count;}
+ inline double GetProbDead() const { return ((double)dead_count) / total_count;}
+ inline double GetProbNeg() const { return ((double)neg_count) / total_count;}
+ inline double GetProbNeut() const { return ((double)neut_count) / total_count;}
+ inline double GetProbPos() const { return ((double)pos_count) / total_count;}
+ inline double GetAvPosSize() const
+ {
+ if (pos_count == 0) return 0;
+ else return pos_size / pos_count;
+ }
+ inline double GetAvNegSize() const
+ {
+ if (neg_count == 0) return 0;
+ else return neg_size / neg_count;
+ }
+ inline double GetProbEpiDead() const
+ {
+ if (total_epi_count == 0) return 0;
+ else return ((double)dead_epi_count) / total_epi_count;
+ }
+ inline double GetProbEpiPos() const
+ {
+ if (total_epi_count == 0) return 0;
+ else return ((double)pos_epi_count) / total_epi_count;
+ }
+ inline double GetProbEpiNeg() const
+ {
+ if (total_epi_count == 0) return 0;
+ else return ((double)neg_epi_count) / total_epi_count;
+ }
+ inline double GetProbNoEpi() const
+ {
+ if (total_epi_count == 0) return 0;
+ else return ((double)no_epi_count) / total_epi_count;
+ }
+ inline double GetAvPosEpiSize() const
+ {
+ if (pos_epi_count == 0) return 0;
+ else return pos_epi_size / pos_epi_count;
+ }
+ inline double GetAvNegEpiSize() const
+ {
+ if (neg_epi_count == 0) return 0;
+ else return neg_epi_size / neg_epi_count;
+ }
+ inline double GetAvNoEpiSize() const
+ {
+ if (no_epi_count == 0) return 0;
+ else return no_epi_size / no_epi_count;
+ }
- inline double GetProbEpiDead() const {
- if (total_epi_count == 0) return 0;
- else return ((double)dead_epi_count)/total_epi_count;}
- inline double GetProbEpiPos() const {
- if (total_epi_count == 0) return 0;
- else return ((double)pos_epi_count) /total_epi_count;}
- inline double GetProbEpiNeg() const {
- if (total_epi_count == 0) return 0;
- else return ((double)neg_epi_count) /total_epi_count;}
- inline double GetProbNoEpi() const {
- if (total_epi_count == 0) return 0;
- else return ((double)no_epi_count)/total_epi_count;}
- inline double GetAvPosEpiSize() const {
- if (pos_epi_count == 0) return 0;
- else return pos_epi_size/pos_epi_count;}
- inline double GetAvNegEpiSize() const {
- if (neg_epi_count == 0) return 0;
- else return neg_epi_size/neg_epi_count;}
- inline double GetAvNoEpiSize() const {
- if (no_epi_count == 0) return 0;
- else return no_epi_size/no_epi_count;}
-
inline int GetNumTrials() const { return trials; }
-
inline double GetTotalEntropy() const { return total_entropy; }
inline double GetComplexity() const { return complexity; }
};
Modified: development/source/main/cLocalMutations.cc
===================================================================
--- development/source/main/cLocalMutations.cc 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cLocalMutations.cc 2006-01-18 17:50:07 UTC (rev 440)
@@ -34,7 +34,3 @@
// Setup the mutation count array.
counts.Resize(mut_lib.GetSize(), 0);
}
-
-cLocalMutations::~cLocalMutations()
-{
-}
Modified: development/source/main/cLocalMutations.h
===================================================================
--- development/source/main/cLocalMutations.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cLocalMutations.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -16,16 +16,23 @@
#endif
class cMutationLib;
-class cLocalMutations {
+class cLocalMutations
+{
private:
- const cMutationLib & mut_lib;
+ const cMutationLib& mut_lib;
tArray<double> rates;
tArray<int> counts;
+
+
+ cLocalMutations(); // @not_implemented
+ cLocalMutations(const cLocalMutations&); // @not_implemented
+ cLocalMutations& operator=(const cLocalMutations&); // @not_implemented
+
public:
- cLocalMutations(const cMutationLib & _lib, int genome_length);
- ~cLocalMutations();
+ cLocalMutations(const cMutationLib& _lib, int genome_length);
+ ~cLocalMutations() { ; }
- const cMutationLib & GetMutationLib() const { return mut_lib; }
+ const cMutationLib& GetMutationLib() const { return mut_lib; }
double GetRate(int id) const { return rates[id]; }
int GetCount(int id) const { return counts[id]; }
Modified: development/source/main/cMutation.h
===================================================================
--- development/source/main/cMutation.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cMutation.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -15,7 +15,8 @@
#include "cString.h"
#endif
-class cMutation {
+class cMutation
+{
private:
cString name;
int id;
@@ -23,8 +24,12 @@
int scope;
int type;
double rate;
+
+
+ cMutation(); // @not_implemented
+
public:
- cMutation(const cString & _name, int _id, int _trigger, int _scope, int _type, double _rate)
+ cMutation(const cString& _name, int _id, int _trigger, int _scope, int _type, double _rate)
: name(_name), id(_id), trigger(_trigger), scope(_scope), type(_type), rate(_rate)
{
}
Modified: development/source/main/cMutationLib.h
===================================================================
--- development/source/main/cMutationLib.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cMutationLib.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -21,23 +21,26 @@
class cMutation;
class cString;
-class cMutationLib {
+class cMutationLib
+{
private:
- tArray<cMutation *> mutation_array;
+ tArray<cMutation*> mutation_array;
tArray< tList<cMutation> > trigger_list_array;
+
+
+ cMutationLib(const cMutationLib&); // @not_implemented
+ cMutationLib& operator=(const cMutationLib&); // @not_implemented
+
public:
cMutationLib();
~cMutationLib();
int GetSize() const { return mutation_array.GetSize(); }
- cMutation * AddMutation(const cString & name, int trigger, int scope,
- int type, double rate);
+ cMutation* AddMutation(const cString & name, int trigger, int scope, int type, double rate);
- const tArray<cMutation *> & GetMutationArray() const
- { return mutation_array; }
- const tList<cMutation> & GetMutationList(int trigger) const
- { return trigger_list_array[trigger]; }
+ const tArray<cMutation*>& GetMutationArray() const { return mutation_array; }
+ const tList<cMutation>& GetMutationList(int trigger) const { return trigger_list_array[trigger]; }
};
#endif
Modified: development/source/main/cMutationRates.h
===================================================================
--- development/source/main/cMutationRates.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cMutationRates.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -13,7 +13,8 @@
class cWorld;
-class cMutationRates {
+class cMutationRates
+{
private:
cWorld* m_world;
@@ -45,11 +46,13 @@
};
sDivideMuts divide;
- void operator=(const cMutationRates & in_muts)
- { (void) in_muts; } // Disable operator=
+
+ cMutationRates(); // @not_implemented
+ cMutationRates& operator=(const cMutationRates&); // @not_implemented
+
public:
cMutationRates(cWorld* world) : m_world(world) { Clear(); }
- cMutationRates(const cMutationRates & in_muts) : m_world(in_muts.m_world) { Copy(in_muts); }
+ cMutationRates(const cMutationRates& in_muts) : m_world(in_muts.m_world) { Copy(in_muts); }
~cMutationRates() { ; }
void Clear();
Modified: development/source/main/cMxCodeArray.h
===================================================================
--- development/source/main/cMxCodeArray.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cMxCodeArray.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -48,7 +48,7 @@
mutable std::map<int, double, std::less<int> > m_trans_probs;
- cMxCodeArray();
+ cMxCodeArray(); // @not_implemented
public:
cMxCodeArray(cWorld* world);
Modified: development/source/main/cOrgMessage.h
===================================================================
--- development/source/main/cOrgMessage.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cOrgMessage.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -13,7 +13,8 @@
#include <string>
-class cOrgMessage {
+class cOrgMessage
+{
private:
int time;
int sender_id;
@@ -22,9 +23,8 @@
std::string data;
public:
- cOrgMessage() { time=sender_id=recipient_id=-1; label=data=""; }
- cOrgMessage(std::string in_label, std::string in_data)
- { label = in_label; data = in_data; }
+ cOrgMessage() : time(-1), sender_id(-1), recipient_id(-1), label(""), data("") { ; }
+ cOrgMessage(std::string in_label, std::string in_data) { label = in_label; data = in_data; }
void SetTime(int in_time) { time = in_time; }
void SetSenderID(int in_id) { sender_id = in_id; }
Modified: development/source/main/cOrganism.h
===================================================================
--- development/source/main/cOrganism.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cOrganism.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -52,14 +52,15 @@
class cEnvironment;
class cCodeLabel;
-class cOrganism {
+class cOrganism
+{
protected:
cWorld* m_world;
- cHardwareBase * hardware; // The actual machinary running this organism.
- cGenotype * genotype; // Information about organisms with this genome.
+ cHardwareBase* hardware; // The actual machinary running this organism.
+ cGenotype* genotype; // Information about organisms with this genome.
cPhenotype phenotype; // Descriptive attributes of organism.
const cGenome initial_genome; // Initial genome; can never be changed!
- std::deque<cInjectGenotype *> parasites; // List of all parasites associated with
+ std::deque<cInjectGenotype*> parasites; // List of all parasites associated with
// this organism.
cMutationRates mut_rates; // Rate of all possible mutations.
cLocalMutations mut_info; // Info about possible mutations;
@@ -84,7 +85,7 @@
int max_executed; // Max number of instruction executed before death.
int lineage_label; // a lineages tag; inherited unchanged in offspring
- cLineage * lineage; // A lineage descriptor... (different from label)
+ cLineage* lineage; // A lineage descriptor... (different from label)
tBuffer<cOrgMessage> inbox;
tBuffer<cOrgMessage> sent;
@@ -94,22 +95,17 @@
#endif
bool is_running; // Does this organism have the CPU?
-public:
- void PrintStatus(std::ostream& fp, const cString & next_name);
- // Divide functions
- bool Divide_CheckViable();
- bool ActivateDivide();
-
- // Other Special Functions
- void Fault(int fault_loc, int fault_type, cString fault_desc="");
-
+ cOrganism(); // @not_implemented
+ cOrganism(const cOrganism&); // @not_implemented
+ cOrganism& operator=(const cOrganism&); // @not_implemented
+
public:
- cOrganism(cWorld* world, const cGenome & in_genome);
+ cOrganism(cWorld* world, const cGenome& in_genome);
~cOrganism();
- cHardwareBase & GetHardware() { return *hardware; }
- cOrganism * GetNeighbor() { return pop_interface.GetNeighbor(); }
+ cHardwareBase& GetHardware() { return *hardware; }
+ cOrganism* GetNeighbor() { return pop_interface.GetNeighbor(); }
int GetNeighborhoodSize() { return pop_interface.GetNumNeighbors(); }
void Rotate(int direction) { pop_interface.Rotate(direction); }
void DoBreakpoint() { pop_interface.Breakpoint(); }
@@ -212,6 +208,17 @@
// -------- DEBUG ---------
void SetRunning(bool in_running) { is_running = in_running; }
bool GetIsRunning() { return is_running; }
+
+
+ void PrintStatus(std::ostream& fp, const cString & next_name);
+
+ // Divide functions
+ bool Divide_CheckViable();
+ bool ActivateDivide();
+
+ // Other Special Functions
+ void Fault(int fault_loc, int fault_type, cString fault_desc="");
+
};
#endif
Modified: development/source/main/cPhenotype.h
===================================================================
--- development/source/main/cPhenotype.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cPhenotype.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -55,7 +55,8 @@
template <class T> class tList;
class cWorld;
-class cPhenotype {
+class cPhenotype
+{
private:
cWorld* m_world;
bool initialized;
@@ -125,6 +126,11 @@
bool last_child_fertile; // Was the child being born to be fertile?
int child_copied_size; // Instruction copied into child.
+
+ cPhenotype(); // @not_implemented
+ cPhenotype(const cPhenotype&); // @not_implemented
+ cPhenotype& operator=(const cPhenotype&); // @not_implemented
+
public:
cPhenotype(cWorld* world);
~cPhenotype();
@@ -148,13 +154,12 @@
void SetupClone(const cPhenotype & clone_phenotype);
// Input and Output Reaction Tests
- bool TestInput(tBuffer<int> & inputs, tBuffer<int> & outputs);
- bool TestOutput(tBuffer<int> & input_buf, tBuffer<int> & output_buf,
- tBuffer<int> & send_buf, tBuffer<int> & receive_buf,
- const tArray<double> & res_in, tArray<double> & res_change,
- tArray<int> & insts_triggered,
- tList<tBuffer<int> > & other_inputs,
- tList<tBuffer<int> > & other_outputs);
+ bool TestInput(tBuffer<int>& inputs, tBuffer<int>& outputs);
+ bool TestOutput(tBuffer<int>& input_buf, tBuffer<int>& output_buf,
+ tBuffer<int>& send_buf, tBuffer<int>& receive_buf,
+ const tArray<double>& res_in, tArray<double>& res_change,
+ tArray<int>& insts_triggered, tList<tBuffer<int> >& other_inputs,
+ tList<tBuffer<int> >& other_outputs);
// State saving and loading, and printing...
bool SaveState(std::ofstream& fp);
@@ -170,74 +175,44 @@
}
///////////////////// Accessors -- Retrieving ////////////////////
- const cMerit & GetMerit() const
- { assert(initialized == true); return merit; }
- int GetGenomeLength() const
- { assert(initialized == true); return genome_length; }
- int GetCopiedSize() const
- { assert(initialized == true); return copied_size; }
- int GetExecutedSize() const
- { assert(initialized == true); return executed_size; }
- int GetGestationTime() const
- { assert(initialized == true); return gestation_time; }
- int GetGestationStart() const
- { assert(initialized == true); return gestation_start; }
- double GetFitness() const
- { assert(initialized == true); return fitness; }
- double GetDivType() const
- { assert(initialized == true); return div_type; }
+ const cMerit & GetMerit() const { assert(initialized == true); return merit; }
+ int GetGenomeLength() const { assert(initialized == true); return genome_length; }
+ int GetCopiedSize() const { assert(initialized == true); return copied_size; }
+ int GetExecutedSize() const { assert(initialized == true); return executed_size; }
+ int GetGestationTime() const { assert(initialized == true); return gestation_time; }
+ int GetGestationStart() const { assert(initialized == true); return gestation_start; }
+ double GetFitness() const { assert(initialized == true); return fitness; }
+ double GetDivType() const { assert(initialized == true); return div_type; }
- double GetCurBonus() const
- { assert(initialized == true); return cur_bonus; }
- double GetCurMeritBase() const
- { assert(initialized == true); return CalcSizeMerit(); }
- bool GetToDie() const
- { assert(initialized == true); return to_die; }
- bool GetToDelete() const
- { assert(initialized == true); return to_delete; }
- int GetCurNumErrors() const
- { assert(initialized == true); return cur_num_errors; }
- int GetCurNumDonates() const
- { assert(initialized == true); return cur_num_donates; }
- const tArray<int> & GetCurTaskCount() const
- { assert(initialized == true); return cur_task_count; }
- const tArray<int> & GetCurReactionCount() const
- { assert(initialized == true); return cur_reaction_count;}
- const tArray<int> & GetCurInstCount() const
- { assert(initialized == true); return cur_inst_count; }
+ double GetCurBonus() const { assert(initialized == true); return cur_bonus; }
+ double GetCurMeritBase() const { assert(initialized == true); return CalcSizeMerit(); }
+ bool GetToDie() const { assert(initialized == true); return to_die; }
+ bool GetToDelete() const { assert(initialized == true); return to_delete; }
+ int GetCurNumErrors() const { assert(initialized == true); return cur_num_errors; }
+ int GetCurNumDonates() const { assert(initialized == true); return cur_num_donates; }
+ const tArray<int>& GetCurTaskCount() const { assert(initialized == true); return cur_task_count; }
+ const tArray<int>& GetCurReactionCount() const { assert(initialized == true); return cur_reaction_count;}
+ const tArray<int>& GetCurInstCount() const { assert(initialized == true); return cur_inst_count; }
- double GetSensedResource(int _in)
- { assert(initialized == true); return sensed_resources[_in]; }
+ double GetSensedResource(int _in) { assert(initialized == true); return sensed_resources[_in]; }
- double GetLastMeritBase() const
- { assert(initialized == true); return last_merit_base; }
- double GetLastBonus() const
- { assert(initialized == true); return last_bonus; }
- const double GetLastMerit() const
- { assert(initialized == true); return last_merit_base*last_bonus; }
- int GetLastNumErrors() const
- { assert(initialized == true); return last_num_errors; }
- int GetLastNumDonates() const
- { assert(initialized == true); return last_num_donates; }
- const tArray<int> & GetLastTaskCount() const
- { assert(initialized == true); return last_task_count; }
- const tArray<int> & GetLastReactionCount() const
- { assert(initialized == true); return last_reaction_count; }
- const tArray<int> & GetLastInstCount() const
- { assert(initialized == true); return last_inst_count; }
- double GetLastFitness() const
- { assert(initialized == true); return last_fitness; }
+ double GetLastMeritBase() const { assert(initialized == true); return last_merit_base; }
+ double GetLastBonus() const { assert(initialized == true); return last_bonus; }
+ const double GetLastMerit() const { assert(initialized == true); return last_merit_base*last_bonus; }
+ int GetLastNumErrors() const { assert(initialized == true); return last_num_errors; }
+ int GetLastNumDonates() const { assert(initialized == true); return last_num_donates; }
+ const tArray<int>& GetLastTaskCount() const { assert(initialized == true); return last_task_count; }
+ const tArray<int>& GetLastReactionCount() const { assert(initialized == true); return last_reaction_count; }
+ const tArray<int>& GetLastInstCount() const { assert(initialized == true); return last_inst_count; }
+ double GetLastFitness() const { assert(initialized == true); return last_fitness; }
int GetNumDivides() const { assert(initialized == true); return num_divides;}
int GetGeneration() const { assert(initialized == true); return generation; }
int GetTimeUsed() const { assert(initialized == true); return time_used; }
int GetAge() const { assert(initialized == true); return age; }
- const cString & GetFault() const
- { assert(initialized == true); return fault_desc; }
- double GetNeutralMetric() const
- { assert(initialized == true); return neutral_metric; }
- double GetLifeFitness() const
- { assert(initialized == true); return life_fitness; }
+ const cString& GetFault() const { assert(initialized == true); return fault_desc; }
+ double GetNeutralMetric() const { assert(initialized == true); return neutral_metric; }
+ double GetLifeFitness() const { assert(initialized == true); return life_fitness; }
bool IsInjected() const { assert(initialized == true); return is_injected; }
bool IsParasite() const { assert(initialized == true); return is_parasite; }
@@ -257,16 +232,14 @@
bool DivideSex() const { assert(initialized == true); return divide_sex; }
int MateSelectID() const { assert(initialized == true); return mate_select_id; }
int CrossNum() const { assert(initialized == true); return cross_num; }
- bool ChildFertile() const
- { assert(initialized == true); return child_fertile;}
- int GetChildCopiedSize() const
- { assert(initialized == true); return child_copied_size; }
+ bool ChildFertile() const { assert(initialized == true); return child_fertile;}
+ int GetChildCopiedSize() const { assert(initialized == true); return child_copied_size; }
//////////////////// Accessors -- Modifying ///////////////////
- void SetMerit(const cMerit & in_merit) { merit = in_merit; }
+ void SetMerit(const cMerit& in_merit) { merit = in_merit; }
void SetGestationTime(int in_time) { gestation_time = in_time; }
- void SetFault(const cString & in_fault) { fault_desc = in_fault; }
+ void SetFault(const cString& in_fault) { fault_desc = in_fault; }
void SetNeutralMetric(double _in){ neutral_metric = _in; }
void SetLifeFitness(double _in){ life_fitness = _in; }
void SetLinesExecuted(int _exe_size) { executed_size = _exe_size; }
@@ -289,21 +262,21 @@
void IncTimeUsed() { assert(initialized == true); time_used++; }
void IncErrors() { assert(initialized == true); cur_num_errors++; }
void IncDonates() { assert(initialized == true); cur_num_donates++; }
- bool & IsInjected() { assert(initialized == true); return is_injected; }
- bool & IsParasite() { assert(initialized == true); return is_parasite; }
- bool & IsModifier() { assert(initialized == true); return is_modifier; }
- bool & IsModified() { assert(initialized == true); return is_modified; }
- bool & IsFertile() { assert(initialized == true); return is_fertile; }
- bool & IsMutated() { assert(initialized == true); return is_mutated; }
- bool & ParentTrue() { assert(initialized == true); return parent_true; }
- bool & ParentSex() { assert(initialized == true); return parent_sex; }
- int & ParentCrossNum() { assert(initialized == true); return parent_cross_num; }
- bool & CopyTrue() { assert(initialized == true); return copy_true; }
- bool & DivideSex() { assert(initialized == true); return divide_sex; }
- int & MateSelectID() { assert(initialized == true); return mate_select_id; }
- int & CrossNum() { assert(initialized == true); return cross_num; }
- bool & ChildFertile() { assert(initialized == true); return child_fertile; }
- bool & IsMultiThread() { assert(initialized == true); return is_multi_thread; }
+ bool& IsInjected() { assert(initialized == true); return is_injected; }
+ bool& IsParasite() { assert(initialized == true); return is_parasite; }
+ bool& IsModifier() { assert(initialized == true); return is_modifier; }
+ bool& IsModified() { assert(initialized == true); return is_modified; }
+ bool& IsFertile() { assert(initialized == true); return is_fertile; }
+ bool& IsMutated() { assert(initialized == true); return is_mutated; }
+ bool& ParentTrue() { assert(initialized == true); return parent_true; }
+ bool& ParentSex() { assert(initialized == true); return parent_sex; }
+ int& ParentCrossNum() { assert(initialized == true); return parent_cross_num; }
+ bool& CopyTrue() { assert(initialized == true); return copy_true; }
+ bool& DivideSex() { assert(initialized == true); return divide_sex; }
+ int& MateSelectID() { assert(initialized == true); return mate_select_id; }
+ int& CrossNum() { assert(initialized == true); return cross_num; }
+ bool& ChildFertile() { assert(initialized == true); return child_fertile; }
+ bool& IsMultiThread() { assert(initialized == true); return is_multi_thread; }
};
#endif
Modified: development/source/main/cPopulation.h
===================================================================
--- development/source/main/cPopulation.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cPopulation.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -44,13 +44,12 @@
class cOrganism;
class cPopulationCell;
-class cPopulation {
+class cPopulation
+{
private:
- cPopulation(const cPopulation &); // not implemented
-private:
// Components...
cWorld* m_world;
- cSchedule * schedule; // Handles allocation of CPU cycles
+ cSchedule* schedule; // Handles allocation of CPU cycles
tArray<cPopulationCell> cell_array; // Local cells composing the population
cResourceCount resource_count; // Global resources available
cBirthChamber birth_chamber; // Global birth chamber.
@@ -73,17 +72,13 @@
bool sync_events; // Do we need to sync up the event list with population?
///////////////// Private Methods ////////////////////
- void BuildTimeSlicer(cChangeList * change_list); // Build the schedule object
+ void BuildTimeSlicer(cChangeList* change_list); // Build the schedule object
// Methods to place offspring in the population.
- cPopulationCell & PositionChild(cPopulationCell & parent_cell,
- bool parent_ok=true);
- void PositionAge(cPopulationCell & parent_cell,
- tList<cPopulationCell> & found_list, bool parent_ok);
- void PositionMerit(cPopulationCell & parent_cell,
- tList<cPopulationCell> & found_list, bool parent_ok);
- void FindEmptyCell(tList<cPopulationCell> & cell_list,
- tList<cPopulationCell> & found_list);
+ cPopulationCell& PositionChild(cPopulationCell& parent_cell, bool parent_ok = true);
+ void PositionAge(cPopulationCell& parent_cell, tList<cPopulationCell>& found_list, bool parent_ok);
+ void PositionMerit(cPopulationCell & parent_cell, tList<cPopulationCell>& found_list, bool parent_ok);
+ void FindEmptyCell(tList<cPopulationCell>& cell_list, tList<cPopulationCell>& found_list);
// Update statistics collecting...
void UpdateOrganismStats();
@@ -96,16 +91,19 @@
* Attention: InjectGenotype does *not* add the genotype to the archive.
* It assumes thats where you got the genotype from.
**/
- void InjectGenotype(int cell_id, cGenotype * genotype);
- void InjectGenome(int cell_id, const cGenome & genome, int lineage_label);
- void InjectClone(int cell_id, cOrganism & orig_org);
+ void InjectGenotype(int cell_id, cGenotype* genotype);
+ void InjectGenome(int cell_id, const cGenome& genome, int lineage_label);
+ void InjectClone(int cell_id, cOrganism& orig_org);
- void LineageSetupOrganism(cOrganism * organism, cLineage * lineage,
- int lin_label, cGenotype * parent_genotype=NULL);
+ void LineageSetupOrganism(cOrganism* organism, cLineage* lineage, int lin_label, cGenotype* parent_genotype = NULL);
// Must be called to activate *any* organism in the population.
- void ActivateOrganism(cOrganism * in_organism, cPopulationCell &target_cell);
+ void ActivateOrganism(cOrganism* in_organism, cPopulationCell& target_cell);
+ cPopulation(); // @not_implemented
+ cPopulation(const cPopulation&); // @not_implemented
+ cPopulation& operator=(const cPopulation&); // @not_implemented
+
public:
cPopulation(cWorld* world);
~cPopulation();
@@ -114,18 +112,18 @@
bool SetupDemes();
// Activate the offspring of an organism in the population
- bool ActivateOffspring(cGenome & child_genome, cOrganism & parent_organism);
+ bool ActivateOffspring(cGenome& child_genome, cOrganism& parent_organism);
- bool ActivateInject(cOrganism & parent, const cGenome & injected_code);
- bool ActivateInject(const int cell_id, const cGenome & injected_code);
+ bool ActivateInject(cOrganism& parent, const cGenome& injected_code);
+ bool ActivateInject(const int cell_id, const cGenome& injected_code);
// Inject an organism from the outside world.
- void Inject(const cGenome & genome, int cell_id=-1, double merit=-1,
- int lineage_label=0, double neutral_metric=0, int mem_space=0 );
+ void Inject(const cGenome& genome, int cell_id = -1, double merit = -1, int lineage_label = 0,
+ double neutral_metric = 0, int mem_space = 0);
// Deactivate an organism in the population (required for deactivations)
- void KillOrganism(cPopulationCell & in_cell);
- void Kaboom(cPopulationCell & in_cell);
+ void KillOrganism(cPopulationCell& in_cell);
+ void Kaboom(cPopulationCell& in_cell);
// Deme-related methods
void CompeteDemes(int competition_type);
@@ -142,14 +140,14 @@
void CalcUpdateStats();
// Clear all but a subset of cells...
- void SerialTransfer( int transfer_size, bool ignore_deads );
+ void SerialTransfer(int transfer_size, bool ignore_deads);
// Saving and loading...
bool SaveClone(std::ofstream& fp);
- bool LoadClone(std::ifstream & fp);
+ bool LoadClone(std::ifstream& fp);
bool LoadDumpFile(cString filename, int update);
bool SavePopulation(std::ofstream& fp);
- bool LoadPopulation(std::ifstream & fp);
+ bool LoadPopulation(std::ifstream& fp);
bool DumpMemorySummary(std::ofstream& fp);
bool OK();
@@ -158,21 +156,18 @@
int GetWorldX() { return world_x; }
int GetWorldY() { return world_y; }
- cPopulationCell & GetCell(int in_num);
- const tArray<double> & GetResources() const
- { return resource_count.GetResources(); }
- const tArray<double> & GetCellResources(int cell_id) const
- { return resource_count.GetCellResources(cell_id); }
- cBirthChamber & GetBirthChamber(int id) { (void) id; return birth_chamber; }
+ cPopulationCell& GetCell(int in_num);
+ const tArray<double>& GetResources() const { return resource_count.GetResources(); }
+ const tArray<double>& GetCellResources(int cell_id) const { return resource_count.GetCellResources(cell_id); }
+ cBirthChamber& GetBirthChamber(int id) { (void) id; return birth_chamber; }
- void UpdateResources(const tArray<double> & res_change);
+ void UpdateResources(const tArray<double>& res_change);
void UpdateResource(int id, double change);
- void UpdateCellResources(const tArray<double> & res_change,
- const int cell_id);
+ void UpdateCellResources(const tArray<double>& res_change, const int cell_id);
void SetResource(int id, double new_level);
double GetResource(int id) const { return resource_count.Get(id); }
- cEnvironment & GetEnvironment() { return environment; }
+ cEnvironment& GetEnvironment() { return environment; }
int GetNumOrganisms() { return num_organisms; }
bool GetSyncEvents() { return sync_events; }
@@ -183,8 +178,8 @@
bool UpdateMerit(int cell_id, double new_merit);
- void SetChangeList(cChangeList *change_list);
- cChangeList *GetChangeList();
+ void SetChangeList(cChangeList* change_list);
+ cChangeList* GetChangeList();
};
#endif
Modified: development/source/main/cPopulationCell.h
===================================================================
--- development/source/main/cPopulationCell.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cPopulationCell.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -27,7 +27,8 @@
class cOrganism;
class cPopulationCell;
-class cPopulationCell {
+class cPopulationCell
+{
friend class cPopulation;
private:
cWorld* m_world;
@@ -40,21 +41,21 @@
int cell_id; // Unique id for position of cell in population.
int organism_count; // Total number of orgs to ever inhabit this cell.
-private: // Organism changes should only occur through population...
+
void InsertOrganism(cOrganism & new_org);
- cOrganism * RemoveOrganism();
+ cOrganism* RemoveOrganism();
public:
cPopulationCell();
- cPopulationCell(const cPopulationCell & in_cell);
+ cPopulationCell(const cPopulationCell& in_cell);
~cPopulationCell() { ; }
- void operator=(const cPopulationCell & in_cell);
+ void operator=(const cPopulationCell& in_cell);
void Setup(cWorld* world, int in_id, const cMutationRates & in_rates);
void Rotate(cPopulationCell & new_facing);
- cOrganism * GetOrganism() const { return organism; }
+ cOrganism* GetOrganism() const { return organism; }
tList<cPopulationCell> & ConnectionList() { return connection_list; }
const cMutationRates & MutationRates() const { return *mutation_rates; }
cMutationRates & MutationRates() { return *mutation_rates; }
Modified: development/source/main/cPopulationInterface.h
===================================================================
--- development/source/main/cPopulationInterface.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cPopulationInterface.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -30,6 +30,11 @@
cWorld* m_world;
int cell_id;
+
+ cPopulationInterface(); // @not_implemented
+ cPopulationInterface(const cPopulationInterface&); // @not_implemented
+ cPopulationInterface operator=(const cPopulationInterface&); // @not_implemented
+
public:
cPopulationInterface(cWorld* world) : m_world(world), cell_id(-1) { ; }
virtual ~cPopulationInterface() { ; }
Modified: development/source/main/cReaction.h
===================================================================
--- development/source/main/cReaction.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cReaction.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -22,42 +22,45 @@
class cReactionProcess;
class cReactionRequisite;
-class cReaction {
+class cReaction
+{
private:
cString name;
int id;
- cTaskEntry * task;
+ cTaskEntry* task;
tList<cReactionProcess> process_list;
tList<cReactionRequisite> requisite_list;
bool active;
-private:
- // disabled copy constructor.
- cReaction(const cReaction &);
+
+
+ cReaction(); // @not_implemented
+ cReaction(const cReaction&); // @not_implemented
+ cReaction& operator=(const cReaction&); // @not_implemented
+
public:
- cReaction(const cString & _name, int _id);
+ cReaction(const cString& _name, int _id);
~cReaction();
const cString & GetName() const { return name; }
int GetID() const { return id; }
- cTaskEntry * GetTask() { return task; }
- const tList<cReactionProcess> & GetProcesses() { return process_list; }
- const tList<cReactionRequisite> & GetRequisites()
- { return requisite_list; }
+ cTaskEntry* GetTask() { return task; }
+ const tList<cReactionProcess>& GetProcesses() { return process_list; }
+ const tList<cReactionRequisite>& GetRequisites() { return requisite_list; }
bool GetActive() const { return active; }
- void SetTask(cTaskEntry * _task) { task = _task; }
- cReactionProcess * AddProcess();
- cReactionRequisite * AddRequisite();
- void SetActive(bool in_active=true) { active = in_active; }
+ void SetTask(cTaskEntry* _task) { task = _task; }
+ cReactionProcess* AddProcess();
+ cReactionRequisite* AddRequisite();
+ void SetActive(bool in_active = true) { active = in_active; }
// These methods will modify the value of the process listed.
- bool ModifyValue(double new_value, int process_num=0);
- bool MultiplyValue(double value_mult, int process_num=0);
+ bool ModifyValue(double new_value, int process_num = 0);
+ bool MultiplyValue(double value_mult, int process_num = 0);
// This method will modify the instruction triggered by this process
- bool ModifyInst(int inst_id, int process_num=0);
+ bool ModifyInst(int inst_id, int process_num = 0);
- double GetValue(int process_num=0);
+ double GetValue(int process_num = 0);
};
Modified: development/source/main/cReactionLib.h
===================================================================
--- development/source/main/cReactionLib.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cReactionLib.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -18,18 +18,23 @@
class cReaction;
class cString;
-class cReactionLib {
+class cReactionLib
+{
private:
- tArray<cReaction *> reaction_array;
+ tArray<cReaction*> reaction_array;
+
+ cReactionLib(const cReactionLib&); // @not_implemented
+ cReactionLib& operator=(const cReactionLib&); // @not_implemented
+
public:
cReactionLib() { ; }
~cReactionLib();
int GetSize() const { return reaction_array.GetSize(); }
- cReaction * AddReaction(const cString & name);
- cReaction * GetReaction(const cString & name) const;
- cReaction * GetReaction(int id) const;
+ cReaction* AddReaction(const cString& name);
+ cReaction* GetReaction(const cString& name) const;
+ cReaction* GetReaction(int id) const;
};
#endif
Modified: development/source/main/cReactionProcess.h
===================================================================
--- development/source/main/cReactionProcess.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cReactionProcess.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -32,7 +32,7 @@
double max_number; // Max quantity of resource usable.
double min_number; // Minimum quantity of resource needed (otherwise 0)
double max_fraction; // Max fraction of avaiable resources useable.
- cResource * product; // Output resource.
+ cResource* product; // Output resource.
double conversion; // Conversion factor.
bool lethal; // Lethality of reaction
int inst_id; // Instruction to be triggered if reaction successful.
@@ -41,6 +41,11 @@
cResource * detect; // Resource Measured
double detection_threshold; // Min quantity of resource to register present
double detection_error; // Var of Detection Event (as % of resource present)
+
+
+ cReactionProcess(const cReactionProcess&); // @not_implemented
+ cReactionProcess& operator=(const cReactionProcess&); // @not_implemented
+
public:
cReactionProcess()
: resource(NULL)
@@ -60,31 +65,31 @@
}
~cReactionProcess() { ; }
- cResource * GetResource() const { return resource; }
+ cResource* GetResource() const { return resource; }
double GetValue() const { return value; }
int GetType() const { return type; }
double GetMaxNumber() const { return max_number; }
double GetMinNumber() const { return min_number; }
double GetMaxFraction() const { return max_fraction; }
- cResource * GetProduct() const { return product; }
+ cResource* GetProduct() const { return product; }
double GetConversion() const { return conversion; }
int GetInstID() const { return inst_id; }
bool GetLethal() const { return lethal; }
- cResource * GetDetect() const { return detect; }
+ cResource* GetDetect() const { return detect; }
double GetDetectionThreshold() const { return detection_threshold; }
double GetDetectionError() const { return detection_error; }
- void SetResource(cResource * _in) { resource = _in; }
+ void SetResource(cResource* _in) { resource = _in; }
void SetValue(double _in) { value = _in; }
void SetType(int _in) { type = _in; }
void SetMaxNumber(double _in) { max_number = _in; }
void SetMinNumber(double _in) { min_number = _in; }
void SetMaxFraction(double _in) { max_fraction = _in; }
- void SetProduct(cResource * _in) { product = _in; }
+ void SetProduct(cResource* _in) { product = _in; }
void SetConversion(double _in) { conversion = _in; }
void SetInstID(int _in) { inst_id = _in; }
void SetLethal(int _in) { lethal = _in; }
- void SetDetect(cResource * _in) { detect = _in; }
+ void SetDetect(cResource* _in) { detect = _in; }
void SetDetectionThreshold(double _in) { detection_threshold = _in; }
void SetDetectionError(double _in) { detection_error = _in; }
};
Modified: development/source/main/cReactionRequisite.h
===================================================================
--- development/source/main/cReactionRequisite.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cReactionRequisite.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -17,29 +17,31 @@
class cReaction;
-class cReactionRequisite {
+class cReactionRequisite
+{
private:
tList<cReaction> prior_reaction_list;
tList<cReaction> prior_noreaction_list;
int min_task_count;
int max_task_count;
-private:
- // disabled copy constructor.
- cReactionRequisite(const cReactionRequisite &);
+
+
+ cReactionRequisite(const cReactionRequisite&); // @not_implemented
+ cReactionRequisite& operator=(const cReactionRequisite&);
+
public:
cReactionRequisite() : min_task_count(0) , max_task_count(INT_MAX) { ; }
~cReactionRequisite() { ; }
- const tList<cReaction> & GetReactions() const { return prior_reaction_list; }
- const tList<cReaction> & GetNoReactions() const
- { return prior_noreaction_list; }
+ const tList<cReaction>& GetReactions() const { return prior_reaction_list; }
+ const tList<cReaction>& GetNoReactions() const { return prior_noreaction_list; }
int GetMinTaskCount() const { return min_task_count; }
int GetMaxTaskCount() const { return max_task_count; }
- void AddReaction(cReaction * in_reaction) {
+ void AddReaction(cReaction* in_reaction) {
prior_reaction_list.PushRear(in_reaction);
}
- void AddNoReaction(cReaction * in_reaction) {
+ void AddNoReaction(cReaction* in_reaction) {
prior_noreaction_list.PushRear(in_reaction);
}
void SetMinTaskCount(int min) { min_task_count = min; }
@@ -49,7 +51,7 @@
added to satisfy Boost.Python; the semantics are fairly useless --
equality of two references means that they refer to the same object.
*/
- bool operator==(const cReactionRequisite &in) const { return &in == this; }
+ bool operator==(const cReactionRequisite& in) const { return &in == this; }
};
#endif
Modified: development/source/main/cReactionResult.h
===================================================================
--- development/source/main/cReactionResult.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cReactionResult.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -30,10 +30,15 @@
bool lethal;
bool active_reaction;
+
inline void ActivateReaction();
+
+ cReactionResult(); // @not_implemented
+ cReactionResult(const cReactionResult&); // @not_implemented
+ cReactionResult& operator=(const cReactionResult&); // @not_implemented
+
public:
- cReactionResult(const int num_resources, const int num_tasks,
- const int num_reactions);
+ cReactionResult(const int num_resources, const int num_tasks, const int num_reactions);
~cReactionResult();
bool GetActive() { return active_reaction; }
@@ -58,7 +63,7 @@
bool TaskDone(int id);
double GetAddBonus();
double GetMultBonus();
- tArray<int> & GetInstArray();
+ tArray<int>& GetInstArray();
};
#endif
Modified: development/source/main/cResource.h
===================================================================
--- development/source/main/cResource.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cResource.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -15,7 +15,8 @@
#include "cString.h"
#endif
-class cResource {
+class cResource
+{
private:
cString name;
int id;
@@ -36,8 +37,11 @@
double ydiffuse;
double ygravity;
+
+ cResource(); // @not_implemented
+
public:
- cResource(const cString & _name, int _id);
+ cResource(const cString& _name, int _id);
~cResource() { ; }
const cString & GetName() const { return name; }
Modified: development/source/main/cResourceCount.h
===================================================================
--- development/source/main/cResourceCount.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cResourceCount.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -24,7 +24,8 @@
#include "tMatrix.h"
#endif
-class cResourceCount {
+class cResourceCount
+{
private:
mutable tArray<double> resource_count; // Current quantity of each resource
tArray<double> decay_rate; // Multiplies resource count at each step
@@ -45,41 +46,39 @@
static const double UPDATE_STEP; // Fraction of an update per step
static const double EPSILON; // Tolorance for round off errors
static const int PRECALC_DISTANCE; // Number of steps to precalculate
+
public:
- cResourceCount(int num_resources=0);
- cResourceCount(const cResourceCount &);
+ cResourceCount(int num_resources = 0);
+ cResourceCount(const cResourceCount&);
~cResourceCount();
- const cResourceCount &operator=(const cResourceCount &);
+ const cResourceCount& operator=(const cResourceCount&);
void SetSize(int num_resources);
- void Setup(int id, cString name, double initial, double inflow,
- double decay, int in_geometry, double in_xdiffuse,
- double in_xgravity, double in_ydiffuse,
- double in_ygravity, int in_inflowX1,
- int in_inflowX2, int in_inflowY1,
- int in_inflowY2, int in_outflowX1,
- int in_outflowX2, int in_outflowY1,
- int in_outflowY);
+ void Setup(int id, cString name, double initial, double inflow, double decay, int in_geometry,
+ double in_xdiffuse, double in_xgravity, double in_ydiffuse, double in_ygravity,
+ int in_inflowX1, int in_inflowX2, int in_inflowY1, int in_inflowY2,
+ int in_outflowX1, int in_outflowX2, int in_outflowY1, int in_outflowY);
void Update(double in_time);
int GetSize(void) const { return resource_count.GetSize(); }
- const tArray<double> & ReadResources(void) const { return resource_count; }
- const tArray<double> & GetResources() const;
- const tArray<double> & GetCellResources(int cell_id) const;
- const tArray<int> & GetResourcesGeometry() const;
- const tArray< tArray<double> > & GetSpatialRes();
- void Modify(const tArray<double> & res_change);
+ const tArray<double>& ReadResources(void) const { return resource_count; }
+ const tArray<double>& GetResources() const;
+ const tArray<double>& GetCellResources(int cell_id) const;
+ const tArray<int>& GetResourcesGeometry() const;
+ const tArray<tArray<double> >& GetSpatialRes();
+ void Modify(const tArray<double>& res_change);
void Modify(int id, double change);
void ModifyCell(const tArray<double> & res_change, int cell_id);
void Set(int id, double new_level);
- double Get(int id) const{
+ double Get(int id) const
+ {
assert(id < resource_count.GetSize());
- return resource_count[id]; }
+ return resource_count[id];
+ }
void ResizeSpatialGrids(int in_x, int in_y);
- cSpatialResCount GetSpatialResource(int id)
- { return spatial_resource_count[id]; }
+ cSpatialResCount GetSpatialResource(int id) { return spatial_resource_count[id]; }
};
#endif
Modified: development/source/main/cResourceLib.h
===================================================================
--- development/source/main/cResourceLib.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cResourceLib.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -18,18 +18,23 @@
class cResource;
class cString;
-class cResourceLib {
+class cResourceLib
+{
private:
- tArray<cResource *> resource_array;
+ tArray<cResource*> resource_array;
+
+ cResourceLib(const cResourceLib&); // @not_implemented
+ cResourceLib& operator=(const cResourceLib&); // @not_implemented
+
public:
cResourceLib() { ; }
~cResourceLib();
int GetSize() const { return resource_array.GetSize(); }
- cResource * AddResource(const cString & res_name);
- cResource * GetResource(const cString & res_name) const;
- cResource * GetResource(int id) const;
+ cResource* AddResource(const cString& res_name);
+ cResource* GetResource(const cString& res_name) const;
+ cResource* GetResource(int id) const;
};
#endif
Modified: development/source/main/cSpatialCountElem.cc
===================================================================
--- development/source/main/cSpatialCountElem.cc 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cSpatialCountElem.cc 2006-01-18 17:50:07 UTC (rev 440)
@@ -13,24 +13,28 @@
const int MAXFLOWPTS = 8;
-cSpatialCountElem::cSpatialCountElem (double initamount) {
- amount = initamount;
- delta=0.0;
- elempt.Resize(MAXFLOWPTS);
- xdist.Resize(MAXFLOWPTS);
- ydist.Resize(MAXFLOWPTS);
- dist.Resize(MAXFLOWPTS);
+cSpatialCountElem::cSpatialCountElem(double initamount)
+{
+ amount = initamount;
+ delta = 0.0;
+ elempt.Resize(MAXFLOWPTS);
+ xdist.Resize(MAXFLOWPTS);
+ ydist.Resize(MAXFLOWPTS);
+ dist.Resize(MAXFLOWPTS);
}
-cSpatialCountElem::cSpatialCountElem () {
- amount = 0.0;
- delta=0.0;
- elempt.Resize(MAXFLOWPTS);
- xdist.Resize(MAXFLOWPTS);
- ydist.Resize(MAXFLOWPTS);
- dist.Resize(MAXFLOWPTS);
+
+cSpatialCountElem::cSpatialCountElem()
+{
+ amount = 0.0;
+ delta = 0.0;
+ elempt.Resize(MAXFLOWPTS);
+ xdist.Resize(MAXFLOWPTS);
+ ydist.Resize(MAXFLOWPTS);
+ dist.Resize(MAXFLOWPTS);
}
-void cSpatialCountElem::SetPtr (int innum, int inelempt, int inxdist,
- int inydist, double indist) {
+
+void cSpatialCountElem::SetPtr(int innum, int inelempt, int inxdist, int inydist, double indist)
+{
elempt[innum] = inelempt;
xdist[innum] = inxdist;
ydist[innum] = inydist;
Modified: development/source/main/cSpatialCountElem.h
===================================================================
--- development/source/main/cSpatialCountElem.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cSpatialCountElem.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -15,24 +15,27 @@
#include "tArray.h"
#endif
-class cSpatialCountElem {
+class cSpatialCountElem
+{
+private:
mutable double amount, delta;
tArray<int> elempt, xdist, ydist;
tArray<double> dist;
+
public:
- cSpatialCountElem (double initamount);
- cSpatialCountElem ();
- void Rate (double ratein) const {delta += ratein;}
- void State () {amount += delta; delta = 0.0;}
- const double GetAmount() const {return amount;}
- void SetPtr (int innum, int inelempt, int inxdist, int inydist,
- double indist);
- int GetElemPtr (int innum) {return elempt[innum];}
- int GetPtrXdist (int innum) {return xdist[innum];}
- int GetPtrYdist (int innum) {return ydist[innum];}
- double GetPtrDist (int innum) {return dist[innum];}
- friend void FlowMatter (cSpatialCountElem&, cSpatialCountElem&, double,
- double, double, double, int, int, double);
+ cSpatialCountElem();
+ cSpatialCountElem(double initamount);
+
+ void Rate(double ratein) const { delta += ratein; }
+ void State() { amount += delta; delta = 0.0; }
+ const double GetAmount() const { return amount; }
+ void SetPtr(int innum, int inelempt, int inxdist, int inydist, double indist);
+ int GetElemPtr(int innum) { return elempt[innum]; }
+ int GetPtrXdist(int innum) { return xdist[innum]; }
+ int GetPtrYdist(int innum) { return ydist[innum]; }
+ double GetPtrDist(int innum) { return dist[innum]; }
+ friend void FlowMatter(cSpatialCountElem&, cSpatialCountElem&, double, double, double, double,
+ int, int, double);
};
#endif
Modified: development/source/main/cSpatialResCount.h
===================================================================
--- development/source/main/cSpatialResCount.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cSpatialResCount.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -18,37 +18,38 @@
#include "tArray.h"
#endif
-class cSpatialResCount {
+class cSpatialResCount
+{
+private:
tArray<cSpatialCountElem> grid;
double xdiffuse, xgravity, ydiffuse, ygravity;
int inflowX1, inflowX2, inflowY1, inflowY2;
int outflowX1, outflowX2, outflowY1, outflowY2;
int geometry;
int world_x, world_y, num_cells;
+
public:
cSpatialResCount();
cSpatialResCount(int inworld_x, int inworld_y, int ingeometry);
- cSpatialResCount(int inworld_x, int inworld_y, int ingeometry,
- double inxdiffuse,
- double inydiffuse, double inxgravity, double inygravity);
+ cSpatialResCount(int inworld_x, int inworld_y, int ingeometry, double inxdiffuse, double inydiffuse,
+ double inxgravity, double inygravity);
+
void ResizeClear(int inworld_x, int inworld_y, int ingeometry);
void SetPointers();
void CheckRanges();
- int GetSize () {return grid.GetSize();}
- int GetX () {return world_x;}
- int GetY () {return world_y;}
- cSpatialCountElem Element(int x) {return grid[x];}
- void Rate (int x, double ratein) const {grid[x].Rate(ratein);}
- void Rate (int x, int y, double ratein) const
- {grid[y * world_x + x].Rate(ratein);}
- void State (int x) {grid[x].State();}
- void State (int x, int y) {grid[y*world_x + x].State();}
- const double GetAmount (int x) const {return grid[x].GetAmount();}
- const double GetAmount (int x, int y) const
- {return grid[y*world_x + x].GetAmount();}
- void RateAll (double ratein);
- void StateAll ();
- void FlowAll ();
+ int GetSize() { return grid.GetSize(); }
+ int GetX() { return world_x; }
+ int GetY() { return world_y; }
+ cSpatialCountElem Element(int x) { return grid[x]; }
+ void Rate(int x, double ratein) const { grid[x].Rate(ratein); }
+ void Rate(int x, int y, double ratein) const { grid[y * world_x + x].Rate(ratein); }
+ void State(int x) { grid[x].State(); }
+ void State(int x, int y) { grid[y*world_x + x].State(); }
+ const double GetAmount(int x) const { return grid[x].GetAmount(); }
+ const double GetAmount(int x, int y) const { return grid[y*world_x + x].GetAmount(); }
+ void RateAll(double ratein);
+ void StateAll();
+ void FlowAll();
const double SumAll() const;
void Source(double amount) const;
void Sink(double percent) const;
Modified: development/source/main/cStats.h
===================================================================
--- development/source/main/cStats.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cStats.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -44,10 +44,9 @@
class cInjectGenotype;
class cWorld;
-class cStats {
+class cStats
+{
private:
- cStats(const cStats &); // not implemented.
-private:
cWorld* m_world;
// Time scales...
@@ -223,6 +222,10 @@
// State variables
int last_update;
+ cStats(); // @not_implemented
+ cStats(const cStats&); // @not_implemented
+ cStats& operator=(const cStats&); // @not_implemented
+
public:
cStats(cWorld* world);
~cStats() { ; }
Modified: development/source/main/cTaskEntry.h
===================================================================
--- development/source/main/cTaskEntry.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cTaskEntry.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -18,23 +18,25 @@
#include "cTaskLib.h"
#endif
-class cTaskEntry {
+class cTaskEntry
+{
private:
- cString name; // Short keyword for task
- cString desc; // For more human-understandable output...
- int id;
- tTaskTest test_fun;
+ cString m_name; // Short keyword for task
+ cString m_desc; // For more human-understandable output...
+ int m_id;
+ tTaskTest m_test_fun;
+
public:
- cTaskEntry(const cString & _name, const cString & _desc, int _id, tTaskTest _test_fun)
- : name(_name), desc(_desc), id(_id), test_fun(_test_fun)
+ cTaskEntry(const cString& name, const cString& desc, int in_id, tTaskTest test_fun)
+ : m_name(name), m_desc(desc), m_id(in_id), m_test_fun(test_fun)
{
}
~cTaskEntry() { ; }
- const cString & GetName() const { return name; }
- const cString & GetDesc() const { return desc; }
- const int GetID() const { return id; }
- const tTaskTest GetTestFun() const { return test_fun; }
+ const cString& GetName() const { return m_name; }
+ const cString& GetDesc() const { return m_desc; }
+ const int GetID() const { return m_id; }
+ const tTaskTest GetTestFun() const { return m_test_fun; }
};
#endif
Modified: development/source/main/cTaskLib.h
===================================================================
--- development/source/main/cTaskLib.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cTaskLib.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -27,9 +27,10 @@
class cString;
class cTaskEntry;
-class cTaskLib {
+class cTaskLib
+{
private:
- tArray<cTaskEntry *> task_array;
+ tArray<cTaskEntry*> task_array;
// What extra information should be sent along when we are evaluating
// which tasks have been performed?
@@ -43,53 +44,55 @@
mutable tList<tBuffer<int> > other_output_buffers;
mutable int logic_id;
- enum req_list { REQ_NEIGHBOR_INPUT=1,
- REQ_NEIGHBOR_OUTPUT=2,
- UNUSED_REQ_C=4,
- UNUSED_REQ_D=8 };
-private:
- // disabled copy constructor.
- cTaskLib(const cTaskLib &);
+ enum req_list
+ {
+ REQ_NEIGHBOR_INPUT=1,
+ REQ_NEIGHBOR_OUTPUT=2,
+ UNUSED_REQ_C=4,
+ UNUSED_REQ_D=8
+ };
+
+
+ cTaskLib(const cTaskLib &); // @not_implemented
+ cTaskLib& operator=(const cTaskLib&); // @not_implemented
+
public:
cTaskLib();
~cTaskLib();
int GetSize() const { return task_array.GetSize(); }
- cTaskEntry * AddTask(const cString & name);
- const cTaskEntry & GetTask(int id) const;
+ cTaskEntry* AddTask(const cString& name);
+ const cTaskEntry& GetTask(int id) const;
- void SetupTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs,
- const tList<tBuffer<int> > & other_inputs,
- const tList<tBuffer<int> > & other_outputs) const;
- double TestOutput(const cTaskEntry & task) const;
+ void SetupTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs,
+ const tList<tBuffer<int> >& other_inputs,
+ const tList<tBuffer<int> >& other_outputs) const;
+ double TestOutput(const cTaskEntry& task) const;
bool UseNeighborInput() const { return use_neighbor_input; }
bool UseNeighborOutput() const { return use_neighbor_output; }
private: // Direct task related methods
- void NewTask(const cString & name, const cString & desc,
- tTaskTest task_fun, int reqs=0);
- void SetupLogicTests(const tBuffer<int> & inputs,
- const tBuffer<int> & outputs) const;
+ void NewTask(const cString& name, const cString& desc, tTaskTest task_fun, int reqs = 0);
+ void SetupLogicTests(const tBuffer<int>& inputs, const tBuffer<int>& outputs) const;
inline double FractionalReward(unsigned int supplied, unsigned int correct);
double Task_Echo() const;
- double Task_Add() const;
- double Task_Sub() const;
+ double Task_Add() const;
+ double Task_Sub() const;
// 1- and 2-Input Logic Tasks
- double Task_Not() const;
- double Task_Nand() const;
- double Task_And() const;
- double Task_OrNot() const;
- double Task_Or() const;
+ double Task_Not() const;
+ double Task_Nand() const;
+ double Task_And() const;
+ double Task_OrNot() const;
+ double Task_Or() const;
double Task_AndNot() const;
- double Task_Nor() const;
- double Task_Xor() const;
- double Task_Equ() const;
+ double Task_Nor() const;
+ double Task_Xor() const;
+ double Task_Equ() const;
// 3-Input Logic Tasks
double Task_Logic3in_AA() const;
Modified: development/source/main/cWorld.h
===================================================================
--- development/source/main/cWorld.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/main/cWorld.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -56,6 +56,9 @@
// Internal Methods
void Setup();
+ cWorld(const cWorld&); // @not_implemented
+ cWorld& operator=(const cWorld&); // @not_implemented
+
public:
explicit cWorld() : m_conf(new cAvidaConfig()) { Setup(); }
cWorld(cAvidaConfig* cfg) : m_conf(cfg) { Setup(); }
Added: development/source/script/cASLibrary.cc
===================================================================
--- development/source/script/cASLibrary.cc 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cASLibrary.cc 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,11 @@
+/*
+ * cASLibrary.cc
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cASLibrary.h"
+
Property changes on: development/source/script/cASLibrary.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: development/source/script/cASLibrary.h
===================================================================
--- development/source/script/cASLibrary.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cASLibrary.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,30 @@
+/*
+ * cASLibrary.h
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cASLibrary_h
+#define cASLibrary_h
+
+#ifndef cASSymbol_h
+#include "cASSymbol.h"
+#endif
+#ifndef tDictionary_h
+#include "tDictionary.h"
+#endif
+
+
+class cASLibrary
+{
+private:
+ tDictionary<cASSymbol> m_symtbl;
+
+public:
+ cASLibrary() { ; }
+};
+
+#endif
Property changes on: development/source/script/cASLibrary.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: development/source/script/cASSymbol.cc
===================================================================
--- development/source/script/cASSymbol.cc 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cASSymbol.cc 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,11 @@
+/*
+ * cASSymbol.cc
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cASSymbol.h"
+
Property changes on: development/source/script/cASSymbol.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: development/source/script/cASSymbol.h
===================================================================
--- development/source/script/cASSymbol.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cASSymbol.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,28 @@
+/*
+ * cASSymbol.h
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cASSymbol_h
+#define cASSymbol_h
+
+#ifndef cString_h
+#include "cString.h"
+#endif
+
+class cASSymbol
+{
+private:
+ cString m_name;
+
+ cASSymbol();
+
+public:
+ cASSymbol(cString name) : m_name(name) { ; }
+};
+
+#endif
Property changes on: development/source/script/cASSymbol.h
___________________________________________________________________
Name: svn:eol-style
+ native
Added: development/source/script/cParser.cc
===================================================================
--- development/source/script/cParser.cc 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cParser.cc 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,11 @@
+/*
+ * cParser.cc
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#include "cParser.h"
+
Property changes on: development/source/script/cParser.cc
___________________________________________________________________
Name: svn:eol-style
+ native
Added: development/source/script/cParser.h
===================================================================
--- development/source/script/cParser.h 2006-01-17 15:57:55 UTC (rev 439)
+++ development/source/script/cParser.h 2006-01-18 17:50:07 UTC (rev 440)
@@ -0,0 +1,37 @@
+/*
+ * cParser.h
+ * Avida
+ *
+ * Created by David on 1/16/06.
+ * Copyright 2006 Michigan State University. All rights reserved.
+ *
+ */
+
+#ifndef cParser_h
+#define cParser_h
+
+#ifndef cASLibrary_h
+#include "cASLibrary.h"
+#endif
+#ifndef cASSymbol_h
+#include "cASSymbol.h"
+#endif
+#ifndef tDictionary_h
+#include "tDictionary.h"
+#endif
+
+
+class cParser
+{
+private:
+ cASLibrary* m_library;
+ tDictionary<cASSymbol> m_symtbl;
+
+ cParser();
+
+public:
+ cParser(cASLibrary* library) : m_library(library) { ; }
+
+};
+
+#endif
Property changes on: development/source/script/cParser.h
___________________________________________________________________
Name: svn:eol-style
+ native
More information about the Avida-cvs
mailing list