MCPcopy Create free account
hub / github.com/devosoft/avida / LoadFile

Method LoadFile

avida-core/source/main/cResourceHistory.cc:92–117  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

90}
91
92bool cResourceHistory::LoadFile(const cString& filename, const cString& working_dir)
93{
94 cInitFile file(filename, working_dir);
95
96 if (!file.WasOpened()) {
97// tConstListIterator<cString> err_it(file.GetErrors());
98// const cString* errstr = NULL;
99// while ((errstr = err_it.Next())) m_world->GetDriver().RaiseException(*errstr);
100// m_world->GetDriver().RaiseFatalException(1, cString("Could not open instruction set '") + filename + "'.");
101 return false;
102 }
103
104 m_entries.Resize(file.GetNumLines());
105 for (int line = 0; line < file.GetNumLines(); line++) {
106 cStringList cur_line(file.GetLine(line));
107 assert(cur_line.GetSize());
108
109 m_entries[line].update = cur_line.Pop().AsInt();
110
111 int num_values = cur_line.GetSize();
112 m_entries[line].values.Resize(num_values);
113 for (int i = 0; i < num_values; i++) m_entries[line].values[i] = cur_line.Pop().AsDouble();
114 }
115
116 return true;
117}
118

Callers

nothing calls this directly

Calls 8

WasOpenedMethod · 0.80
GetNumLinesMethod · 0.80
ResizeMethod · 0.45
GetLineMethod · 0.45
GetSizeMethod · 0.45
AsIntMethod · 0.45
PopMethod · 0.45
AsDoubleMethod · 0.45

Tested by

no test coverage detected