00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 #ifndef TISSUECELL_HPP_
00029 #define TISSUECELL_HPP_
00030
00031 #include <boost/serialization/access.hpp>
00032
00033 #include "Element.hpp"
00034 #include "CellTypes.hpp"
00035 #include "CellMutationStates.hpp"
00036 #include "AbstractCellCycleModel.hpp"
00037 #include "SimulationTime.hpp"
00038 #include "CancerParameters.hpp"
00039
00040 class AbstractCellCycleModel;
00041
00042
00050 class TissueCell
00051 {
00052 private:
00053
00055 bool mCanDivide;
00056
00058 friend class boost::serialization::access;
00065 template<class Archive>
00066 void serialize(Archive & archive, const unsigned int version)
00067 {
00068
00069
00070
00071 archive & mCanDivide;
00072 archive & mCellType;
00073 archive & mMutationState;
00074 archive & mpCellCycleModel;
00075 archive & mUndergoingApoptosis;
00076 archive & mDeathTime;
00077 archive & mIsDead;
00078 archive & mIsLogged;
00079 archive & mAncestor;
00080 }
00081
00082 protected:
00083
00084
00085
00087 CellType mCellType;
00088
00090 CellMutationState mMutationState;
00091
00093 AbstractCellCycleModel* mpCellCycleModel;
00094
00096 unsigned mAncestor;
00097
00099 double mDeathTime;
00100
00102 bool mUndergoingApoptosis;
00103
00105 bool mIsDead;
00106
00108 bool mIsLogged;
00109
00114 void CommonCopy(const TissueCell &otherCell);
00115
00116 public:
00117
00126 TissueCell(CellType cellType,
00127 CellMutationState mutationState,
00128 AbstractCellCycleModel* pCellCycleModel,
00129 bool archiving = false);
00130
00134 ~TissueCell();
00135
00140 TissueCell(const TissueCell &otherCell);
00141
00151 TissueCell& operator=(const TissueCell &otherCell);
00152
00158 void SetBirthTime(double birthTime);
00159
00165 void SetCellCycleModel(AbstractCellCycleModel* pCellCycleModel);
00166
00170 AbstractCellCycleModel* GetCellCycleModel() const;
00171
00175 void InitialiseCellCycleModel();
00176
00180 double GetAge() const;
00181
00185 double GetBirthTime() const;
00186
00190 CellType GetCellType() const;
00191
00197 void SetCellType(CellType cellType);
00198
00202 CellMutationState GetMutationState() const;
00203
00209 void SetMutationState(CellMutationState mutationState);
00210
00215 bool ReadyToDivide();
00216
00223 TissueCell Divide();
00224
00228 void StartApoptosis();
00229
00234 void Kill();
00235
00239 bool HasApoptosisBegun() const;
00240
00244 double TimeUntilDeath() const;
00245
00249 bool IsDead() const;
00250
00254 void SetLogged();
00255
00259 bool IsLogged();
00260
00265 void SetAncestor(unsigned ancestorIndex);
00266
00271 unsigned GetAncestor() const;
00272 };
00273
00274
00275 namespace boost
00276 {
00277 namespace serialization
00278 {
00282 template<class Archive>
00283 inline void save_construct_data(
00284 Archive & ar, const TissueCell * t, const BOOST_PFTO unsigned int file_version)
00285 {
00286
00287 const CellType cell_type = t->GetCellType();
00288 const CellMutationState mutation_state = t->GetMutationState();
00289 const AbstractCellCycleModel* const p_cell_cycle_model = t->GetCellCycleModel();
00290 ar << cell_type;
00291 ar << mutation_state;
00292 ar << p_cell_cycle_model;
00293 }
00294
00298 template<class Archive>
00299 inline void load_construct_data(
00300 Archive & ar, TissueCell * t, const unsigned int file_version)
00301 {
00302
00303 CellType cell_type;
00304 CellMutationState mutation_state;
00305 AbstractCellCycleModel* p_cell_cycle_model;
00306 ar >> cell_type;
00307 ar >> mutation_state;
00308 ar >> p_cell_cycle_model;
00309 bool archiving = true;
00310
00311
00312 ::new(t)TissueCell(cell_type, mutation_state, p_cell_cycle_model, archiving);
00313 }
00314 }
00315 }
00316
00317 #endif