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
00039 class AbstractCellCycleModel;
00040
00041
00049 class TissueCell
00050 {
00051 private:
00052
00054 bool mCanDivide;
00055
00057 friend class boost::serialization::access;
00064 template<class Archive>
00065 void serialize(Archive & archive, const unsigned int version)
00066 {
00067
00068
00069
00070 archive & mCanDivide;
00071 archive & mCellType;
00072 archive & mMutationState;
00073 archive & mpCellCycleModel;
00074 archive & mUndergoingApoptosis;
00075 archive & mDeathTime;
00076 archive & mStartOfApoptosisTime;
00077 archive & mIsDead;
00078 archive & mIsLogged;
00079 archive & mAncestor;
00080 archive & mCellId;
00081 archive & mMaxCellId;
00082 }
00083
00084 protected:
00085
00086
00087
00089 CellType mCellType;
00090
00092 CellMutationState mMutationState;
00093
00095 AbstractCellCycleModel *mpCellCycleModel;
00096
00098 unsigned mAncestor;
00099
00101 unsigned mCellId;
00102
00104 static unsigned mMaxCellId;
00105
00107 double mDeathTime;
00108
00110 double mStartOfApoptosisTime;
00111
00113 bool mUndergoingApoptosis;
00114
00119 bool mIsDead;
00120
00122 bool mIsLogged;
00123
00129 void CommonCopy(const TissueCell& rOtherCell);
00130
00131 public:
00132
00141 TissueCell(CellType cellType,
00142 CellMutationState mutationState,
00143 AbstractCellCycleModel* pCellCycleModel,
00144 bool archiving = false);
00145
00149 ~TissueCell();
00150
00155 TissueCell(const TissueCell& rOtherCell);
00156
00162 TissueCell& operator=(const TissueCell& rOtherCell);
00163
00169 void SetBirthTime(double birthTime);
00170
00176 void SetCellCycleModel(AbstractCellCycleModel* pCellCycleModel);
00177
00181 AbstractCellCycleModel* GetCellCycleModel() const;
00182
00186 void InitialiseCellCycleModel();
00187
00191 double GetAge() const;
00192
00196 double GetBirthTime() const;
00197
00201 double GetStartOfApoptosisTime() const;
00202
00206 CellType GetCellType() const;
00207
00213 void SetCellType(CellType cellType);
00214
00218 CellMutationState GetMutationState() const;
00219
00225 void SetMutationState(CellMutationState mutationState);
00226
00231 bool ReadyToDivide();
00232
00239 TissueCell Divide();
00240
00247 void StartApoptosis(bool setDeathTime=true);
00248
00253 void Kill();
00254
00258 bool HasApoptosisBegun() const;
00259
00263 double TimeUntilDeath() const;
00264
00268 bool IsDead();
00269
00273 void SetLogged();
00274
00278 bool IsLogged();
00279
00285 void SetAncestor(unsigned ancestorIndex);
00286
00291 unsigned GetAncestor() const;
00292
00296 unsigned GetCellId() const;
00297
00301 static void ResetMaxCellId();
00302 };
00303
00304
00305 namespace boost
00306 {
00307 namespace serialization
00308 {
00312 template<class Archive>
00313 inline void save_construct_data(
00314 Archive & ar, const TissueCell * t, const BOOST_PFTO unsigned int file_version)
00315 {
00316
00317 const CellType cell_type = t->GetCellType();
00318 const CellMutationState mutation_state = t->GetMutationState();
00319 const AbstractCellCycleModel* const p_cell_cycle_model = t->GetCellCycleModel();
00320 ar << cell_type;
00321 ar << mutation_state;
00322 ar << p_cell_cycle_model;
00323 }
00324
00328 template<class Archive>
00329 inline void load_construct_data(
00330 Archive & ar, TissueCell * t, const unsigned int file_version)
00331 {
00332
00333 CellType cell_type;
00334 CellMutationState mutation_state;
00335 AbstractCellCycleModel *p_cell_cycle_model;
00336 ar >> cell_type;
00337 ar >> mutation_state;
00338 ar >> p_cell_cycle_model;
00339 bool archiving = true;
00340
00341
00342 ::new(t)TissueCell(cell_type, mutation_state, p_cell_cycle_model, archiving);
00343 }
00344 }
00345 }
00346
00347 #endif