bool ConsoleCommandParserCombatEngine::performParsing (const NetworkId & userId, const StringVector_t & argv, const String_t & originalCommand, String_t & result, const CommandParser * node)
{
	NOT_NULL (node);
	UNREF (userId);

	UNREF(originalCommand);

    //-----------------------------------------------------------------
	if (isAbbrev( argv [0], "reload"))
	{	
		if (CombatEngine::reloadCombatData())
			result += getErrorMessage(argv[0], ERR_SUCCESS);
		else
			result += getErrorMessage(argv[0], ERR_NO_ERROR_MSG);
	}

	//-----------------------------------------------------------------

	else
	{
		result += getErrorMessage(argv[0], ERR_NO_HANDLER);
	}

	return true;
}
Esempio n. 2
0
bool Renderer::CreateTimerQuery()
{
    ::IDirect3DDevice9 *lpD3DDevice = static_cast<::IDirect3DDevice9 *>(this->mpD3DDevice);

    ::IDirect3DQuery9 *lpQuery = 0;
    ::HRESULT lResult;
    lResult = lpD3DDevice->CreateQuery(::D3DQUERYTYPE_TIMESTAMPFREQ, &lpQuery);
    if (FAILED(lResult))
    {
        REPORTERROR2("CreatePixelShader failed, HR=0x%x '%s'", lResult, getErrorMessage(lResult));
        return false;
    }

    uint64 lu64TimerFrequency;
    while (S_FALSE == lpQuery->GetData(&lu64TimerFrequency, sizeof(lu64TimerFrequency), D3DGETDATA_FLUSH))
    {
    }

    lpQuery->Release();

    lResult = lpD3DDevice->CreateQuery(::D3DQUERYTYPE_TIMESTAMP, &lpQuery);
    if (FAILED(lResult))
    {
        REPORTERROR2("CreatePixelShader failed, HR=0x%x '%s'", lResult, getErrorMessage(lResult));
        return false;
    }

    this->mu64TimerFrequency = lu64TimerFrequency;
    this->mpTimerQuery = lpQuery;

    return true;
}
/******************************************************************************
* AUTHOR		: Balaji R.
* DATE			: 23-DEC-2004
* NAME			: LTKTraceGroup
* DESCRIPTION	: Initialization constructor
* ARGUMENTS		: inTraceVector - vector of traces to be set to class member
* RETURNS		:
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
******************************************************************************/
LTKTraceGroup::LTKTraceGroup(const LTKTraceVector& inTraceVector,
                             float xScaleFactor, float yScaleFactor) :
	m_traceVector(inTraceVector)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
		"Enter: LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;

	if(xScaleFactor <= 0)
	{
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
        "Error: "<<EINVALID_X_SCALE_FACTOR <<": "<<
		getErrorMessage(EINVALID_X_SCALE_FACTOR) <<
		"LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;

		throw LTKException(EINVALID_X_SCALE_FACTOR);
	}

	if(yScaleFactor <= 0)
	{
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) <<
        "Error: "<<EINVALID_Y_SCALE_FACTOR <<": "<<
		getErrorMessage(EINVALID_Y_SCALE_FACTOR) <<
		"LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;

		throw LTKException(EINVALID_Y_SCALE_FACTOR);
	}

	m_xScaleFactor = xScaleFactor;
	m_yScaleFactor = yScaleFactor;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) <<
		"Exit: LTKTraceGroup::LTKTraceGroup(LTKTraceVector&, float,float)"<<endl;


}
/******************************************************************************
* AUTHOR		: Nidhi sharma
* DATE			: 08-Feb-2007
* NAME			: LTKLipiEngineModule::validateProfile
* DESCRIPTION	: 
* ARGUMENTS		: 
* RETURNS		: 
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* 
******************************************************************************/
int LTKLipiEngineModule::validateProfile(const string& strProjectName, 
										 const string& strProfileName, 
	 									 const string& projectType, 
										 string& outRecognizerString)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        "Entering: LTKLipiEngineModule::validateProfile()"<<endl;
	
	int errorCode; 
	string profileCfgPath = m_strLipiRootPath + PROJECTS_PATH_STRING + 
						strProjectName + PROFILE_PATH_STRING + strProfileName 
						+ SEPARATOR + PROFILE_CFG_STRING;

	LTKConfigFileReader* profileConfigReader = NULL;
	
	try
	{
		profileConfigReader = new LTKConfigFileReader(profileCfgPath);
	}
	catch(LTKException e)
	{
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
            "Error: "<< getErrorMessage(e.getErrorCode()) << profileCfgPath <<
    		" LTKLipiEngineModule::validateProfile()"<<endl;

		LTKReturnError(e.getErrorCode());
	}

	errorCode = profileConfigReader->getConfigValue(projectType, 
													outRecognizerString);
	
	if(errorCode != SUCCESS)
	{
		/* No recognizer specified. */
		if (projectType == SHAPE_RECOGNIZER_STRING )
		{
			errorCode = ENO_SHAPE_RECOGNIZER;
		}
		else
		{
			errorCode = ENO_WORD_RECOGNIZER;
		}

		LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
            "Error: "<< getErrorMessage(errorCode) << profileCfgPath <<
    		" LTKLipiEngineModule::validateProfile()"<<endl;
	
		delete profileConfigReader;		

		LTKReturnError(errorCode); 
	}

	delete profileConfigReader;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        "Exiting: LTKLipiEngineModule::validateProfile()"<<endl;
	
	return SUCCESS;
}
/******************************************************************************
* AUTHOR		: Nidhi sharma
* DATE			: 08-Feb-2007
* NAME			: LTKLipiEngineModule::validateProject
* DESCRIPTION	: 
* ARGUMENTS		: 
* RETURNS		: 
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* 
*******************************************************************************/
int LTKLipiEngineModule::validateProject(const string& strProjectName, 
										 const string& projectType)
{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        "Enterng: LTKLipiEngineModule::validateProject()"<<endl;
	
	LTKConfigFileReader* projectConfigReader = NULL;
	
	string projectTypeCfgEntry = "";

	if(strProjectName == "")
	{
		/* invalid or no entry for project name */
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
        "Error: "<< getErrorMessage(EINVALID_PROJECT_NAME) <<
		"LTKLipiEngineModule::validateProject()"<<endl;

        LTKReturnError(EINVALID_PROJECT_NAME);
	}

	string projectCfgPath = m_strLipiRootPath + PROJECTS_PATH_STRING +  
					strProjectName + PROFILE_PATH_STRING + PROJECT_CFG_STRING;
	
	try
	{
		projectConfigReader = new LTKConfigFileReader(projectCfgPath);
	}
	catch(LTKException e)
	{
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
        "Error: "<< getErrorMessage(e.getErrorCode()) << projectCfgPath <<
		" LTKLipiEngineModule::validateProject()"<<endl;

		LTKReturnError(EINVALID_PROJECT_NAME);
	}
	
	int errorCode = projectConfigReader->getConfigValue(PROJECT_TYPE_STRING,
															projectTypeCfgEntry);
	
	if( errorCode != SUCCESS || projectTypeCfgEntry != projectType)
	{
		/* Invalid configuration entry for ProjectType */	
		LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
            "Error: "<< getErrorMessage(EINVALID_PROJECT_TYPE) <<
    		" LTKLipiEngineModule::validateProject()"<<endl;

		delete projectConfigReader;
		//Project type in CFG is missing or an invalid value
		LTKReturnError(EINVALID_PROJECT_TYPE); 
	}

	delete projectConfigReader;

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        "Exiting: LTKLipiEngineModule::validateProject()"<<endl;
		
	return SUCCESS;
}
/******************************************************************************
* AUTHOR        : Thanigai 
* DATE          : 29-JUL-2005
* NAME          : mapShapeAlgoModuleFunctions
* DESCRIPTION   : To map function addresses of the methods exposed by 
*				  the shape recognition modules
* ARGUMENTS     : None
* RETURNS       : 0 on success and other values on error 
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
******************************************************************************/
int LTKLipiEngineModule::mapShapeAlgoModuleFunctions(void *dllHandle)
{
	LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
    "Entering: LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
	

	module_createShapeRecognizer = NULL;
	module_deleteShapeRecognizer = NULL;

    void* functionHandle = NULL;

    int returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle, 
                                            CREATESHAPERECOGNIZER_FUNC_NAME, 
                                            &functionHandle);
    
    // Could not map the  function from the DLL
	if(returnVal != SUCCESS)
	{
	    LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
        "Error: "<<
		getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<CREATESHAPERECOGNIZER_FUNC_NAME
		<<" "<<"LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;


        m_OSUtilPtr->unloadSharedLib(dllHandle);

		LTKReturnError(EDLL_FUNC_ADDRESS);
	}

    module_createShapeRecognizer = (FN_PTR_CREATESHAPERECOGNIZER)functionHandle;

	functionHandle = NULL;

    returnVal = m_OSUtilPtr->getFunctionAddress(dllHandle, 
                                            DELETESHAPERECOGNIZER_FUNC_NAME, 
                                            &functionHandle);
    
    // Could not map the  function from the DLL
	if(returnVal != SUCCESS)
	{
	    LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
        "Error: "<<
		getErrorMessage(EDLL_FUNC_ADDRESS) <<" "<<DELETESHAPERECOGNIZER_FUNC_NAME
		<<" "<<"LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;

        m_OSUtilPtr->unloadSharedLib(dllHandle);

		LTKReturnError(EDLL_FUNC_ADDRESS);
	}

    module_deleteShapeRecognizer = (FN_PTR_DELETESHAPERECOGNIZER)functionHandle;

	LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
    "Exiting: LTKLipiEngineModule::mapShapeAlgoModuleFunctions()"<<endl;
	
	return SUCCESS;
}
Esempio n. 7
0
bool Socket::bindImpl(const std::string& hostname,int port)
{
	close();

	addrinfo* p=getAddrInfo(hostname.c_str(),port,false);
	
	for(;p != 0; p = p->ai_next)
	{
		m_socket=socket(p->ai_family,p->ai_socktype,p->ai_protocol);
		
		if(m_socket == int(INVALID_SOCKET))
		{
			std::cerr<<"Cannot create a socket: "<<getErrorMessage()<<std::endl;
			continue;
		}
		
		if(::bind(m_socket,p->ai_addr,p->ai_addrlen)==SOCKET_ERROR)
		{
			std::cerr<<"Cannot bind to port "<<port<<": "<<getErrorMessage()<<std::endl;
			close();
			continue;			
		}	
		
		break;
	}
	
	freeAddrInfo(p);
	
	if(!p)
	{
		std::cerr<<"Cannot create a socket: "<<getErrorMessage()<<std::endl;
		return false;
	}
	
	if(listen(m_socket,10)==SOCKET_ERROR)
	{
		std::cerr<<"Cannot listen socket:"<<getErrorMessage()<<std::endl;
		close();
		return false;			
	}
	
	if(setNonBlock(m_socket) == false)
	{
		std::cerr<<"Cannot set socket to non-blocking mode: "<<getErrorMessage()<<std::endl;
		close();
		return false;
	}
		
	return true;
}
int NPenShapeFeatureExtractor::readConfig(const string& cfgFilePath)
{
    LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
        "NPenShapeFeatureExtractor::readConfig()" << endl;
    
	LTKConfigFileReader* configurableProperties = NULL;
    string tempStringVar = "";

	try
    {
        configurableProperties = new LTKConfigFileReader(cfgFilePath);
        
		int errorCode = configurableProperties->getConfigValue(NPEN_WINDOW_SIZE, tempStringVar);
		
		if( errorCode == SUCCESS)
        {
            if (setWindowSize(atoi((tempStringVar).c_str())) != SUCCESS)
            {
                LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << 
                    ECONFIG_FILE_RANGE << " : " << 
                    getErrorMessage(ECONFIG_FILE_RANGE) <<
                    " NPenShapeFeatureExtractor::readConfig" <<endl;
                
                throw LTKReturnError(ECONFIG_FILE_RANGE);
            }
        }
	}

	catch(LTKException e)
    {
        delete configurableProperties;

        int eCode = e.getErrorCode();
        
        LOG(LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode << 
            " : " << getErrorMessage(eCode) <<
            " NPenShapeFeatureExtractor::readConfig" <<endl;
        
        LTKReturnError(eCode);
    }
	delete configurableProperties;

    LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
        "NPenShapeFeatureExtractor::readConfig()" << endl;
    
	return SUCCESS;

}
Esempio n. 9
0
//-----------------------------------------------
CanESD::CanESD(int iIniBaudRate, int iNrNet)
{
	//initial values
	int net=1; /* logical net number (here: 0) */
	uint32_t mode=0; /* mode used for canOpen() */
	int32_t txqueuesize=100; /* size of transmit queue */
	int32_t rxqueuesize=100; /* size of receive queue */
	int32_t txtimeout=0; /* timeout for transmit operations in ms */
	int32_t rxtimeout=0; /* timeout for receive operations in ms */
	NTCAN_RESULT retvalue; /* return values of NTCAN API calls */
	//uint32_t baud=2; /* configured CAN baudrate (here: 500 kBit/s.) */
	CMSG cmsg[8]; /* can message buffer */
	int rtr=0; /* rtr bit */
	int32_t len; /* # of CAN messages */

	retvalue = canOpen(iNrNet, mode, txqueuesize, rxqueuesize, txtimeout, rxtimeout, &m_Handle);
	if (retvalue != NTCAN_SUCCESS)
	{
		LOGINFO("canOpen() failed: " << getErrorMessage(retvalue));
	}
	Sleep(300);
	retvalue = canSetBaudrate(m_Handle, getBaudRate(iIniBaudRate));
	if (retvalue != 0)
	{
		LOGINFO("canSetBaudrate() failed: " << getErrorMessage(retvalue)); 
		canClose(m_Handle);
	}
	else 
	{
		LOGINFO("Baudrate set to " << getBaudRate(iIniBaudRate));	
	}
	Sleep(300);
	
	//set Amtek Arm IDs
	int i;
	for(i=1; i < 2048; i++)
	{
		retvalue = canIdAdd(m_Handle, i);
		if (retvalue != NTCAN_SUCCESS)
		{
			LOGERROR("canIdAdd() failed: " << getErrorMessage(retvalue)); 
		}
	}

	Sleep(300);

	m_LastID = -1;
}
/******************************************************************************
* AUTHOR        : Thanigai 
* DATE          : 29-JUL-2005
* NAME          : deleteWordRecognizer
* DESCRIPTION   : To delete the recognizer object which is created 
*				  using "createWordRecognizer" call
* ARGUMENTS     : obj - handle the previously created recognizer object
* RETURNS       : 0 on success other values error
* NOTES         :
* CHANGE HISTROY
* Author            Date                Description of change
******************************************************************************/
int LTKLipiEngineModule::deleteWordRecognizer(LTKWordRecognizer* obj)
{
	LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
		"Entering: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;

	int errorCode;

	//	Call recognition module's deleteWordRecognizer(obj) 
	if(obj)
	{
		deleteModule(obj);		
		errorCode = module_deleteWordRecognizer(obj);
		if(errorCode !=SUCCESS)
		{
			LOG( LTKLogger::LTK_LOGLEVEL_ERR) << 
    			"Error: " << getErrorMessage(errorCode) << 
    			"LTKLipiEngineModule::deleteShapeRecognizer()"<<endl;
            
			LTKReturnError(errorCode);
		}	
		obj = NULL;
	}
	
	LOG(LTKLogger::LTK_LOGLEVEL_INFO)<<
		"Exiting: LTKLipiEngineModule::deleteWordRecognizer()"<<endl;
	
	return SUCCESS;

}
/******************************************************************************
* AUTHOR		: Saravanan R.
* DATE			: 09-Feb-2007
* NAME			: 
* DESCRIPTION	: 
* ARGUMENTS		: 
* RETURNS		: 
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
* 
******************************************************************************/
int LTKLipiEngineModule::loadRecognizerDLL(const string& recognizerName,
										   void **dllHandler)
{
	LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
		"Entering: LTKLipiEngineModule::loadRecognizerDLL()"<<endl;
	
	string recognizerDLLPath = "";
	int returnVal = SUCCESS;

    returnVal = m_OSUtilPtr->loadSharedLib(m_strLipiRootPath, recognizerName, dllHandler);

    
	if(returnVal != SUCCESS)
	{
		LOG(LTKLogger::LTK_LOGLEVEL_ERR)<<
		"Error: "<< getErrorMessage(ELOAD_SHAPEREC_DLL) <<" "<<recognizerDLLPath <<
		"LTKLipiEngineModule::loadRecognizerDLL()"<<endl;

		LTKReturnError(ELOAD_SHAPEREC_DLL); 
	}
    
	LOG(LTKLogger::LTK_LOGLEVEL_DEBUG)<<
		"Exiting: LTKLipiEngineModule::loadRecognizerDLL()"<<endl;
	
	return SUCCESS;
}
void PINExchangeProcess::finalize()
{
	if(!success) {
		LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token!")
		np->handleMessage(user, "twitter-account", "Error while exchanging PIN for Access Token!");
		np->handleLogoutRequest(user, "");
	} else {
		std::string replyMsg;
		while(replyMsg.length() == 0) {
			twitObj->getLastWebResponse(replyMsg);
		}

		std::string error = getErrorMessage(replyMsg);
		if(error.length()) {
			LOG4CXX_ERROR(logger, user << ": Error while exchanging PIN for Access Token! " << error)
			np->handleMessage(user, "twitter-account", error);
			np->handleLogoutRequest(user, "");
			return;
		}


		std::string OAuthAccessTokenKey, OAuthAccessTokenSecret;
		twitObj->getOAuth().getOAuthTokenKey( OAuthAccessTokenKey );
		twitObj->getOAuth().getOAuthTokenSecret( OAuthAccessTokenSecret );

		if(np->storeUserOAuthKeyAndSecret(user, OAuthAccessTokenKey, OAuthAccessTokenSecret) == false) {
			np->handleLogoutRequest(user, "");
			return;
		}
		np->pinExchangeComplete(user, OAuthAccessTokenKey, OAuthAccessTokenSecret);
		LOG4CXX_INFO(logger, user << ": Sent PIN " << data << " and obtained Access Token");
	}
}
Esempio n. 13
0
//-----------------------------------------------
bool CanESD::transmitMsg(CanMsg &CMsg)
{
  	CMSG NTCANMsg;
	NTCANMsg.id = CMsg.m_iID;
	NTCANMsg.len = CMsg.m_iLen;

	for(int i=0; i<8; i++)
		NTCANMsg.data[i] = CMsg.getAt(i);
	
	NTCAN_RESULT ret;
	int32_t len;
	bool bRet = true;
	len = 1;
	//ret = canWrite(m_Handle, canmsg, &len, NULL);
	ret = canSend(m_Handle, &NTCANMsg, &len);

	if( ret != NTCAN_SUCCESS)
	{
		LOGERROR("canSend() failed: " << getErrorMessage(ret));
		bRet = false;
	}

	m_LastID = (int)NTCANMsg.data[0];
	//ret auswerten
	return bRet;
}
Esempio n. 14
0
Regex& Regex::compile(const std::string& pattern)
{
    mPattern = pattern;

    destroy();

    // TODO: So, I would like an RAII object for this.  But, this object would
    //       need to call pcre2_compile() in its constructor rather than take
    //       ownership of a pointer (so that it has access to the error code
    //       information on failure) and its copy constructor / assignment
    //       operator would need to hold onto mPattern.  At that point the
    //       class is close to being this Regex class itself.
    static const int FLAGS = PCRE2_DOTALL;
    int errorCode;
    PCRE2_SIZE errorOffset;
    mPCRE = pcre2_compile(reinterpret_cast<PCRE2_SPTR>(mPattern.c_str()),
                          mPattern.length(),
                          FLAGS,
                          &errorCode,
                          &errorOffset,
                          NULL); // Use default compile context

    if (mPCRE == NULL)
    {
        std::ostringstream ostr;
        ostr << "PCRE compilation failed at offset " << errorOffset
             << ": " << getErrorMessage(errorCode);
        throw RegexException(Ctxt(ostr.str()));
    }

    return *this;
}
int LTKStrEncoding::tamilCharToUnicode(const unsigned short& shapeID,  vector<unsigned short>& unicodeString)
{

	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
	  " Entering: LTKStrEncoding::tamilCharToUnicode()" << endl;


		if(shapeID < 35)
		{
			if(shapeID == 34)
			{
				unicodeString.push_back(0x0b95);
				unicodeString.push_back(0x0bcd);
				unicodeString.push_back(0x0bb7);
			}
			else
			{
				unicodeString.push_back(tamilIsoCharMap[shapeID]);
			}
		}
		else
		{
			LOG(LTKLogger::LTK_LOGLEVEL_ERR)
                  <<"Error : "<< EINVALID_SHAPEID <<":"<< getErrorMessage(EINVALID_SHAPEID)
                  <<"LTKStrEncoding::tamilCharToUnicode()" <<endl;

			LTKReturnError(EINVALID_SHAPEID);
		}
		LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
		  " Exiting: LTKStrEncoding::tamilCharToUnicode()" << endl;

	return SUCCESS;
}
int PointFloatShapeFeatureExtractor::readConfig(const string& cfgFilePath)
{
    LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
        "PointFloatShapeFeatureExtractor::readConfig()" << endl;
    
	LTKConfigFileReader* configurableProperties = NULL;
	string tempStringVar = "";

	try
	{
		configurableProperties = new LTKConfigFileReader(cfgFilePath);
	}

	catch(LTKException e)
	{
		delete configurableProperties;

        int eCode = e.getErrorCode();

        LOG( LTKLogger::LTK_LOGLEVEL_ERR) << "Error: " << eCode << 
            " : " << getErrorMessage(eCode) <<
            " PointFloatShapeFeatureExtractor::readConfig" <<endl;
        
		LTKReturnError(eCode);
	}
    
	delete configurableProperties;

    LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
        "PointFloatShapeFeatureExtractor::readConfig()" << endl;
	return SUCCESS;

}
Esempio n. 17
0
void Socket::commitWrite()
{
	if(m_write_buffer.size() == 0)
		return;
	
	int res;
		
	do
	{	
		res=send(m_socket,m_write_buffer.c_str(),m_write_buffer.size(),0);
		
		if(res==SOCKET_ERROR)
		{
#ifdef WIN32
			if(WSAGetLastError()!=WSAEWOULDBLOCK)		
#else
			if(errno!=EWOULDBLOCK)	
#endif
			{
				close();
				throw ConnectionClosedException("Writing failed: " + getErrorMessage());
			}
			
			return;
		}
		
		m_write_buffer.erase(0,res);
	}
	while(res);
}
Esempio n. 18
0
int Socket::readImpl(char* data,int size)
{
	if(m_socket == int(INVALID_SOCKET))
		return 0;

	int res=recv(m_socket,data,size,0);
	
	if(res==SOCKET_ERROR)
	{
#ifdef WIN32
		if(WSAGetLastError()!=WSAEWOULDBLOCK)		
#else
		if(errno!=EWOULDBLOCK)	
#endif
		{
			close();
			throw ConnectionClosedException("Reading failed: " + getErrorMessage());
		}
		
		return 0;
	}
	
	if(res==0)
	{
		close();
		throw ConnectionClosedException("Connection closed gracefully.");
	}
	
	return res;
}
Esempio n. 19
0
int copyRTEELF(void *arg)
{
	DiskType type;
	int rv;

	setEnableDisc(-1);

	if (isDVDVSupported()) {
		type = CDDA_DiskType();
	
		/* Detect disk type, so loading will work. */
		if (type == DiskType_DVDV) {
			CDVD_SetDVDV(1);
		} else {
			CDVD_SetDVDV(0);
		}
	}

	rv = real_copyRTEELF(arg);

	if (isDVDVSupported()) {
		/* Always stop CD/DVD when an error happened. */
		CDVD_Stop();
		CDVD_FlushCache();
	}

	setEnableDisc(0);

	if (getErrorMessage() == NULL) {
		graphic_setPercentage(0, NULL);
	}

	return 0;
}
Esempio n. 20
0
bool Renderer::CreateImmediateModeVertexBuffer()
{
    ::IDirect3DDevice9 *lpD3DDevice = static_cast<::IDirect3DDevice9 *>(this->mpD3DDevice);
    const ::UINT lu32Length = this->mu32ImmediateModeVBLength;
    const ::DWORD lu32Usage = D3DUSAGE_DYNAMIC | D3DUSAGE_WRITEONLY;
    const ::DWORD lu32FVF = 0;
    const ::D3DPOOL lePool = ::D3DPOOL_DEFAULT;
    ::IDirect3DVertexBuffer9 *lpVertexBuffer = 0;
    ::HRESULT lResult = lpD3DDevice->CreateVertexBuffer(
        lu32Length,
        lu32Usage,
        lu32FVF,
        lePool,
        &lpVertexBuffer,
        0);
    if (FAILED(lResult))
    {
        REPORTERROR2("CreateVertexBuffer failed, HR=0x%x '%s'", lResult, getErrorMessage(lResult));
        return false;
    }

    this->mpImmediateModeVB = lpVertexBuffer;
    this->mu32ImmediateModeOffset = 0;

    return true;
}
Esempio n. 21
0
void *
Renderer::BeginImmediateMode(const unsigned int lu32Size, unsigned int &lu32Offset)
{
    ::DWORD lu32Flags = 0;
    unsigned int lu32CurrentOffset = this->mu32ImmediateModeOffset;
    const unsigned int lu32NextOffset = lu32CurrentOffset + lu32Size;
    if (lu32NextOffset >= this->mu32ImmediateModeVBLength)
    {
        lu32CurrentOffset = 0;
        lu32Flags |= D3DLOCK_DISCARD;
    }
    else
    {
        lu32Flags |= D3DLOCK_NOOVERWRITE;
    }

    ::IDirect3DVertexBuffer9 *lpVertexBuffer = static_cast<::IDirect3DVertexBuffer9 *>(this->mpImmediateModeVB);
    void *lpData;
    ::HRESULT lResult = lpVertexBuffer->Lock(lu32CurrentOffset, lu32Size, &lpData, lu32Flags);
    if (FAILED(lResult))
    {
        REPORTERROR2("VertexBuffer Lock failed, HR=0x%x '%s'", lResult, getErrorMessage(lResult));
        return 0;
    }

    lu32Offset = lu32CurrentOffset;
    this->mu32ImmediateModeOffset = lu32NextOffset;

    return lpData;
}
/**********************************************************************************
* AUTHOR		: Deepu V.
* DATE			: 22-FEB-2005
* NAME			: LTKRecognitionContext
* DESCRIPTION	: Initialization constructor
* ARGUMENTS		: 
* RETURNS		: 
* NOTES			:
* CHANGE HISTROY
* Author			Date				Description of change
*************************************************************************************/
LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer *wordRecPtr )
:m_wordRecPtr(wordRecPtr),
m_confidThreshold(0), 
m_numResults(0),
m_nextBestResultIndex(0) 

