Clean up CMakeLists in all C++ examples

+ Rename output executables to match directory structure
+ Remove libraries for small examples
+ Supress -Wreturn-type warnings for singleton that is intentionally not copyable
This commit is contained in:
2022-03-31 16:01:08 -04:00
parent 573fc4e1e8
commit a97dfbe34b
98 changed files with 695 additions and 598 deletions

View File

@@ -0,0 +1,33 @@
#ifndef FACTORY_HPP
#define FACTORY_HPP
#include <array>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include "parts.hpp"
// Gear Concrete Factory
class GearFactory {
public:
explicit GearFactory(std::string name_="GearFactory") :
name(std::move(name_)) {}
Part* requestPart();
Part* requestPart(std::string partName, float price);
void showStock() const;
std::string getName() const { return name;}
protected:
Part* makePart();
Part* makePart(std::string name, float price);
private:
std::string name;
std::unordered_map<std::string, int> inventory;
};
#endif // FACTORY_HPP