Example #1
0
 Reader() : _running( false )
     {
         registerCommand( 0u,
                          co::CommandFunc< Reader >( this, &Reader::_cmd ),
                          &_queue );
         registerCommand( 1u,
                          co::CommandFunc<Reader>( this, &Reader::_cmdStop ),
                          &_queue );
     }
Example #2
0
Console::Console(SonicEngine &engine) :
	::Engines::Console(engine, Graphics::Aurora::kSystemFontMono, 10),
	_engine(&engine) {

	registerCommand("listareas", boost::bind(&Console::cmdListAreas, this, _1),
			"Usage: listareas\nList all areas");
	registerCommand("gotoarea" , boost::bind(&Console::cmdGotoArea , this, _1),
			"Usage: gotoarea <area>\nMove to a specific area");
}
Example #3
0
 LocalNode()
     : _gotAsync( false )
     , _counter( 0 )
 {
     co::CommandQueue* q = getCommandThreadQueue();
     registerCommand( CMD_ASYNC, CmdFunc( this, &LocalNode::_cmdAsync ), q );
     registerCommand( CMD_SYNC, CmdFunc( this, &LocalNode::_cmdSync ), q );
     registerCommand( CMD_DATA, CmdFunc( this, &LocalNode::_cmdData ), q );
     registerCommand( CMD_DATA_REPLY,
                      CmdFunc( this, &LocalNode::_cmdDataReply ), q );
 }
