source: cpp/frams/genetics/fF/fF_genotype.h @ 145

Last change on this file since 145 was 145, checked in by sz, 10 years ago

Genetics reorganization (affects ALL applications!):

  • Converters/Validators? are now configured/initialized in a more verbose but also less confusing way
  • At the same time, the PreconfiguredGenetics? object will help you avoid the increased complexity by creating the ready-to-use environment that is sufficient in 99% of cases (see the demos)
  • Format F genetics updated (work in progress)
  • Property svn:eol-style set to native
File size: 977 bytes
Line 
1// This file is a part of the Framsticks GDK.
2// Copyright (C) 2002-2014  Maciej Komosinski and Szymon Ulatowski.  See LICENSE.txt for details.
3// Refer to http://www.framsticks.com/ for further information.
4
5#ifndef _FF_GENOTYPE_H_
6#define _FF_GENOTYPE_H_
7
8#include <stdio.h>
9#include "common/stl-util.h"
10#include <frams/param/param.h>
11
12struct fF_growth_params
13{
14        int number_of_chambers;
15        double scalex, scaley, scalez;
16        double translation;
17        double angle1, angle2;
18
19        static ParamEntry paramtab[];
20        Param param;
21
22        fF_growth_params()
23                :param(paramtab, this)
24        {
25                reset();
26        }
27
28        void reset()
29        {
30                param.setDefault();
31        }
32
33        bool load(const char* serialized)
34        {
35                SString s = serialized;
36                int p = 0; //position in string
37                return ((param.load2(s, p)==7) && (p==s.len()));
38        }
39
40        string save()
41        {
42                SString tmp;
43                param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
44                return string((const char*)tmp);
45        }
46};
47
48
49#endif
Note: See TracBrowser for help on using the repository browser.