예제 #1
0
void CStatement::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
           << "' received from " << e.GetSource()->GetIdent());

    CResultSet *rs;

    if (dynamic_cast<const CDbapiFetchCompletedEvent*>(&e) != 0 ) {
        if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
            if( rs == m_irs ) {
                m_rowCount = rs->GetTotalRows();
                _TRACE("Rowcount from the last resultset: " << m_rowCount);
            }
        }
    }

    if (dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
        RemoveListener(e.GetSource());
        if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this);
            delete this;
        }
        else if( m_irs != 0 && (rs = dynamic_cast<CResultSet*>(e.GetSource())) != 0 ) {
            if( rs == m_irs ) {
                _TRACE("Clearing cached CResultSet " << (void*)m_irs);
                m_irs = 0;
            }
        }
    }
}
예제 #2
0
파일: Hooking.cpp 프로젝트: devyyj/Mini-DLP
///
///	@brief 클래스 이름이 Internet Explorer_Server 인 윈도우 핸들을 찾는다.
///
HWND GetIESeverHandle()
{
	POINT point;
	GetCursorPos(&point);
	HWND hRet = WindowFromPoint(point);

	TCHAR szClassName[1024] = {0};
	CString strClassName;

	do {
		GetClassName(hRet, szClassName, 1024);
		strClassName = szClassName;
		_TRACE(L"Current Window ClassName : %s, %x", strClassName, hRet);

		/// 클래스 네임이 Internet Explorer_Server 라면 바로 return
		if(strClassName.CompareNoCase(L"Internet Explorer_Server") == 0)
			break;
		else if(strClassName.CompareNoCase(L"IEFrame") == 0 || strClassName.CompareNoCase(L"TabWindowClass") == 0)
		{
			hRet = GetWindowHandleFromChildWindow(hRet, L"Internet Explorer_Server");
			break;
		}
		hRet = GetParent(hRet);
	} while (hRet);

	GetClassName(hRet, szClassName, 1024);
	_TRACE(L"return ClassName : %s, %x", szClassName, hRet);

	return hRet;
}
예제 #3
0
BOOL __stdcall Mine_GetKeyboardState(PBYTE a0)
{
	_TRACE("GetKeyboardState(%lx)\n", a0);

	BOOL rv = 0;
	__try {
		rv = Real_GetKeyboardState(a0);
	} __finally {
		_TRACE("GetKeyboardState() -> %lx\n", rv);
	};

	if (!rv)
		return FALSE;

	BYTE state[256];
	int n = myGetKeyState(state);
	if (n > 0) {

		gVKeyboard->transToVKState(state, n);
		for (int i = 0; i < n; i ++) {
			if (state[i] & 0x80)
				a0[i] |= 0x80;
		}
	}

	return rv;
}
예제 #4
0
bool HookUser32()
{
#if defined(DETOURS_VERSION) && DETOURS_VERSION == 20100 

	DetourTransactionBegin();
	DetourAttach(&(PVOID& )Real_GetAsyncKeyState, Mine_GetAsyncKeyState);
	DetourAttach(&(PVOID& )Real_GetKeyState, Mine_GetKeyState);
	DetourAttach(&(PVOID& )Real_GetKeyboardState, Mine_GetKeyboardState);
	DetourTransactionCommit();

#else // #if defined(DETOURS_VERSION) && DETOURS_VERSION == 20100 
	if (!DetourFunctionWithTrampoline((PBYTE)Real_GetAsyncKeyState,	(PBYTE)Mine_GetAsyncKeyState))
		return false;

	_TRACE("HookUser32(), Real_GetAsyncKeyState = %p, Mine_GetAsyncKeyState = %p\n", 
		Real_GetAsyncKeyState, &Mine_GetAsyncKeyState);

	if (!DetourFunctionWithTrampoline((PBYTE)Real_GetKeyState, (PBYTE)Mine_GetKeyState))
		return false;

	_TRACE("HookUser32(), Real_GetKeyState = %p, Mine_GetKeyState = %p\n", 
		Real_GetKeyState, &Mine_GetKeyState);

	DetourFunctionWithTrampoline((PBYTE)Real_GetKeyboardState,
		(PBYTE)Mine_GetKeyboardState);
#endif // #if defined(DETOURS_VERSION) && DETOURS_VERSION == 20100 
	return true;
}
예제 #5
0
BOOL OPCEngine::initialize(
	IN enum serverTypeCOM type, 
	IN REFCLSID clsid, 
	IN UINT rgsResource, 
	IN HINSTANCE hInst,
	IN DWORD coInit)	// COM init mode
{ 
	_TRACE(TL_INF, TG_ENG, (_T("initialize engine; clsid:%8.8X-%4.4X-%4.4X-%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X%2.2X"), clsid.Data1, clsid.Data2, clsid.Data3, clsid.Data4[0], clsid.Data4[1], clsid.Data4[2], clsid.Data4[3], clsid.Data4[4], clsid.Data4[5], clsid.Data4[6], clsid.Data4[7]));
	HRESULT res;

	g_clsid = clsid;
	g_registerId = rgsResource;

	m_type = type;

	if (type != InProc)
	{
		if (SUCCEEDED(res = ::CoInitializeEx(NULL, coInit)))
			m_initialized = TRUE;
		else
			_ERROR(TG_ENG, OPCENGINE_ERR_COM,(_T("Can't initialize COM: coInit:0x%X [0x%X]"), coInit, res));
	}

	_Module.Init(g_objectMap, hInst);
    ::CoFileTimeNow(&m_startTime);

	GenericPointer<GenericServer> pg = m_creator->createServer(TRUE);
	m_opcRoot->addBranch(pg);
	pg->setName(_T("PublicGroups"));
	
	_TRACE(TL_DEB, TG_ENG, (_T("< initialize 0x%X"), res));
	return SUCCEEDED(res); 
}
예제 #6
0
bool CCallableStatement::HasMoreResults()
{
    _TRACE("CCallableStatement::HasMoreResults(): Calling parent method");
    bool more = CStatement::HasMoreResults();
    
    if (more
        && GetCDB_Result() != 0
        && GetCDB_Result()->ResultType() == eDB_StatusResult ) {

        _TRACE("CCallableStatement::HasMoreResults(): Status result received");
        CDB_Int *res = 0;
        while( GetCDB_Result()->Fetch() ) {
            res = dynamic_cast<CDB_Int*>(GetCDB_Result()->GetItem());
        }

        if( res != 0 ) {
            m_status = res->Value();
			m_StatusIsAvailable = true;
            _TRACE("CCallableStatement::HasMoreResults(): Return status "
                   << m_status );
            delete res;
        }

        more = CStatement::HasMoreResults();
    }

    return more;
}
예제 #7
0
OPCEngine::~OPCEngine(void)
{
	OPCShutdownRequest *sreq; 

	_TRACE(TL_DEB, TG_ENG, (_T("> destructor")));
	setEventHandler(NULL);
	setConfigurationFileHandler(NULL);
	m_creator->release();
	m_nsRoot->release();
	m_opcRoot->release();
	g_engine = NULL;

	while(!m_shutdownList.IsEmpty())
	{
		sreq = m_shutdownList.RemoveHead();
		if (sreq->server)
			sreq->server->release();
		delete sreq;
	}

	if (m_events[END_EVENT] != INVALID_HANDLE_VALUE)
		CloseHandle(m_events[END_EVENT]);
	if (m_events[SHUTDOWN_EVENT] != INVALID_HANDLE_VALUE)
		CloseHandle(m_events[SHUTDOWN_EVENT]);

	freeAllPoolEvents();

	_TRACE(TL_DEB, TG_ENG, (_T("< destructor")));
}
예제 #8
0
파일: wdispsw.c 프로젝트: Yurand/tw-light
/* _win_switch_out:
 *  Puts the library in the background.
 */