{
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        " Entering: LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" << endl;

	if(m_wordRecPtr == NULL)
    {
    	LOG(LTKLogger::LTK_LOGLEVEL_ERR)
            <<"Error : "<< ENULL_POINTER <<":"<< getErrorMessage(ENULL_POINTER)
            <<" LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" <<endl;

       throw LTKException(ENULL_POINTER);
    }

	m_recognitionFlags.clear();
	m_wordRecPtr = wordRecPtr;


	
	LOG( LTKLogger::LTK_LOGLEVEL_DEBUG) << 
        " Exiting: LTKRecognitionContext::LTKRecognitionContext(LTKWordRecognizer*)" << endl;
}
/**********************************************************************************
 * AUTHOR		: Saravanan. R
 * DATE			: 25-01-2007
 * NAME			: deletePreprocessor
 * DESCRIPTION	: This method is used to deletes the PreProcessor instance
 * ARGUMENTS		: ptrPreprocInstance : Holds the pointer to the LTKPreprocessorInterface
 * RETURNS		: none
 * NOTES			:
 * CHANGE HISTROY
 * Author			Date				Description
 *************************************************************************************/
int featurefilewriter::deletePreprocessor()
{

    LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Entering " <<
        "featurefilewriter::deletePreprocessor()" << endl;

    //deleting the preprocessor instance
    if(m_ptrPreproc != NULL)
    {
        m_deleteLTKLipiPreProcessor(m_ptrPreproc);
        m_ptrPreproc = NULL;
    }

    //Unload the dll
    int returnStatus = unloadPreprocessorDLL();
    if(returnStatus != SUCCESS)
    {
        LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Error: " <<
            getErrorMessage(returnStatus) <<
            " featurefilewriter::deletePreprocessor()" << endl;
        LTKReturnError(returnStatus);
    }

    LOG(LTKLogger::LTK_LOGLEVEL_DEBUG) << "Exiting " <<
        "featurefilewriter::deletePreprocessor()" << endl;

    return SUCCESS;
}
Esempio n. 24
0
void CEstEIDIEPluginBHO::setError(unsigned int code)
{
	EstEID_log("");
	this->errorCode = code;
	this->errorMessage.assign(getErrorMessage(code));
	EstEID_log("Set error: %s (HEX %Xh, DEC %u)", this->errorMessage.c_str(), code, code);
}
v8::Local<v8::Value> ErrorMessage::getErrorMessage(const int errorCode,
                                                   const name_map_t &errorcodeMapper,
                                                   const std::string &customMessage)
{
    return getErrorMessage(errorCode, errorcodeMapper, customMessage, std::string(),
                           static_cast<nrfjprogdll_err_t>(0));
}
Esempio n. 26
0
bool MainWindow::tryToOpenPIP (const File& pipFile)
{
    PIPGenerator generator (pipFile);

    if (! generator.hasValidPIP())
        return false;

    auto generatorResult = generator.createJucerFile();

    if (generatorResult != Result::ok())
    {
        AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
                                          "PIP Error.",
                                          generatorResult.getErrorMessage());

        return false;
    }


    if (! generator.createMainCpp())
    {
        AlertWindow::showMessageBoxAsync (AlertWindow::WarningIcon,
                                          "PIP Error.",
                                          "Failed to create Main.cpp.");

        return false;
    }

    if (! ProjucerApplication::getApp().mainWindowList.openFile (generator.getJucerFile()))
        return false;

    openPIP (generator);
    return true;
}
Esempio n. 27
0
int16_t sendPushoverNotification(const char* apikey, const char* event, const char* desc) {
  int16_t        result = -1;
  int32_t       data_size;
  char          url[128];
  HTTPResponse *response = NULL;
  char         *data = NULL;

  data = createMessage(apikey, event, desc, &data_size);

  if(data) {
    snprintf(url, 128, "%s%s", PUSHOVER_URL, PUSHOVER_ADD);
    response = sendHTTPData(url, NULL, data, data_size);
    if(response) {
      if(response->responseCode == 200) {
        result = 1;
      } else {
        dbg_printf(P_ERROR, "Pushover Notification failed: %s (%d)",
              getErrorMessage(response->responseCode),
              response->responseCode);
        result = -response->responseCode;
      }
      HTTPResponse_free(response);
    }
    am_free(data);
  }

  return result;
}
Esempio n. 28
0
void memoryError(){
//printf("memoryError\n");
	exitStatus = 4;
	getErrorMessage(ER_MALLOC_E);
	yyerror(NULL);
	exit(exitStatus);
}
Esempio n. 29
0
void sendResponseError(const GServerEvent& event, int httpErrorCode,
                       const std::string& errorMessage) {
    std::string errorMessageActual = errorMessage;
    if (errorMessageActual.empty()) {
        errorMessageActual = getErrorMessage(httpErrorCode);
    }
    getPlatform()->httpserver_sendResponse(event.getRequestID(), httpErrorCode, CONTENT_TYPE_ERROR, errorMessageActual);
}
Esempio n. 30
0
	Win32Exception::Win32Exception( DWORD errorCode, const std::string& fileName, int lineNo )
		: std::runtime_error( "" )
		, errorCode_( errorCode )
	{
		std::stringstream str;
		str << fileName << "(" << lineNo << "):" << getErrorMessage( errorCode );
		errorMessage_ = str.str();
	}