Nemo  2.3.46
ttrait.h
Go to the documentation of this file.
1 
30 #ifndef TTRAIT_H
31 #define TTRAIT_H
32 
33 #include "types.h"
34 #include "simcomponent.h"
35 
46 class TTrait: public StorableComponent {
47 
48 public:
50  virtual void init () = 0;
51 
53  virtual void init_sequence () = 0;
54 
56  virtual void reset () = 0;
61  virtual void inherit (TTrait* mother, TTrait* father) = 0;
63  virtual void mutate () = 0;
68  virtual void* set_trait (void* value) = 0;
72  virtual void set_sequence (void** seq) = 0;
78  virtual double get_allele_value (int loc, int all) = 0;
84  virtual void set_allele_value (unsigned int locus, unsigned int allele, double value) = 0;
85 
87  virtual void set_value () = 0;
91  virtual void* getValue () const = 0;
95  virtual trait_t get_type () const = 0;
99  virtual void** get_sequence () const = 0;
101  virtual void show_up () = 0;
106  virtual TTrait* clone () = 0;
109 
111  virtual TTrait& operator= (const TTrait&) = 0;
113  virtual bool operator== (const TTrait&) = 0;
114  virtual bool operator!= (const TTrait&) = 0;
116  virtual ~TTrait ( ) { }
117 };
118 
126 
127 protected:
129  int _index;
130 
131 public:
134  virtual void reset () = 0;
136  virtual TTrait* hatch () = 0;
138  virtual TraitPrototype* clone () = 0;
142  virtual trait_t get_type () const = 0;
144  virtual void set_index(int idx) {_index = idx;}
146  virtual int get_index() {return _index;}
147 
148 };
149 #endif //TTRAIT_H
150 
virtual double get_allele_value(int loc, int all)=0
Called to read one allele value at a particular locus.
virtual TTrait * hatch()=0
Creates the trait of which it is the prototype, called by IndFactory::makePrototype().
virtual void inherit(TTrait *mother, TTrait *father)=0
Inheritance procedure, creates a new trait from mother's and father's traits.
virtual void set_index(int idx)
Sets the traits index.
Definition: ttrait.h:144
std::string trait_t
Trait types.
Definition: types.h:63
virtual void * set_trait(void *value)=0
Called to set the phenotypic to a particular value or to give context-dependant value(s) to the trait...
virtual TTrait * clone()=0
Returns a copy of itself.
virtual void mutate()=0
Mutation procedure, perform mutations on the genes sequence.
virtual bool operator!=(const TTrait &)=0
virtual bool operator==(const TTrait &)=0
Checks for parameters equivalence, not genetic equivalence.
virtual void set_sequence(void **seq)=0
Called to set the sequence pointer to an existing trait.
Interface for all trait types, declares all basic trait operations.
Definition: ttrait.h:46
virtual TTrait & operator=(const TTrait &)=0
Copies the complete state of the trait from right to left side of the operator, sequence data include...
virtual int get_index()
Index getter.
Definition: ttrait.h:146
virtual trait_t get_type() const =0
type accessor.
virtual void init()=0
Called to allocate the trait's genotypic sequences.
virtual ~TTrait()
Definition: ttrait.h:116
Interface to all basic components of a simulation (traits, life cycle events, pop, etc. ).
Definition: simcomponent.h:45
virtual void reset()=0
Called at the end of each simulation/replicate, deallocates sequence memory.
virtual void ** get_sequence() const =0
sequence accessor.
virtual void * getValue() const =0
Genotype to phenotype mapper.
virtual TraitPrototype * clone()=0
Returns a copy of itself.
virtual void set_value()=0
Tells the trait to set its phenotype from genotype, should be used instead of getValue().
virtual void reset()=0
Called at the end of a simulation to reset the Traits' prototypes (e.g.
int _index
The trait index in the Individual traits table.
Definition: ttrait.h:129
TTrait setter.
Definition: ttrait.h:125
virtual trait_t get_type() const =0
Type accessor.
virtual void show_up()=0
Writes some info to stdout.
virtual void set_allele_value(unsigned int locus, unsigned int allele, double value)=0
Called to change the allelic value at a particular locus.
virtual void init_sequence()=0
Called at the start of each replicate, sets the initial genotypes.
Provides an interface to binary data saving and uploading.
Definition: simcomponent.h:155

Generated for Nemo v2.3.0 by  doxygen 1.8.8 --
Catalogued on GSR