1 | // This file is a part of Framsticks GDK library. |
---|
2 | // Copyright (C) 2002-2006 Szymon Ulatowski. See LICENSE.txt for details. |
---|
3 | // Refer to http://www.frams.alife.pl/ for further information. |
---|
4 | |
---|
5 | #include "genotypeloader.h" |
---|
6 | |
---|
7 | #define FIELDSTRUCT MiniGenotype |
---|
8 | ParamEntry minigenotype_paramtab[]= |
---|
9 | { |
---|
10 | {"Genotype",1,3,"org",}, |
---|
11 | {"name",0,0,"Name","s 0 40",FIELD(name),}, |
---|
12 | {"genotype",0,0,"Genotype","s 1",FIELD(genotype),}, |
---|
13 | {"info",0,0,"Info","s 1",FIELD(info),}, |
---|
14 | {0,0,0,}, |
---|
15 | }; |
---|
16 | #undef FIELDSTRUCT |
---|
17 | |
---|
18 | MiniGenotypeLoader::MiniGenotypeLoader():genotype_param(minigenotype_paramtab,&genotype_object) {init();} |
---|
19 | MiniGenotypeLoader::MiniGenotypeLoader(VirtFILE *f):MultiParamLoader(f),genotype_param(minigenotype_paramtab,&genotype_object) {init();} |
---|
20 | MiniGenotypeLoader::MiniGenotypeLoader(const char* filename):MultiParamLoader(filename),genotype_param(minigenotype_paramtab,&genotype_object) {init();} |
---|
21 | |
---|
22 | void MiniGenotypeLoader::init() |
---|
23 | { |
---|
24 | addClass(&genotype_param); |
---|
25 | breakOn(MultiParamLoader::OnError + MultiParamLoader::AfterObject); |
---|
26 | } |
---|
27 | |
---|
28 | MiniGenotype* MiniGenotypeLoader::loadNextGenotype() |
---|
29 | { |
---|
30 | genotype_object.clear(); |
---|
31 | if ((go()==AfterObject)&&(getClass()==&genotype_param)) |
---|
32 | return &genotype_object; |
---|
33 | else |
---|
34 | return 0; |
---|
35 | } |
---|