void ServiceContext::ClientDeleter::operator()(Client* client) const {
    ServiceContext* const service = client->getServiceContext();
    {
        stdx::lock_guard<stdx::mutex> lk(service->_mutex);
        invariant(service->_clients.erase(client));
    }
    onDestroy(client, service->_clientObservers);
    delete client;
}
Exemple #2
0
Bool simplest::Simple::destroy()  {
    if(!isExists())
        return false;
    onDestroy();
    pushFreeSimple(*this);
    setExists(false);
    resetID();
    return true;
}
void ServiceContext::OperationContextDeleter::operator()(OperationContext* opCtx) const {
    auto client = opCtx->getClient();
    auto service = client->getServiceContext();
    {
        stdx::lock_guard<Client> lk(*client);
        client->resetOperationContext();
    }
    onDestroy(opCtx, service->_clientObservers);
    delete opCtx;
}
Exemple #4
0
Bool testlist::Parent::destroy()  {
    if(!isExists())
        return false;
    onDestroy();
    cascadeRemoveChild();
    pushFreeParent(*this);
    setExists(false);
    resetID();
    return true;
}
LRESULT CALLBACK MessageRouterHelper::DlgProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
	UNREFERENCED_PARAMETER(wParam);
	UNREFERENCED_PARAMETER(lParam);
	switch (message)
	{

	case WM_STREAMEVENT_COLOR:
        //UpdateStreams(1);
        break;
	case WM_STREAMEVENT_DEPTH:
        //UpdateStreams(2);
        break;

	case WM_INITDIALOG:
		// store window handle
		m_hWnd = hWnd;
		onCreate();
		break;
	
	case WM_CLOSE:
		DestroyWindow(hWnd);
		onDestroy();
		break;

	case WM_DESTROY:
		PostQuitMessage(0);
		break;
	case WM_COMMAND:
		processUIMessage(wParam, lParam);
		break;
	case WM_HSCROLL:
		onSliderChanged(wParam, lParam);
		break;
	case WM_VSCROLL:
		onSliderScroll(wParam, lParam);
		break;
	case WM_NOTIFY:
		switch (((LPNMHDR)lParam)->code)
		{
		case TCN_SELCHANGE:
		{
			int iPage = TabCtrl_GetCurSel(GetDlgItem(m_hWnd, IDC_TAB2));
			onTabSelected(iPage);
		}
			break;
		}

	default:
		break;

	}
	return FALSE;
}
Exemple #6
0
Bool testlist::Child::destroy()  {
    if(!isExists())
        return false;
    onDestroy();
    if ( getParent().isValid() )
        getParent().removeChild(*this);
    pushFreeChild(*this);
    setExists(false);
    resetID();
    return true;
}
Exemple #7
0
Bool testhash::Parent::destroy()  {
    if(!isExists())
        return false;
    onDestroy();
    cascadeRemoveTableListChild();
    cascadeRemoveChild();
    Parent::remove__ChildTableBlock__Parent(*this);
    pushFreeParent(*this);
    setExists(false);
    resetID();
    return true;
}
void Identification::rename(uint64_t id, const std::string& name, const std::string& layer){
	onDestroy(id);

	Identifier* identifier = _engine.manager.getComponent<Identifier>(id);

	strcpy_s(identifier->name, name.c_str());

	if (layer != "")
		strcpy_s(identifier->layer, layer.c_str());

	onCreate(id);
}
Exemple #9
0
bool AbstractWindow::destroy( ) {
    if ( !m_isCreated ) {
        osre_warn( Tag, "Surface not valid, cannot be destoyed." );
        return false;
    }
    
    if ( onDestroy() ) {
        m_isCreated = false;
    }

    return ( false == m_isCreated );
}
Exemple #10
0
bool mxWindow::handleMessage(
		LRESULT *lRes,
		UINT uMsg,
		WPARAM wParam,
		LPARAM lParam
		)
{
	switch (uMsg) {
	case MM_MCINOTIFY:
		return onMciNotify(wParam, lParam);

	case WM_CLOSE:
		return onClose();

	case WM_COMMAND:
		return onCommand(
				LOWORD(wParam),
				reinterpret_cast<HWND>(lParam),
				HIWORD(wParam));

	case WM_CREATE:
		return onCreate(lRes, reinterpret_cast<CREATESTRUCT*>(lParam));

	case WM_DESTROY:
		return onDestroy();

	case WM_ERASEBKGND:
		return onEraseBkgnd(lRes, reinterpret_cast<HDC>(wParam));

	case WM_LBUTTONDBLCLK:
		return onLButtonDown(TRUE, mxPoint(lParam), wParam);

	case WM_LBUTTONDOWN:
		return onLButtonDown(FALSE, mxPoint(lParam), wParam);

	case WM_MOUSEMOVE:
		return onMouseMove(mxPoint(lParam), wParam);

	case WM_PAINT: {
		mxPaintDC dc(this);
		return onPaint(&dc); }

	case WM_SIZE:
		return onSize(wParam, mxSize(lParam));

	case WM_TIMER:
		return onTimer(wParam);

	}
	return false;
}
Exemple #11
0
void SWGameScene::destroy()
{
	onDestroy();
	for ( SWRefNode* node = m_rootNode() ; node ; node = node->next() )
	{
		SWGameObject* go = (SWGameObject*)node->ref();
		if ( go ) go->destroyNow();
	}
	m_rootNode = NULL;
	m_destroyGOs.clear();

	SWInput.removeInputDelegate( GetDelegator(handleEvent) );
	__super::destroy();
}
Exemple #12
0
int
main ( int   argc,
       char *argv[] ) {
    gtk_init (&argc, &argv); // initGUI();

    if (argc==1) {
	/* leave at defaults */
    } else if (argc==5) {
# define CHK(expr) if ((expr)!=1) { goto usage; }
	CHK(sscanf(argv[1],"%lf",&xcenter));
	CHK(sscanf(argv[2],"%lf",&ycenter));
	CHK(sscanf(argv[3],"%lf",&size));
	CHK(sscanf(argv[4],"%d",&depth));
    } else {
    usage:
	printf("usage: %s [xcenter ycenter size depth]\n", argv[0]);
	return 1;
    }
    printf("xcenter=%lf\n",xcenter);
    printf("ycenter=%lf\n",ycenter);
    printf("   size=%lf\n",size);
    printf("  depth=%d\n",depth);
    {
	GtkWidget *window= gtk_window_new(GTK_WINDOW_TOPLEVEL);
	GtkWidget *drawing= gtk_drawing_area_new();
	assert(window);
	assert(drawing);
	gtk_window_set_title(window, "Mandelbrot");
	gtk_container_add (GTK_CONTAINER (window), drawing);
	{
	    /* widgetModifyBg drawing StateNormal bg */
	    GdkColor bg= {
		0,
		0,
		0,
		0
	    };
	    gtk_widget_modify_bg(drawing, GTK_STATE_NORMAL, &bg); 
	}
	onExpose(drawing, renderScene); /* onExpose drawing (renderScene drawing) */
	onDestroy(window, mainQuit); /* onDestroy window mainQuit */
	gtk_window_set_default_size(window, 800, 600); /* windowSetDefaultSize window 800 600 */
	gtk_window_set_position(window, GTK_WIN_POS_CENTER); /* windowSetPosition window WinPosCenter */
	/* widgetShowAll window */ //hmm don't have?
	gtk_widget_show(drawing);
	gtk_widget_show(window);
	gtk_main(); /* mainGUI */
    }
    return 0;
}
Exemple #13
0
void UIControl::onRecursion(UINT message)
{
    switch (message)
    {
    case WM_CREATE:
        onCreate();
        break;
    case WM_DESTROY:
        onDestroy();
        break;
    default:
        break;
    }
}
bool
Mhal_facebeauty::
onCreate(MtkCameraFaceMetadata* FaceInfo)
{
    MBOOL   ret = MFALSE;
    MINT32  ec = 0;
    MINT32  g_BufWidth;
    MINT32  g_BufHeight;
    MY_LOGD("[facebeauty init] FBFaceInfo adr 0x%x FBFaceInfo num %d \n",(MUINT32)FaceInfo->faces,FaceInfo->number_of_faces);
    UtilityStatus = 1;
    FBmetadata.faces=(MtkCameraFace *)FBFaceInfo;
    FBmetadata.posInfo=(MtkFaceInfo *)MTKPoseInfo;
    FBmetadata.number_of_faces = FaceInfo->number_of_faces;

    for(int i=0;i<FaceInfo->number_of_faces;i++)
    {
        FBmetadata.faces[i].rect[0] = FaceInfo->faces[i].rect[0];
        FBmetadata.faces[i].rect[1] = FaceInfo->faces[i].rect[1];
        FBmetadata.faces[i].rect[2] = FaceInfo->faces[i].rect[2];
        FBmetadata.faces[i].rect[3] = FaceInfo->faces[i].rect[3];
        FBmetadata.posInfo[i].rop_dir = FaceInfo->posInfo[i].rop_dir;
        FBmetadata.posInfo[i].rip_dir = FaceInfo->posInfo[i].rip_dir;
    }

    mpIMemDrv =  IMemDrv::createInstance();
    if (mpIMemDrv == NULL)
    {
        MY_LOGE("g_pIMemDrv is NULL \n");
        return 0;
    }

    mpFb = halFACEBEAUTIFYBase::createInstance(HAL_FACEBEAUTY_OBJ_SW);

    if  ( ! mpFb )
    {
        MY_LOGE("[init] NULL mpFb \n");
        goto lbExit;
    }
    mpFbObj = this;
    mpFb->CANCEL = MFALSE;

    ret = MTRUE;
lbExit:
    if  ( ! ret )
    {
        onDestroy();
    }
    MY_LOGD("[init] rc(%d) \n", ret);
    return  ret;
}
Exemple #15
0
//------------------------------------------------------------------------------
void Entity::destroy()
{
    if (!getFlag(SN_EF_DESTROYED))
    {
        onDestroy();
        setFlag(SN_EF_DESTROYED, true);
        releaseScript();
        // TODO Instant destruction
        release();
    }
    else
    {
        SN_ERROR("Attempt to call destroy() on an already destroyed entity!");
    }
}
Exemple #16
0
void Splitter::create(const Seed& cs) {
	pos = cs.pos;
	horizontal = cs.horizontal;
	BaseType::create(cs);

	theme.load(VSCLASS_WINDOW, this);
	onPainting([this](PaintCanvas& canvas) { handlePainting(canvas); });

	onLeftMouseDown([this](const MouseEvent& mouseEvent) { return handleLButtonDown(mouseEvent); });
	onMouseMove([this](const MouseEvent& mouseEvent) { return handleMouseMove(mouseEvent); });
	onLeftMouseUp([this](const MouseEvent&) { return handleLButtonUp(); });

	auto tip = WidgetCreator<ToolTip>::create(this, ToolTip::Seed());
	tip->setText(Texts::get(Texts::resize));
	onDestroy([tip] { tip->close(); });
}
Exemple #17
0
void Entity::handleDestructionCurrent()
{
    // If marked for destruction, mark all components for destruction
    if (mDestuctionFlag)
    {
        // Flag all children for destruction
        for (Component* component : components)
        {
            component->destroy();
        }

        // Call onDestroy event on self
        onDestroy();
    }

    // Check for components needing destruction
    for (std::vector<Component*>::iterator it = components.begin(); it != components.end();)
    {
        Component* component = *it;
        // Check if component is marked for destruction
        if (component->getDestructionFlag())
        {
            // Call onDestory event on component
            component->onDestroy();
            // Remove component from components list
            it = components.erase(it);
            // Delete component
            delete component;
        }
        // Advanced iterator, done this way to handle issue raised by using erase
        if (it != components.end())
        {
            ++it;
        }
    }
    
    // Destroy self
    if (mDestuctionFlag)
    {
        removeFromScene();
    }
}
MRESULT EXPENTRY NP_LOADDS AutoDlgProc(HWND hWnd, ULONG msg, MPARAM mp1, MPARAM mp2)
{
  switch(msg)
  {
    case WM_INITDLG:
      onInitDialog(hWnd, 0, mp2);
      return (MRESULT)FALSE;
    case WM_COMMAND:
    case WM_CONTROL:
      onCommand(hWnd, SHORT1FROMMP(mp1), 0, SHORT2FROMMP(mp1));
      break;
    case WM_DESTROY:
      onDestroy(hWnd);
      break;

    default:
      return WinDefDlgProc(hWnd, msg, mp1, mp2);
  }
  return (MRESULT)TRUE;
}
Exemple #19
0
            void Activity::pollEvent()
            {
                int ident;
                int events;
                struct android_poll_source *source;

                while((ident = ALooper_pollAll(0, NULL, &events, (void**)&source)) >= 0)
                {
                    if(source != NULL)
                        source->process(_app, source);

                    if(ident == LOOPER_ID_USER)
                        this->onEvent();

                    if(_app->destroyRequested != 0)
                    {
                        onDestroy();
                        return;
                    }
                }
            }
