示例#1
0
ComponentGate::ComponentGate(BlackBoardUID uid,
                             BlackBoard *blackBoard)
    : Component(uid, blackBoard)
{
    registerMessageHandler("MessageClientUsesObject",       bind(&ComponentGate::handleMessageClientUsesObject, this, _1));
    registerMessageHandler("MessageDeclareInitialPosition", bind(&ComponentGate::handleMessageDeclareInitialPosition, this, _1));
}
ComponentExitMapOnUse::ComponentExitMapOnUse(BlackBoardUID uid,
											 BlackBoard *blackBoard)
: Component(uid, blackBoard),
  world(0)
{
	registerMessageHandler("MessageClientUsesObject", bind(&ComponentExitMapOnUse::handleMessageClientUsesObject, this, _1));
	registerMessageHandler("MessageSetWorld",         bind(&ComponentExitMapOnUse::handleMessageSetWorld, this, _1));
	resetMembers();
}
ComponentAttachParticleSystem::
ComponentAttachParticleSystem(BlackBoardUID uid, BlackBoard *blackBoard)
: Component(uid, blackBoard),
  world(0),
  active(true)
{
	registerMessageHandler("MessageOrientationHasBeenSet", bind(&ComponentAttachParticleSystem::handleMessageOrientationHasBeenSet, this, _1));
	registerMessageHandler("MessagePositionHasBeenSet",    bind(&ComponentAttachParticleSystem::handleMessagePositionHasBeenSet, this, _1));
	registerMessageHandler("MessageSetWorld",              bind(&ComponentAttachParticleSystem::handleMessageSetWorld, this, _1));
	registerMessageHandler("MessageZombifyActor",          bind(&ComponentAttachParticleSystem::handleMessageZombifyActor, this, _1));

	resetMembers();
}
ComponentUserControllable::ComponentUserControllable(BlackBoardUID _uid,
									                 BlackBoard *_blackBoard)
: Component(_uid, _blackBoard),
  input(0)
{
	north = south = east = west = false;
	w = s = a = d = false;

	registerMessageHandler("MessagePassInputSubsystem", bind(&ComponentUserControllable::handleMessagePassInputSubsystem, this, _1));
	registerMessageHandler("MessageSetPlayerNumber",    bind(&ComponentUserControllable::handleMessageSetPlayerNumber, this, _1));
	registerMessageHandler("MessageZombifyActor",       bind(&ComponentUserControllable::handleMessageZombifyActor, this, _1));
	registerMessageHandler("MessagePositionHasBeenSet", bind(&ComponentUserControllable::handleMessagePositionHasBeenSet, this, _1));
}
示例#5
0
void QDeclarativeNearField::componentComplete()
{
    m_componentCompleted = true;

    if (!m_filter.isEmpty())
        registerMessageHandler();
}
示例#6
0
ComponentSpinAround::ComponentSpinAround(BlackBoardUID uid,
										 BlackBoard *blackBoard)
: Component(uid, blackBoard)
{
	resetMembers();
	registerMessageHandler("MessageDeclareInitialPosition", bind(&ComponentSpinAround::handleMessageDeclareInitialPosition, this, _1));
}
示例#7
0
  RoboRobo* RoboRoboFactory::Create()
  {
    auto client = std::unique_ptr<gloox::Client>(CreateClient());
    auto commandsMap = std::make_unique<CommandsMap>();
    const CommandsMap& commandsMapRef = *commandsMap;
    auto messageHandler = new MessageHandler(*client, std::move(commandsMap));
    auto connectionListener = new ConnectionListener(*client);

    client->registerMessageHandler(messageHandler);
    client->registerConnectionListener(connectionListener);

    auto soundPlayer = SoundPlayerFactory::CreateUniquePointer();
    auto synthesizer = SpeechSynthesizerFactory::CreateUniquePointer(*soundPlayer);
    auto gpio = GpioFactory::CreateUniquePointer();


    messageHandler->RegisterDefaultCommand(std::move(std::make_unique<UnknownCommand>()));
    messageHandler->RegisterCommand('s', std::move(std::make_unique<ServoCommand>(*gpio)));
    messageHandler->RegisterCommand('l', std::move(std::make_unique<LedCommand>(*gpio)));
    messageHandler->RegisterCommand('t', std::move(std::make_unique<TellCommand>(*synthesizer)));
    messageHandler->RegisterCommand('p', std::move(std::make_unique<PlaySoundCommand>(*soundPlayer)));
    messageHandler->RegisterCommand('h', std::move(std::make_unique<HelpCommand>(commandsMapRef)));

    auto robo = new RoboRobo(std::move(gpio), std::move(soundPlayer), std::move(synthesizer), std::move(client));
    return robo;
  }
