void visit_fnctsInNast::visit_function_decl (function_decl_n *np) { nast_node *child; clearData(); fData = new fnctData; fData->setNodeP(np); fData->setSource(np->getSource()); #ifdef TEST_VISIT_FNCTS_IN_NAST cout << "#FUNCTION - BEGIN\n"; #endif // get the name if (np->hasEdgeName(NAME_EDGE)) { child = np->edgeName(NAME_EDGE); child->accept(*this); if (tempS == "") fnctName = "XOgastan_NOname" + a2b::long2string(++noNameNumber); else fnctName = tempS; } // get the type buildingFnctType = true; if (np->hasEdgeName(TYPE_EDGE)) { child = np->edgeName(TYPE_EDGE); child->accept(*this); } // set the data about the declaration fData->setName(fnctName); fData->setType(fnctType); #ifdef TEST_VISIT_FNCTS_IN_NAST cout << "type returned : " << fData->getType() << "\n" << "name : " << fData->getName() << "\n" << "source file : " << fData->getSource() << "\n"; #endif // visit the parameters if (np->hasEdgeName(ARGUMENTS_EDGE)) { child = np->edgeName(ARGUMENTS_EDGE); child->accept(*this); } // add the data to the list fL->push_front(fData); #ifdef TEST_VISIT_FNCTS_IN_NAST cout << "number of paramaters : " << fData->numParm() << "\n" << "#FUNCTION - END\n\n"; #endif // visit the next declaration if (np->hasEdgeName(NEXT_DECL_EDGE)) { child = np->edgeName(NEXT_DECL_EDGE); child->accept(*this); } return; }
MechPart::~MechPart() { clearData(); }
StoneHandler::~StoneHandler() { clearData(); delete stones; delete groups; }
TweakResource::~TweakResource() { clearData(); delete e; }
/** * @brief MainWindow::MainWindow Initialize the main window and everything else * @param parent */ MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow) { // Initialize the interface ui->setupUi(this); ui->glWidget->addAction(ui->actionFullscreen); ui->glWidget->addAction(ui->actionExit); connect(ui->actionExit,SIGNAL(triggered()),this,SLOT(close())); connect(ui->actionFullscreen,SIGNAL(triggered()),this,SLOT(toggleFullscreenSlot())); // The test script runs a simple experiment experimentScript = new TestScript(this,this); // Add a cosmetic line to the splitter handle // so that it's easier to grab with the mouse QSplitterHandle *handle = ui->splitter->handle(1); QVBoxLayout *layout = new QVBoxLayout(handle); layout->setSpacing(0); layout->setMargin(0); QFrame *line = new QFrame(handle); line->setFrameShape(QFrame::VLine); line->setFrameShadow(QFrame::Sunken); layout->addWidget(line); // In a future revision, we'll move the SimWorld // to a more intelligent place. It doesn't // belong as a child to the graphics widget. SimWorld* world = ui->glWidget->getWorld(); CapBody* capBody = world->getBody(); #if defined( BOARD_DATA ) BoardMarkerData* md = ui->glWidget->getWorld()->getMarkerData(); #elif defined( POKE_DATA ) PokeMarkerData* md = ui->glWidget->getWorld()->getMarkerData(); #else MarkerData* md = world->getMarkerData(); #endif // We populate a ScrollArea with the same number of // MarkerWidgets as there are markers in the data file. QScrollArea* sa = new QScrollArea; QWidget* wid = new QWidget; layout = new QVBoxLayout; layout->setContentsMargins(0,0,0,0); // This part needs to become part of a function // that is called everytime a new data file is // loaded. int markCnt = md->marker_count; ui->markerCountLineEdit->setText(QString::number(markCnt)); ui->frameCountLineEdit->setText(QString::number(md->size())); ui->markerFileLineEdit->setText("data.c3d"); ui->markerFrameStartBox->setValue(0); setDataRange(md->size()); QHBoxLayout* innerLayout = new QHBoxLayout; QPushButton* connectButton = new QPushButton("Connect"); QPushButton* releaseButton = new QPushButton("Release"); QPushButton* updateButton = new QPushButton("Update Anchors"); innerLayout->addWidget(connectButton); innerLayout->addWidget(releaseButton); innerLayout->addWidget(updateButton); connect(connectButton,SIGNAL(clicked()),this,SLOT(connectMarkers())); connect(releaseButton,SIGNAL(clicked()),this,SLOT(releaseMarkers())); connect(updateButton,SIGNAL(clicked()),this,SLOT(updateMarkerAnchors())); layout->addLayout(innerLayout); markerWidgetArray.resize(markCnt); for (int ii=0;ii<markCnt;++ii) { markerWidgetArray[ii] = new MarkerWidget(ii,0); layout->addWidget(markerWidgetArray[ii]); } wid->setLayout(layout); sa->setWidget(wid); ui->controlTabWidget->addTab(sa,"Markers"); // Joint control tab sa = new QScrollArea; wid = new QWidget; layout = new QVBoxLayout; layout->setContentsMargins(0,0,0,0); // A couple buttons at the top of the joint tab make it possible // to rapidly change all the force limits innerLayout = new QHBoxLayout; QPushButton* zeroButton = new QPushButton("Zero"); QPushButton* lightButton = new QPushButton("Light"); QPushButton* resetButton = new QPushButton("Strong"); innerLayout->addWidget(zeroButton); innerLayout->addWidget(lightButton); innerLayout->addWidget(resetButton); layout->addLayout(innerLayout); connect(zeroButton,SIGNAL(clicked()),this,SLOT(zeroForces())); connect(lightButton,SIGNAL(clicked()),this,SLOT(lightForces())); connect(resetButton,SIGNAL(clicked()),this,SLOT(strongForces())); // Fill the tab with hard-coded data about the model... populateJointTab(capBody,layout); wid->setLayout(layout); sa->setWidget(wid); ui->controlTabWidget->addTab(sa,"Joints"); // Body dimensions widget sa = new QScrollArea; wid = new QWidget; layout = new QVBoxLayout; layout->setContentsMargins(0,0,0,0); QCheckBox* keepBodyRel = new QCheckBox("Body Rel"); layout->addWidget(keepBodyRel); // Fill the tab with model-specific widgets populateBodyTab(capBody,layout); wid->setLayout(layout); sa->setWidget(wid); ui->controlTabWidget->addTab(sa,"Model dimensions"); // Hook up the interface elements to their respecitve functionality connect(ui->saveButton,SIGNAL(clicked()),capBody,SLOT(saveBody())); connect(ui->loadButton,SIGNAL(clicked()),capBody,SLOT(loadBody())); connect(ui->testButton,SIGNAL(clicked()),this,SLOT(experimentSlot())); // When a the CapBody loads the marker map, tell the interface // how and where the markers are connected. connect(capBody,SIGNAL(markMap(int,int)),this,SLOT(setMarkMap(int,int))); connect(capBody,SIGNAL(markPoint(int,double,double,double)), this,SLOT(setMarkPoint(int,double,double,double))); // ***** // (Each MarkerWidget informs the capBody when the interface // changes). for (int ii=0;ii<markCnt;++ii) { connect(markerWidgetArray[ii],SIGNAL(markBodySet(int,int)),md,SLOT(changeBodyConnect(int,int))); connect(markerWidgetArray[ii],SIGNAL(markConnect(int,bool)),md,SLOT(changeBodyLink(int,bool))); connect(markerWidgetArray[ii],SIGNAL(markPosSet(int,double,double,double)), md,SLOT(changeLinkPos(int,double,double,double))); connect(markerWidgetArray[ii],SIGNAL(markGrab(int)),this, SLOT(grabMarkPos(int))); } connect(ui->clearPlotButton,SIGNAL(clicked()),this,SLOT(clearData())); connect(ui->glWidget->getWorld(),SIGNAL(useMarkers(bool)),this,SLOT(usingMarkers(bool))); connect(ui->frictionSpinBox,SIGNAL(valueChanged(double)),world,SLOT(setGroundFriction(double))); connect(ui->terrainSpinBox,SIGNAL(valueChanged(double)),world,SLOT(setTerrainSoftness(double))); connect(ui->zBox,SIGNAL(valueChanged(double)),ui->glWidget->getWorld(),SLOT(setTerrainZ(double))); connect(ui->forceLinesCheckBox,SIGNAL(clicked(bool)),ui->glWidget,SLOT(setDrawLines(bool))); connect(ui->camFollowCheckBox,SIGNAL(clicked(bool)),ui->glWidget,SLOT(setFollowCamera(bool))); connect(ui->timeSlider,SIGNAL(valueChanged(int)),world->getMarkerData(),SLOT(setFrame(int))); connect(ui->glWidget->getWorld()->getMarkerData(),SIGNAL(frameChanged(int)),ui->timeSlider,SLOT(setValue(int))); connect(ui->bodyAlpha,SIGNAL(valueChanged(double)),ui->glWidget,SLOT(setBodyAlpha(double))); connect(ui->showMarkBox,SIGNAL(toggled(bool)),ui->glWidget,SLOT(setShowMarkers(bool))); connect(ui->selfCollideBox,SIGNAL(toggled(bool)),world,SLOT(setSelfCollide(bool))); connect(ui->saveStateButton,SIGNAL(clicked()),this,SLOT(saveModel())); connect(ui->restoreButton,SIGNAL(clicked()),this,SLOT(restoreModel())); connect(ui->markerRadio,SIGNAL(toggled(bool)),this,SLOT(useMarkers(bool))); connect(ui->torqueRadio,SIGNAL(toggled(bool)),this,SLOT(useTorques(bool))); connect(ui->altRadio,SIGNAL(toggled(bool)),this,SLOT(useAltForces(bool))); connect(ui->playAllButton,SIGNAL(clicked(bool)),this,SLOT(playPauseAll(bool))); connect(ui->playPauseDataButton,SIGNAL(clicked(bool)),this,SLOT(playPauseData(bool))); connect(ui->playPauseSimButton,SIGNAL(clicked(bool)),this,SLOT(playPauseSim(bool))); connect(ui->stepAllButton,SIGNAL(clicked()),this,SLOT(stepAll())); connect(ui->stepDataButton,SIGNAL(clicked()),this,SLOT(stepData())); connect(ui->stepSimButton,SIGNAL(clicked()),this,SLOT(stepSim())); connect(ui->selectFileToolButton,SIGNAL(clicked()),this,SLOT(markerFileDialog())); connect(ui->dataStepBox,SIGNAL(valueChanged(int)),this,SLOT(setDataStep(int))); connect(ui->dataFrameBox,SIGNAL(valueChanged(int)),this,SLOT(setDataFrame(int))); connect(ui->timeSlider,SIGNAL(valueChanged(int)),ui->dataFrameBox,SLOT(setValue(int))); connect(ui->actionAbout,SIGNAL(triggered()),this,SLOT(aboutSlot())); // Monitor and manipulate recorded angle data connect(world->angle_sequence,SIGNAL(lengthChanged(int)),this,SLOT(setAngleFrameCount(int))); connect(ui->angleDataFrameBox,SIGNAL(valueChanged(int)),this,SLOT(setAngleCurrentFrame(int))); connect(world,SIGNAL(angleFrame(int)),this,SLOT(setAngleCurrentFrame(int))); connect(ui->saveAnglesButton,SIGNAL(clicked()),this,SLOT(writeSavedAngles())); connect(ui->loadAnglesButton,SIGNAL(clicked()),this,SLOT(loadSavedAngles())); connect(ui->clearAnglesButton,SIGNAL(clicked()),this,SLOT(clearSavedAngles())); // Monitor and manipulate recorded torque data connect(world->torque_sequence,SIGNAL(lengthChanged(int)),this,SLOT(setTorqueFrameCount(int))); connect(ui->torqueDataFrameBox,SIGNAL(valueChanged(int)),this,SLOT(setTorqueCurrentFrame(int))); connect(world,SIGNAL(torqueFrame(int)),this,SLOT(setTorqueCurrentFrame(int))); connect(ui->saveTorquesButton,SIGNAL(clicked()),this,SLOT(writeSavedTorques())); connect(ui->loadTorquesButton,SIGNAL(clicked()),this,SLOT(loadSavedTorques())); connect(ui->clearTorquesButton,SIGNAL(clicked()),this,SLOT(clearSavedTorques())); // ***** // Need to dynamically change this ui->timeSlider->setRange(0,world->getMarkerData()->size()-1); connect(ui->globalBox,SIGNAL(toggled(bool)),this,SLOT(useGlobalForces(bool))); #if defined( BOARD_DATA ) bd = new BoardData(this); bd->loadData("boardData.dat"); ui->glWidget->setBoardData(bd); #endif // Start the timer for updating the data, sim, and graphics updateTimer.setSingleShot(false); connect(&updateTimer,SIGNAL(timeout()),this,SLOT(updateLoop())); connect(ui->frameTimeBox,SIGNAL(valueChanged(double)),this,SLOT(setFrameTime(double))); ui->frameTimeBox->setValue(1/60.0); ui->dataStepBox->setValue(2); capBody->loadBody(); useMarkers(true); saveModel(); }
Output::~Output() { clearData(); }
SorolletPattern::~SorolletPattern() { clearData(); }
inline void nDataMonomial::setOrder(MLex const * mlex) { _mlex = mlex; clearData(); };
iaMemBlock::~iaMemBlock() { clearData(); }
void ScoreWebSender::addDataToFinishGame(RecordLine rL) { if (rL.points == 0) { clearData(); return; } ostringstream oss; // << taille des données initiales : 1 octet oss << (unsigned char) sizeof(RecordLine); // << données initiales : x octets rL.lines_u = convert_endianness(rL.lines_u, BINARY_NETWORK_BIG_ENDIAN); rL.points_u = convert_endianness(rL.points_u, BINARY_NETWORK_BIG_ENDIAN); rL.tetrominos_u = convert_endianness(rL.tetrominos_u, BINARY_NETWORK_BIG_ENDIAN); rL.time_u = convert_endianness(rL.time_u, BINARY_NETWORK_BIG_ENDIAN); for (size_t i=0; i<sizeof(RecordLine); i++) oss << (char) rL.b[i]; // << nombre de ligne de données du déroulement de jeu // << taille d'une ligne de donnée _4bytes gameDataSize; gameDataSize.i = gameDatas.size(); gameDataSize = convert_endianness(gameDataSize , BINARY_NETWORK_BIG_ENDIAN); oss << gameDataSize.b[0] << gameDataSize.b[1] << gameDataSize.b[2] << gameDataSize.b[3] << (char) sizeof(ScoreWebSenderDataSample); for (size_t i=0; i<gameDatas.size(); i++) { ScoreWebSenderDataSample dL = gameDatas[i]; dL.u.nbDelLines = convert_endianness(dL.u.nbDelLines, BINARY_NETWORK_BIG_ENDIAN); dL.u.nbDelLinesDiff = convert_endianness(dL.u.nbDelLinesDiff, BINARY_NETWORK_BIG_ENDIAN); dL.u.nbManualDown = convert_endianness(dL.u.nbManualDown, BINARY_NETWORK_BIG_ENDIAN); dL.u.nbTetromino = convert_endianness(dL.u.nbTetromino, BINARY_NETWORK_BIG_ENDIAN); dL.u.score = convert_endianness(dL.u.score, BINARY_NETWORK_BIG_ENDIAN); dL.u.scoreDiff = convert_endianness(dL.u.scoreDiff, BINARY_NETWORK_BIG_ENDIAN); dL.u.timeMilliseconds = convert_endianness(dL.u.timeMilliseconds, BINARY_NETWORK_BIG_ENDIAN); for (size_t j=0; j<sizeof(ScoreWebSenderDataSample); j++) oss << (char) dL.b[j]; } string g = oss.str(); rL.points_u = convert_endianness(rL.points_u, BINARY_NETWORK_BIG_ENDIAN); Console::out("Envoi du record de " + to_string((int) rL.points) + " points au serveur de score ..."); sf::Thread * th = new sf::Thread(&webSendNewData, g); ScoreWebSender::_uploadThreads.push_back(th); ScoreWebSender::_uploadData.push_back(""); th->launch(); clearData(); }
void CACollectionView::reloadViewSizeData() { clearData(); m_nSections = m_pCollectionViewDataSource->numberOfSections(this); m_nRowsInSections.resize(m_nSections); for (unsigned int i=0; i<m_nSections; i++) { unsigned int rowsInSection = m_pCollectionViewDataSource->numberOfRowsInSection(this, i); m_nRowsInSections[i] = rowsInSection; } m_nSectionHeaderHeights.resize(m_nSections); for (unsigned int i=0; i<m_nSections; i++) { unsigned int sectionHeaderHeight = m_pCollectionViewDataSource->collectionViewHeightForHeaderInSection(this, i); m_nSectionHeaderHeights[i] = sectionHeaderHeight; } m_nSectionFooterHeights.resize(m_nSections); for (unsigned int i=0; i<m_nSections; i++) { unsigned int sectionFooterHeight = m_pCollectionViewDataSource->collectionViewHeightForFooterInSection(this, i); m_nSectionFooterHeights[i] = sectionFooterHeight; } m_nRowHeightss.resize(m_nSections); for (unsigned int i=0; i<m_nSections; i++) { std::vector<unsigned int> rowHeights(m_nRowsInSections.at(i)); for (unsigned int j=0; j<m_nRowsInSections.at(i); j++) { unsigned int rowHeight = m_pCollectionViewDataSource->collectionViewHeightForRowAtIndexPath(this, i, j); rowHeights[j] = rowHeight; } m_nRowHeightss[i] = rowHeights; } unsigned int viewHeight = 0; m_nSectionHeights.resize(m_nSections); for (unsigned int i=0; i<m_nSections; i++) { unsigned int sectionHeight = 0; sectionHeight += m_nSectionHeaderHeights.at(i); sectionHeight += m_nSectionFooterHeights.at(i); sectionHeight += m_nVertInterval; for (unsigned int j=0; j<m_nRowHeightss.at(i).size(); j++) { sectionHeight += m_nRowHeightss.at(i).at(j); sectionHeight += m_nVertInterval; } m_nSectionHeights[i] = sectionHeight; viewHeight += sectionHeight; } viewHeight += m_nCollectionHeaderHeight; viewHeight += m_nCollectionFooterHeight; DSize size = this->getBounds().size; size.height = viewHeight; this->setViewSize(size); }
bool ModuleListInstance::readProjectFile(const QString& path) { clearData(); mFileSource = path; QFile srcFile(path); int stage = 0; if(srcFile.open(QIODevice::ReadOnly | QIODevice::Text)) { while(!srcFile.atEnd()) { QString text = srcFile.readLine(); QString strippedText = text.simplified(); if(!strippedText.startsWith("//")) { if(text.contains("Torque3D::beginConfig(", Qt::CaseInsensitive)) { // We now check for modules and project defines. On to the next stage. stage = 1; } else if(text.contains("Torque3D::endConfig(", Qt::CaseInsensitive)) { // Done checking for modules and project defines. On to the next stage. stage = 2; } else if(stage == 0 && strippedText.startsWith("$")) { // Could be a move class variable or a module path. Start with // a move class. bool handled = readMoveClass(text); if(!handled) { // Not a move class so try a module path. readModulePath(text); } } else if(stage == 1 && text.contains("includeModule(")) { // Handle the module readModule(text); } else if(stage == 1 && text.contains("addProjectDefine(")) { // Handle the project define readProjectDefine(text); } } } srcFile.close(); } else { return false; } return true; }
void ServiceClient::sltDisconnected() { //emit isLogon(c, false, false);?? //QMessageBox::information(0, "Disconnect", ""); clearData(); }
void visit_fnctsInNast::visit_parm_decl (parm_decl_n *np) { nast_node *child; parmData* pData; clearData(); pData = new parmData; pData->setNodeP(np); pData->setPosName(fnctName); #ifdef TEST_VISIT_FNCTS_IN_NAST cout << "\tPARAMETER\n"; #endif // get the name if (np->hasEdgeName(NAME_EDGE)) { child = np->edgeName(NAME_EDGE); child->accept(*this); parmName = tempS; } // get the type buildingFnctType = false; if (np->hasEdgeName(TYPE_EDGE)) { child = np->edgeName(TYPE_EDGE); child->accept(*this); } if (constantSetted) parmTypeExtra += "constant "; if (volatileSetted) parmTypeExtra += "volatile "; if (restrictSetted) parmTypeExtra += "restrict"; // set the data about the declaration pData->setName(parmName); pData->setType(parmType); pData->setTypeExtra(parmTypeExtra); pData->setStarNumber(parmStarNumber); pData->setSquareNumber(parmSquareNumber); #ifdef TEST_VISIT_FNCTS_IN_NAST cout << "\tName : " << pData->getName() << "\n" << "\tType : " << pData->getType() << "\n" << "\tType Extra : " << pData->getTypeExtra() << "\n" << "\t* number: " << pData->getStarNumber() << "\n" << "\t[] number: " << pData->getSquareNumber() << "\n" << "\tPARAMETER - END\n\n"; #endif // add the current parameter fData->addParm(pData); // visit the next parm_decl if (np->hasEdgeName(NEXT_DECL_EDGE)) { child = np->edgeName(NEXT_DECL_EDGE); child->accept(*this); } return; }
bool SerialTrans :: openSerial() { struct termios setting; fd = open(qPrintable("/dev/" + setData.devName), O_RDWR); if (fd == -1) { QMessageBox::warning(this, "open error", strerror(errno)); goto openerr; } tcgetattr(fd, &setting); // 设置波特率 speed_t speed; if (setData.baudRate == "B4800") { speed = B4800; } else if (setData.baudRate == "B9600") { speed = B9600; } else if (setData.baudRate == "B19200") { speed = B19200; } else if (setData.baudRate == "B38400") { speed = B38400; } else if (setData.baudRate == "B57600") { speed = B57600; } else if (setData.baudRate == "B115200") { speed = B115200; } else if (setData.baudRate == "B230400") { speed = B230400; } else if (setData.baudRate == "B460800") { speed = B460800; } else { QMessageBox::warning(this, "error", "speed error!"); goto seterr; } cfsetispeed(&setting, speed); cfsetospeed(&setting, speed); cfmakeraw(&setting); // 设置数据位 if (setData.dataBit == "8") { setting .c_cflag |= CS8; } else if (setData.dataBit == "7") { setting.c_cflag |= CS7; } else if (setData.dataBit == "6") { setting.c_cflag |= CS6; } else if (setData.dataBit == "5") { setting.c_cflag |= CS5; } else { QMessageBox::warning(this, "error", "dataBit error!"); goto seterr; } // 设置parity if (setData.parity == "none") { setting.c_cflag &= ~PARENB; setting.c_iflag &= ~INPCK; } else if (setData.parity == "odd") { setting.c_cflag |= (PARODD | PARENB); setting.c_iflag |= INPCK; } else if (setData.parity == "even") { setting.c_cflag |= PARENB; setting.c_cflag &= ~PARODD; setting.c_iflag |= INPCK; } else { QMessageBox::warning(this, "error", "dataBit error!"); goto seterr; } // 设置停止位 if (setData.stopBit == "1") { setting.c_cflag &= ~CSTOPB; } else if (setData.stopBit == "2") { setting.c_cflag |= CSTOPB; } else { QMessageBox::warning(this, "error", "stopBit error!"); goto seterr; } tcflush(fd, TCIFLUSH); setting.c_cc[VTIME] = 0; setting.c_cc[VMIN] = 0; tcsetattr(fd, TCSANOW, &setting); monitor = new QSocketNotifier(fd, QSocketNotifier::Read, NULL); autoTimer = new QTimer; connect(monitor, SIGNAL(activated(int)), this, SLOT(readData())); connect(autoTimer, SIGNAL(timeout()), this, SLOT(sendData())); monitor->setEnabled(true); charBox->setCheckState(Qt::Checked); autoSend->setCheckState(Qt::Unchecked); sendSpin->setValue(100); sendInfo->clear(); clearData(); return true; seterr: ::close(fd); openerr: return false; }
void SamplingProfiler::clearData() { LockHolder locker(m_lock); clearData(locker); }
void Output::setData(value::Value* value) { clearData(); m_data = value; }
void CAAutoCollectionView::reloadViewSizeData() { clearData(); int nSections = m_pCollectionViewDataSource->numberOfSections(this); m_rCollectionViewSection.resize(nSections); CollectionViewRow r; for (unsigned int i = 0; i<nSections; i++) { CollectionViewSection& cvs = m_rCollectionViewSection[i]; cvs.nSectionHeaderHeight = m_pCollectionViewDataSource->collectionViewHeightForHeaderInSection(this, i); cvs.nSectionFooterHeight = m_pCollectionViewDataSource->collectionViewHeightForFooterInSection(this, i); unsigned int itemCount = m_pCollectionViewDataSource->numberOfItemsInSection(this, i); for (int j = 0; j < itemCount; j++) { DSize rSize = m_pCollectionViewDataSource->collectionViewSizeForItemAtIndexPath(this, i, j); if (!fillSectionRowData(r, rSize)) { cvs.CollectionViewRows.push_back(r); r = CollectionViewRow(); j--; } } if (r.iMaxValue > 0) { cvs.CollectionViewRows.push_back(r); r = CollectionViewRow(); } } unsigned int cellXValue = (m_pCollectionViewOrientation == CACollectionViewOrientationVertical) ? m_nVertCellInterval : m_nHoriCellInterval; unsigned int viewHeight = (m_pCollectionViewOrientation == CACollectionViewOrientationVertical) ? (2 * m_iVertMargins) : (2 * m_iHoriMargins); for (int i = 0; i < nSections; i++) { CollectionViewSection& cvs = m_rCollectionViewSection[i]; unsigned int sectionHeight = 0; if (cvs.nSectionHeaderHeight>0) { sectionHeight += cvs.nSectionHeaderHeight; sectionHeight += cellXValue; } if (cvs.nSectionFooterHeight>0) { sectionHeight += cvs.nSectionFooterHeight; sectionHeight += cellXValue; } for (unsigned int j = 0; j < cvs.CollectionViewRows.size(); j++) { sectionHeight += cvs.CollectionViewRows[j].iMaxValue; sectionHeight += cellXValue; } viewHeight += sectionHeight; } viewHeight += m_nCollectionHeaderHeight; viewHeight += m_nCollectionFooterHeight; DSize size = this->getBounds().size; if (m_pCollectionViewOrientation == CACollectionViewOrientationVertical) { size.height = viewHeight; } else { size.width = viewHeight; } this->setViewSize(size); }
//============================================================================= // DESTRUCTOR: SPELLipcTrash::~SPELLipcTrash //============================================================================= SPELLipcTrash::~SPELLipcTrash() { clearData(); DEBUG( "## [IPCT-" + m_name + "] SPELLipcTrash destroyed" ); }
MLErrorCode FuzzyConnectedness::calculate(PagedImg *inputData, PagedImg *inputMarker) { // Clear former data. clearData(); // Get the images' extents. Vector extent = inputData->getImgExt(); // Create image box for internal images. // The input image extents SubImgBox box(Vector(-1,-1,-1,0,0,0),Vector(extent.x, extent.y, extent.z, 0, 0,0)); //Set extends of internal images _connectivityMapOutImg.setBox(box); _labelMapOutImg.setBox(box); _inputTmpImg.setBox(box); _pointerTmpImg.setBox(box); // Copy input image MLErrorCode status =getTile(inputData->getBaseOp(),inputData->getOutIndex(),_inputTmpImg); if(status==ML_RESULT_OK) { // Copy seed points status = getTile(inputMarker->getBaseOp(),inputMarker->getOutIndex(),_labelMapOutImg); if(status==ML_RESULT_OK) { // Allocate memory for the connectivity map. _connectivityMapOutImg.allocate(ML_RETURN_NULL); if(_connectivityMapOutImg.getData()!=NULL) { // Allocate memory for the temporary image used internally. _pointerTmpImg.allocate(ML_RETURN_NULL); if( _pointerTmpImg.getData() != NULL ) { SubImgBox box(extent); // Calculate the minimum and maximum intensity values in the image. // The original SubImgBox has to be used, as the padding voxels have not been // initialised. (As they are never read in the algorithm it is not necessary!!) _inputTmpImg.calcMinMax(_minValue,_maxValue,&box); // initialise the allocated data. _connectivityMapOutImg.fillSubImg(_minValue); _pointerTmpImg.fillSubImg(0); // initialise the segmentation module. _segmentCore.setProperty(extent.x+2,extent.y+2,extent.z+2, _minValue); //Start calculation. Resulting connectivity map will be stored in _outputImageData, the color map in _markerData _segmentCore.startShortestPathSearchAsFloat(_inputTmpImg.getData(),_connectivityMapOutImg.getData(), _labelMapOutImg.getData(),_pointerTmpImg.getData()); // Free temporary data. _inputTmpImg.free(); _pointerTmpImg.free(); } else { // If memory allocation failed MLErrorCode status=ML_NO_MEMORY; } } else { // If memory allocation failed MLErrorCode status = ML_NO_MEMORY; } } } if(status != ML_RESULT_OK) { // If an error occured clear image data. clearData(); } return status; }
static void freeData( gpointer data ) { clearData( data ); g_free( data ); }
FuzzyConnectedness::~FuzzyConnectedness() { // Clear image data. clearData(); }
void TweakResource::updateBar(TwBar *bar) { clearData(); const TiXmlNode *n = e->FirstChild(); while (n != NULL) { const TiXmlElement *f = n->ToElement(); if (f == NULL) { n = n->NextSibling(); continue; } if (strcmp(f->Value(), "enum") == 0) { EnumData *enumVar = new EnumData(manager); string files = string(f->Attribute("files")) + ","; string::size_type start = 0; string::size_type index; while ((index = files.find(',', start)) != string::npos) { enumVar->files.push_back(files.substr(start, index - start)); start = index + 1; } datas.push_back(enumVar); TwEnumVal enumValues[256]; int nbValues = 0; const TiXmlNode *m = f->FirstChild(); while (m != NULL) { const TiXmlElement *g = m->ToElement(); enumValues[nbValues].Value = nbValues; enumValues[nbValues].Label = g->Attribute("label"); vector<string> values; if (g->FirstChild() != NULL && strcmp(g->FirstChild()->Value(), "a") == 0) { const TiXmlNode *l = g->FirstChild(); while (l != NULL) { values.push_back(l->ToElement()->GetText()); l = l->NextSibling(); } } else { values.push_back(string(g->GetText())); } enumVar->replacements.push_back(values); m = m->NextSibling(); nbValues++; } if (nbValues == 2 && strcmp(enumValues[0].Label, "OFF") == 0 && strcmp(enumValues[1].Label, "ON") == 0) { TwAddVarCB(bar, f->Attribute("label"), TW_TYPE_BOOL32, SetEnumCallback, GetEnumCallback, enumVar, NULL); } else { ostringstream enumName; enumName << "enum" << TWBAR_COUNTER++; TwType enumType = TwDefineEnum(enumName.str().c_str(), enumValues, nbValues); TwAddVarCB(bar, f->Attribute("label"), enumType, SetEnumCallback, GetEnumCallback, enumVar, NULL); } setParam(bar, f, "key"); setParam(bar, f, "group"); setParam(bar, f, "help"); } if (strcmp(f->Value(), "bool") == 0) { UniformData *var = new UniformData(manager, f->Attribute("path"), 1); datas.push_back(var); TwAddVarCB(bar, f->Attribute("label"), TW_TYPE_BOOLCPP, SetUniformCallback, GetUniformCallback, var, NULL); setParam(bar, f, "group"); setParam(bar, f, "help"); } if (strcmp(f->Value(), "float") == 0) { UniformData *var = new UniformData(manager, f->Attribute("path"), 1); datas.push_back(var); TwAddVarCB(bar, f->Attribute("label"), TW_TYPE_FLOAT, SetUniformCallback, GetUniformCallback, var, NULL); setParam(bar, f, "keyincr"); setParam(bar, f, "keydecr"); setParam(bar, f, "min"); setParam(bar, f, "max"); setParam(bar, f, "step"); setParam(bar, f, "group"); setParam(bar, f, "help"); } if (strcmp(f->Value(), "color") == 0) { UniformData *var = new UniformData(manager, f->Attribute("path"), 3); datas.push_back(var); TwAddVarCB(bar, f->Attribute("label"), TW_TYPE_COLOR3F, SetUniformCallback, GetUniformCallback, var, NULL); setParam(bar, f, "group"); setParam(bar, f, "help"); } if (strcmp(f->Value(), "direction") == 0) { UniformData *var = new UniformData(manager, f->Attribute("path"), 3); datas.push_back(var); TwAddVarCB(bar, f->Attribute("label"), TW_TYPE_DIR3F, SetUniformCallback, GetUniformCallback, var, NULL); setParam(bar, f, "group"); setParam(bar, f, "help"); } n = n->NextSibling(); } }
void CCRTPPacketDesctructor(CCRTPPacket* crPacket) { clearData(crPacket); }
QSpotifyAlbumBrowse::~QSpotifyAlbumBrowse() { clearData(); }
AntiDos::AntiDos(QSettings &settings) { loadVals(settings); // Clears history every day, to save RAM. connect(&timer, SIGNAL(timeout()), this, SLOT(clearData())); }
/** Clears all memory associated with the AlgorithmManager * and with the Analysis & Instrument data services. */ void FrameworkManagerImpl::clear() { clearAlgorithms(); clearInstruments(); clearData(); clearPropertyManagers(); }
SerialTrans :: SerialTrans(QWidget * parent) : QWidget(parent) { revInfo = new QTextEdit; revInfo->setMinimumSize(5,5); revInfo->setReadOnly(true); charBox = new QCheckBox("char"); hexBox = new QCheckBox("hex"); checkBoxGroup = new QButtonGroup; checkBoxGroup->addButton(charBox); checkBoxGroup->addButton(hexBox); recNum = new QLCDNumber; clearButton = new QPushButton("clear"); revControlLayout = new QHBoxLayout; revControlLayout->addWidget(charBox); revControlLayout->addWidget(hexBox); revControlLayout->addWidget(recNum); revControlLayout->addWidget(clearButton); sendInfo = new QLineEdit; autoSend = new QCheckBox("auto"); sendSpin = new QSpinBox; sendSpin->setSuffix("ms"); sendSpin->setRange(1, 10000); sendNum = new QLCDNumber; sendButon = new QPushButton("send"); sendControlLayout = new QHBoxLayout; sendControlLayout->addWidget(autoSend); sendControlLayout->addWidget(sendSpin); sendControlLayout->addWidget(sendNum); sendControlLayout->addWidget(sendButon); devLabel = new QLabel; baudLabel = new QLabel; dataLabel = new QLabel; parityLabel = new QLabel; stopLabel = new QLabel; closeButton = new QPushButton("close"); devLabel->setAlignment(Qt::AlignCenter); baudLabel->setAlignment(Qt::AlignCenter); dataLabel->setAlignment(Qt::AlignCenter); parityLabel->setAlignment(Qt::AlignCenter); stopLabel->setAlignment(Qt::AlignCenter); comLayout = new QHBoxLayout(); comLayout->addWidget(devLabel); comLayout->addWidget(baudLabel); comLayout->addWidget(dataLabel); comLayout->addWidget(parityLabel); comLayout->addWidget(stopLabel); comLayout->addWidget(closeButton); layout = new QVBoxLayout; layout->addWidget(revInfo); layout->addLayout(revControlLayout); layout->addWidget(sendInfo); layout->addLayout(sendControlLayout); layout->addLayout(comLayout); this->setLayout(layout); connect(closeButton, SIGNAL(clicked()), this, SLOT(closeSerial())); connect(checkBoxGroup, SIGNAL(buttonClicked(int)), this, SLOT(updateData())); connect(clearButton, SIGNAL(clicked()), this, SLOT(clearData())); connect(sendButon, SIGNAL(clicked()), this, SLOT(sendData())); connect(autoSend, SIGNAL(clicked()), this, SLOT(startAutoSend())); }
ViewCalendarModel::~ViewCalendarModel() { clearData(); }
WatchGeoDataTree::WatchGeoDataTree(int inPrimitiveType, int outPrimitiveType, VertexBox *primitiveMap, VertexBox *vertexCount, QWidget *parent) : WatchView(parent) { /* Setup GUI */ setupUi(this); fMapping->setVisible(false); m_dataModel = new GeoShaderDataModel(inPrimitiveType, outPrimitiveType, primitiveMap, vertexCount, NULL, NULL, this); m_filterProxy = new GeoShaderDataSortFilterProxyModel(this); m_filterProxy->setSourceModel(m_dataModel); m_filterProxy->setDynamicSortFilter(true); connect(tbHideInactive, SIGNAL(toggled(bool)), m_filterProxy, SLOT(setHideInactive(bool))); connect(tbHideEmpty, SIGNAL(toggled(bool)), m_filterProxy, SLOT(setHideEmpty(bool))); tvGeoData->setModel(m_filterProxy); tvGeoData->setAllColumnsShowFocus(true); tvGeoData->setUniformRowHeights(true); connect(tvGeoData, SIGNAL(doubleClicked(const QModelIndex &)), this, SLOT(newSelection(const QModelIndex &))); connect(m_dataModel, SIGNAL(dataDeleted(int)), this, SLOT(detachData(int))); connect(m_dataModel, SIGNAL(empty()), this, SLOT(closeView())); twGeoInfo->item(0, 0)->setText(QString(lookupEnum(inPrimitiveType))); twGeoInfo->item(1, 0)->setText( QString::number(m_dataModel->getNumInPrimitives())); twGeoInfo->item(0, 2)->setText(QString(lookupEnum(outPrimitiveType))); twGeoInfo->item(1, 2)->setText( QString::number(m_dataModel->getNumOutPrimitives())); if (GeoShaderDataModel::isBasicPrimitive(inPrimitiveType)) { twGeoInfo->hideColumn(1); } else { twGeoInfo->item(0, 1)->setText( lookupEnum( GeoShaderDataModel::getBasePrimitive(inPrimitiveType))); twGeoInfo->item(1, 1)->setText( QString::number(m_dataModel->getNumSubInPrimitives())); } twGeoInfo->resizeColumnsToContents(); twGeoInfo->resizeRowsToContents(); twGeoInfo->setSelectionBehavior(QAbstractItemView::SelectRows); // Add OpenGL view to window QGridLayout *gridLayout; gridLayout = new QGridLayout(fGLview); gridLayout->setSpacing(0); gridLayout->setMargin(0); m_qGLscatter = new GLScatter(this); gridLayout->addWidget(m_qGLscatter); slPointSize->setMinimum(1); slPointSize->setMaximum(1000); slPointSize->setValue(300); slPointSize->setTickInterval(50); m_scatterPositions = NULL; m_scatterColorsAndSizes = NULL; m_dataSelection = DATA_CURRENT; m_maxScatterDataElements = MAX(m_dataModel->getNumInPrimitives(), m_dataModel->getNumOutVertices()); m_scatterDataElements = 0; m_scatterPositions = new float[3 * m_maxScatterDataElements]; m_scatterColorsAndSizes = new float[3 * m_maxScatterDataElements]; m_scatterDataX = m_scatterPositions; clearData(m_scatterDataX, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountX = 0; m_scatterDataY = m_scatterPositions + 1; clearData(m_scatterDataY, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountY = 0; m_scatterDataZ = m_scatterPositions + 2; clearData(m_scatterDataZ, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountZ = 0; m_scatterDataRed = m_scatterColorsAndSizes; clearData(m_scatterDataRed, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountRed = 0; m_scatterDataGreen = m_scatterColorsAndSizes + 1; clearData(m_scatterDataGreen, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountGreen = 0; m_scatterDataBlue = m_scatterColorsAndSizes + 2; clearData(m_scatterDataBlue, m_maxScatterDataElements, 3, 0.0f); m_scatterDataCountBlue = 0; m_qGLscatter->setData(m_scatterPositions, m_scatterColorsAndSizes, 0); on_slPointSize_valueChanged(300); setupMappingUI(); updateGUI(); }