コード例 #1
0
ファイル: connection.cpp プロジェクト: jameslin2014/xskit
int xsConnection::doConnect()
{
	int ret = XS_EC_ERROR;

	XS_TRACE("[NET]DoConnect");
	// Has address, connect
	addr.port = xsHtons(port);
	//sock = xsSocketCreate();

	if (sock < 0)
	{
		XS_ERROR("Create socket failed. ret:%d", sock);

		// destroy self
		destroyInstance();
		return sock;
	}

	XS_TRACE("connecting");
	state = XS_CONN_CONNECTING;
	//ret = xsSocketConnect(sock, &addr);
	if (ret < 0)
	{
		if (ret == XS_EC_IN_PROGRESS)
			return ret;

		// other error code, indicate failure
		XS_ERROR("Connect failed. ret:%d", ret);
		// destroy self
		destroyInstance();
		return ret;
	}

	return ret;
}
コード例 #2
0
ファイル: depthConverter.cpp プロジェクト: Anna83/openfx
////////////////////////////////////////////////////////////////////////////////
// The main function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs, OfxPropertySetHandle outArgs)
{
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle ) handle;

  if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxActionCreateInstance) == 0) {
    return createInstance(effect);
  } 
  else if(strcmp(action, kOfxActionDestroyInstance) == 0) {
    return destroyInstance(effect);
  } 
  else if(strcmp(action, kOfxImageEffectActionIsIdentity) == 0) {
    return isIdentity(effect, inArgs, outArgs);
  }    
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetClipPreferences) == 0) {
    return getClipPreferences(effect, inArgs, outArgs);
  }  
    
  // other actions to take the default value
  return kOfxStatReplyDefault;
}
コード例 #3
0
ファイル: System.cpp プロジェクト: alemariusnexus/gtatools
void System::initializeInstance()
{
	initializeGL();

	Engine* engine = Engine::getInstance();

	engine->getMeshCache()->resize(10 * 1000000); // 10MB
	engine->getTextureCache()->resize(25 * 1000000); // 25MB
	engine->getAnimationCache()->resize(10 * 1000000); // 10MB

	ProfileManager::getInstance()->loadProfiles();

	MainWindow* win = new MainWindow;
	win->show();

	win->initialize();

	connect(qApp, SIGNAL(lastWindowClosed()), this, SLOT(destroyInstance()));

	EntityManager::getInstance();

	initializing = false;

	emit initializationDone();
}
コード例 #4
0
ファイル: PluginInstance.cpp プロジェクト: mpomarlan/semrec
 void PluginInstance::unload() {
   if(m_vdLibHandle) {
     m_piInstance->deinit();
     
     void (*destroyInstance)(plugins::Plugin*);
     destroyInstance = (void (*)(plugins::Plugin*))dlsym(m_vdLibHandle, "destroyInstance");
     destroyInstance(m_piInstance);
     dlclose(m_vdLibHandle);
     
     this->info("Unloaded plugin '" + m_strName + "'");
   }
 }