void _win_switch_out(void)
{
   int mode;

   _TRACE(PREFIX_I "switch out\n");

   _win_app_foreground = FALSE;

   key_dinput_unacquire();
   mouse_dinput_unacquire();
   joystick_dinput_unacquire();

   midi_switch_out();

   if (win_gfx_driver && win_gfx_driver->switch_out)
      win_gfx_driver->switch_out();

   /* handle switch modes */
   mode = get_display_switch_mode();

   if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) {
      _TRACE(PREFIX_I "AMNESIA or PAUSE mode suspension\n");
      ResetEvent(foreground_event);

      /* if the thread doesn't stop, lower its priority only if another window is active */ 
      allegro_thread_priority = GetThreadPriority(allegro_thread); 
      if ((HINSTANCE)GetWindowLong(GetForegroundWindow(), GWL_HINSTANCE) != allegro_inst)
	 SetThreadPriority(allegro_thread, THREAD_PRIORITY_LOWEST); 
   }

   _switch_out();
}
예제 #9
0
파일: wdispsw.c 프로젝트: Yurand/tw-light
/* _win_switch_in:
 *  Puts the library in the foreground.
 */
void _win_switch_in(void)
{
   int mode;

   _TRACE(PREFIX_I "switch in\n");

   _win_app_foreground = TRUE;

   key_dinput_acquire();
   mouse_dinput_acquire();
   joystick_dinput_acquire();

   if (win_gfx_driver && win_gfx_driver->switch_in)
      win_gfx_driver->switch_in();

   /* handle switch modes */
   mode = get_display_switch_mode();

   if ((mode == SWITCH_AMNESIA) || (mode == SWITCH_PAUSE)) {
      _TRACE(PREFIX_I "AMNESIA or PAUSE mode recovery\n");
      SetEvent(foreground_event);

      /* restore old priority and wake up */
      SetThreadPriority(allegro_thread, allegro_thread_priority);
   }

   _switch_in();
}
예제 #10
0
파일: objostr.cpp 프로젝트: swuecho/igblast
void CObjectOStream::WritePointer(TConstObjectPtr objectPtr,
                                  TTypeInfo declaredTypeInfo)
{
    _TRACE("WritePointer("<<NStr::PtrToString(objectPtr)<<", "
           <<declaredTypeInfo->GetName()<<")");
    if ( objectPtr == 0 ) {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": null");
        WriteNullPointer();
        return;
    }
    TTypeInfo realTypeInfo = declaredTypeInfo->GetRealTypeInfo(objectPtr);
    if ( m_Objects ) {
        const CWriteObjectInfo* info =
            m_Objects->RegisterObject(objectPtr, realTypeInfo);
        if ( info ) {
            // old object
            WriteObjectReference(info->GetIndex());
            return;
        }
    }
    if ( declaredTypeInfo == realTypeInfo ) {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<": new");
        WriteThis(objectPtr, realTypeInfo);
    }
    else {
        _TRACE("WritePointer: "<<NStr::PtrToString(objectPtr)<<
               ": new "<<realTypeInfo->GetName());
        WriteOther(objectPtr, realTypeInfo);
    }
}
예제 #11
0
CRef<CSplitQueryBlk>
CQuerySplitter::Split()
{
    if (m_SplitBlk.NotEmpty()) {
        return m_SplitBlk;
    }

    m_SplitBlk.Reset(new CSplitQueryBlk(m_NumChunks,
                                        m_Options->GetGappedMode()));
    m_QueryChunkFactories.reserve(m_NumChunks);

    if (m_NumChunks == 1) {
        m_QueryChunkFactories.push_back(m_QueryFactory);
    } else {
        _TRACE("Splitting into " << m_NumChunks << " query chunks");
        x_ComputeChunkRanges();
        x_ComputeQueryIndicesForChunks();
        x_ComputeQueryContextsForChunks();

        for (size_t chunk_num = 0; chunk_num < m_NumChunks; chunk_num++) {
            CRef<IQueryFactory> qf
                (new CObjMgr_QueryFactory(*m_SplitQueriesInChunk[chunk_num]));
            m_QueryChunkFactories.push_back(qf);
        }

        x_ComputeContextOffsetsForChunks();
    }

    _TRACE("CSplitQuerBlk contents: " << *m_SplitBlk);
    _TRACE("CQuerySplitter contents: " << *this);

    return m_SplitBlk;
}
예제 #12
0
blast::SDataLoaderConfig 
InitializeQueryDataLoaderConfiguration(bool query_is_protein, 
                                       CRef<blast::CLocalDbAdapter> db_adapter)
{
    SDataLoaderConfig retval(query_is_protein);
    retval.OptimizeForWholeLargeSequenceRetrieval();

    /* Load the BLAST database into the data loader configuration for the query
     * so that if the query sequence(s) are specified as seq-ids, these can be 
     * fetched from the BLAST database being searched */
    if (db_adapter->IsBlastDb() &&  /* this is a BLAST database search */
        retval.m_UseBlastDbs &&   /* the BLAST database data loader is requested */
        (query_is_protein == db_adapter->IsProtein())) { /* the same database type is used for both queries and subjects */
        // Make sure we don't add the same database more than once
        vector<string> default_dbs;
        NStr::Tokenize(retval.m_BlastDbName, " ", default_dbs);
        if (default_dbs.size() &&
            (find(default_dbs.begin(), default_dbs.end(),
                 db_adapter->GetDatabaseName()) == default_dbs.end())) {
        CNcbiOstrstream oss;
        oss << db_adapter->GetDatabaseName() << " " << retval.m_BlastDbName;
        retval.m_BlastDbName = CNcbiOstrstreamToString(oss);
    }
    }
    if (retval.m_UseBlastDbs) {
        _TRACE("Initializing query data loader to '" << retval.m_BlastDbName 
               << "' (" << (query_is_protein ? "protein" : "nucleotide") 
               << " BLAST database)");
    }
    if (retval.m_UseGenbank) {
        _TRACE("Initializing query data loader to use GenBank data loader");
    }
    return retval;
}
예제 #13
0
status_t ChatSession::Say(const String16& statement)
{
	HRESULT hr = S_OK;
	String16 userName;
	int callerPid = GetCallerPID();
	_TRACE("ChatSession::Say(%s) >>",DISPLAY_STRING16(statement));	
	
	{
		Mutex::Autolock _lock(m_csAdviseLock);
		sp<IBinder> binder = m_Listeners.valueFor(callerPid);
		sp<IChatSessionEvents> eventSink = interface_cast<IChatSessionEvents>(binder);
		if(eventSink != NULL){
			_TRACE("**source(cse:%p  binder:%p) ",eventSink.get(),binder.get());
			userName  =  eventSink->GetUserName();
		}
	}

	if (userName.size() && CheckAccess(userName))
	{		
		{
			Mutex::Autolock _lock(m_csStatementLock);
			m_statements.add(userName + String16("\t:\t") +statement);
		}
		//Fire_OnNewStatement(userName, statement);
		ChatWorker::getInstance().Defer_OnNewStatement(this,userName, statement);
	}
	else
		hr = E_ACCESSDENIED;

	_TRACE("ChatSession::Say() <<hr:%x",hr);
	return hr;
}
예제 #14
0
void CMsvcConfigure::Configure(CMsvcSite&         site, 
                               const list<SConfigInfo>& configs,
                               const string&            root_dir)
{
    _TRACE("*** Analyzing 3rd party libraries availability ***");
    
    site.InitializeLibChoices();
    InitializeFrom(site);
    site.ProcessMacros(configs);

    if (CMsvc7RegSettings::GetMsvcPlatform() >= CMsvc7RegSettings::eUnix ||
        GetApp().IsCMakeMode()) {
        return;
    }
    _TRACE("*** Creating Makefile.third_party.mk files ***");
    // Write makefile uses to install 3-rd party dlls
    list<string> third_party_to_install;
    site.GetThirdPartyLibsToInstall(&third_party_to_install);
    // For static buid
    ITERATE(list<SConfigInfo>, p, configs) {
        const SConfigInfo& config = *p;
        s_CreateThirdPartyLibsInstallMakefile(site, 
                                              third_party_to_install, 
                                              config, 
                                              GetApp().GetBuildType());
    }
}
예제 #15
0
파일: rs_impl.cpp 프로젝트: swuecho/igblast
void CResultSet::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this
              << ": '" << e.GetName()
              << "' received from " << e.GetSource()->GetIdent());

    if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
        if( dynamic_cast<CStatement*>(e.GetSource()) != 0
            || dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
            if( m_rs != 0 ) {
                _TRACE("Discarding old CDB_Result " << (void*)m_rs);
                Invalidate();
            }
        }
    }
    else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {

        RemoveListener(e.GetSource());

        if(dynamic_cast<CStatement*>(e.GetSource()) != 0
           || dynamic_cast<CCursor*>(e.GetSource()) != 0
           || dynamic_cast<CCallableStatement*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this);
            delete this;
        }
    }
}
예제 #16
0
void ChatSession::AsyncSay(const String16& statement){
	_TRACE("ChatSession::AsyncSay(%s) >>",DISPLAY_STRING16(statement));	
	Mutex::Autolock _lock(m_csStatementLock);
	m_statements.add(String16("\t:\t") +statement);
	ChatWorker::getInstance().Defer_OnNewStatement(this,String16("(Async)"), statement);
	_TRACE("ChatSession::AsyncSay() <<");
}
예제 #17
0
	virtual sp<IChatSession>  FindSession(const String16& name, 
								BOOL bDontCreate,
								BOOL bAllowAnonymousAccess) 
	{
		Parcel data, reply;
		sp<IChatSession> cs;
		_TRACE("BpChatSessionManager::FindSession() >>" );

		data.writeInterfaceToken(IChatSessionManager::getInterfaceDescriptor());
		data.writeString16(name);
		data.writeInt32(bDontCreate);
		data.writeInt32(bAllowAnonymousAccess);		
		status_t err = remote()->transact(ICSM_FindSession, data, &reply);
		if (err != NO_ERROR) {
	            LOGE("FindSession error: %s", strerror(-err));
        	} else {
       	     cs  = interface_cast<IChatSession>(reply.readStrongBinder());
        	}

		if(cs == NULL){
			_TRACE("failed to find Session");
		}
			
		_TRACE("BpChatSessionManager::FindSession() <<" );				
		return cs;
	}
