summaryrefslogtreecommitdiff
path: root/src/ZooAnimal.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/ZooAnimal.cc')
-rw-r--r--src/ZooAnimal.cc44
1 files changed, 44 insertions, 0 deletions
diff --git a/src/ZooAnimal.cc b/src/ZooAnimal.cc
new file mode 100644
index 0000000..6bfa1d2
--- /dev/null
+++ b/src/ZooAnimal.cc
@@ -0,0 +1,44 @@
+#include <utility>
+
+#include "ZooAnimal.hh"
+
+namespace zoo {
+ZooAnimal::~ZooAnimal() = default;
+
+void ZooAnimal::setIDNum(int _idNumber) { this->idNumber = _idNumber; }
+
+void ZooAnimal::setCageNum(int _cageNumber) {
+ if (validateCageNumber(_cageNumber)) {
+ this->cageNumber = _cageNumber;
+ }
+}
+
+void ZooAnimal::setDateAcq(int _dateAcquired) {
+ this->dateAcquired = _dateAcquired;
+}
+
+void ZooAnimal::setSpecies(std::string _species) {
+ this->species = std::move(_species);
+}
+
+int ZooAnimal::getIDNum() const { return this->idNumber; }
+
+int ZooAnimal::getCageNum() const { return this->cageNumber; }
+
+int ZooAnimal::getDateAcq() const { return this->dateAcquired; }
+
+std::string ZooAnimal::getSpecies() { return this->species; }
+
+bool ZooAnimal::validateCageNumber(int _cageNumber) {
+ if (this->zoo != nullptr) {
+ for (std::size_t i = 0;
+ i < static_cast<std::size_t>(this->zoo->getNumCages()); ++i) {
+ if (*zoo->getCage(i) == _cageNumber) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+} // namespace zoo