Example #4
0
CSVEventFabric::CSVEventFabric(QObject *parent)
	: AbstractEventFabric(parent)
{
	registerCommand( new CSVMousePressCommand(this) );
	registerCommand( new CSVMouseReleaseCommand(this) );
	registerCommand( new CSVMouseMoveCommand(this) );
//	registerCommand( new CSVMouseEnterCommand(this) );
//	registerCommand( new CSVMouseLeaveCommand(this) );
    registerCommand( new CSVKeyPressCommand(this));
    registerCommand( new CSVKeyReleaseCommand(this));
}
Example #5
0
Client::Client()
        : Super()
        , _impl( new detail::Client )
{
    registerCommand( fabric::CMD_CLIENT_EXIT,
                     ClientFunc( this, &Client::_cmdExit ), &_impl->queue );
    registerCommand( fabric::CMD_CLIENT_INTERRUPT,
                     ClientFunc( this, &Client::_cmdInterrupt ), &_impl->queue);

    LBVERB << "New client at " << (void*)this << std::endl;
}
Example #6
0
void Pipe::attach( const co::base::UUID& id, const uint32_t instanceID )
{
    Super::attach( id, instanceID );

    co::CommandQueue* cmdQ = getCommandThreadQueue();
    registerCommand( fabric::CMD_OBJECT_SYNC,
                     PipeFunc( this, &Pipe::_cmdSync ), cmdQ );
    registerCommand( fabric::CMD_PIPE_CONFIG_INIT_REPLY,
                     PipeFunc( this, &Pipe::_cmdConfigInitReply ), cmdQ );
    registerCommand( fabric::CMD_PIPE_CONFIG_EXIT_REPLY, 
                     PipeFunc( this, &Pipe::_cmdConfigExitReply ), cmdQ );
}
Example #7
0
void Window::attach( const UUID& id, const uint32_t instanceID )
{
    Super::attach( id, instanceID );

    co::CommandQueue* cmdQ = getCommandThreadQueue();
    registerCommand( fabric::CMD_OBJECT_SYNC,
                     WindowFunc( this, &Window::_cmdSync ), cmdQ );
    registerCommand( fabric::CMD_WINDOW_CONFIG_INIT_REPLY,
                     WindowFunc( this, &Window::_cmdConfigInitReply ), cmdQ );
    registerCommand( fabric::CMD_WINDOW_CONFIG_EXIT_REPLY,
                     WindowFunc( this, &Window::_cmdConfigExitReply ), cmdQ );
}
Example #8
0
void Channel::attach( const co::base::UUID& id, const uint32_t instanceID )
{
    Super::attach( id, instanceID );
    
    co::CommandQueue* mainQ  = getMainThreadQueue();
    co::CommandQueue* cmdQ = getCommandThreadQueue();

    registerCommand( fabric::CMD_CHANNEL_CONFIG_INIT_REPLY, 
                     CmdFunc( this, &Channel::_cmdConfigInitReply ), cmdQ );
    registerCommand( fabric::CMD_CHANNEL_CONFIG_EXIT_REPLY,
                     CmdFunc( this, &Channel::_cmdConfigExitReply ), cmdQ );
    registerCommand( fabric::CMD_CHANNEL_FRAME_FINISH_REPLY,
                     CmdFunc( this, &Channel::_cmdFrameFinishReply ), mainQ );
}
Example #9
0
void Server::setClient( ClientPtr client )
{
    Super::setClient( client );
    if( !client )
        return;

    co::CommandQueue* queue = client->getMainThreadQueue();
    registerCommand( fabric::CMD_SERVER_CHOOSE_CONFIG_REPLY,
                     CmdFunc( this, &Server::_cmdChooseConfigReply ), queue );
    registerCommand( fabric::CMD_SERVER_RELEASE_CONFIG_REPLY,
                     CmdFunc( this, &Server::_cmdReleaseConfigReply ), queue );
    registerCommand( fabric::CMD_SERVER_SHUTDOWN_REPLY,
                     CmdFunc( this, &Server::_cmdShutdownReply ), queue );
}
Example #10
0
void FS_Console_Init( FS_Console_InitStruct_t * initStruct,
                      FS_Console_InitReturnsStruct_t * returns )
{
  // Create a mutex to protect the list of IO streams.
  io.mutex = xSemaphoreCreateMutex();

  // Transfer the pertinent fields from the init struct.
  echo = initStruct->echo;
  echoToAllOutputStreams = initStruct->echoToAllOutputStreams;
  instance = initStruct->instance;

  // Copy in the default IO stream interface.
  io.interfaces[0] = initStruct->io;
  io.defaultInterfaceIndex = 0;

  // Bind the instance to the implementation.
  instance->printf = consolePrintf;
  instance->registerCommand = registerCommand;

  // Populate the returns struct.
  returns->addIOStreamCallback = addIOStreamCallback;
  returns->removeIOStreamCallback = removeIOStreamCallback;
  returns->mainLoop = mainLoop;
  returns->success = true;

  // Add the built-in commands to the command table.
  registerCommand("help", help, "TEST HELP STRING");
}
Example #11
0
void Channel::postDelete()
{
    // Deregister server-queue command handler to avoid assertion in
    // command invokation after channel deletion
    registerCommand( fabric::CMD_CHANNEL_FRAME_FINISH_REPLY,
                     CmdFunc( this, &Channel::_cmdNop ), 0 );
}
Example #12
0
void View::attach( const UUID& id, const uint32_t instanceID )
{
    Super::attach( id, instanceID );

    co::CommandQueue* mainQ = getServer()->getMainThreadQueue();
    registerCommand( fabric::CMD_VIEW_FREEZE_LOAD_BALANCING,
                     ViewFunc( this, &View::_cmdFreezeLoadBalancing ), mainQ );
}
Example #13
0
void CommandMap::registerAll(const std::string &fallbackPrefix, std::vector<Command *> commands)
{
	if (!commands.empty())
	{
		for (Command *c : commands)
			registerCommand(fallbackPrefix, c);
	}
}
Example #14
0
Client::Client()
        : Super()
        , _running( false )
{
    registerCommand( fabric::CMD_CLIENT_EXIT, 
                     ClientFunc( this, &Client::_cmdExit ), &_mainThreadQueue );

    LBVERB << "New client at " << (void*)this << std::endl;
}
Example #15
0
void QueueMaster::attach( const UUID& id, const uint32_t instanceID )
{
    Object::attach( id, instanceID );

    CommandQueue* queue = getLocalNode()->getCommandThreadQueue();
    registerCommand( CMD_QUEUE_GET_ITEM, 
                     CommandFunc< detail::QueueMaster >(
                         _impl, &detail::QueueMaster::cmdGetItem ), queue );
}
void
ReplicatorStateMachine::initialize( )
{
    dprintf( D_ALWAYS, "ReplicatorStateMachine::initialize started\n" );

    reinitialize( );
    // register commands that the service responds to
    registerCommand(HAD_BEFORE_PASSIVE_STATE);
    registerCommand(HAD_AFTER_ELECTION_STATE);
    registerCommand(HAD_AFTER_LEADER_STATE);
    registerCommand(HAD_IN_LEADER_STATE);
    registerCommand(REPLICATION_LEADER_VERSION);
    registerCommand(REPLICATION_TRANSFER_FILE);
    registerCommand(REPLICATION_NEWLY_JOINED_VERSION);
    registerCommand(REPLICATION_GIVING_UP_VERSION);
    registerCommand(REPLICATION_SOLICIT_VERSION);
    registerCommand(REPLICATION_SOLICIT_VERSION_REPLY);
}
Example #17
0
// Register multiple commands.
static dn_error_t registerCommands (dnm_cli_cont_t * pCont)
{
   dn_error_t res;

   for (pCont->numCmd = 0; pCont->cmdArr[pCont->numCmd].command; pCont->numCmd++) {
      res = registerCommand(pCont->inpCh, pCont->cmdArr + pCont->numCmd, pCont->numCmd);
      if (res != DN_ERR_NONE)
         return res;
   }
   return DN_ERR_NONE;
}
bool AppFrontController::xInitCommand()
{
    /// register commands
    auto* psCMD = s_sCmdTable;
    while( psCMD->pMetaObject != NULL )
    {
        registerCommand(psCMD->strCommandName, psCMD->pMetaObject);
        psCMD++;
    }
    return true;
}
Example #19
0
void SCgHorizontalArranger::startOperation()
{
    QList<SCgObject*> objects;
    foreach(QGraphicsItem* it, mView->scene()->selectedItems())
        if(SCgObject::isSCgObjectType(it->type()) && it->type() != SCgPair::Type)
            objects.append(static_cast<SCgObject*>(it));

    if(objects.isEmpty() || objects.size() == 1)
    {
        QMessageBox::information(0, qAppName(), tr("Nothing to align. Did you forget to select objects for alignment?"));
        return;
    }

    QList<SCgObject*>::const_iterator it;
    double averageY = 0;

    // Calculate average Y coordinate
    for (it = objects.begin(); it != objects.end(); ++it)
       averageY += (*it)->y();
    averageY = averageY/objects.size();

    // Set objects position
    for (it = objects.begin(); it != objects.end(); ++it)
    {
        if((*it)->type() == SCgBus::Type)
        {
            SCgBus* b = static_cast<SCgBus*>(*it);
            QVector<QPointF> points = b->mapToParent(b->points());

            for(int i = 0; i < points.size(); ++i)
                points[i].setY(averageY);

            registerCommand(b,  b->mapFromParent(points));
        }else
        {
            QPointF p = (*it)->pos();
            p.setY(averageY);
            registerCommand(*it, p);
        }
    }
}
Example #20
0
bool CommandMap::registerCommand(const std::string &label, const std::string &fallbackPrefix, Command *command)
{
	std::string newLabel = SMUtil::toLower(SMUtil::trim(label));
	std::string newFallbackPrefix = SMUtil::toLower(SMUtil::trim(fallbackPrefix));

	bool registered = registerCommand(newLabel, command, false, newFallbackPrefix);

	std::vector<std::string> aliases = command->getAliases();
	for (auto it = aliases.begin(); it != aliases.end(); ++it)
	{
		if (!registerCommand(*it, command, true, newFallbackPrefix))
			it = aliases.erase(it);
	}

	if (!registered)
		command->setLabel(newFallbackPrefix + ":" + newLabel);

	command->registerCommand(this);

	return registered;
}
Example #21
0
Pitcher::Pitcher(){
	_checkMidi=true;
	addJoinAction([this](System&){ _silence=_glissSeparation+1; return ""; });
	registerCommand("serialize_pitcher", "", [this](std::stringstream&){
		std::stringstream ss;
		ss<<_glissSeparation<<" "<<_glissRate<<" "<<_vibratoRate<<" "<<_vibratoAmount;
		return ss.str();
	});
	registerCommand("deserialize_pitcher", "<serialized>", [this](std::stringstream& ss){
		ss>>_glissSeparation>>_glissRate>>_vibratoRate>>_vibratoAmount;
		return "";
	});
Example #22
0
int
registerUpdateCommands()
{
    int ret;

    ret = registerCommand("assert", CMD_ARGS_BOOLEAN, cmd_assert, NULL);
    if (ret < 0) return ret;

    ret = registerCommand("copy_dir", CMD_ARGS_WORDS, cmd_copy_dir, NULL);
    if (ret < 0) return ret;

    ret = registerCommand("delete", CMD_ARGS_WORDS, cmd_delete, NULL);
    if (ret < 0) return ret;

    ret = registerCommand("format", CMD_ARGS_WORDS, cmd_format, NULL);
    if (ret < 0) return ret;

    ret = registerCommand("mark", CMD_ARGS_WORDS, cmd_mark, NULL);
    if (ret < 0) return ret;

    ret = registerCommand("done", CMD_ARGS_WORDS, cmd_done, NULL);
    if (ret < 0) return ret;

//xxx some way to fix permissions
//xxx could have "installperms" commands that build the fs_config list
//xxx along with a "commitperms", and any copy_dir etc. needs to see
//    a commitperms before it will work

    return 0;
}
Example #23
0
Server::Server()
        : Super( &_nf )
        , _mainThreadQueue( co::Global::getCommandQueueLimit( ))
        , _running( false )
{
    lunchbox::Log::setClock( &_clock );
    disableInstanceCache();

    registerCommand( fabric::CMD_SERVER_CHOOSE_CONFIG,
                     ServerFunc( this, &Server::_cmdChooseConfig ),
                     &_mainThreadQueue );
    registerCommand( fabric::CMD_SERVER_RELEASE_CONFIG,
                     ServerFunc( this, &Server::_cmdReleaseConfig ),
                     &_mainThreadQueue );
    registerCommand( fabric::CMD_SERVER_DESTROY_CONFIG_REPLY,
                     ServerFunc( this, &Server::_cmdDestroyConfigReply ), 0 );
    registerCommand( fabric::CMD_SERVER_SHUTDOWN,
                     ServerFunc( this, &Server::_cmdShutdown ),
                     &_mainThreadQueue );
    registerCommand( fabric::CMD_SERVER_MAP,
                     ServerFunc( this, &Server::_cmdMap ), &_mainThreadQueue );
    registerCommand( fabric::CMD_SERVER_UNMAP,
                     ServerFunc( this, &Server::_cmdUnmap ),
                     &_mainThreadQueue );
}
Example #24
0
void SCgTupleArranger::startOperation()
{
    // affect changes to bus
    SCgBus *bus = mTupleNode->bus();
    Q_ASSERT(bus != 0);
    SCgBus *ghostBus = qgraphicsitem_cast<SCgBus*>(mGhosts[bus]);
    Q_ASSERT(ghostBus != 0);

    registerCommand(bus, ghostBus->points());

    // affect pairs and objects
    foreach(SCgPair *pair, mBusPairs)
    {
        SCgObject *end = pair->getEndObject();
        Q_ASSERT(end != 0);
        SCgObject *ghostEnd = mGhosts[end];
        Q_ASSERT(ghostEnd != 0);
        SCgPair *ghostPair = qgraphicsitem_cast<SCgPair*>(mGhosts[pair]);
        Q_ASSERT(ghostPair != 0);

        registerCommand(pair, ghostPair->points());
        registerCommand(end, ghostEnd->pos());
    }
Example #25
0
Shell::Shell()
{
    registerCommand(new ChangeDirCommand());
    registerCommand(new ExitCommand());
    registerCommand(new StdioCommand());
    registerCommand(new WriteCommand());
    registerCommand(new HelpCommand(this));
    registerCommand(new TimeCommand());
}
Example #26
0
void CommandHandler::registerSystemCommands()
{
	registerCommand(CommandDelegate("status", "Displays System Information", "system", commandFunctionDelegate(&CommandHandler::procesStatusCommand,this)));
	registerCommand(CommandDelegate("echo", "Displays command entered", "system", commandFunctionDelegate(&CommandHandler::procesEchoCommand,this)));
	registerCommand(CommandDelegate("help", "Displays all available commands", "system", commandFunctionDelegate(&CommandHandler::procesHelpCommand,this)));
	registerCommand(CommandDelegate("debugon", "Set Serial debug on", "system", commandFunctionDelegate(&CommandHandler::procesDebugOnCommand,this)));
	registerCommand(CommandDelegate("debugoff", "Set Serial debug off", "system", commandFunctionDelegate(&CommandHandler::procesDebugOffCommand,this)));
	registerCommand(CommandDelegate("command","Use verbose/silent/prompt as command options","system", commandFunctionDelegate(&CommandHandler::processCommandOptions,this)));
}
Example #27
0
void initProcessList( struct SensorModul* sm ) {

	if( (procdir = opendir( PROCDIR )) == NULL ) {
		print_error( "cannot open \"%s\" for reading\n", PROCDIR );
		return;
	}
	pagesz=getpagesize();
	ProcessList = new_ctnr();
	updateProcessList();

	/*
	 *  register the supported monitors & commands
	 */
	registerMonitor( "pscount", "integer",
				printProcessCount, printProcessCountInfo, sm );
	registerMonitor( "ps", "table",
				printProcessList, printProcessListInfo, sm );

	if (!RunAsDaemon)
	{
		registerCommand("kill", killProcess);
		registerCommand("setpriority", setPriority);
	}
}
void ApplicationCommandManager::registerAllCommandsForTarget (ApplicationCommandTarget* target)
{
    if (target != nullptr)
    {
        Array<CommandID> commandIDs;
        target->getAllCommands (commandIDs);

        for (int i = 0; i < commandIDs.size(); ++i)
        {
            ApplicationCommandInfo info (commandIDs.getUnchecked(i));
            target->getCommandInfo (info.commandID, info);

            registerCommand (info);
        }
    }
}
Example #29
0
Console::Console(KotOR2Engine &engine) :
	::Engines::Console(engine, Graphics::Aurora::kSystemFontMono, 13),
	_engine(&engine), _maxSizeMusic(0) {

	registerCommand("exitmodule" , boost::bind(&Console::cmdExitModule    , this, _1),
			"Usage: exitmodule\nExit the module, returning to the main menu");
	registerCommand("listmodules", boost::bind(&Console::cmdListModules   , this, _1),
			"Usage: listmodules\nList all modules");
	registerCommand("loadmodule" , boost::bind(&Console::cmdLoadModule    , this, _1),
			"Usage: loadmodule <module>\nLoad and enter the specified module");
	registerCommand("listmusic"  , boost::bind(&Console::cmdListMusic     , this, _1),
			"Usage: listmusic\nList all available music resources");
	registerCommand("stopmusic"  , boost::bind(&Console::cmdStopMusic     , this, _1),
			"Usage: stopmusic\nStop the currently playing music resource");
	registerCommand("playmusic"  , boost::bind(&Console::cmdPlayMusic     , this, _1),
			"Usage: playmusic [<music>]\nPlay the specified music resource. "
			"If none was specified, play the default area music.");
	registerCommand("tfc"        , boost::bind(&Console::cmdToggleFreeCam , this, _1),
			"Usage: tfc\nToggle free roam camera mode");
	registerCommand("tw"         , boost::bind(&Console::cmdToggleWalkmesh, this, _1),
			"Usage: tw\nToggle walkmesh display");
}
Example #30
0
void Window::attach( const uint128_t& id, const uint32_t instanceID )
{
    Super::attach( id, instanceID );

    co::CommandQueue* queue = getPipeThreadQueue();

    registerCommand( fabric::CMD_WINDOW_CREATE_CHANNEL,
                     WindowFunc( this, &Window::_cmdCreateChannel ), queue );
    registerCommand( fabric::CMD_WINDOW_DESTROY_CHANNEL,
                     WindowFunc( this, &Window::_cmdDestroyChannel ), queue );
    registerCommand( fabric::CMD_WINDOW_CONFIG_INIT,
                     WindowFunc( this, &Window::_cmdConfigInit ), queue );
    registerCommand( fabric::CMD_WINDOW_CONFIG_EXIT,
                     WindowFunc( this, &Window::_cmdConfigExit ), queue );
    registerCommand( fabric::CMD_WINDOW_FRAME_START,
                     WindowFunc( this, &Window::_cmdFrameStart ), queue );
    registerCommand( fabric::CMD_WINDOW_FRAME_FINISH,
                     WindowFunc( this, &Window::_cmdFrameFinish ), queue );
    registerCommand( fabric::CMD_WINDOW_FLUSH,
                     WindowFunc( this, &Window::_cmdFlush), queue );
    registerCommand( fabric::CMD_WINDOW_FINISH,
                     WindowFunc( this, &Window::_cmdFinish), queue );
    registerCommand( fabric::CMD_WINDOW_THROTTLE_FRAMERATE,
                     WindowFunc( this, &Window::_cmdThrottleFramerate ),
                     queue );
    registerCommand( fabric::CMD_WINDOW_BARRIER,
                     WindowFunc( this, &Window::_cmdBarrier ), queue );
    registerCommand( fabric::CMD_WINDOW_NV_BARRIER,
                     WindowFunc( this, &Window::_cmdNVBarrier ), queue );
    registerCommand( fabric::CMD_WINDOW_SWAP,
                     WindowFunc( this, &Window::_cmdSwap), queue );
    registerCommand( fabric::CMD_WINDOW_FRAME_DRAW_FINISH,
                     WindowFunc( this, &Window::_cmdFrameDrawFinish ), queue );
}