Exemple #20
0
// The onEvent() method is normally defined by FOG_EVENT_BEGIN() and
// FOG_EVENT_END() macros, but Fog::Object is an exception.
void Object::onEvent(Event* ev)
{
  switch (ev->getCode())
  {
    case EVENT_CREATE:
      onCreate(reinterpret_cast<CreateEvent*>(ev));
      break;
    case EVENT_DESTROY:
      onDestroy(reinterpret_cast<DestroyEvent*>(ev));
      break;

    case EVENT_CHILD_ADD:
    case EVENT_CHILD_REMOVE:
      onChild(reinterpret_cast<ChildEvent*>(ev));
      break;

    case EVENT_PROPERTY:
      onProperty(reinterpret_cast<PropertyEvent*>(ev));
      break;
  }
}
void Application::run()
{
	Utility::resetTimer();
	m_running = true;
	do
	{
		float deltaTime = Utility::tickTimer();

		onUpdate( deltaTime );

		onDraw();

		glfwSwapBuffers(m_window);
		glfwPollEvents();

	} while (m_running == true && glfwWindowShouldClose(m_window) == 0);

	onDestroy();

	glfwTerminate();
}
Exemple #22
0
    void DBConnectionPool::taskDoWork() { 
        vector<DBClientBase*> toDelete;
        
        {
            // we need to get the connections inside the lock
            // but we can actually delete them outside
            scoped_lock lk( _mutex );
            for ( PoolMap::iterator i=_pools.begin(); i!=_pools.end(); ++i ) {
                i->second.getStaleConnections( toDelete );
            }
        }

        for ( size_t i=0; i<toDelete.size(); i++ ) {
            try {
                onDestroy( toDelete[i] );
                delete toDelete[i];
            }
            catch ( ... ) {
                // we don't care if there was a socket error
            }
        }
    }
