Files
solver/MbDCode/System.h
Aik-Siong Koh 475b8d16bc First commit
2023-04-26 17:23:31 -06:00

37 lines
1.1 KiB
C++

#pragma once
#include <memory>
#include <vector>
#include "Item.h"
#include "Part.h"
#include "Joint.h"
#include "SystemSolver.h"
namespace MbD {
class SystemSolver;
class System : public Item
{
//ToDo: Needed members admSystem namedItems mbdTime parts jointsMotions forcesTorques sensors variables hasChanged mbdSystemSolver
public:
static System& getInstance() {
//https://medium.com/@caglayandokme/further-enhancing-the-singleton-pattern-in-c-8278b02b1ac7
static System singleInstance; // Block-scoped static Singleton instance
return singleInstance;
};
std::vector<std::shared_ptr<Part>> parts;
std::vector<std::shared_ptr<Joint>> jointsMotions;
bool hasChanged = false;
std::shared_ptr<SystemSolver> systemSolver;
private:
System() {
parts = std::vector<std::shared_ptr<Part>>();
jointsMotions = std::vector<std::shared_ptr<Joint>>();
systemSolver = std::make_shared<SystemSolver>(*this);
}
//System() = default; // Private constructor
System(const System&) = delete;
System& operator=(const System&) = delete; // Deleted copy assignment
~System() = default; // Private destructor
};
}