SENutrition.h
1 /* Distributed under the Apache License, Version 2.0.
2  See accompanying NOTICE file for details.*/
3 
4 #pragma once
5 
6 class CDM_DECL SENutrition : public Loggable
7 {
8  friend class PBPatientNutrition;//friend the serialization class
9 public:
10 
11  SENutrition(Logger* logger);
12  virtual ~SENutrition();
13 
14  virtual void Clear();
15  virtual void Copy(const SENutrition& src);
16 
17  const SEScalar* GetScalar(const std::string& name);
18 
19  bool SerializeToString(std::string& output, SerializationFormat m) const;
20  bool SerializeToFile(const std::string& filename, SerializationFormat m) const;
21  bool SerializeFromString(const std::string& src, SerializationFormat m);
22  bool SerializeFromFile(const std::string& filename, SerializationFormat m);
23 
24  void Increment(const SENutrition& from);
25 
26  virtual bool HasCarbohydrate() const;
27  virtual SEScalarMass& GetCarbohydrate();
28  virtual double GetCarbohydrate(const MassUnit& unit) const;
29 
30  virtual bool HasCarbohydrateDigestionRate() const;
31  virtual SEScalarMassPerTime& GetCarbohydrateDigestionRate();
32  virtual double GetCarbohydrateDigestionRate(const MassPerTimeUnit& unit) const;
33 
34  virtual bool HasFat() const;
35  virtual SEScalarMass& GetFat();
36  virtual double GetFat(const MassUnit& unit) const;
37 
38  virtual bool HasFatDigestionRate() const;
39  virtual SEScalarMassPerTime& GetFatDigestionRate();
40  virtual double GetFatDigestionRate(const MassPerTimeUnit& unit) const;
41 
42  virtual bool HasProtein() const;
43  virtual SEScalarMass& GetProtein();
44  virtual double GetProtein(const MassUnit& unit) const;
45 
46  virtual bool HasProteinDigestionRate() const;
47  virtual SEScalarMassPerTime& GetProteinDigestionRate();
48  virtual double GetProteinDigestionRate(const MassPerTimeUnit& unit) const;
49 
50  virtual bool HasSodium() const;
51  virtual SEScalarMass& GetSodium();
52  virtual double GetSodium(const MassUnit& unit) const;
53 
54  virtual bool HasCalcium() const;
55  virtual SEScalarMass& GetCalcium();
56  virtual double GetCalcium(const MassUnit& unit) const;
57 
58  virtual bool HasWater() const;
59  virtual SEScalarVolume& GetWater();
60  virtual double GetWater(const VolumeUnit& unit) const;
61 
62  virtual double GetWeight(const MassUnit& unit) const;
63 
64  virtual void ToString(std::ostream &str) const;
65 
66 protected:
67 
77 };
78 
79 inline std::ostream& operator<< (std::ostream& out, const SENutrition& n)
80 {
81  n.ToString(out);
82  return out;
83 }
Definition: SEScalarMass.h:23
Definition: SEScalar.h:19
Definition: SEScalarVolume.h:7
static bool SerializeToFile(const SENutrition &src, const std::string &filename, SerializationFormat m)
Definition: PBPatientNutrition.cpp:80
SEScalarMassPerTime * m_FatDigestionRate
Definition: SENutrition.h:71
Definition: SEScalarMassPerTime.h:26
static bool SerializeFromString(const std::string &src, SENutrition &dst, SerializationFormat m)
Definition: PBPatientNutrition.cpp:89
Definition: SEScalarVolume.h:23
SEScalarMassPerTime * m_ProteinDigestionRate
Definition: SENutrition.h:73
Definition: Logger.h:61
SEScalarVolume * m_Water
Definition: SENutrition.h:76
SEScalarMass * m_Sodium
Definition: SENutrition.h:75
static bool SerializeFromFile(const std::string &filename, SENutrition &dst, SerializationFormat m)
Definition: PBPatientNutrition.cpp:97
Definition: SENutrition.h:6
Definition: Logger.h:11
static void Copy(const SENutrition &src, SENutrition &dst)
Definition: PBPatientNutrition.cpp:67
Definition: SEScalarMassPerTime.h:7
SEScalarMass * m_Calcium
Definition: SENutrition.h:74
static bool SerializeToString(const SENutrition &src, std::string &output, SerializationFormat m)
Definition: PBPatientNutrition.cpp:74
Definition: PBPatientNutrition.h:8
SEScalarMass * m_Protein
Definition: SENutrition.h:72
SEScalarMass * m_Fat
Definition: SENutrition.h:70
SEScalarMass * m_Carbohydrate
Definition: SENutrition.h:68
virtual void ToString(std::ostream &str) const
Definition: SENutrition.cpp:320
Definition: SEScalarMass.h:7
SEScalarMassPerTime * m_CarbohydrateDigestionRate
Definition: SENutrition.h:69