/** Does a deep copy of 'data'. */ int writeDataChunk(FileWriteHandle handle,struct bufferData *data) { if (handle != NULL && data != NULL) { struct FileWriteObject *object = (struct FileWriteObject*)handle; // A valid file, but it has not been opened yet. struct bufferData *dataCopy = deepCopyBufferData(data); pthread_mutex_lock(&writeMutex); pushData(object->writeObjects,dataCopy); pthread_mutex_unlock(&writeMutex); if(object->fileStatus == 1) { // Normal data, nothing to do. } else if(object->fileStatus == 0) { printf("File not opened yet; buffering data.\n"); } else { // TODO: Handle ERROR printf("File Error.\n"); } } return 0; }
wxThread::ExitCode GammaBlockUSB::Entry() { //wxMutexLocker locker(m_processDataMutex); if(deviceFind() && deviceInit()) { while(!GetThread()->TestDestroy()) { GammaDataUSB* pDataOut(new GammaDataUSB); int bytesRead = 0x200; #if defined(_MSC_VER) && defined(GAMMA_USB_CYAPI) LONG length = bytesRead; m_usbDevice->BulkInEndPt->XferData(pDataOut->data, length); bytesRead = length; #else //usb_claim_interface(m_usbDevice, 0); bytesRead = usb_bulk_read(m_usbDevice, EP6IN, (char*)pDataOut->data, bytesRead, GAMMA_READ_TIMEOUT); //usb_release_interface(m_usbDevice, 0); #endif wxASSERT(GAMMA_READ_SIZE == bytesRead); pushData(wxSharedPtr<GammaData>(pDataOut)); } } return 0; }
void Debugger::afterCompletion(Interpreter interpreter) { boost::shared_ptr<DebugSession> session = getSession(interpreter); if (!session) return; Data msg; msg.compound["replyType"] = Data("finished", Data::VERBATIM); pushData(session, msg); }
/** \fn void cmscope(scicos_block * block,int flag) \brief the computational function \param block A pointer to a scicos_block \param flag An int which indicates the state of the block (init, update, ending) */ SCICOS_BLOCKS_IMPEXP void canimxy3d(scicos_block * block, scicos_flag flag) { char const* pFigureUID; sco_data *sco; int j; BOOL result; switch (flag) { case Initialization: sco = getScoData(block); if (sco == NULL) { set_block_error(-5); break; } pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } break; case StateUpdate: pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } appendData(block, block->inptr[0], block->inptr[1], block->inptr[2]); for (j = 0; j < block->insz[0]; j++) { result = pushData(block, j); if (result == FALSE) { Coserror("%s: unable to push some data.", "cscopxy3d"); break; } } break; case Ending: freeScoData(block); break; default: break; } }
void Debugger::afterCompletion(Interpreter& interpreter) { InterpreterImpl* impl = interpreter.getImpl().get(); std::shared_ptr<DebugSession> session = getSession(impl); if (!session) return; Data msg; msg.compound["replyType"] = Data("finished", Data::VERBATIM); pushData(session, msg); }
/** \fn void cmatview(scicos_block * block,int flag) \brief the computational function \param block A pointer to a scicos_block \param flag An int which indicates the state of the block (init, update, ending) */ SCICOS_BLOCKS_IMPEXP void cmatview(scicos_block * block, scicos_flag flag) { char const* pFigureUID; double *u; sco_data *sco; BOOL result; switch (flag) { case Initialization: sco = getScoData(block); if (sco == NULL) { set_block_error(-5); break; } pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } break; case StateUpdate: pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } u = GetRealInPortPtrs(block, 1); result = pushData(block, u); if (result == FALSE) { Coserror("%s: unable to push some data.", "cmatview"); break; } break; case Ending: freeScoData(block); break; default: break; } }
/** \fn void cmscope(scicos_block * block,int flag) \brief the computational function \param block A pointer to a scicos_block \param flag An int which indicates the state of the block (init, update, ending) */ SCICOS_BLOCKS_IMPEXP void cscopxy3d(scicos_block * block, scicos_flag flag) { int iFigureUID; sco_data *sco; int j; BOOL result; switch (flag) { case Initialization: sco = getScoData(block); if (sco == NULL) { set_block_error(-5); } iFigureUID = getFigure(block); if (iFigureUID == 0) { // allocation error set_block_error(-5); } break; case StateUpdate: iFigureUID = getFigure(block); if (iFigureUID == 0) { // allocation error set_block_error(-5); break; } appendData(block, GetRealInPortPtrs(block, 1), GetRealInPortPtrs(block, 2), GetRealInPortPtrs(block, 3)); for (j = 0; j < block->insz[0]; j++) { result = pushData(block, j); if (result == FALSE) { Coserror("%s: unable to push some data.", "cscopxy3d"); break; } } break; case Ending: freeScoData(block); break; default: break; } }
bool Color2Gray::process() { emit logout("Color2Gray::process()"); ImageData *idata = qobject_cast<ImageData *>(m_inputPort.data()); if(idata) { cv::Mat mat; cv::cvtColor(idata->imageData(), mat, CV_RGB2GRAY); ImageData grayData; grayData.setImageData(mat); pushData(&grayData, "grayImage"); emit logout("Color2Gray::process() OK"); return true; } return false; }
TabDialog::TabDialog(QWidget *parent):QDialog(parent) { readToFile(); findWidget = new Find(this); addWidget = new Add(this); tabWidget = new QTabWidget; tabWidget->addTab(findWidget,tr("Поиск")); tabWidget->addTab(addWidget,tr("Добавить")); QVBoxLayout *layout = new QVBoxLayout; layout->addWidget(tabWidget); setLayout(layout); connect(addWidget,SIGNAL(addCar(Car)),this,SLOT(pushData(Car))); connect(findWidget,SIGNAL(findClick()),this,SLOT(importContainerInfo())); connect(this,SIGNAL(infoToTable(int,QVector<Car>)),this,SLOT(findResult(int,QVector<Car>))); setWindowTitle(tr("Каталог автомобилей")); }
void DebuggerServlet::send(google::LogSeverity severity, const char* full_filename, const char* base_filename, int line, const struct ::tm* tm_time, const char* message, size_t message_len) { // _sendQueue is thread-safe, not sure about ToString though LogMessage msg(severity, full_filename, base_filename, line, tm_time, std::string(message, message_len), ToString(severity, base_filename, line, tm_time, message, message_len)); msg.compound["replyType"] = Data("log", Data::VERBATIM); pushData(boost::shared_ptr<DebugSession>(), msg); }
void GammaTransMI::processData(wxSharedPtr<GammaData> sDataIn) { wxMutexLocker locker(m_processDataMutex); wxASSERT(GAMMA_DATA_TYPE_MATRIX == sDataIn->type); GammaMatrix* pDataIn = dynamic_cast<GammaMatrix*>(sDataIn.get()); wxSharedPtr<GammaData> sDataOut(new GammaImage()); GammaImage* pDataOut = dynamic_cast<GammaImage*>(sDataOut.get()); calcMax(pDataIn->eventMax()); calcColour(0); pDataOut->image.SetRGB( wxRect(0, 0, 256, 256), m_colour.Red(), m_colour.Green(), m_colour.Blue() ); for(wxUint32 y = 0; y < 256; y++) { for(wxUint32 x = 0; x < 256; x++) { if(pDataIn->matrix[POINT(x,y)]) { calcColour(pDataIn->matrix[POINT(x,y)]); pDataOut->image.SetRGB( x, y, m_colour.Red(), m_colour.Green(), m_colour.Blue() ); } } } /* if(GAMMA_TRIG_NONE != pDataIn->trig) { getManager()->DataTierSetParam(GAMMA_PARAM_UNIFORM_MATRIX_SET, pDataIn->matrix); getManager()->PresentationTierSetParam(GAMMA_PARAM_TRIG_TYPE, &pDataIn->trig); } */ /* wxLogStatus("eventMax = %u, m_max = %f, eventSum = %"wxLongLongFmtSpec"d, span = %"wxLongLongFmtSpec"d freq = %f k/s", pDataIn->eventMax, m_max, pDataIn->eventSum, pDataIn->span.GetValue().GetValue(), (double)pDataIn->eventSum / pDataIn->span.GetValue().GetValue()); */ getManager()->PresentationTierSetParam(GAMMA_PARAM_DATA_TYPE_MATRIX, (void*)pDataIn); getManager()->PresentationTierSetParam(GAMMA_PARAM_IMG_DATA, (void*)&pDataOut->image); getManager()->PresentationTierSetParam(GAMMA_PARAM_TIME_NOW, &pDataIn->acqTime); pushData(sDataOut); }
int mwInt2(int* accum, int* latest, int* old, BUFFER* filtered) { /* * GroupDelay: 72.5 ms */ // Dynamic Retrieving of values &accu += &latest; &accu -= &old; // Filter math int y = &accu / 30; // Pushing data back to buffer object pushData(filtered, y); return 0; }
void SocialWidget::accept() { tDebug() << "Sharing social link!"; QVariantMap shareInfo; Tomahawk::InfoSystem::InfoStringHash trackInfo; trackInfo["title"] = m_query->track(); trackInfo["artist"] = m_query->artist(); trackInfo["album"] = m_query->album(); shareInfo["trackinfo"] = QVariant::fromValue< Tomahawk::InfoSystem::InfoStringHash >( trackInfo ); shareInfo["message"] = ui->textEdit->toPlainText(); shareInfo["accountlist"] = QStringList( "all" ); Tomahawk::InfoSystem::InfoPushData pushData( uuid(), Tomahawk::InfoSystem::InfoShareTrack, shareInfo, Tomahawk::InfoSystem::PushNoFlag ); Tomahawk::InfoSystem::InfoSystem::instance()->pushInfo( pushData ); deleteLater(); }
void GammaNemaCalc::processData(wxSharedPtr<GammaData> pData) { wxMutexLocker locker(m_processDataMutex); wxASSERT(GAMMA_DATA_TYPE_MATRIX == pData->type); m_pDataIn = dynamic_cast<GammaMatrix*>(pData.get()); GammaMatrix* pDataOut(new GammaMatrix); floodFill(wxPoint(0,0), 0); marginalRemove(); convolutionFilter(pDataOut); memcpy(m_pDataIn->matrix, pDataOut->matrix, sizeof(wxUint32) * 256 * 256); pDataOut->acqTime = m_pDataIn->acqTime; wxLogStatus("Intg = %f, Diff(X) = %f, Diff(Y) = %f", getIntgUniformity(), getDiffUniformity(GAMMA_DIRECTION_X), getDiffUniformity(GAMMA_DIRECTION_Y)); pushData(wxSharedPtr<GammaData>(pDataOut)); }
/** \fn void cscope(scicos_block * block,int flag) \brief the computational function \param block A pointer to a scicos_block \param flag An int which indicates the state of the block (init, update, ending) */ SCICOS_BLOCKS_IMPEXP void cevscpe(scicos_block * block, scicos_flag flag) { int iFigureUID; double t; int i; int mask; int nclk = block->nipar - 6; sco_data *sco; BOOL result; switch (flag) { case Initialization: sco = getScoData(block); if (sco == NULL) { set_block_error(-5); } iFigureUID = getFigure(block); if (iFigureUID == 0) { // allocation error set_block_error(-5); break; } setSegsBuffers(block, DEFAULT_MAX_NUMBER_OF_POINTS); break; case StateUpdate: iFigureUID = getFigure(block); if (iFigureUID == 0) { // allocation error set_block_error(-5); break; } t = get_scicos_time(); // select only the masked indexes for (i = 0; i < nclk; i++) { mask = 1 << i; if ((block->nevprt & mask) == mask) { appendData(block, i, t); result = pushData(block, i); if (result == FALSE) { Coserror("%s: unable to push some data.", "cevscpe"); break; } } } break; case Ending: freeScoData(block); break; default: break; } }
SICALLBACK ToonixLighter_BeginEvaluate( ICENodeContext& in_ctxt ) { TXLight* light = NULL; CValue userData = in_ctxt.GetUserData(); if(userData.IsEmpty()) { // Build a new Light Object light = new TXLight(); // Get the input TXGeometry CDataArrayCustomType ToonixData( in_ctxt, ID_IN_ToonixData ); CDataArrayCustomType::TData* pBufferToonixData; ULONG nSizeToonixData; ToonixData.GetData( 0,(const CDataArrayCustomType::TData**)&pBufferToonixData, nSizeToonixData ); TXData* data = (TXData*)pBufferToonixData; light->_geom = data->_geom; in_ctxt.PutUserData((CValue::siPtrType)light); } else { light = (TXLight*)(CValue::siPtrType)in_ctxt.GetUserData( ); } if(GetLighterDirtyState(in_ctxt)) { //Application().LogMessage(L"Toonix Lighter >State Dirty..."); // Get lights positions used for light detection light->_lights.clear(); siICENodeDataType inPortType; siICENodeStructureType inPortStruct; siICENodeContextType inPortContext; in_ctxt.GetPortInfo( ID_IN_LightPosition, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { //Application().LogMessage(L"ONE Light"); CDataArrayVector3f lightPointData( in_ctxt, ID_IN_LightPosition ); light->_lights.push_back(lightPointData[0]); light->_nbl = 1; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { //Application().LogMessage(L"MULTI Lights"); CDataArray2DVector3f lightPointsData( in_ctxt, ID_IN_LightPosition ); CDataArray2DVector3f::Accessor lightPointData = lightPointsData[0]; light->_nbl = lightPointData.GetCount(); for(LONG l=0;l<light->_nbl;l++) { light->_lights.push_back(lightPointData[l]); } } light->_bias.resize(light->_nbl); in_ctxt.GetPortInfo( ID_IN_LightBias, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { CDataArrayFloat lightBiasData( in_ctxt, ID_IN_LightBias ); light->_bias[0] = lightBiasData[0]; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { CDataArray2DFloat lightPointsData( in_ctxt, ID_IN_LightBias ); CDataArray2DFloat::Accessor lightPointData = lightPointsData[0]; ULONG nbl = lightPointData.GetCount(); for(LONG l=0;l<nbl&&l<light->_nbl;l++) { light->_bias[l] = lightPointData[l]; } } light->_distance.resize(light->_nbl); in_ctxt.GetPortInfo( ID_IN_LightDistance, inPortType, inPortStruct, inPortContext ); if ( inPortStruct == XSI::siICENodeStructureSingle ) { CDataArrayFloat lightDistanceData( in_ctxt, ID_IN_LightDistance ); light->_distance[0] = lightDistanceData[0]; } else if ( inPortStruct == XSI::siICENodeStructureArray ) { CDataArray2DFloat lightDistancesData( in_ctxt, ID_IN_LightDistance ); CDataArray2DFloat::Accessor lightDistanceData = lightDistancesData[0]; ULONG nbl = lightDistanceData.GetCount(); for(LONG l=0;l<nbl&&l<light->_nbl;l++) { light->_distance[l] = lightDistanceData[l]; } } CDataArrayBool revertData( in_ctxt, ID_IN_Revert ); light->_reverse = revertData[0]; CDataArrayFloat pushData( in_ctxt, ID_IN_Push ); light->_push = pushData[0]; CDataArrayVector3f viewData( in_ctxt, ID_IN_ViewPosition ); light->_view = viewData[0]; light->Build(); in_ctxt.PutUserData((CValue::siPtrType)light); } return CStatus::OK; }
/** \fn void cmscope(scicos_block * block,int flag) \brief the computational function \param block A pointer to a scicos_block \param flag An int which indicates the state of the block (init, update, ending) */ SCICOS_BLOCKS_IMPEXP void cmscope(scicos_block * block, scicos_flag flag) { char const* pFigureUID; double t; double *u; sco_data *sco; int i, j; BOOL result; switch (flag) { case Initialization: sco = getScoData(block); if (sco == NULL) { set_block_error(-5); break; } pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } break; case StateUpdate: pFigureUID = getFigure(block); if (pFigureUID == NULL) { // allocation error set_block_error(-5); break; } t = get_scicos_time(); for (i = 0; i < block->nin; i++) { u = (double *)block->inptr[i]; appendData(block, i, t, u); for (j = 0; j < block->insz[i]; j++) { result = pushData(block, i, j); if (result == FALSE) { Coserror("%s: unable to push some data.", "cmscope"); break; } } } break; case Ending: freeScoData(block); break; default: break; } }
void closeFileWriteHandle(FileWriteHandle handle) { pthread_mutex_lock(&writeMutex); pushData(fileCloseList,(void*)handle); pthread_mutex_unlock(&writeMutex); }
static void pushHandleOntoOpenList(FileWriteHandle handle) { pthread_mutex_lock(&writeMutex); pushData(fileOpenList,(void*)handle); pthread_mutex_unlock(&writeMutex); }
static void addToWritePendingList(struct FileWriteObject *object) { pthread_mutex_lock(&writeMutex); pushData(fileWriteList,(void*)object); pthread_mutex_unlock(&writeMutex); }
static void addToReadPendingList(struct FileReadObject *object) { pthread_mutex_lock(&readMutex); pushData(fileReadList,(void*)object); pthread_mutex_unlock(&readMutex); }
static void addDataToReadList(struct node *list, struct bufferData *dataChunk) { pthread_mutex_lock(&readMutex); pushData(list,dataChunk); pthread_mutex_unlock(&readMutex); }