Example #1
0
boolean CVisualisationManager::createResourceGroup(CIdentifier& rResourceGroupIdentifier, const CString& rResourceGroupName)
{
	if(m_pOgreVisualisation == NULL)
	{
		return false;
	}
	m_pOgreVisualisation->createResourceGroup(rResourceGroupIdentifier, rResourceGroupName.toASCIIString());
	return true;
}
Example #2
0
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;
}
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;
}
Example #4
0
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;
}
Example #5
0
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 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 = 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;
		}