Files
salmanoff/smocore/include/mind.h
T

64 lines
1.4 KiB
C++

#ifndef _MIND_H
#define _MIND_H
#include <config.h>
#include <functional>
#include <memory>
#include <string>
#include <spinscale/callback.h>
#include <spinscale/component.h>
#include <spinscale/puppetApplication.h>
#include <componentThread.h>
#include <mindThread.h>
#include <director/director.h>
#include <simulator/simulator.h>
#include <body/body.h>
namespace smo {
class Mind
: public PuppetApplication
{
public:
Mind(void);
~Mind(void) = default;
typedef std::function<void(bool)> mindLifetimeMgmtOpCbFn;
void initializeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
void finalizeReq(Callback<mindLifetimeMgmtOpCbFn> callback);
// ComponentThread access methods
std::shared_ptr<MindThread> getComponentThread(ThreadId id) const;
std::shared_ptr<MindThread> getComponentThread(
const std::string& name) const;
// Get all this Mind's component threads.
std::vector<std::shared_ptr<MindThread>> getMindThreads() const;
// CPU distribution method
void distributeAndPinThreadsAcrossCpus();
public:
director::Director director;
simulator::Simulator canvas;
PuppetComponent subconscious;
body::Body body;
PuppetComponent world;
private:
friend class body::Body;
bool bodyComponentInitialized = false;
private:
class MindLifetimeMgmtOp;
};
namespace mind {
// Global Mind instance will be defined in marionette.cpp
extern std::shared_ptr<Mind> globalMind;
} // namespace mind
} // namespace smo
#endif