예제 #18
0
int CSoundPlayer::Open(WAVEFORMATEX _tOutWFX)
{
	DWORD dwFlag = 0;
	HRESULT	hr = NOERROR;
	MMRESULT	mmhr;

	if (NULL != soundObj.hWaveOut)	return -1;

	//if (NULL==soundObj.hNotify)	soundObj.hNotify = CreateEvent( NULL, FALSE, FALSE, 0 );

#if 0
	// Query WaveOut Device for _tOutWFX
	dwFlag = WAVE_FORMAT_DIRECT | WAVE_FORMAT_QUERY; //WAVE_MAPPED
	dwFlag |= CALLBACK_NULL;
	mmhr = waveOutOpen( &soundObj.hWaveOut, WAVE_MAPPER, &_tOutWFX, NULL, 0, dwFlag );
	if( MMSYSERR_NOERROR != mmhr ) {
		_TRACE("waveOutOpen Query Fail ret:%d \n", mmhr );
		return -3;
	}
#endif
	// Open WaveOut Device for _tOutWFX
	dwFlag = WAVE_FORMAT_DIRECT;
	dwFlag |= CALLBACK_EVENT;
	mmhr = waveOutOpen( &soundObj.hWaveOut, WAVE_MAPPER, &_tOutWFX, 
						//(DWORD)NULL, (DWORD_PTR)0, dwFlag );
						(DWORD)soundObj.hNotify, (DWORD_PTR)0, dwFlag );
	if( MMSYSERR_NOERROR != mmhr ) {
		_TRACE("waveOutOpen Fail ret:%d \n", mmhr );
		return -4;
	}

	for( unsigned int i=0; i<soundObj.waveHdrNum; i++ ) 
	{
		soundObj.pWaveHdr[i].dwFlags = 0;
		soundObj.pWaveHdr[i].dwBufferLength = MAX_AUDIO_BUFFER_LENGTH;
		mmhr = waveOutPrepareHeader( soundObj.hWaveOut, &soundObj.pWaveHdr[i], sizeof(WAVEHDR) );
		soundObj.pWaveHdr[i].dwBufferLength = 0;
	}
	soundObj.initWaveHdr = 0x01;

	soundObj.samplerate = _tOutWFX.nSamplesPerSec;
	soundObj.channel    = _tOutWFX.nChannels;
	soundObj.bitpersec  = _tOutWFX.wBitsPerSample;

	ResetData();

	if (NULL == soundObj.hThread)
	{
		soundObj.flag = 0x01;
		soundObj.pEx  = this;
		soundObj.hThread = CreateThread(NULL, 0, __SOUND_PLAY_THREAD, &soundObj, 0, NULL);
		while (soundObj.flag != 0x02 && soundObj.flag != 0x00)	{Sleep(100);}
	}
	soundObj.waveHdrWriteIdx = 0;



	return 0;
}
예제 #19
0
파일: rs_impl.cpp 프로젝트: swuecho/igblast
bool CResultSet::Next()
{
    bool more = false;

	if (m_rs) {
		more = m_rs->Fetch();
        m_LastVariantNum = 0;
        m_RowReadType = eReadUnknown;
	}

    if (more  &&  m_data.size() == 0) {
        Init();
    }

    m_column = 0;
    if( more && !IsDisableBind() ) {
        for(unsigned int i = 0; i < m_rs->NofItems(); ++i ) {
            EDB_Type type = m_rs->ItemDataType(i);
            if( type == eDB_Text || type == eDB_Image )  {
                break;
            }
            ++m_column;
        }

        m_LastVariantNum = m_column;
        if ((unsigned int)m_column >= m_rs->NofItems()) {
            m_column = -1;
        }
    }
    else {
        m_RowReadType = eReadRaw;
    }

    if( !more ) {
        if( m_ostr ) {
            _TRACE("CResulstSet: deleting BLOB output stream...");
                   delete m_ostr;
                   m_ostr = 0;
        }
        if( m_istr ) {
            _TRACE("CResulstSet: deleting BLOB input stream...");
            delete m_istr;
            m_istr = 0;
        }
        if( m_rd ) {
            _TRACE("CResulstSet: deleting BLOB reader...");
            delete m_rd;
            m_rd = 0;
        }

        Notify(CDbapiFetchCompletedEvent(this));
    }
    else {
        ++m_totalRows;
    }

    return more;
}
예제 #20
0
	virtual void    OnUserLeft(const String16& name) 
	{
		Parcel data, reply;
		_TRACE("BpChatSessionEvents::OnUserLeft>>"); 
		data.writeInterfaceToken(IChatSessionEvents::getInterfaceDescriptor());
		data.writeString16(name);
		status_t err = remote()->transact(ICSE_OnUserLeft, data, &reply,IBinder::FLAG_ONEWAY);
		_TRACE("BpChatSessionEvents::OnUserLeft<< err(%d)",err);
	}