コード例 #5
0
ファイル: oclplugin.cpp プロジェクト: MrKepzie/openfx
////////////////////////////////////////////////////////////////////////////////
// The main function
static OfxStatus
pluginMain(const char *action,  const void *handle, OfxPropertySetHandle inArgs,  OfxPropertySetHandle outArgs)
{
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxActionLoad) == 0) {
    return onLoad();
  }
  else if(strcmp(action, kOfxActionUnload) == 0) {
    return onUnLoad();
  }
  else if(strcmp(action, kOfxActionCreateInstance) == 0) {
    return createInstance(effect);
  }
  else if(strcmp(action, kOfxActionDestroyInstance) == 0) {
    return destroyInstance(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionIsIdentity) == 0) {
    return isIdentity(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetRegionOfDefinition) == 0) {
    return getSpatialRoD(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetRegionsOfInterest) == 0) {
    return getSpatialRoI(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetClipPreferences) == 0) {
    return getClipPreferences(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxActionInstanceChanged) == 0) {
    return instanceChanged(effect, inArgs, outArgs);
  }
  else if(strcmp(action, kOfxImageEffectActionGetTimeDomain) == 0) {
    return getTemporalDomain(effect, inArgs, outArgs);
  }


  // other actions to take the default value
  return kOfxStatReplyDefault;
}
コード例 #6
0
void LuaTouchEventManager::removeTouchableNode(LuaEventNode *node)
{
    _touchableNodes.eraseObject(node);
    auto found = _nodeLuaEventNodeMap.find(node->getNode());
    if (found != _nodeLuaEventNodeMap.end())
    {
        _nodeLuaEventNodeMap.erase(found);
    }
//    CCLOG("REMOVE TOUCHABLE NODE <%p>", node);
    if (_touchableNodes.size() == 0 && m_touchDispatchingEnabled)
    {
        disableTouchDispatching();
        destroyInstance();
    }
}
コード例 #7
0
ファイル: custom.cpp プロジェクト: EQ4/openfx
////////////////////////////////////////////////////////////////////////////////
// The main function
static OfxStatus
pluginMain(const char *action,  const void *handle,  OfxPropertySetHandle inArgs, OfxPropertySetHandle outArgs)
{
  try {
  // cast to appropriate type
  OfxImageEffectHandle effect = (OfxImageEffectHandle) handle;

  if(strcmp(action, kOfxActionDescribe) == 0) {
    return describe(effect);
  }
  else if(strcmp(action, kOfxImageEffectActionDescribeInContext) == 0) {
    return describeInContext(effect, inArgs);
  }
  else if(strcmp(action, kOfxActionCreateInstance) == 0) {
    return createInstance(effect);
  } 
  else if(strcmp(action, kOfxActionDestroyInstance) == 0) {
    return destroyInstance(effect);
  } 
  else if(strcmp(action, kOfxImageEffectActionIsIdentity) == 0) {
    return isIdentity(effect, inArgs, outArgs);
  }    
  else if(strcmp(action, kOfxImageEffectActionRender) == 0) {
    return render(effect, inArgs, outArgs);
  }    
  } catch (std::bad_alloc) {
    // catch memory
    //std::cout << "OFX Plugin Memory error." << std::endl;
    return kOfxStatErrMemory;
  } catch ( const std::exception& e ) {
    // standard exceptions
    //std::cout << "OFX Plugin error: " << e.what() << std::endl;
    return kOfxStatErrUnknown;
  } catch (int err) {
      // ho hum, gone wrong somehow
      return err;
  } catch ( ... ) {
    // everything else
    //std::cout << "OFX Plugin error" << std::endl;
    return kOfxStatErrUnknown;
  }

  // other actions to take the default value
  return kOfxStatReplyDefault;
}
コード例 #8
0
ファイル: erroradapters.cpp プロジェクト: s090444/dominator
void ErrorAdapter::createInstance() {
	destroyInstance();
	s_instance = new ErrorAdapter();
	s_instance->addListener(new ErrorListener());
}
コード例 #9
0
ファイル: connection.cpp プロジェクト: jameslin2014/xskit
int xsConnection::processEvent(xsEvent *e)
{
//	xsConnection *conn;
	xsConnEvent evt;

	// handle resolve event
	if (e->type == XS_EVT_RESOLVE)
	{
		XS_TRACE("[NET]xsConnResolveHandler: state:%d", state);
		if (state == XS_CONN_RESOLVING)
		{// should connect
			if (e->sys->data.resolve.success)
			{
				addr.addr.n = e->sys->data.resolve.addr.addr.n;
				return doConnect();
			}
			XS_ERROR("[NET]xsConnResolveHandler: Resolve failed.");
		}
		else
		{
			XS_ERROR("[NET]xsConnResolveHandler: Invoke XS_EVT_RESOLVE on wrong state: %d", state);
		}

		return XS_EC_ERROR;
	}

	// Cannot handle other event except socket event.
	if (e->type != XS_EVT_SOCK_READ && e->type != XS_EVT_SOCK_WRITE
		&& e->type != XS_EVT_SOCK_CONNECT && e->type != XS_EVT_SOCK_CLOSE)
		return XS_EC_OK;

	// handle socket event
	if (e->sys->data.socket.status != XS_EC_OK)
	{
		XS_ERROR("socket error. %d", e->sys->data.socket.status);
		destroyInstance();
		return XS_EC_OK;
	}

	switch (e->type)
	{
	case XS_EVT_SOCK_READ:
		XS_TRACE("[NET]xsConnHandler: OnRead");
		if (state == XS_CONN_ESTABLISHED)
			return doRecv();
		break;
	case XS_EVT_SOCK_WRITE:
		XS_TRACE("[NET]xsConnHandler: OnWrite");
		if (state == XS_CONN_ESTABLISHED)
			return doSend();
		break;
	case XS_EVT_SOCK_CONNECT:
		XS_TRACE("[NET]xsConnHandler: OnConnect");
		if (state == XS_CONN_CONNECTING)
		{
			state = XS_CONN_ESTABLISHED;
			evt.type = XS_EVT_CONN_ESTABLISHED;
			xsEvent::send(this, &evt);
		}
		else
		{
			XS_ERROR("[NET]xsConnHandler: Invoke XS_EVT_SOCK_CONNECT on wrong state: %d", state);
		}
		break;
	case XS_EVT_SOCK_CLOSE:
		XS_TRACE("[NET]xsConnHandler: OnClose");
		destroyInstance();
		break;
	}

	return XS_EC_OK;
}