示例#8
0
ComponentHealth::ComponentHealth(BlackBoardUID _uid,
                                 BlackBoard *_blackBoard)
    : Component(_uid, _blackBoard),
      world(0)
{
    registerMessageHandler("MessageCharacterHasBeenResurrected",   bind(&ComponentHealth::handleMessageCharacterHasBeenResurrected, this, _1));
    registerMessageHandler("MessageCharacterHasDied",              bind(&ComponentHealth::handleMessageCharacterHasDied, this, _1));
    registerMessageHandler("MessageCharacterReceivesWeaponPower",  bind(&ComponentHealth::handleMessageCharacterReceivesWeaponPower, this, _1));
    registerMessageHandler("MessageCharacterReceivesDamage",       bind(&ComponentHealth::handleMessageCharacterReceivesDamage, this, _1));
    registerMessageHandler("MessageCharacterReceivesHealing",      bind(&ComponentHealth::handleMessageCharacterReceivesHealing, this, _1));
    registerMessageHandler("MessagePositionHasBeenSet",            bind(&ComponentHealth::handleMessagePositionHasBeenSet, this, _1));
    registerMessageHandler("MessageRequestSetHeight",              bind(&ComponentHealth::handleMessageRequestSetHeight, this, _1));
    registerMessageHandler("MessagePassFont",                      bind(&ComponentHealth::handleMessagePassFont, this, _1));
    registerMessageHandler("MessageExplosionOccurs",               bind(&ComponentHealth::handleMessageExplosionOccurs, this, _1));
    registerMessageHandler("MessageSetWorld",                      bind(&ComponentHealth::handleMessageSetWorld, this, _1));

    resetMembers();
}
ComponentRenderAsModel::ComponentRenderAsModel(BlackBoardUID _uid, BlackBoard *_blackBoard)
: Component(_uid, _blackBoard),
  model(0),
  dead(false),
  highlightMode(HighlightDisable),
  highlightIntensity(1.0f),
  hightlightIntensityRate(100.0f)
{
	registerMessageHandler("MessageCharacterHasBeenResurrected", bind(&ComponentRenderAsModel::handleMessageCharacterHasBeenResurrected, this, _1));
	registerMessageHandler("MessageCharacterHasDied",            bind(&ComponentRenderAsModel::handleMessageCharacterHasDied, this, _1));
	registerMessageHandler("MessageRequestSetModel",             bind(&ComponentRenderAsModel::handleMessageRequestSetModel, this, _1));
	registerMessageHandler("MessageChangeAnimation",             bind(&ComponentRenderAsModel::handleMessageChangeAnimation, this, _1));
	registerMessageHandler("MessageRequestSetHeight",            bind(&ComponentRenderAsModel::handleMessageRequestSetHeight, this, _1));
	registerMessageHandler("MessageOrientationHasBeenSet",       bind(&ComponentRenderAsModel::handleMessageOrientationHasBeenSet, this, _1));
	registerMessageHandler("MessageRequestLookAt",               bind(&ComponentRenderAsModel::handleMessageRequestLookAt, this, _1));
	registerMessageHandler("MessagePositionHasBeenSet",          bind(&ComponentRenderAsModel::handleMessagePositionHasBeenSet, this, _1));
	registerMessageHandler("MessageEnableModelHighlight",        bind(&ComponentRenderAsModel::handleMessageEnableModelHighlight, this, _1));
	registerMessageHandler("MessageDisableModelHighlight",       bind(&ComponentRenderAsModel::handleMessageDisableModelHighlight, this, _1));
}
示例#10
0
CServerConnectionsManager<T>::CServerConnectionsManager()
{
	m_rakServer = RakNetworkFactory::GetRakServerInterface();
	if (!m_rakServer)
		throw ireon::net::EUnableToInitializeServer();

	registerMessageHandler(ID_NEW_INCOMING_CONNECTION, static_cast<ServiceMessageHandler>(&CServerConnectionsManager::createNewConnection));
	registerMessageHandler(ID_CONNECTION_LOST, static_cast<ServiceMessageHandler>(&CServerConnectionsManager::deleteConnection));
	registerMessageHandler(ID_DISCONNECTION_NOTIFICATION, static_cast<ServiceMessageHandler>(&CServerConnectionsManager::deleteConnection));
	registerMessageHandler(ID_RECEIVED_STATIC_DATA, static_cast<ServiceMessageHandler>(&CGenericConnectionsManager::nullHandler));
	/*
	ID_CONNECTION_BANNED
	ID_CONNECTION_REQUEST_ACCEPTED
	ID_CONNECTION_ATTEMPT_FAILED
	ID_NO_FREE_INCOMING_CONNECTIONS
	ID_RECEIVED_STATIC_DATA
	ID_INVALID_PASSWORD
	ID_MODIFIED_PACKET
	*/
}
示例#11
0
void PrivateChat::createChatBox()
{
	QVBoxLayout* main = new QVBoxLayout;
	inputLine = new QLineEdit;
	chatBox = new QTextBrowser;
	main->addWidget(chatBox);
	main->addWidget(inputLine);
	setLayout(main);
	
	connect(this, SIGNAL(reciveMessage(QString,QString)), SLOT(addToMessageBox(QString,QString)));
	connect(this, SIGNAL(reciveNotPrivateMessage(QString,QString,QString)), ((ChatDialog*)parent()), SLOT(addToMessageBox(QString,QString,QString)));
	connect(inputLine, SIGNAL(returnPressed()), this, SLOT(sendMessage()));
	connect(this, SIGNAL(setTrayBlink(bool)), ((ChatDialog*)parent())->mainWindow, SLOT(setTrayBlink(bool)));
	
	registerMessageHandler(this);
}
int ResManagerMainSegment2ndPhase(void)
{
	int res = FUNC_RETURN_OK;

	elog(DEBUG5, "HAWQ RM SEG is triggered.");

	/* Register message handlers */
	registerMessageHandler(REQUEST_QE_MOVETOCGROUP, handleQEMoveToCGroup);
	registerMessageHandler(REQUEST_QE_MOVEOUTCGROUP, handleQEMoveOutCGroup);
	registerMessageHandler(REQUEST_QE_SETWEIGHTCGROUP, handleQESetWeightCGroup);
	registerMessageHandler(REQUEST_RM_INCREASE_MEMORY_QUOTA, handleRMIncreaseMemoryQuota);
	registerMessageHandler(REQUEST_RM_DECREASE_MEMORY_QUOTA, handleRMDecreaseMemoryQuota);
	registerMessageHandler(REQUEST_RM_TMPDIR, handleRMSEGRequestTmpDir);
	registerMessageHandler(REQUEST_RM_RUALIVE, handleRMSEGRequestRUAlive);


	/**************************************************************************
	 * New socket facility poll based server.
	 **************************************************************************/
	res = initializeSocketServer_RMSEG();
	if ( res != FUNC_RETURN_OK ) {
		elog(LOG, "Fail to initialize socket server. Segment sleeps for ever.");
		MainHandler_RMSEGDummyLoop();
	}

	initializeRMSEG2RMComm();

	/*
	 * Resource enforcement: initialize, cleanup, and rebuild CGroup hash table
	 * when segment resource manager starts/restarts
	 */
	initCGroupThreads();

	InitFileAccess();

	/*
	 * Notify postmaster that HAWQ RM is ready. Ignore the possible problem that
	 * the parent process quits. HAWQ RM will automatically detect if its parent
	 * dies, then HAWQ RM should exit normally.
	 */
	kill(DRMGlobalInstance->ParentPID, SIGUSR2);
	elog(LOG, "HAWQ RM SEG process works now.");

    /* Start request handler to provide services. */
    res = MainHandlerLoop_RMSEG();

    elog(RMLOG, "HAWQ RM SEG server goes into exit phase.");
    return res;

}
示例#13
0
ComponentPhysicsGeom::ComponentPhysicsGeom(BlackBoardUID uid,
										   BlackBoard *blackBoard)
