Line data Source code
1 : #ifndef CFE848F0_38AC_4182_9A69_D7C2AB0577CA_HPP 2 : #define CFE848F0_38AC_4182_9A69_D7C2AB0577CA_HPP 3 : 4 : #include "Hashing.hpp" 5 : #include "Types.hpp" 6 : 7 : #include <SFML/Graphics/Color.hpp> 8 : 9 : #include <string> 10 : 11 : namespace cell 12 : { 13 : 14 : /** 15 : * @brief Contains the physical and visual properties of a disc. Disc types used in the simulation need to be distinct 16 : * by name 17 : */ 18 : class DiscType 19 : { 20 : public: 21 : /** 22 : * @brief Creates a new disc type 23 : */ 24 : DiscType(const std::string& name, Radius radius, Mass mass); 25 : 26 : /** 27 : * @brief Disc types should be shared across all discs and be unique 28 : */ 29 : DiscType(const DiscType&) = delete; 30 : DiscType& operator=(const DiscType&) = delete; 31 36 : DiscType(DiscType&&) = default; 32 : DiscType& operator=(DiscType&&) = default; 33 : 34 : /** 35 : * @returns The name of this DiscType 36 : */ 37 : const std::string& getName() const; 38 : 39 : /** 40 : * @brief Sets the name for this DiscType (can't be empty) 41 : */ 42 : void setName(const std::string& name); 43 : 44 : /** 45 : * @returns The radius of this DiscType in px 46 : */ 47 : double getRadius() const; 48 : 49 : /** 50 : * @brief Sets the radius of this DiscType in px (must be > 0) 51 : */ 52 : void setRadius(double radius); 53 : 54 : /** 55 : * @returns The mass of this DiscType (arbitrary unit right now) 56 : */ 57 : double getMass() const; 58 : 59 : /** 60 : * @brief Sets the mass of this DiscType (must be > 0, arbitrary unit) 61 : */ 62 : void setMass(double mass); 63 : 64 : /** 65 : * @brief Comparison by all members 66 : */ 67 : bool operator==(const DiscType& other) const; 68 : 69 : private: 70 : /** 71 : * @brief The name is used to uniquely identify disc types within the disc type distribution 72 : */ 73 : std::string name_; 74 : 75 : /** 76 : * @brief Radius in px 77 : */ 78 : double radius_ = 0; 79 : 80 : /** 81 : * @brief Mass in arbitrary unit 82 : */ 83 : double mass_ = 0; 84 : }; 85 : 86 : } // namespace cell 87 : 88 : #endif /* CFE848F0_38AC_4182_9A69_D7C2AB0577CA_HPP */