Files
salmanoff/smocore/include/mind.h
T

64 lines
1.4 KiB
C++
Raw Normal View History

2024-09-04 14:08:50 +10:00
#ifndef _MIND_H
#define _MIND_H
2025-01-04 07:33:15 -04:00
#include <config.h>
#include <functional>
2025-09-03 14:43:00 -04:00
#include <memory>
#include <string>
2025-12-26 01:18:39 -04:00
#include <spinscale/callback.h>
2024-09-08 01:04:41 +10:00
2025-12-26 01:18:39 -04:00
#include <spinscale/component.h>
#include <spinscale/puppetApplication.h>
#include <componentThread.h>
2025-12-26 01:18:39 -04:00
#include <mindThread.h>
2025-01-04 07:33:15 -04:00
#include <director/director.h>
#include <simulator/simulator.h>
#include <body/body.h>
2024-09-04 14:08:50 +10:00
2025-07-22 06:48:04 -04:00
namespace smo {
2025-01-04 11:32:37 -04:00
class Mind
: public PuppetApplication
2024-09-04 14:08:50 +10:00
{
2025-01-04 13:21:33 -04:00
public:
2025-09-03 14:43:00 -04:00
Mind(void);
~Mind(void) = default;
typedef std::function<void(bool)> mindLifetimeMgmtOpCbFn;
void initializeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
2025-01-04 13:21:33 -04:00
2025-09-03 14:43:00 -04:00
// ComponentThread access methods
2025-12-26 01:18:39 -04:00
std::shared_ptr<MindThread> getComponentThread(ThreadId id) const;
std::shared_ptr<MindThread> getComponentThread(
2025-09-03 14:43:00 -04:00
const std::string& name) const;
// Get all this Mind's component threads.
std::vector<std::shared_ptr<MindThread>> getMindThreads() const;
2025-09-03 14:43:00 -04:00
// CPU distribution method
void distributeAndPinThreadsAcrossCpus();
public:
director::Director director;
simulator::Simulator canvas;
PuppetComponent subconscious;
body::Body body;
PuppetComponent world;
2025-09-03 14:43:00 -04:00
private:
friend class body::Body;
bool bodyComponentInitialized = false;
private:
class MindLifetimeMgmtOp;
2024-09-04 14:08:50 +10:00
};
namespace mind {
2025-09-03 14:43:00 -04:00
// Global Mind instance will be defined in marionette.cpp
extern std::shared_ptr<Mind> globalMind;
} // namespace mind
2025-07-22 06:48:04 -04:00
} // namespace smo
2025-01-04 11:32:37 -04:00
2024-09-04 14:08:50 +10:00
#endif