Exemple #23
0
void Application::run()
{
	Utility::resetTimer();
	m_running = true;
	do
	{
		float deltaTime = Utility::tickTimer();
		if (glfwGetKey(m_window,GLFW_KEY_F12) == GLFW_PRESS){ glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); }else{ glPolygonMode( GL_FRONT_AND_BACK, GL_FILL ); }

		onUpdate( deltaTime );

		onDraw();

		glfwSwapBuffers(m_window);
		glfwPollEvents();

	} while (m_running == true && glfwWindowShouldClose(m_window) == 0);

	onDestroy();

	glfwTerminate();
}
Exemple #24
0
LRESULT CALLBACK windowProc(HWND hwnd, UINT umsg, WPARAM wparam, LPARAM lparam)
{
    switch (umsg)
    {
        case WM_CREATE:
            onCreate(hwnd);
            break;

        case WM_CLOSE:
            DestroyWindow(hwnd); // exit
            break;

        case WM_DESTROY:
            onDestroy(hwnd);
            break;

        case WM_SHELLNOTIFY:
            onTray(hwnd, wparam, lparam);
            break;

        case WM_TIMER:
            onTimer(hwnd, wparam, lparam);
            break;

        case WM_HOTKEY:
            onHotkey(hwnd, wparam, lparam);
            break;

        case WM_COMMAND:
            onCommand(hwnd, LOWORD(wparam), HIWORD(wparam), (HWND)lparam);
            SetForegroundWindow(tibia_getwindow()); // set focus to tibia window after using tray menu
            break;

        default:
            return DefWindowProc(hwnd, umsg, wparam, lparam);
    }
    return 0;
}
        //-----------------------------------------------------------------------------------------------------------
        bool AndroidApplication::run()
        {
                float elapsedTime = 0.0f;
                timer_.reset();

                while(shouldRun_)
                {
                        int ident;
                        int events;
                        android_poll_source* source;

                        while((ident = ALooper_pollAll(isPaused_ ? -1 : 0, nullptr, &events,
                                                       reinterpret_cast<void**>(&source))) >= 0)
                        {
                                if(source != nullptr)
                                        source->process(state_, source);

                                if(state_->destroyRequested != 0)
                                {
                                        onDestroy();
                                        return true;
                                }
                        }

                        if(!isPaused_ && isInitialized_)
                        {
                                timer_.reset();

                                onUpdate(elapsedTime);
                                onRender(elapsedTime);

                                elapsedTime = timer_.getElapsedTime();
                                setPressedControlButtonsMask(0);
                        }
                }

                return true;
        }