예제 #21
0
void CConnection::Action(const CDbapiEvent& e)
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName()
        << "' received from " << e.GetSource()->GetIdent() << " " << (void*)e.GetSource());

    if(dynamic_cast<const CDbapiClosedEvent*>(&e) != 0 ) {
/*
        CStatement *stmt;
        CCallableStatement *cstmt;
        CCursor *cursor;
        CDBAPIBulkInsert *bulkInsert;
        if( (cstmt = dynamic_cast<CCallableStatement*>(e.GetSource())) != 0 ) {
            if( cstmt == m_cstmt ) {
                _TRACE("CConnection: Clearing cached callable statement " << (void*)m_cstmt);
                m_cstmt = 0;
            }
        }
        else if( (stmt = dynamic_cast<CStatement*>(e.GetSource())) != 0 ) {
            if( stmt == m_stmt ) {
                _TRACE("CConnection: Clearing cached statement " << (void*)m_stmt);
                m_stmt = 0;
            }
        }
        else if( (cursor = dynamic_cast<CCursor*>(e.GetSource())) != 0 ) {
            if( cursor == m_cursor ) {
                _TRACE("CConnection: Clearing cached cursor " << (void*)m_cursor);
                m_cursor = 0;
            }
        }
        else if( (bulkInsert = dynamic_cast<CDBAPIBulkInsert*>(e.GetSource())) != 0 ) {
            if( bulkInsert == m_bulkInsert ) {
                _TRACE("CConnection: Clearing cached bulkinsert " << (void*)m_bulkInsert);
                m_bulkInsert = 0;
            }
        }
*/
        if( m_connCounter == 1 )
            m_connUsed = false;
    }
    else if(dynamic_cast<const CDbapiAuxDeletedEvent*>(&e) != 0 ) {
        if( m_connCounter > 1 ) {
            --m_connCounter;
            _TRACE("Server: " << GetCDB_Connection()->ServerName()
                   <<", connections left: " << m_connCounter);
        }
        else
            m_connUsed = false;
    }
    else if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
        RemoveListener(e.GetSource());
        if(dynamic_cast<CDataSource*>(e.GetSource()) != 0 ) {
            if( m_ownership == eNoOwnership ) {
                delete this;
            }
        }
    }
}
예제 #22
0
	void Defer_OnUserLeft(ChatSession* cs,const String16& pwszUser)
	{
		_TRACE("ChatWorkThread:Defer_OnUserLeft>> (cs %p)",cs);
		sp<work_item_t> data = new work_item_t(WORK_Defer_OnUserLeft,cs,pwszUser,String16());	
		Mutex::Autolock _locker(workMutex);
		work.add(data);
		workCond.signal();

		_TRACE("ChatWorkThread:Defer_OnUserLeft<< (cs %p)",cs);		
	}
