boolean CVisualisationManager::createResourceGroup(CIdentifier& rResourceGroupIdentifier, const CString& rResourceGroupName) { if(m_pOgreVisualisation == NULL) { return false; } m_pOgreVisualisation->createResourceGroup(rResourceGroupIdentifier, rResourceGroupName.toASCIIString()); return true; }
boolean CVisualisationManager::addResourceLocation(const CIdentifier& rResourceGroupIdentifier, const CString& rPath, EResourceType type, bool bRecursive) { if(m_pOgreVisualisation == NULL) { return false; } switch(type) { case ResourceType_File: case ResourceType_Directory: return m_pOgreVisualisation->addResourceLocation(rResourceGroupIdentifier, rPath.toASCIIString(), std::string("FileSystem"), bRecursive); break; case ResourceType_ZipArchive: return m_pOgreVisualisation->addResourceLocation(rResourceGroupIdentifier, rPath.toASCIIString(), std::string("Zip"), bRecursive); break; } return false; }
boolean CSkeletonGenerator::cleanConfigurationFile(CString sFileName) { FILE* l_pFile=::fopen(sFileName.toASCIIString(), "wb"); if(!l_pFile) { m_rKernelContext.getLogManager() << LogLevel_Warning << "Failed to clean [" << sFileName << "]\n"; return false; } m_rKernelContext.getLogManager() << LogLevel_Info << "Configuration file [" << sFileName << "] cleaned.\n"; ::fclose(l_pFile); return true; }
CLogListenerFile::CLogListenerFile(const IKernelContext& rKernelContext, const CString& sApplicationName, const CString& sLogFilename) :TKernelObject<ILogListener>(rKernelContext) ,m_sApplicationName(sApplicationName) ,m_sLogFilename(sLogFilename) ,m_bTimeInSeconds(true) ,m_bLogWithHexa(false) ,m_ui64TimePrecision(3) { // Create the path to the log file FS::Files::createParentPath(sLogFilename.toASCIIString()); m_fsFileStream.open(sLogFilename.toASCIIString(), ios::out); if (!m_fsFileStream.is_open()) { std::cout << "[ ERR ] Error while creating FileLogListener into '" << sLogFilename << "'" << std::endl; return; } m_fsFileStream << flush; std::cout << "[ INF ] Logging to '" << sLogFilename << "'" << std::endl; }
boolean OpenViBEToolkit::Tools::ColorGradient::parse(IMatrix& rColorGradient, const CString& rString) { std::string l_sString(rString.toASCIIString()); std::string::size_type l_iStart=0; std::string::size_type l_iEnd; std::map < float64, SColor > l_vColorGradient; do { l_iEnd=l_sString.find(OV_Value_EnumeratedStringSeparator, l_iStart); if(l_iEnd==std::string::npos) { l_iEnd=l_sString.length(); } std::string l_sColor; l_sColor.assign(l_sString, l_iStart, l_iEnd-l_iStart); int p,r,g,b; if(sscanf(l_sColor.c_str(), "%i:%i,%i,%i", &p, &r, &g, &b) == 4) { SColor l_oColor; l_oColor.fPercent=p; l_oColor.fRed=r; l_oColor.fGreen=g; l_oColor.fBlue=b; l_vColorGradient[l_oColor.fPercent]=l_oColor; } l_iStart=l_iEnd+1; } while(l_iStart<l_sString.length()); rColorGradient.setDimensionCount(2); rColorGradient.setDimensionSize(0, 4); rColorGradient.setDimensionSize(1, l_vColorGradient.size()); uint32 i=0; std::map < float64, SColor > ::const_iterator it; for(it=l_vColorGradient.begin(); it!=l_vColorGradient.end(); it++, i++) { rColorGradient[i*4 ]=it->second.fPercent; rColorGradient[i*4+1]=it->second.fRed; rColorGradient[i*4+2]=it->second.fGreen; rColorGradient[i*4+3]=it->second.fBlue; } return true; }
//___________________________________________________________________// // // boolean CDriverMicromedSystemPlusEvolution::saveElectrodesInformation(CString sFilename) { FILE * l_pFile = ::fopen(sFilename.toASCIIString(), "wb"); if(!l_pFile) { m_rDriverContext.getLogManager() << LogLevel_ImportantWarning << "Could not open file [" << sFilename << "] to save the electrodes information.\n"; return false; } ::fprintf(l_pFile, "Index;Status;Coordinate System;x;y;z;Latitudine;Longitudine;Positive Input Label;Negative Input Label;Type;Measurement Unit;Present in Map;Used in Average;Description\n"); for(uint32 i = 0; i<this->getHeader()->getChannelCount(); i++) { char bufferType[128]; unsigned int l_uiCharCount = m_oFgetChannelType(i,bufferType); bufferType[l_uiCharCount] = '\0'; char bufferUnit[128]; l_uiCharCount = m_oFgetChannelMeasurementUnit(i,bufferUnit); bufferUnit[l_uiCharCount] = '\0'; float x,y,z,lat,lon; m_oFgetChannelPolarCoordinates(i,lat,lon); m_oFgetChannel3DCoordinates(i,x,y,z); ::fprintf(l_pFile, "%i;%i%;%s;%f;%f;%f;%f;%f;%s;%s;%s;%s;%i;%i;%s\n", i, m_oFisChannelAcquired(i), m_oFisChannelPolarCoordinateSystem(i) ? "Polar" : (m_oFisChannel3DCoordinateSystem(i) ? "3D" : "N/A"), x, y, z, lat, lon, m_oFgetPositiveInputLabel(i), m_oFgetNegativeInputLabel(i), bufferType, bufferUnit, m_oFisChannelInMap(i), m_oFisChannelInAvg(i), m_oFgetChannelDescription(i)); } ::fclose(l_pFile); l_pFile=NULL; return true; }
boolean CBufferDatabase::getElectrodePosition(const CString& rElectrodeLabel, float64* pElectrodePosition) { //TODO : add time parameter and look for coordinates closest to that time! for(unsigned int i=0; i<m_oChannelLocalisationLabels.size(); i++) { if(strcmp(rElectrodeLabel.toASCIIString(), m_oChannelLocalisationLabels[i].toASCIIString()) == 0) { //if(m_bCartesianStreamedCoords == true) //{ *pElectrodePosition = *(m_oChannelLocalisationStreamedCoords[0].first->getBuffer() + 3*i); *(pElectrodePosition+1) = *(m_oChannelLocalisationStreamedCoords[0].first->getBuffer() + 3*i+1); *(pElectrodePosition+2) = *(m_oChannelLocalisationStreamedCoords[0].first->getBuffer() + 3*i+2); //} return true; } } return false; }
boolean CSkeletonGenerator::saveCommonParameters(CString sFileName) { // we get the latest values getCommonParameters(); FILE* l_pFile=::fopen(sFileName.toASCIIString(), "ab"); if(!l_pFile) { m_rKernelContext.getLogManager() << LogLevel_Warning << "Saving the common entries in [" << sFileName << "] failed !\n"; return false; } // generator selected CString l_sActive; ::GtkWidget* l_pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "sg-driver-selection-radio-button")); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(l_pWidget))) { l_sActive = "0"; } l_pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "sg-algo-selection-radio-button")); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(l_pWidget))) { l_sActive = "1"; } l_pWidget = GTK_WIDGET(gtk_builder_get_object(m_pBuilderInterface, "sg-box-selection-radio-button")); if(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(l_pWidget))) { l_sActive = "2"; } ::fprintf(l_pFile, "SkeletonGenerator_GeneratorSelected = %s\n", l_sActive.toASCIIString()); ::fprintf(l_pFile, "SkeletonGenerator_Common_Author = %s\n", m_sAuthor.toASCIIString()); ::fprintf(l_pFile, "SkeletonGenerator_Common_Company = %s\n", m_sCompany.toASCIIString()); ::fclose(l_pFile); m_rKernelContext.getLogManager() << LogLevel_Info << "Common entries saved in [" << sFileName << "]\n"; //we can reload the file, it may have changed m_bConfigurationFileLoaded = false; return true; }
boolean CXMLStimulationScenarioPlayer::readAutomaton(const CString& oFilename) { ifstream l_oFile(oFilename.toASCIIString()); if(!l_oFile.good()) { return false; } size_t l_iFileSize = 0; l_oFile.seekg(0, ios::end); l_iFileSize = (size_t)l_oFile.tellg(); l_oFile.seekg(0, ios::beg); char * l_pXmlBuffer = new char[l_iFileSize]; l_oFile.read(l_pXmlBuffer, l_iFileSize); m_pXMLAutomatonReader->processData(l_pXmlBuffer, l_iFileSize); l_oFile.close(); return true; }