Spinscale: PuppetComponent takes PuppetApplication&
This commit is contained in:
+11
-5
@@ -4,6 +4,7 @@
|
||||
#include <spinscale/asynchronousLoop.h>
|
||||
#include <spinscale/callback.h>
|
||||
#include <spinscale/callableTracer.h>
|
||||
#include <spinscale/puppetApplication.h>
|
||||
#include <body/body.h>
|
||||
#include <componentThread.h>
|
||||
#include <mind.h>
|
||||
@@ -23,14 +24,15 @@ class Body::InitializeReq
|
||||
{
|
||||
public:
|
||||
InitializeReq(
|
||||
Mind &parent, const std::shared_ptr<ComponentThread> &caller,
|
||||
PuppetApplication &parent,
|
||||
const std::shared_ptr<ComponentThread> &caller,
|
||||
Callback<bodyLifetimeMgmtOpCbFn> callback)
|
||||
: PostedAsynchronousContinuation<bodyLifetimeMgmtOpCbFn>(caller, callback),
|
||||
parent(parent)
|
||||
{}
|
||||
|
||||
private:
|
||||
Mind &parent;
|
||||
PuppetApplication &parent;
|
||||
|
||||
public:
|
||||
void initializeReq1_posted(
|
||||
@@ -54,15 +56,17 @@ public:
|
||||
* We used to use Marionette, but there's a strong argument for using
|
||||
* Body instead since it's meant to handle device-management operations.
|
||||
*/
|
||||
// Upcast to Mind to access Mind-specific members
|
||||
Mind &mind = static_cast<Mind&>(context->parent);
|
||||
stim_buff::StimBuffApiManager::getInstance()
|
||||
.loadAllStimBuffApiLibsFromOptions(parent.body.thread);
|
||||
.loadAllStimBuffApiLibsFromOptions(mind.body.thread);
|
||||
|
||||
/** EXPLANATION:
|
||||
* Consider body::initializeReq to have been called if even one of its
|
||||
* operations was executed at all, whether successfully or
|
||||
* unsuccessfully.
|
||||
*/
|
||||
context->parent.bodyComponentInitialized = true;
|
||||
mind.bodyComponentInitialized = true;
|
||||
|
||||
std::cout << stim_buff::StimBuffApiManager::getInstance().stringifyLibs()
|
||||
<< std::endl;
|
||||
@@ -176,7 +180,9 @@ void Body::finalizeReq(Callback<bodyLifetimeMgmtOpCbFn> callback)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!parent.bodyComponentInitialized)
|
||||
// Upcast to Mind to access Mind-specific members
|
||||
Mind &mind = static_cast<Mind&>(parent);
|
||||
if (!mind.bodyComponentInitialized)
|
||||
{
|
||||
std::cout << "Mrntt: Body component not initialized. "
|
||||
<< "Skipping finalization." << "\n";
|
||||
|
||||
Reference in New Issue
Block a user