예제 #23
0
	void Defer_OnNewUser(ChatSession*  cs,const String16& pwszUser)
	{
		_TRACE("ChatWorkThread:Defer_OnNewUser>>(cs %p) %s",cs,DISPLAY_STRING16(pwszUser));
		sp<work_item_t> data = new work_item_t(WORK_Defer_OnNewUser,cs,pwszUser,String16());
		Mutex::Autolock _locker(workMutex);
		work.add(data);
		workCond.signal();

		_TRACE("ChatWorkThread:Defer_OnNewUser<<(cs %p)",cs);		
	}
예제 #24
0
	virtual status_t DeleteSession(const String16& name) 
	{
		Parcel data, reply;
		_TRACE("BpChatSessionManager::DeleteSession() >>" );
		data.writeInterfaceToken(IChatSessionManager::getInterfaceDescriptor());
		data.writeString16(name);
		status_t err = remote()->transact(ICSM_DeleteSession, data, &reply);
		_TRACE("BpChatSessionManager::DeleteSession() <<" );
		return err == NO_ERROR ? reply.readInt32() : 0;
	}
예제 #25
0
	virtual void    AsyncSay(const String16& statement)
	{
		Parcel data, reply;
		_TRACE("BpChatSession::AsyncSay>>");	
		data.writeInterfaceToken(IChatSession::getInterfaceDescriptor());
//		data.writeInt32((int32_t)getpid());

		data.writeString16(statement);
		status_t err = remote()->transact(ICS_AsyncSay, data, &reply,IBinder::FLAG_ONEWAY);
		_TRACE("BpChatSession::AsyncSay<< err(%d)",err);	
	}
