Ejemplo n.º 1
0
bool GtPlusReconJob2DTGadget::
sendOutJob(int jobID, GtPlusReconJobTypeCPFL* job)
{
    try
    {
      GDEBUG("GtPlusReconJob2DTGadget sendOutJob ...\n");

        if (!this->controller_)
        {
	  GERROR("Cannot return result to controller, no controller set\n");
	  return false;
        }

        GadgetContainerMessage<GadgetMessageIdentifier>* mb =
            new GadgetContainerMessage<GadgetMessageIdentifier>();

        mb->getObjectPtr()->id = GADGET_MESSAGE_CLOUD_JOB;

        GadgetContainerMessage<int>* m1 = new GadgetContainerMessage<int>();
        *(m1->getObjectPtr()) = jobID;

        GadgetContainerMessage<GtPlusReconJobTypeCPFL>* m2 = new GadgetContainerMessage<GtPlusReconJobTypeCPFL>();

        *(m2->getObjectPtr()) = *job;

        m1->cont(m2);
        mb->cont(m1);

        int ret =  this->controller_->output_ready(mb);
        if (ret < 0)
        {
            GDEBUG("Failed to return GtPlusReconJob2DTGadget job massage to controller\n");
            return false;
        }
    }
    catch(...)
    {
        GERROR_STREAM("Errors in GtPlusReconJob2DTGadget::sendOutJob(...) ... ");
        return false;
    }

    return true;
}
    int ImageFinishGadget::process(GadgetContainerMessage<ISMRMRD::ImageHeader>* m1)
    {
        if (!this->controller_)
        {
            GERROR("Cannot return result to controller, no controller set");
            return -1;
        }

        GadgetContainerMessage<GadgetMessageIdentifier>* mb = new GadgetContainerMessage<GadgetMessageIdentifier>();

        mb->getObjectPtr()->id = GADGET_MESSAGE_ISMRMRD_IMAGE;
        mb->cont(m1);

        int ret = this->controller_->output_ready(mb);

        if ((ret < 0))
        {
            GERROR("Failed to return massage to controller\n");
            return GADGET_FAIL;
        }

        return GADGET_OK;
    }