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

Last change on this file since 348 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
RevLine 
[286]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.
[140]4
5#ifndef _FF_GENOTYPE_H_
6#define _FF_GENOTYPE_H_
7
8#include <stdio.h>
9#include "common/stl-util.h"
[145]10#include <frams/param/param.h>
[140]11
[176]12//Growth parameters; see http://www.framsticks.com/foraminifera
[140]13struct fF_growth_params
14{
15        int number_of_chambers;
[145]16        double scalex, scaley, scalez;
17        double translation;
[140]18        double angle1, angle2;
19
[145]20        static ParamEntry paramtab[];
21        Param param;
22
[140]23        fF_growth_params()
[145]24                :param(paramtab, this)
[140]25        {
26                reset();
27        }
28
29        void reset()
30        {
[145]31                param.setDefault();
[140]32        }
33
34        bool load(const char* serialized)
35        {
[145]36                SString s = serialized;
37                int p = 0; //position in string
[176]38                return ((param.load2(s, p) == 7) && (p == s.len()));
[140]39        }
40
41        string save()
42        {
[145]43                SString tmp;
44                param.save2(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
[348]45                return string(tmp.c_str());
[140]46        }
47};
48
49#endif
Note: See TracBrowser for help on using the repository browser.