예제 #26
0
	virtual status_t Sync_OnNewStatement(const String16& name,
										const String16& statement)
	{
		Parcel data, reply;
		_TRACE("BpChatSessionEvents::Sync_OnNewStatement>>"); 
		data.writeInterfaceToken(IChatSessionEvents::getInterfaceDescriptor());
		data.writeString16(name);
		data.writeString16(statement);		
		status_t err = remote()->transact(ICSE_Sync_OnNewStatement, data, &reply);
		_TRACE("BpChatSessionEvents::Sync_OnNewStatement<< err(%d)",err);	
		return err == NO_ERROR ? reply.readInt32() : 0;
	}	
예제 #27
0
// IChatSessionManager methods
Vector<String16> ChatSessionClass::GetSessionNames(void) 
{
	Vector<String16> names;

	_TRACE("ChatSessionClass::GetSessionNames() >>");
	Mutex::Autolock _lock(m_csSessionLock);
	for(size_t i =0; i< m_sessions.size();i++)
		names.add(m_sessions.valueAt(i)->GetName());
	_TRACE("ChatSessionClass::GetSessionNames() <<");
	return names;

}
예제 #28
0
// send the OnUserLeft event to all listeners
void 
ChatSession::Fire_OnUserLeft(const String16& pwszUser)
{
	_TRACE("ChatSession::Fire_OnUserLeft >>this(%p),(%s,%s) ",this,DISPLAY_STRING16(m_wszSessionName),DISPLAY_STRING16(pwszUser));
	Mutex::Autolock _lock(m_csAdviseLock);
	for (size_t i = 0; i < m_Listeners.size(); i++) 	{
		sp<IBinder> binder = m_Listeners.valueAt(i);
		sp<IChatSessionEvents> cse = interface_cast<IChatSessionEvents> (binder);
		_TRACE("**target(cse:%p binder:%p) ",cse.get(),binder.get());
		cse ->OnUserLeft(pwszUser);
	}	
	_TRACE("ChatSession::Fire_OnUserLeft << ");
}
예제 #29
0
void CDBAPIBulkInsert::Action(const CDbapiEvent& e) 
{
    _TRACE(GetIdent() << " " << (void*)this << ": '" << e.GetName() 
           << "' from " << e.GetSource()->GetIdent());

    if(dynamic_cast<const CDbapiDeletedEvent*>(&e) != 0 ) {
	RemoveListener(e.GetSource());
        if(dynamic_cast<CConnection*>(e.GetSource()) != 0 ) {
            _TRACE("Deleting " << GetIdent() << " " << (void*)this); 
            delete this;
        }
    }
}
예제 #30
0
size_t
SplitQuery_GetChunkSize(EProgram program)
{
    size_t retval = 0;

    // used for experimentation purposes
    char* chunk_sz_str = getenv("CHUNK_SIZE");
    if (chunk_sz_str && !NStr::IsBlank(chunk_sz_str)) {
        retval = NStr::StringToInt(chunk_sz_str);
        _TRACE("DEBUG: Using query chunk size " << retval);
    } else {

        switch (program) {
        case eBlastn:
            retval = 1000000;
            break;
        case eMegablast:
        case eDiscMegablast:
            retval = 5000000;
            break;
        case eTblastn:
            retval = 20000;
            break;
        // if the query will be translated, round the chunk size up to the next
        // multiple of 3, that way, when the nucleotide sequence(s) get(s)
        // split, context N%6 in one chunk will have the same frame as context
        // N%6 in the next chunk
        case eBlastx:
        case eTblastx:
            // N.B.: the splitting is done on the nucleotide query sequences,
            // then each of these chunks is translated
            retval = 10002;
            break;
        case eBlastp:
        default:
            retval = 10000;
            break;
        }

        _TRACE("Using query chunk size " << retval);
    }

    const EBlastProgramType prog_type(EProgramToEBlastProgramType(program));
    if (Blast_QueryIsTranslated(prog_type) && !Blast_SubjectIsPssm(prog_type) &&
        (retval % CODON_LENGTH) != 0) {
        NCBI_THROW(CBlastException, eInvalidArgument, 
                   "Split query chunk size must be divisible by 3");
    }

    return retval;
}