void i4_horizontal_compact_window_class::receive_event(i4_event * ev) { if (ev->type()==i4_event::WINDOW_MESSAGE) { CAST_PTR(mess,i4_window_message_class,ev); if (mess->sub_type==i4_window_message_class::NOTIFY_RESIZE) { CAST_PTR(res,i4_window_notify_resize_class,ev); sw32 ow=res->from()->width(), oh=res->from()->height(); res->from()->private_resize(res->new_width, res->new_height); compact(); res->from()->private_resize(ow, oh); note_undrawn(0,0, width()-1, height()-1); } else { i4_parent_window_class::receive_event(ev); } } else { i4_parent_window_class::receive_event(ev); } }
void* cGT_AcquisitionModelForward(void* ptr_am, const void* ptr_imgs) { try { CAST_PTR(DataHandle, h_am, ptr_am); CAST_PTR(DataHandle, h_imgs, ptr_imgs); AcquisitionModel& am = objectFromHandle<AcquisitionModel>(h_am); ImagesContainer& imgs = objectFromHandle<ImagesContainer>(h_imgs); boost::shared_ptr<AcquisitionsContainer> sptr_acqs = am.fwd(imgs); return sptrObjectHandle<AcquisitionsContainer>(sptr_acqs); } CATCH; }
void* cGT_setCSMs(void* ptr_am, const void* ptr_csms) { try { CAST_PTR(DataHandle, h_am, ptr_am); CAST_PTR(DataHandle, h_csms, ptr_csms); AcquisitionModel& am = objectFromHandle<AcquisitionModel>(h_am); boost::shared_ptr<CoilSensitivitiesContainer> sptr_csms = objectSptrFromHandle<CoilSensitivitiesContainer>(h_csms); am.setCSMs(sptr_csms); return (void*)new DataHandle; } CATCH; }
void* cGT_addGadget(void* ptr_gc, const char* id, const void* ptr_g) { try { CAST_PTR(DataHandle, h_gc, ptr_gc); CAST_PTR(DataHandle, h_g, ptr_g); GadgetChain& gc = objectFromHandle<GadgetChain>(h_gc); boost::shared_ptr<aGadget>& g = objectSptrFromHandle<aGadget>(h_g); gc.add_gadget(id, g); } CATCH; return (void*)new DataHandle; }
void* cGT_processImages(void* ptr_proc, void* ptr_input) { try { CAST_PTR(DataHandle, h_proc, ptr_proc); CAST_PTR(DataHandle, h_input, ptr_input); ImagesProcessor& proc = objectFromHandle<ImagesProcessor>(h_proc); ImagesContainer& input = objectFromHandle<ImagesContainer>(h_input); proc.process(input); boost::shared_ptr<ImagesContainer> sptr_img = proc.get_output(); return sptrObjectHandle<ImagesContainer>(sptr_img); } CATCH; }
void* cGT_AcquisitionModel(const void* ptr_acqs, const void* ptr_imgs) { try { CAST_PTR(DataHandle, h_acqs, ptr_acqs); CAST_PTR(DataHandle, h_imgs, ptr_imgs); boost::shared_ptr<AcquisitionsContainer> acqs = objectSptrFromHandle<AcquisitionsContainer>(h_acqs); boost::shared_ptr<ImagesContainer> imgs = objectSptrFromHandle<ImagesContainer>(h_imgs); boost::shared_ptr<AcquisitionModel> am(new AcquisitionModel(acqs, imgs)); return sptrObjectHandle<AcquisitionModel>(am); } CATCH; }
void* cGT_computeCoilSensitivities(void* ptr_csms, void* ptr_acqs) { try { CAST_PTR(DataHandle, h_csms, ptr_csms); CAST_PTR(DataHandle, h_acqs, ptr_acqs); CoilSensitivitiesContainer& csms = objectFromHandle<CoilSensitivitiesContainer>(h_csms); AcquisitionsContainer& acqs = objectFromHandle<AcquisitionsContainer>(h_acqs); csms.compute(acqs); return (void*)new DataHandle; } CATCH; }
void* cGT_reconstructImages(void* ptr_recon, void* ptr_input) { try { CAST_PTR(DataHandle, h_recon, ptr_recon); CAST_PTR(DataHandle, h_input, ptr_input); ImagesReconstructor& recon = objectFromHandle<ImagesReconstructor>(h_recon); AcquisitionsContainer& input = objectFromHandle<AcquisitionsContainer>(h_input); recon.process(input); boost::shared_ptr<ImagesContainer> sptr_img = recon.get_output(); return sptrObjectHandle<ImagesContainer>(sptr_img); } CATCH; }
void* cGT_processAcquisitions(void* ptr_proc, void* ptr_input) { try { CAST_PTR(DataHandle, h_proc, ptr_proc); CAST_PTR(DataHandle, h_input, ptr_input); AcquisitionsProcessor& proc = objectFromHandle<AcquisitionsProcessor>(h_proc); AcquisitionsContainer& input = objectFromHandle<AcquisitionsContainer>(h_input); proc.process(input); boost::shared_ptr<AcquisitionsContainer> sptr_ac = proc.get_output(); return sptrObjectHandle<AcquisitionsContainer>(sptr_ac); } CATCH; }
void* cGT_sendParameters(void* ptr_con, const void* ptr_par) { try { CAST_PTR(DataHandle, h_con, ptr_con); CAST_PTR(DataHandle, h_par, ptr_par); GTConnector& conn = objectFromHandle<GTConnector>(h_con); GadgetronClientConnector& con = conn(); std::string& par = objectFromHandle<std::string>(h_par); //std::cout << par << std::endl; con.send_gadgetron_parameters(par); } CATCH; return (void*)new DataHandle; }
/** * Send signal to QMGR. The input includes signal number and * signal data. The signal data is normally a copy of a received * signal so it contains expected arbitrator node id and ticket. * The sender in signal data is the QMGR node id. */ void ArbitMgr::sendSignalToQmgr(ArbitSignal& aSignal) { NdbApiSignal signal(numberToRef(API_CLUSTERMGR, theFacade.ownId())); signal.theVerId_signalNumber = aSignal.gsn; signal.theReceiversBlockNumber = QMGR; signal.theTrace = 0; signal.theLength = ArbitSignalData::SignalLength; ArbitSignalData* sd = CAST_PTR(ArbitSignalData, signal.getDataPtrSend()); sd->sender = numberToRef(API_CLUSTERMGR, theFacade.ownId()); sd->code = aSignal.data.code; sd->node = aSignal.data.node; sd->ticket = aSignal.data.ticket; sd->mask = aSignal.data.mask; #ifdef DEBUG_ARBIT char buf[17] = ""; ndbout << "arbit send: "; ndbout << " gsn=" << aSignal.gsn; ndbout << " recv=" << aSignal.data.sender; ndbout << " code=" << aSignal.data.code; ndbout << " node=" << aSignal.data.node; ndbout << " ticket=" << aSignal.data.ticket.getText(buf, sizeof(buf)); ndbout << " mask=" << aSignal.data.mask.getText(buf, sizeof(buf)); ndbout << endl; #endif theFacade.lock_mutex(); theFacade.sendSignalUnCond(&signal, aSignal.data.sender); theFacade.unlock_mutex(); }
void deleteObject(void* ptr) { if (!ptr) return; CAST_PTR(anObjectHandle, ptr_obj, ptr); delete ptr_obj; }
void g1_net_window_class::receive_event(i4_event * ev) { if (ev->type()==i4_event::OBJECT_MESSAGE) { CAST_PTR(oev, i4_object_message_event_class, ev); if (oev->object==this) { if (oev->sub_type==(w32)poll_id) { poll(); i4_object_message_event_class poll(this, poll_id); poll_event_id=i4_time_dev.request_event(this, &poll, poll_delay); } else { object_message(oev->sub_type); } } else { object_message(-1); i4_parent_window_class::receive_event(ev); } } else { i4_parent_window_class::receive_event(ev); } }
void cGT_setImageToRealConversion(void* ptr_imgs, int type) { CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& images = objectFromHandle<ImagesContainer>(h_imgs); images.set_image_to_real_conversion(type); }
void* cGT_imageWrapFromContainer(void* ptr_imgs, unsigned int img_num) { CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& images = objectFromHandle<ImagesContainer>(h_imgs); return sptrObjectHandle<ImageWrap>(images.sptr_image_wrap(img_num)); }
void cGT_getImageDataAsCmplxArray (void* ptr_imgs, int img_num, double* re, double* im) { CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& list = objectFromHandle<ImagesContainer>(h_imgs); list.get_image_data_as_cmplx_array(img_num, re, im); }
void cGT_getImageDataAsComplexArray(void* ptr_imgs, int img_num, size_t ptr_data) { complex_float_t* data = (complex_float_t*)ptr_data; CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& list = objectFromHandle<ImagesContainer>(h_imgs); list.get_image_data_as_complex_array(img_num, data); }
void cGT_getImageDataAsDoubleArray(void* ptr_imgs, int img_num, size_t ptr_data) { double* data = (double*)ptr_data; CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& list = objectFromHandle<ImagesContainer>(h_imgs); list.get_image_data_as_double_array(img_num, data); }
void* cGT_dot(const void* ptr_x, const void* ptr_y) { try { CAST_PTR(DataHandle, h_x, ptr_x); CAST_PTR(DataHandle, h_y, ptr_y); aDataContainer& x = objectFromHandle<aDataContainer>(h_x); aDataContainer& y = objectFromHandle<aDataContainer>(h_y); complex_double_t* result = (complex_double_t*)malloc(sizeof(complex_double_t)); *result = x.dot(y); DataHandle* handle = new DataHandle; handle->set(result, 0, GRAB); return (void*)handle; } CATCH; }
void cGT_getImageDimensions(void* ptr_imgs, int img_num, size_t ptr_dim) { int* dim = (int*)ptr_dim; CAST_PTR(DataHandle, h_imgs, ptr_imgs); ImagesContainer& list = objectFromHandle<ImagesContainer>(h_imgs); list.get_image_dimensions(img_num, dim); }
void* cGT_configGadgetChain(void* ptr_con, void* ptr_gc) { try { CAST_PTR(DataHandle, h_con, ptr_con); CAST_PTR(DataHandle, h_gc, ptr_gc); GTConnector& conn = objectFromHandle<GTConnector>(h_con); GadgetronClientConnector& con = conn(); GadgetChain& gc = objectFromHandle<GadgetChain>(h_gc); std::string config = gc.xml(); //std::cout << config << std::endl; con.send_gadgetron_configuration_script(config); } CATCH; return (void*)new DataHandle; }
int NdbOperation::init(const NdbTableImpl* tab, NdbTransaction* myConnection){ NdbApiSignal* tSignal; theStatus = Init; theError.code = 0; theErrorLine = 1; m_currentTable = m_accessTable = tab; theNdbCon = myConnection; for (Uint32 i=0; i<NDB_MAX_NO_OF_ATTRIBUTES_IN_KEY; i++) for (int j=0; j<3; j++) theTupleKeyDefined[i][j] = 0; theFirstATTRINFO = NULL; theCurrentATTRINFO = NULL; theLastKEYINFO = NULL; theTupKeyLen = 0; theNoOfTupKeyLeft = tab->getNoOfPrimaryKeys(); theTotalCurrAI_Len = 0; theAI_LenInCurrAI = 0; theStartIndicator = 0; theCommitIndicator = 0; theSimpleIndicator = 0; theDirtyIndicator = 0; theInterpretIndicator = 0; theDistrKeyIndicator_ = 0; theScanInfo = 0; theTotalNrOfKeyWordInSignal = 8; theMagicNumber = 0xABCDEF01; theBlobList = NULL; m_abortOption = -1; m_noErrorPropagation = false; m_no_disk_flag = 1; tSignal = theNdb->getSignal(); if (tSignal == NULL) { setErrorCode(4000); return -1; } theTCREQ = tSignal; theTCREQ->setSignal(m_tcReqGSN); theAI_LenInCurrAI = 20; TcKeyReq * const tcKeyReq = CAST_PTR(TcKeyReq, theTCREQ->getDataPtrSend()); tcKeyReq->scanInfo = 0; theKEYINFOptr = &tcKeyReq->keyInfo[0]; theATTRINFOptr = &tcKeyReq->attrInfo[0]; if (theReceiver.init(NdbReceiver::NDB_OPERATION, this)) { // theReceiver sets the error code of its owner return -1; } return 0; }
int NdbInfoScanOperation::sendDBINFO_SCANREQ(void) { DBUG_ENTER("NdbInfoScanOperation::sendDBINFO_SCANREQ"); SimpleSignal ss; DbinfoScanReq * req = CAST_PTR(DbinfoScanReq, ss.getDataPtrSend()); // API Identifiers req->resultData = m_result_data; req->transId[0] = m_transid0; req->transId[1] = m_transid1; req->resultRef = m_result_ref; // Scan parameters req->tableId = m_table->getTableId(); req->colBitmap[0] = ~0; req->colBitmap[1] = ~0; req->requestInfo = 0; req->maxRows = m_max_rows; req->maxBytes = m_max_bytes; DBUG_PRINT("info", ("max rows: %d, max bytes: %d", m_max_rows, m_max_bytes)); // Scan result req->returnedRows = 0; // Cursor data Uint32* cursor_ptr = DbinfoScan::getCursorPtrSend(req); for (unsigned i = 0; i < m_cursor.size(); i++) { *cursor_ptr = m_cursor[i]; DBUG_PRINT("info", ("cursor[%u]: 0x%x", i, m_cursor[i])); cursor_ptr++; } req->cursor_sz = m_cursor.size(); m_cursor.clear(); assert((m_rows_received == 0 && m_rows_confirmed == (Uint32)~0) || // first m_rows_received == m_rows_confirmed); // subsequent // No rows recieved in this batch yet m_rows_received = 0; // Number of rows returned by batch is not yet known m_rows_confirmed = ~0; assert(m_node_id); Uint32 len = DbinfoScanReq::SignalLength + req->cursor_sz; if (m_signal_sender->sendSignal(m_node_id, ss, DBINFO, GSN_DBINFO_SCANREQ, len) != SEND_OK) { m_state = Error; DBUG_RETURN(NdbInfo::ERR_ClusterFailure); } DBUG_RETURN(0); }
void cGT_getCSMDimensions(void* ptr_csms, int csm_num, size_t ptr_dim) { int* dim = (int*)ptr_dim; CAST_PTR(DataHandle, h_csms, ptr_csms); CoilSensitivitiesContainer& list = objectFromHandle<CoilSensitivitiesContainer>(h_csms); list.get_dim(csm_num, dim); }
void* cGT_registerImagesReceiver(void* ptr_con, void* ptr_img) { try { CAST_PTR(DataHandle, h_con, ptr_con); CAST_PTR(DataHandle, h_img, ptr_img); GTConnector& conn = objectFromHandle<GTConnector>(h_con); GadgetronClientConnector& con = conn(); boost::shared_ptr<ImagesContainer> sptr_images = objectSptrFromHandle<ImagesContainer>(h_img); con.register_reader(GADGET_MESSAGE_ISMRMRD_IMAGE, boost::shared_ptr<GadgetronClientMessageReader> (new GadgetronClientImageMessageCollector(sptr_images))); } CATCH; return (void*)new DataHandle; }
void cGT_getCSMDataAbs(void* ptr_csms, int csm_num, size_t ptr) { double* v = (double*)ptr; CAST_PTR(DataHandle, h_csms, ptr_csms); CoilSensitivitiesContainer& list = objectFromHandle<CoilSensitivitiesContainer>(h_csms); list.get_data_abs(csm_num, v); }
void* cGT_axpby( double ar, double ai, const void* ptr_x, double br, double bi, const void* ptr_y ){ try { CAST_PTR(DataHandle, h_x, ptr_x); CAST_PTR(DataHandle, h_y, ptr_y); aDataContainer& x = objectFromHandle<aDataContainer>(h_x); aDataContainer& y = objectFromHandle<aDataContainer>(h_y); boost::shared_ptr<aDataContainer> sptr_z = x.new_data_container(); complex_double_t a(ar, ai); complex_double_t b(br, bi); sptr_z->axpby(a, x, b, y); return sptrObjectHandle<aDataContainer>(sptr_z); } CATCH; }
void* cGT_sendImages(void* ptr_con, void* ptr_img) { try { CAST_PTR(DataHandle, h_con, ptr_con); CAST_PTR(DataHandle, h_img, ptr_img); GTConnector& conn = objectFromHandle<GTConnector>(h_con); GadgetronClientConnector& con = conn(); ImagesContainer& images = objectFromHandle<ImagesContainer>(h_img); for (int i = 0; i < images.number(); i++) { ImageWrap& iw = images.image_wrap(i); con.send_wrapped_image(iw); } } CATCH; return (void*)new DataHandle; }
void cGT_getCSMData(void* ptr_csms, int csm_num, size_t ptr_re, size_t ptr_im) { double* re = (double*)ptr_re; double* im = (double*)ptr_im; CAST_PTR(DataHandle, h_csms, ptr_csms); CoilSensitivitiesContainer& list = objectFromHandle<CoilSensitivitiesContainer>(h_csms); list.get_data(csm_num, re, im); }
void ClusterMgr::execDISCONNECT_REP(const NdbApiSignal* sig, const LinearSectionPtr ptr[]) { const DisconnectRep * rep = CAST_CONSTPTR(DisconnectRep, sig->getDataPtr()); Uint32 nodeId = rep->nodeId; assert(nodeId > 0 && nodeId < MAX_NODES); Node & cm_node = theNodes[nodeId]; trp_node & theNode = cm_node; bool node_failrep = theNode.m_node_fail_rep; set_node_dead(theNode); theNode.set_connected(false); noOfConnectedNodes--; if (noOfConnectedNodes == 0) { if (!global_flag_skip_invalidate_cache && theFacade.m_globalDictCache) { theFacade.m_globalDictCache->lock(); theFacade.m_globalDictCache->invalidate_all(); theFacade.m_globalDictCache->unlock(); m_connect_count ++; m_cluster_state = CS_waiting_for_clean_cache; } if (m_auto_reconnect == 0) { theStop = 2; } } if (node_failrep == false) { /** * Inform API */ NdbApiSignal signal(numberToRef(API_CLUSTERMGR, getOwnNodeId())); signal.theVerId_signalNumber = GSN_NODE_FAILREP; signal.theReceiversBlockNumber = API_CLUSTERMGR; signal.theTrace = 0; signal.theLength = NodeFailRep::SignalLengthLong; NodeFailRep * rep = CAST_PTR(NodeFailRep, signal.getDataPtrSend()); rep->failNo = 0; rep->masterNodeId = 0; rep->noOfNodes = 1; NodeBitmask::clear(rep->theAllNodes); NodeBitmask::set(rep->theAllNodes, nodeId); execNODE_FAILREP(&signal, 0); } }