Working on Dext, acceptation of PO

This commit is contained in:
2025-09-29 15:26:43 +02:00
parent 55688f88d3
commit 715a448b80
9 changed files with 23 additions and 9 deletions

View File

@@ -1008,4 +1008,5 @@ src/CMakeFiles/factory_core.dir/Processor.cpp.o: \
/usr/include/c++/13/cxxabi.h \
/usr/include/x86_64-linux-gnu/c++/13/bits/cxxabi_tweaks.h \
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/Machine.hpp \
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/ProductionOrder.hpp
/home/lj50/Univ/M2/Modelisation_problemes/simulation/src/ProductionOrder.hpp \
/usr/include/c++/13/iostream

View File

@@ -5307,6 +5307,7 @@ src/CMakeFiles/factory_core.dir/Processor.cpp.o
/usr/include/c++/13/initializer_list
/usr/include/c++/13/ios
/usr/include/c++/13/iosfwd
/usr/include/c++/13/iostream
/usr/include/c++/13/istream
/usr/include/c++/13/iterator
/usr/include/c++/13/limits

View File

@@ -5302,6 +5302,7 @@ src/CMakeFiles/factory_core.dir/Processor.cpp.o: src/Processor.cpp \
/usr/include/c++/13/initializer_list \
/usr/include/c++/13/ios \
/usr/include/c++/13/iosfwd \
/usr/include/c++/13/iostream \
/usr/include/c++/13/istream \
/usr/include/c++/13/iterator \
/usr/include/c++/13/limits \
@@ -12734,6 +12735,8 @@ src/ProductionOrder.hpp:
/usr/include/c++/13/tr1/ell_integral.tcc:
/usr/include/c++/13/iostream:
/usr/include/c++/13/bits/hash_bytes.h:
/usr/include/boost/smart_ptr/shared_ptr.hpp:

View File

@@ -25,6 +25,7 @@
*/
#include "Processor.hpp"
#include <iostream> // TODO: Remove this when debug is over
namespace artis::factory {
@@ -33,20 +34,28 @@ void Processor::dint(const Time & /* t */) {
// Fonction que gère les évolutions internes de ce modèle
}
void Processor::dext(const Time & /* t */, const Time & /* e */, const Bag &bag) {
std::for_each(bag.begin(), bag.end(), [](const ExternalEvent & /* event */) {
// TODO
// Fonction gérant les réponses du système aux évents passés via event()
void Processor::dext(const Time &t, const Time &e, const Bag &bag) {
std::for_each(bag.begin(), bag.end(), [this, t, e](const ExternalEvent &/*event*/) { // [this] capture this et le remet dans la lambda
// Fonction gérant les réponses du système aux évents passés via event()
if(this->currentState == this->ProcessorState::WAIT){
// We're waiting for a new event, and can work on this one !
this->currentState = this->ProcessorState::LOADING; // New state, we're loading this PO
std::cout << "PO loaded ! Time t : " << t << ", Time e : " << e << std::endl;
}else{
// Error, please wait, we're busy
//TODO
}
});
}
void Processor::start(const Time &t) {
// Démarrage et initialisation
this->currentState = this->ProcessorState::INIT; // ID de la phase d'état du modèle
this->currentState = this->ProcessorState::WAIT; // Prêt à recevoir un Production Order
this->startTime = t;
}
Time Processor::ta(const Time & /* t */) const {

View File

@@ -89,8 +89,8 @@ public:
private:
// TODO (state)
ProcessorState currentState;
Time startTime;
ProcessorState currentState = ProcessorState::INIT;
Time startTime = 0;
};
} // namespace artis::factory

Binary file not shown.