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

Last change on this file since 601 was 348, checked in by Maciej Komosinski, 9 years ago
  • explicit c_str() in SString instead of (const char*) cast
  • genetic converters and GenMan? are now thread-local which enables multi-threaded simulator separation
  • Property svn:eol-style set to native
File size: 1001 bytes
Line 
1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
2// Copyright (C) 1999-2015  Maciej Komosinski and Szymon Ulatowski.
3// See LICENSE.txt for details.
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
12//Growth parameters; see http://www.framsticks.com/foraminifera
13struct fF_growth_params
14{
15        int number_of_chambers;
16        double scalex, scaley, scalez;
17        double translation;
18        double angle1, angle2;
19
20        static ParamEntry paramtab[];
21        Param param;
22
23        fF_growth_params()
24                :param(paramtab, this)
25        {
26                reset();
27        }
28
29        void reset()
30        {
31                param.setDefault();
32        }
33
34        bool load(const char* serialized)
35        {
36                SString s = serialized;
37                int p = 0; //position in string
38                return ((param.load2(s, p) == 7) && (p == s.len()));
39        }
40
41        string save()
42        {
43                SString tmp;
44                param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
45                return string(tmp.c_str());
46        }
47};
48
49#endif
Note: See TracBrowser for help on using the repository browser.