[Avida-cvs] [avida-svn] r851 - development/source/tools
kaben@myxo.css.msu.edu
kaben at myxo.css.msu.edu
Mon Jul 24 10:34:38 PDT 2006
Author: kaben
Date: 2006-07-24 13:34:38 -0400 (Mon, 24 Jul 2006)
New Revision: 851
Removed:
development/source/tools/cGenesis.cc
development/source/tools/cGenesis.h
Log:
Removed unused cGenesis class and files.
Deleted: development/source/tools/cGenesis.cc
===================================================================
--- development/source/tools/cGenesis.cc 2006-07-24 17:04:34 UTC (rev 850)
+++ development/source/tools/cGenesis.cc 2006-07-24 17:34:38 UTC (rev 851)
@@ -1,97 +0,0 @@
-/*
- * cGenesis.cc
- * Avida
- *
- * Created by David on 12/7/05.
- * Copyright 2005-2006 Michigan State University. All rights reserved.
- * Copyright 1993-2003 California Institute of Technology
- *
- */
-
-#include "cGenesis.h"
-
-using namespace std;
-
-
-cGenesis::cGenesis(const cString & in_filename) : cInitFile(in_filename)
-{
- if( !IsOpen() ){
- cerr<<"Failed to open '" << in_filename << "' file!!!\n" << endl;
- }
-
- Load();
- Compress();
- Close();
-}
-
-int cGenesis::Open(cString _filename, ios::openmode mode)
-{
- if( IsOpen() ){
- cerr << "Trying to reopen '" << _filename << "' file!!!\n" << endl;
- return 0;
- }
-
- int base_ret = cFile::Open(_filename, mode);
-
- if (IsOpen() == false) return base_ret; // Failed to open!
-
- Load();
- Compress();
- Close();
-
- return base_ret;
-}
-
-void cGenesis::AddInput(const cString & in_name, int in_value)
-{
- cString in_string;
- in_string.Set("%s %s, ");
- in_string += in_name;
- in_string += "(), ";
- in_string += in_value;
- in_string += "()";
- AddLine(in_string);
-}
-
-void cGenesis::AddInput(const cString & in_name, const cString & in_value)
-{
- cString in_string;
- in_string.Set("%s %s, ");
- in_string += in_name;
- in_string += "(), ";
- in_string += in_value;
- in_string += "()";
- AddLine(in_string);
-}
-
-int cGenesis::ReadInt(const cString & name, int base, bool warn) const
-{
- if (name == "" || IsOpen() == false) return base;
- cString cur_line;
-
- if (!Find(cur_line, name, 0)) {
- if (verbose == true && warn == true) {
- cout << "Warning: " << name << " not in \"" << GetFilename()
- << "\", defaulting to: " << base <<endl;
- }
- return base;
- }
-
- return cur_line.GetWord(1).AsInt();
-}
-
-double cGenesis::ReadFloat(const cString & name, float base, bool warn) const
-{
- if (name == "" || IsOpen() == false) return base;
- cString cur_line;
-
- if (!Find(cur_line, name, 0)) {
- if (verbose == true && warn == true) {
- cout << "Warning: " << name << " not in \"" << GetFilename()
- << "\", defaulting to: " << base <<endl;
- }
- return base;
- }
-
- return cur_line.GetWord(1).AsDouble();
-}
Deleted: development/source/tools/cGenesis.h
===================================================================
--- development/source/tools/cGenesis.h 2006-07-24 17:04:34 UTC (rev 850)
+++ development/source/tools/cGenesis.h 2006-07-24 17:34:38 UTC (rev 851)
@@ -1,109 +0,0 @@
-/*
- * cGenesis.h
- * Avida
- *
- * Created by David on 12/7/05.
- * Copyright 2005-2006 Michigan State University. All rights reserved.
- * Copyright 1993-2003 California Institute of Technology
- *
- */
-
-#ifndef cGenesis_h
-#define cGenesis_h
-
-#ifndef cInitFile_h
-#include "cInitFile.h"
-#endif
-#ifndef cString_h
-#include "cString.h"
-#endif
-
-/**
- * A specialized initialization file class that is used for setting up
- * the way Avida should run.
- */
-
-class cGenesis : public cInitFile {
-private:
- cGenesis(const cGenesis &);
-public:
- /**
- * The empty constructor creates a clean object.
- **/
- cGenesis() { ; }
-
- /**
- * This constructor opens the given initialization file, reads it in,
- * removes all comments, and closes it again.
- **/
- cGenesis(const cString & filename);
-
- /**
- * Opens an initialization file, reads it in, removes all comments, and
- * closes it again.
- **/
- int Open(cString _filename, std::ios::openmode mode=(std::ios::in));
-
- /**
- * Convenience function. Adds an integer valued entry to the file in
- * memory. Uses @ref cInitFile::AddLine().
- **/
- void AddInput(const cString & in_name, int in_value);
-
- /**
- * Convenience function. Adds a string valued entry to the file in
- * memory. Uses @ref cInitFile::AddLine().
- **/
- void AddInput(const cString & in_name, const cString & in_value);
-
- /**
- * Reads an entry of type int. In case the entry does not exist,
- * the value of base is returned.
- *
- * @param name The name of the entry.
- * @param base The default value.
- * @param warn Warn user if not set?
- **/
- int ReadInt (const cString & name, int base=0, bool warn=true) const;
-
- /**
- * Reads an entry of type float. In case the entry does not exist,
- * the value of base is returned.
- *
- * @param name The name of the entry.
- * @param base The default value.
- * @param warn Warn user if not set?
- **/
- double ReadFloat (const cString & name, float base=0.0, bool warn=true) const;
-
- void Read(cString & _var, const cString & _name, const cString & _def="") {
- _var = ReadString(_name, _def);
- }
-
- void Read(int & _var, const cString & _name, const cString & _def="0") {
- _var = ReadInt(_name, _def.AsInt());
- }
-
- void Read(double & _var, const cString & _name, const cString & _def="0.0") {
- _var = ReadFloat(_name, _def.AsDouble());
- }
-
- void Read(bool & _var, const cString & _name, const cString & _def="0.0") {
- _var = ReadInt(_name, _def.AsInt()) != 0;
- }
-};
-
-
-#ifdef ENABLE_UNIT_TESTS
-namespace nGenesis {
- /**
- * Run unit tests
- *
- * @param full Run full test suite; if false, just the fast tests.
- **/
- void UnitTests(bool full = false);
-}
-#endif
-
-#endif
-
More information about the Avida-cvs
mailing list