tristate KexiAutoFormView::afterSwitchFrom(Kexi::ViewMode mode) { kDebug(); kDebug() << tempData()->name; QDomElement e = tempData()->autoformDefinition; //if (tempData()->schemaChangedInPreviousView) { if (m_autoForm) { m_scrollArea->takeWidget(); delete m_autoForm; } m_autoForm = new AutoForm(this, m_pageSelector); KexiDB::Connection *conn = KexiMainWindowIface::global()->project()->dbConnection(); KexiDB::Cursor *cursor = conn->executeQuery(*(conn->tableSchema("actor"))); if (cursor) { kDebug() << "Opened Cursor"; KexiTableViewData *data = new KexiTableViewData(cursor); data->preloadAllRows(); m_autoForm->setData(data); } m_scrollArea->setWidget(m_autoForm); //} return true; }
tristate ReportDesignView::beforeSwitchTo ( ::ViewMode mode, bool &dontStore ) { kDebug(planDbg()) << mode; dontStore = true; if ( _rd && mode == ::DataViewMode ) { tempData()->reportDefinition = _rd->document(); tempData()->reportSchemaChangedInPreviousView = true; } return true; }
tristate KexiReportDesignView::beforeSwitchTo(Kexi::ViewMode mode, bool &dontStore) { kDebug() << mode; dontStore = true; if (_rd && mode == Kexi::DataViewMode) { tempData()->document = _rd->document().toString(); tempData()->reportSchemaChangedInPreviousView = true; } return true; }
tristate KexiReportDesignView::beforeSwitchTo(Kexi::ViewMode mode, bool &dontStore) { kDebug() << mode; dontStore = true; if (m_reportDesigner && mode == Kexi::DataViewMode) { kDebug() << "Saving temp data"; tempData()->reportDefinition = m_reportDesigner->document(); kDebug() << m_reportDesigner->document().toDocument().toString(); tempData()->reportSchemaChangedInPreviousView = true; } return true; }
tristate KexiReportDesignView::afterSwitchFrom(Kexi::ViewMode mode) { kDebug() << tempData()->document; if (tempData()->document.isEmpty()) { _rd = new ReportDesigner(this, KexiMainWindowIface::global()->project()->dbConnection()); } else { if (_rd) { scr->takeWidget(); delete _rd; _rd = 0; } _rd = new ReportDesigner(this, KexiMainWindowIface::global()->project()->dbConnection(), tempData()->document); } scr->setWidget(_rd); //plugSharedAction ( "edit_copy", _rd, SLOT ( slotEditCopy() ) ); //plugSharedAction ( "edit_cut", _rd, SLOT ( slotEditCut() ) ); //plugSharedAction ( "edit_paste", _rd, SLOT ( slotEditPaste() ) ); //plugSharedAction ( "edit_delete", _rd, SLOT ( slotEditDelete() ) ); connect(_rd, SIGNAL(propertySetChanged()), this, SLOT(slotDesignerPropertySetChanged())); connect(_rd, SIGNAL(dirty()), this, SLOT(setDirty())); //Edit Actions connect(editCutAction, SIGNAL(activated()), _rd, SLOT(slotEditCut())); connect(editCopyAction, SIGNAL(activated()), _rd, SLOT(slotEditCopy())); connect(editPasteAction, SIGNAL(activated()), _rd, SLOT(slotEditPaste())); connect(editDeleteAction, SIGNAL(activated()), _rd, SLOT(slotEditDelete())); connect(sectionEdit, SIGNAL(activated()), _rd, SLOT(slotSectionEditor())); //Control Actions connect(res->itemLabel, SIGNAL(clicked()), this, SLOT(slotLabel())); connect(res->itemField, SIGNAL(clicked()), this, SLOT(slotField())); connect(res->itemText, SIGNAL(clicked()), this, SLOT(slotText())); connect(res->itemLine, SIGNAL(clicked()), this, SLOT(slotLine())); connect(res->itemBarcode, SIGNAL(clicked()), this, SLOT(slotBarcode())); connect(res->itemChart, SIGNAL(clicked()),this, SLOT(slotChart())); connect(res->itemImage, SIGNAL(clicked()), this, SLOT(slotImage())); connect(res->itemShape, SIGNAL(clicked()), this, SLOT(slotShape())); connect(res->itemCheck, SIGNAL(clicked()), this, SLOT(slotCheck())); //Raise/Lower connect(itemRaiseAction, SIGNAL(activated()), _rd, SLOT(slotRaiseSelected())); connect(itemLowerAction, SIGNAL(activated()), _rd, SLOT(slotLowerSelected())); return true; }
bool UnlabelledClassificationData::removeLastSample() { if( totalNumSamples > 0 ) { //The dataset has changed so flag that any previous cross validation setup will now not work crossValidationSetup = false; crossValidationIndexs.clear(); //If there is only one sample then we just need to clear the buffer if( totalNumSamples == 1 ) { data.clear(); return true; } //Create a temporary Matrix to copy the data into MatrixDouble tempData(data.getNumRows()-1,data.getNumCols()); //Copy the data for(UINT i=0; i<tempData.getNumRows()-1; i++) { for(UINT j=0; j<tempData.getNumCols(); j++) { tempData[i][j] = data[i][j]; } } return true; } else return false; }
void QOggSimplePlayer::readDone() { if(output==NULL) return; if(buffer.bufferUsage()<MIN_BUFFER_SIZE) { char pcmout[4096]; buffer.seek(buffer.bufferUsage()); while(buffer.bufferUsage()<MAX_BUFFER_SIZE){ long ret=ov_read(&vf,pcmout,sizeof(pcmout),0,2,1,¤t_section); if (ret == 0) { /* EOF */ break; } else if (ret < 0) { /* error in the stream. Not a problem, just reporting it in case we (the app) cares. In this case, we don't. */ } else { /* we don't bother dealing with sample rate changes, etc, but you'll have to */ QByteArray tempData(pcmout,ret); //int pos=buffer.pos(); if(tempData.isEmpty()) break; buffer.write(tempData); //buffer.seek(pos); } } buffer.seek(0); } }
tristate KexiTableDesigner_DataView::afterSwitchFrom(Kexi::ViewMode mode) { Q_UNUSED(mode); if (tempData()->tableSchemaChangedInPreviousView) { KexiUtils::WaitCursor wait; KexiDB::Cursor *c = KexiMainWindowIface::global()->project()->dbConnection()->prepareQuery( *tempData()->table); if (!c) return false; setData(c); tempData()->tableSchemaChangedInPreviousView = false; } return true; }
/*! This function samples `t` milliseconds of data at the sample rate given in setup(). The result is stored in the `sb` member of this class. If `sb` is not empty when this function is called, the data is appended to `sb`. */ void SoundBufferOutput::sampleData(CX::CX_Millis t) { if (_inputs.size() == 0) { CX::Instances::Log.warning("SoundBufferOutput") << "sampleData(): Attempted to sample data when no inputs were connected."; return; } unsigned int samplesToTake = ceil(_data->sampleRate * t.seconds()); vector<float> tempData(samplesToTake); ModuleBase* input = _inputs.front(); for (unsigned int i = 0; i < samplesToTake; i++) { tempData[i] = CX::Util::clamp<float>((float)input->getNextSample(), -1, 1); } if (sb.getTotalSampleCount() == 0) { sb.setFromVector(tempData, 1, _data->sampleRate); } else { for (unsigned int i = 0; i < tempData.size(); i++) { sb.getRawDataReference().push_back(tempData[i]); } } }
data_chunk BIO::doRead() const { data_chunk tempData(itsChunkSize); DBG << "BIO read will be attempted" << std::endl; int rxedNumber = -1; while (rxedNumber < 0) { rxedNumber = BIO_read(itsBIO, &tempData.at(0), itsChunkSize); if (rxedNumber <= 0) { NFO << "BIO read interrupted" << std::endl; if (this->ShouldRetry()) { std::string s("Recoverable error when reading from BIO"); if ((errno == EAGAIN) || (errno == EWOULDBLOCK)) { throw RecoverableException(s); } } else { std::string s("Fatal error when reading from BIO; "); s += Utils::getLastErrorSSL(); throw RemoteDiedException(s); } } else { tempData.resize(rxedNumber); DBG << "Data read from BIO" << Utils::DataToString(tempData) << std::endl; } } return tempData; }
DecalSystem::DecalSystem(IStorm3D &storm, IStorm3D_TerrainDecalSystem &system) { scoped_ptr<Data> tempData(new Data(storm, system)); tempData->parseEffects(); data.swap(tempData); }
Dialog::Dialog(int resourceId) { boost::scoped_ptr<DialogData> tempData(new DialogData()); tempData->modalDialog = true; tempData->resourceId = resourceId; data.swap(tempData); }
Dialog::Dialog(int resourceId, HWND parentWindowHandle, ResizeType type) { boost::scoped_ptr<DialogData> tempData(new DialogData()); tempData->resizeType = type; CreateDialogParam(GetModuleHandle(0), MAKEINTRESOURCE(resourceId), parentWindowHandle, DialogData::DialogHandler, reinterpret_cast<LPARAM> (tempData.get()) ); data.swap(tempData); }
MappedObject::MappedObject(const std::string &fileName, IStorm3D_Model &model) { boost::scoped_ptr<MappedObjectData> tempData(new MappedObjectData()); boost::scoped_ptr<BuildingMap> tempBuilding(new BuildingMap(fileName.c_str(), &model)); data.swap(tempData); data->building.swap(tempBuilding); }
// nrItems need to be exactly specified vector<vector<float> > Storage::LoadDataFloatMPIBin(char* filename, int nrItems, int startColumn, int endColumn, MPI_Comm comm)//vector<int> indexes, MPI_Comm comm) { double timeStart; if(m_mpiRank == 0) { cout<<"Loading "<<filename<<"...";cout.flush(); timeStart = MPI_Wtime(); } vector<vector<float> > data(nrItems); MPI_File fh; MPI_File_open(comm,filename,MPI_MODE_RDONLY,MPI_INFO_NULL,&fh); vector<float> tempData(nrItems*(endColumn-startColumn)); if(endColumn-startColumn == 0) { cout<<"(E) endColumn-startColumn == 0\n";cout.flush(); } MPI_Status status; MPI_File_read_at(fh,startColumn*nrItems*sizeof(MPI_REAL4),&tempData[0],(endColumn-startColumn)*nrItems,MPI_REAL4,&status);//MPI_FLOAT,&status); //MPI_File_read_at(fh,startColumn*nrItems*sizeof(MPI_FLOAT),&tempData[0],(endColumn-startColumn)*nrItems,MPI_FLOAT,&status); //for(int i=0;i<(endColumn-startColumn);i++) for(int i=0;i<nrItems;i++) { vector<float> f(endColumn-startColumn); data[i] = f; } int index = 0; for(int j=0;j<(endColumn-startColumn);j++) { for(int i=0;i<nrItems;i++) { data[i][j] = tempData[index]; index++; } } MPI_File_close(&fh); if(m_mpiRank == 0) { if(data.size()>0) cout<<"Loaded "<<data.size()<<" items of size "<<data[0].size()<<". (Time (process 0): "<<MPI_Wtime()-timeStart<<")\n"; else cout<<"Warning: Loaded no items from filename: "<<filename<<"\n"; cout.flush(); } return data; }
CollisionModel::CollisionModel(ObjectData &data_, const COL &color, const Vector &position, const VC3 &rotation, Storm &storm) { boost::scoped_ptr<CollisionModelData> tempData(new CollisionModelData(storm)); tempData->data = data_; tempData->position = position; tempData->rotation = rotation; tempData->color = color; data.swap(tempData); }
CollisionVolume::CollisionVolume(ObjectData &data_) { boost::scoped_ptr<CollisionVolumeData> tempData(new CollisionVolumeData(data_)); tempData->boundingRadius = max(data_.radiusX, data_.radiusZ); tempData->boundingRadius *= tempData->boundingRadius; tempData->boundingRadius += data_.height*data_.height; tempData->boundingRadius = sqrtf(tempData->boundingRadius); data.swap(tempData); }
tristate KexiReportView::afterSwitchFrom(Kexi::ViewMode mode) { Q_UNUSED(mode); qDebug(); if (tempData()->reportSchemaChangedInPreviousView) { qDebug() << "Schema changed"; delete m_preRenderer; qDebug() << tempData()->reportDefinition.tagName(); m_preRenderer = new KoReportPreRenderer(tempData()->reportDefinition); if (m_preRenderer->isValid()) { KoReportData *reportData = 0; if (!tempData()->connectionDefinition.isNull()) { reportData = sourceData(tempData()->connectionDefinition); } m_preRenderer->setSourceData(reportData); m_preRenderer->setName(window()->partItem()->name()); //Add a kexi object to provide kexidb and extra functionality //! @todo KEXI3 if we want this if(!m_kexi) { // m_kexi = new KexiScriptAdaptor(); // } // m_preRenderer->registerScriptObject(m_kexi, "Kexi"); //If using a kexidb source, add a functions scripting object if (tempData()->connectionDefinition.attribute("type") == "internal") { m_functions = new KRScriptFunctions(reportData, KexiMainWindowIface::global()->project()->dbConnection()); m_preRenderer->registerScriptObject(m_functions, "field"); connect(m_preRenderer, SIGNAL(groupChanged(QMap<QString, QVariant>)), m_functions, SLOT(setGroupData(QMap<QString, QVariant>))); } if (m_reportDocument) { qDebug() << "=======================================Deleting old document"; delete m_reportDocument; } m_reportDocument = m_preRenderer->generate(); if (m_reportDocument) { m_reportView->setDocument(m_reportDocument); #ifndef KEXI_MOBILE m_pageSelector->setRecordCount(m_reportView->pageCount()); m_pageSelector->setCurrentRecordNumber(1); #endif } } else { KMessageBox::error(this, xi18n("Report schema appears to be invalid or corrupt"), xi18n("Opening failed")); } tempData()->reportSchemaChangedInPreviousView = false; } return true; }
Storm3D_VideoStreamer::Storm3D_VideoStreamer(Storm3D &storm, const char *fileName, IStorm3D_StreamBuilder *streamBuilder, bool loop, bool downscale, bool higherColorRange) { boost::scoped_ptr<Data> tempData(new Data(storm, downscale, higherColorRange)); tempData->streamBuilder = streamBuilder; tempData->initialize(fileName); data.swap(tempData); if(!data->initStormResources()) return; data->looping = loop; }
tristate KexiReportView::afterSwitchFrom(Kexi::ViewMode mode) { Q_UNUSED(mode); kDebug(); if (tempData()->reportSchemaChangedInPreviousView) { delete m_preRenderer; m_preRenderer = new ORPreRender(tempData()->document, KexiMainWindowIface::global()->project()->dbConnection()); m_preRenderer->setName( tempData()->name ); m_currentPpage = 1; m_reportDocument = m_preRenderer->generate(); m_pageCount = m_reportDocument->pages(); m_pageSelector->setRecordCount(m_pageCount); m_reportWidget = new KexiReportPage(this, m_reportDocument); m_reportWidget->setObjectName("KexiReportPage"); m_scrollArea->setWidget(m_reportWidget); tempData()->reportSchemaChangedInPreviousView = false; } return true; }
tristate KexiReportDesignView::afterSwitchFrom(Kexi::ViewMode mode) { Q_UNUSED(mode); if (tempData()->reportDefinition.isNull()) { m_reportDesigner = new KoReportDesigner(this); } else { if (m_reportDesigner) { m_scrollArea->takeWidget(); delete m_reportDesigner; m_reportDesigner = 0; } m_reportDesigner = new KoReportDesigner(this, tempData()->reportDefinition); m_sourceSelector->setConnectionData(tempData()->connectionDefinition); } connect(m_reportDesigner, SIGNAL(itemInserted(QString)), this, SIGNAL(itemInserted(QString))); m_scrollArea->setWidget(m_reportDesigner); connect(m_reportDesigner, SIGNAL(propertySetChanged()), this, SLOT(slotDesignerPropertySetChanged())); connect(m_reportDesigner, SIGNAL(dirty()), this, SLOT(setDirty())); //Edit Actions connect(m_editCutAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditCut())); connect(m_editCopyAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditCopy())); connect(m_editPasteAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditPaste())); connect(m_editDeleteAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotEditDelete())); connect(m_sectionEdit, SIGNAL(activated()), m_reportDesigner, SLOT(slotSectionEditor())); //Raise/Lower connect(m_itemRaiseAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotRaiseSelected())); connect(m_itemLowerAction, SIGNAL(activated()), m_reportDesigner, SLOT(slotLowerSelected())); return true; }
/////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// // // // Retrieve the requested tag // // /////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////// ptr<data> dataGroup::getTag(std::uint16_t tagId, bool bCreate /* =false */) { PUNTOEXE_FUNCTION_START(L"dataGroup::getTag"); ptr<data> pData=getData(tagId, 0); if(pData == 0 && bCreate) { ptr<data> tempData(new data(this)); pData = tempData; setData(tagId, 0, pData); } return pData; PUNTOEXE_FUNCTION_END(); }
Window::Window(const char *title, int iconId, bool maximize, bool disableSizing, int width, int height ) { boost::scoped_ptr<WindowData> tempData(new WindowData()); // Window class WNDCLASSEX windowClass = { 0 }; windowClass.cbSize = sizeof(WNDCLASSEX); windowClass.style = 0; //CS_OWNDC; windowClass.lpfnWndProc = &WindowData::WindowProc; windowClass.hInstance = GetModuleHandle(0); windowClass.hIcon = LoadIcon(GetModuleHandle(0), reinterpret_cast<const char *> (iconId)); windowClass.hCursor = LoadCursor(NULL, IDC_ARROW); windowClass.hbrBackground = 0; // CreateSolidBrush(0x383838); //COLOR_TEXT; windowClass.lpszMenuName = MAKEINTRESOURCE(IDR_MENU); //0; windowClass.lpszClassName = windowClassName; windowClass.hIconSm = 0; RegisterClassEx(&windowClass); // Default to fullscreen int windowSizeX = GetSystemMetrics(SM_CXSCREEN); int windowSizeY = GetSystemMetrics(SM_CYSCREEN); int windowStyle = WS_POPUP; windowSizeX /= 2; windowSizeY /= 2; windowStyle = WS_OVERLAPPEDWINDOW; if(disableSizing) windowStyle = WS_CAPTION | WS_SYSMENU |WS_MINIMIZEBOX; windowSizeX = width; windowSizeY = height; tempData->windowHandle = CreateWindowEx(0, windowClassName, title, windowStyle, 0, 0, windowSizeX, windowSizeY, 0, 0, GetModuleHandle(0), tempData.get()); if(maximize) ShowWindow(tempData->windowHandle, SW_MAXIMIZE); else ShowWindow(tempData->windowHandle, SW_SHOW); SetFocus(tempData->windowHandle); data.swap(tempData); }
bool courtEntity::initializeObjects() // initializes the basketball objects { courtComponentsSharedPtr tempComponent(new courtComponents); component = tempComponent; courtDataSharedPtr tempData(new courtData); data = tempData; courtFlagsSharedPtr tempFlag(new courtFlags); flag = tempFlag; courtStateMachineSharedPtr tempStateMachine(new courtStateMachine); stateMachine = tempStateMachine; courtPhysicsSharedPtr tempPhysics(new courtPhysics); component->setPhysics(tempPhysics); return (true); }
void Stats::deserialise(LoadingState *state, data::IData *data) { base::Handle<data::Table> dataMap(data::Table::checkDataType(data, "stats")); if (!dataMap) { return; } base::Handle<data::Table> baseStats(dataMap->at<data::Table>("baseStats")); if (baseStats) { for (auto iter = baseStats->beginMap(); iter != baseStats->endMap(); ++iter) { Stat::StatType type = Stat::getStatType(iter->first.c_str()); if (type == Stat::MAX_STAT_LENGTH) { std::stringstream ss; ss << "Unknown stat '" << iter->first << '\''; am_log("LOADERR", ss); continue; } base::Handle<data::Number> num(dynamic_cast<data::Number *>(iter->second.get())); if (num) { setBaseStat(type, num->value<float>()); } else { std::stringstream ss; ss << "Cannot load base stat '" << iter->first << "' from a '"; ss << iter->second->typeName() << "'"; am_log("LOADERR", ss); continue; } } } base::Handle<data::IData> tempData(dataMap->at("modifiers")); if (tempData) { mModifiers->deserialise(state, tempData); } }
/*! This function samples `t` milliseconds of data at the sample rate given in setup(). The result is stored in the `sb` member of this class. If `sb` is not empty when this function is called, the data is appended to `sb`. */ void StereoSoundBufferOutput::sampleData(CX::CX_Millis t) { unsigned int samplesToTake = ceil(left.getData().sampleRate * t.seconds()); unsigned int channels = 2; //Stereo vector<float> tempData(samplesToTake * channels); for (unsigned int i = 0; i < samplesToTake; i++) { tempData[(i * channels) + 0] = CX::Util::clamp<float>((float)left.getNextSample(), -1, 1); tempData[(i * channels) + 1] = CX::Util::clamp<float>((float)right.getNextSample(), -1, 1); } if (sb.getTotalSampleCount() == 0) { sb.setFromVector(tempData, channels, left.getData().sampleRate); } else { for (unsigned int i = 0; i < tempData.size(); i++) { sb.getRawDataReference().push_back(tempData[i]); } } }
vector<T> smoothenData(const vector<T> &rawData, int32 support) { vector<float> gaussKernel = formGaussKernel(2*support + 1); std::vector<T> smoothData(rawData.size()); vector<T> tempData(rawData.size()+2*support); //Create a temporary vector with mirrored boundaries std::copy(rawData.begin(), rawData.end(), tempData.begin()+support); std::reverse_copy(rawData.begin(), rawData.begin()+support,tempData.begin()); std::reverse_copy(rawData.end()-support,rawData.end(), tempData.end()-support); for(int i=0; i< smoothData.size(); i++) { T tempVec = initVal<T>(); for(int j=-support; j<=support; j++) { tempVec += tempData[i+j+support] * gaussKernel[j+support]; } smoothData[i] = tempVec; } return smoothData; }
Storm3D_VideoPlayer::Storm3D_VideoPlayer(Storm3D &storm, Storm3D_Scene &scene, const char *fileName, IStorm3D_StreamBuilder *streamBuilder) { boost::scoped_ptr<Storm3D_VideoPlayerData> tempData(new Storm3D_VideoPlayerData(storm, scene, fileName, streamBuilder)); data.swap(tempData); }
GroupSaveDialog::GroupSaveDialog() { scoped_ptr<Data> tempData(new Data()); data.swap(tempData); }
//! Constructor Storm3D_TerrainLod::Storm3D_TerrainLod(Storm3D &storm) { boost::scoped_ptr<Storm3D_TerrainLodData> tempData(new Storm3D_TerrainLodData(storm)); data.swap(tempData); }