Exemple #26
0
bool DesktopWindow::onMessage(UINT message, WPARAM wParam, LPARAM lParam)
{
  switch (message) {
    case WM_HSCROLL:
      return onHScroll(wParam, lParam);
    case WM_VSCROLL:
      return onVScroll(wParam, lParam);
    case WM_ERASEBKGND:
      return onEraseBackground(reinterpret_cast<HDC>(wParam));
    case WM_DEADCHAR:
    case WM_SYSDEADCHAR:
      return onDeadChar(wParam, lParam);
    case WM_DRAWCLIPBOARD:
      return onDrawClipboard();
    case WM_CREATE:
      return onCreate(reinterpret_cast<LPCREATESTRUCT>(lParam));
    case WM_SIZE:
      return onSize(wParam, lParam);
    case WM_DESTROY:
      return onDestroy();
    case WM_CHAR:
    case WM_SYSCHAR:
      return onChar(wParam, lParam);
    case WM_KEYDOWN:
    case WM_KEYUP:
    case WM_SYSKEYDOWN:
    case WM_SYSKEYUP:
      return onKey(wParam, lParam);
    case WM_SETFOCUS:
      m_rfbKeySym->processFocusRestoration();
      return true;
    case WM_KILLFOCUS:
      m_rfbKeySym->processFocusLoss();
      return true;
  }
  return false;
}
KITECH_HSVColorRecognitionComp::~KITECH_HSVColorRecognitionComp() 
{
	onDestroy();
}
Exemple #28
0
GyroSensorComp::~GyroSensorComp() 
{
	onDestroy();
}
Exemple #29
0
Popup::~Popup()
{
  onDestroy( *this );
}
CNR_7DOFAnalyticInverseKinematicsComp::~CNR_7DOFAnalyticInverseKinematicsComp() 
{
	onDestroy();
}