Host Class Documentation
-
class Host : public Organism
Subclassed by Bacterium, EfficientHost, PGGHost
Public Functions
-
inline Host(emp::Ptr<emp::Random> _random, emp::Ptr<SymWorld> _world, emp::Ptr<SymConfigBase> _config, double _intval = 0.0, emp::vector<emp::Ptr<Organism>> _syms = {}, emp::vector<emp::Ptr<Organism>> _repro_syms = {}, double _points = 0.0)
The constructor for the host class
-
inline ~Host()
Input: None
Output: None
Purpose: To delete the memory used by a host’s symbionts when the host is deleted.
-
Host(const Host&) = default
Input: None
Output: None
Purpose: To force a copy constructor to be generated by the compiler.
-
Host(Host&&) = default
Input: None
Output: None
Purpose: To force a move constructor to be generated by the compiler
-
Host() = default
Input: None
Output: None
Purpose: To tell the compiler to use its default generated variants of the constructor
-
Host &operator=(const Host&) = default
Input: None
Output: None
Purpose: To force a copy assignment operator to be generated by the compiler.
-
Host &operator=(Host&&) = default
Input: None
Output: None
Purpose: To force a move assignment operator to be generated by the compiler.
-
inline bool operator==(const Host &other) const
Input: An object of host to be compared to the current host.
Output: To boolean representing if thing1 == &thing2
Purpose: To override the bool operator == to return (thing1 == &thing2)
-
inline bool operator!=(const Host &other) const
Input: An object of host, and the address of the thing it is being compared to.
Output: To boolean representing if *thing1 == thing2
Purpose: To override the bool operator != to return !(*thing1 == thing2)
-
inline std::string const GetName()
Input: None
Output: Name of class as string, Host
Purpose: To know which subclass the object is
-
inline void SetReproCount(size_t _in)
Input: Set the reproduction counter
Output: None
Purpose: To set the count of reproductions in this lineage.
-
inline size_t GetReproCount()
Input: None.
Output: The reproduction count
Purpose: To get the count of reproductions in this lineage.
-
inline void SetTowardsPartnerCount(size_t _in)
Input: Set the flips towards a partner counter
Output: None
Purpose: To set the count of flips towards a partner in this lineage.
-
inline size_t GetTowardsPartnerCount()
Input: None.
Output: The flips towards a partner count
Purpose: To get the count of flips towards a partner in this lineage.
-
inline void SetFromPartnerCount(size_t _in)
Input: Set the flips from a partner counter
Output: None
Purpose: To set the count of flips from a partner in this lineage.
-
inline size_t GetFromPartnerCount()
Input: None.
Output: The flips from a partner count
Purpose: To get the count of flips from a partner in this lineage.
-
inline double GetIntVal() const
Input: None
Output: The double representing host’s interaction value
Purpose: To get the double representing host’s interaction value
-
inline emp::vector<emp::Ptr<Organism>> &GetSymbionts()
Input: None
Output: A vector of pointers to the organisms that are the host’s syms.
Purpose: To get the vector containing pointers to the host’s symbionts.
-
inline emp::vector<emp::Ptr<Organism>> &GetReproSymbionts()
Input: None
Output: A vector of pointers to the organisms that are the host’s repro syms.
Purpose: To get the vector containing pointers to the host’s repro syms.
-
inline double GetPoints()
Input: None
Output: The double representing a host’s points.
Purpose: To get the host’s points.
-
inline double GetResInProcess()
Input: None
Output: The double representing res_in_process
Purpose: To get the value of res_in_process
-
inline emp::WorldPosition GetLocation()
Input: None
Output: The world position of the organism
Purpose: To get the world position of the organism
-
inline bool IsHost()
Input: None
Output: The bool representing if an organism is a host.
Purpose: To determine if an organism is a host.
-
inline void SetIntVal(double _in)
Input: A double representing the host’s new interaction value.
Output: None
Purpose: To set a host’s interaction value.
-
inline void SetSymbionts(emp::vector<emp::Ptr<Organism>> _in)
Input: A vector of pointers to organisms that will become a host’s symbionts.
Output: None
Purpose: To set a host’s symbionts to the input vector of organisms.
-
inline void SetPoints(double _in)
Input: A double representing a host’s new point value.
Output: None
Purpose: To set a host’s points.
-
inline virtual void SetLocation(emp::WorldPosition _in)
Input: A new world position
Output: None
Purpose: To set the organism’s world position
-
inline void ClearSyms()
Input: None
Output: None
Purpose: To clear a host’s symbionts.
-
inline void ClearReproSyms()
Input: None
Output: None
Purpose: To clear a host’s repro symbionts.
-
inline void SetTag(emp::BitSet<TAG_LENGTH> &_in)
Input: The new tag
Output: None
Purpose: To set a host’s tag.
-
inline emp::BitSet<TAG_LENGTH> &GetTag()
Input: None
Output: The host’s tag.
Purpose: To get a host’s tag.
-
inline void SetTagPermissiveness(double _in)
Input: The tag permissiveness value to set for this host
Output: None
Purpose: To set the tag permissiveness value of this host
-
inline double GetTagPermissiveness()
Input: None
Output: The tag permissiveness value of this host
Purpose: To get the tag permissiveness value of this host
-
inline void SetDead()
Input: None
Output: None
Purpose: To kill a host.
-
inline void SetResInProcess(double _in)
Input: The double to be set as res_in_process
Output: None
Purpose: To set the value of res_in_process
-
inline bool GetDead()
Input: None
Output: boolean
Purpose: To determine if a host is dead.
-
inline int GetAge()
Input: None
Output: an int representing the current age of the Host
Purpose: To get the Host’s age.
-
inline void SetAge(int _in)
Input: An int of what age the Host should be set to
Output: None
Purpose: To set the Host’s age for testing purposes.
-
inline void GrowOlder()
Input: None
Output: None
Purpose: Increments age by one and kills it if too old.
-
inline double StealResources(double _intval)
Input: The interaction value of the symbiont that is eligible to steal resources from the host.
Output: The double representing the amount of resources that are actually stolen from the host.
Purpose: To determine if a host’s symbiont is eligible to steal resources from the host.
-
inline void AddPoints(double _in)
Input: The double representing the number of points to be incremented onto a host’s points.
Output: None
Purpose: To increment a host’s points by the input value.
-
inline emp::Ptr<Organism> RemoveSymbiont(int index)
Input: The symbiont index position to remove (remember it should be 1-indexed)
Output: The removed symbiont or null if invalid index given
Purpose: To allow removal of a symbiont
-
inline int AddSymbiont(emp::Ptr<Organism> _in)
Input: The pointer to the organism that is to be added to the host’s symbionts.
Output: The int describing the symbiont’s position ID, or 0 if it did not successfully get added to the host’s list of symbionts.
Purpose: To add a symbionts to a host’s symbionts
-
inline bool SymAllowedIn()
Input: None
Output: A bool representing if a symbiont will be allowed to enter a host.
Purpose: To determine if a symbiont will be allowed into a host. If phage exclusion is off, this function will always return true. If phage exclusion is on, then there is a 1/2^n chance of a new phage being allowed in, where n is the number of existing phage.
-
inline void AddReproSym(emp::Ptr<Organism> _in)
Input: A pointer to the organism to be added to the host’s symbionts.
Output: None
Purpose: To add a repro sym to the host’s symbionts.
-
inline bool HasSym()
Input: None
Output: A bool representing if a host has any symbionts.
Purpose: To determine if a host has any symbionts, though they might be corpses that haven’t been removed yet.
-
inline emp::Ptr<Organism> MakeNew()
Input: None.
Output: A new host with same properties as this host.
Purpose: To avoid creating an organism via constructor in other methods.
-
inline emp::Ptr<Organism> Reproduce()
Input: None.
Output: A new host baby of the current host, mutated.
Purpose: To create a new baby host and reset this host’s points to 0.
-
inline void Mutate()
Input: None
Output: None
Purpose: To mutate a host’s interaction value. This is called on newly generated hosts to allow for evolution to occur.
-
inline void DistribResources(double resources)
Input: The double representing the number of resources to be distributed to the host and its symbionts and the position of the host in the world.
Output: None
Purpose: To distribute resources to a host and its symbionts. In the event that the host has no symbionts, the host gets all resources not allocated to defense or given to absent partner. Otherwise, the resource is split into equal chunks for each symbiont
-
inline double HandleEctosymbiosis(double resources, size_t location)
Input: The total resources received by the host and its location in the world.
Output: The resources remaining after the host maybe does ectosymbiosis.
Purpose: To handle ectosymbiosis.
-
inline bool GetDoEctosymbiosis(size_t location)
Input: The location of this host in the world.
Output: A bool value representing whether this host should interact with a parallel sym
Purpose: To determine whether a host should interact with a parallel sym
-
inline void DistribResToSym(emp::Ptr<Organism> sym, double sym_piece)
Input: The sym to whom resources are distributed and the resources it might recieve.
Output: None
Purpose: To distribute resources between sym and host depending on their interaction values.
-
inline void Process(emp::WorldPosition pos)
Input: The size_t value representing the location of the host.
Output: None
Purpose: To process the host, meaning determining eligibility for reproduction, checking for vertical transmission, removing dead syms, and processing alive syms.
-
inline Host(emp::Ptr<emp::Random> _random, emp::Ptr<SymWorld> _world, emp::Ptr<SymConfigBase> _config, double _intval = 0.0, emp::vector<emp::Ptr<Organism>> _syms = {}, emp::vector<emp::Ptr<Organism>> _repro_syms = {}, double _points = 0.0)