: ComponentPhysics(uid, blackBoard)
{
	resetMembers();
	registerMessageHandler("MessageSetWorld",               bind(&ComponentPhysicsGeom::handleMessageSetWorld, this, _1));
	registerMessageHandler("MessageRequestPositionBeSet",   bind(&ComponentPhysicsGeom::handleMessageRequestPositionBeSet, this, _1));
	registerMessageHandler("MessageRequestLookAt",          bind(&ComponentPhysicsGeom::handleMessageRequestLookAt, this, _1));
	registerMessageHandler("MessageRequestSetOrientation",  bind(&ComponentPhysicsGeom::handleMessageRequestSetOrientation, this, _1));
	registerMessageHandler("MessageDeclareInitialPosition", bind(&ComponentPhysicsGeom::handleMessageDeclareInitialPosition, this, _1));
	registerMessageHandler("MessageZombifyActor",           bind(&ComponentPhysicsGeom::handleMessageZombifyActor, this, _1));
}
示例#14
0
SoundSystem::SoundSystem(BlackBoardUID _uid, BlackBoard *_blackBoard)
: BlackBoardSubscriber(_uid, _blackBoard)
{
	registerMessageHandler("MessagePlaySound", bind(&SoundSystem::handleMessagePlaySound, this, _1));

	cache.clear();
	soundVolume = 1.0f;
	musicVolume = 0.5f;
	mute = false;
	musicStream = 0;
	musicChannel = -1;

	int mixrate = 44100;
	int maxsoftwarechannels = 32;
	unsigned int flags = 0;
	FSOUND_Init(mixrate, maxsoftwarechannels, flags);

	TRACE("Sound System initialized");
}
示例#15
0
ComponentBrainKamikaze::ComponentBrainKamikaze(BlackBoardUID uid,
											   BlackBoard *blackBoard)
: ComponentBrain(uid, blackBoard)
{
	registerMessageHandler("MessagePhysicsCollision", bind(&ComponentBrainKamikaze::handleMessagePhysicsCollision, this, _1));
}
示例#16
0
ComponentIsSwitch::ComponentIsSwitch(BlackBoardUID uid,
									 BlackBoard *blackBoard)
: Component(uid, blackBoard)
{
	registerMessageHandler("MessageClientUsesObject", bind(&ComponentIsSwitch::handleMessageClientUsesObject, this, _1));
}