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

Last change on this file since 720 was 720, checked in by Maciej Komosinski, 6 years ago

Param::save2() renamed to saveSingleLine(); unified Param::load() so that it gets a single-line/multi-line format selector

  • Property svn:eol-style set to native
File size: 1.3 KB
RevLine 
[286]1// This file is a part of Framsticks SDK.  http://www.framsticks.com/
[667]2// Copyright (C) 1999-2017  Maciej Komosinski and Szymon Ulatowski.
[286]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;
[667]16        double radius0x, radius0y, radius0z; //radius of 0th (initial) chamber
17        double scalex, scaley, scalez; //(cumulative) scaling of consecutive chambers
[145]18        double translation;
[140]19        double angle1, angle2;
[667]20#define fF_PROPS_TO_MUTATE {0,4,5,6,7,8,9} //indexes of properties from paramtab; keep synchronized with fF_genotype.cpp
[140]21
[145]22        static ParamEntry paramtab[];
23        Param param;
24
[667]25        fF_growth_params() :param(paramtab, this)
[140]26        {
27                reset();
28        }
29
30        void reset()
31        {
[145]32                param.setDefault();
[140]33        }
34
35        bool load(const char* serialized)
36        {
[145]37                SString s = serialized;
[720]38                ParamInterface::LoadOptions opts;
39                return ((param.load(ParamInterface::FormatSingleLine, s, &opts) == param.getPropCount()) && (opts.offset == s.len()));
[140]40        }
41
42        string save()
43        {
[145]44                SString tmp;
[720]45                param.saveSingleLine(tmp, NULL/*object containing default values for comparison*/, false/*add CR*/, false/*force field names*/);
[348]46                return string(tmp.c_str());
[140]47        }
48};
49
50#endif
Note: See TracBrowser for help on using the repository browser.