当前位置: 首页>>代码示例>>C++>>正文


C++ CommandArgs类代码示例

本文整理汇总了C++中CommandArgs的典型用法代码示例。如果您正苦于以下问题:C++ CommandArgs类的具体用法?C++ CommandArgs怎么用?C++ CommandArgs使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了CommandArgs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: container_main

int container_main(void* arg)
{
    // no need to delete it because we execv finally.
    CommandArgs* args = reinterpret_cast<CommandArgs*>(arg);

    printf("Container [%d] - inside the container!\n", getpid());

    printf("Container: eUID = %ld;  eGID = %ld, UID=%ld, GID=%ld\n",
            (long) geteuid(), (long) getegid(), (long) getuid(), (long) getgid());

    char ch;
    close(pipefd[1]);
    int ret = read(pipefd[0], &ch, 1);
    if (ret < 0) {
        printf("Error: read failed: %d, %s\n", errno, strerror(errno));
        return 1;
    }

    close(pipefd[0]);

    printf("Container: eUID = %ld;  eGID = %ld, UID=%ld, GID=%ld\n",
            (long) geteuid(), (long) getegid(), (long) getuid(), (long) getgid());

    mount("proc", "/proc", "proc", 0, NULL);
    char** argv = args->GetExecArgs();
    execv(argv[0], argv);
    printf("Something's wrong!\n");
    return 1;
}
开发者ID:airekans,项目名称:container,代码行数:29,代码来源:main.cpp

示例2: OnCommandReceived

void RGBLed::OnCommandReceived(CommandArgs *args)
{
    if(args->Get_Type() == Get && (args->Get_Command() == All | args->Get_Command() == RGBLedCommand))
    {
        CommandArgs sendArgs;
        sendArgs.Set_Type(Set);
        sendArgs.Set_Command(RGBLedCommand);
        byte values[3];
        values[0] = Get_Red();
        values[1] = Get_Green();
        values[2] = Get_Blue();
        sendArgs.Set_Length(3);
        sendArgs.Set_Value(values);
        SendCommand(&sendArgs);
    }
    else if(args->Get_Type() == Set && args->Get_Command() == RGBLedCommand)
    {
        byte* values = args->Get_Value();
        if(values != null)
        {
            if(args->Get_Length() == 3)
            {
                Set_Red(values[0]);
                Set_Green(values[1]);
                Set_Blue(values[2]);
            }
        }
    }
}
开发者ID:holtsoftware,项目名称:Arduino-BlueTooth,代码行数:29,代码来源:RGBLed.cpp

示例3: error

void ProxyScheduler::error(SchedulerDriver* driver, const std::string& message)
{
    CommandArgs args;
    args.push_back(CommandArg(message));

    dispatcher_->send( MesosCommand("error", args) );
}
开发者ID:ByteFoundryAU,项目名称:perl-mesos,代码行数:7,代码来源:ProxyScheduler.cpp

示例4: main

int main(int argc, char** argv)
{
  QApplication qapp(argc, argv);
#ifdef G2O_HAVE_GLUT
  glutInit(&argc, argv);
#endif

  string dummy;
  string inputFilename;
  CommandArgs arg;
  arg.param("solverlib", dummy, "", "specify a solver library which will be loaded");
  arg.param("typeslib", dummy, "", "specify a types library which will be loaded");
  arg.paramLeftOver("graph-input", inputFilename, "", "graph file which will be processed", true);

  arg.parseArgs(argc, argv);
  
  // loading the standard solver /  types
  DlWrapper dlTypesWrapper;
  loadStandardTypes(dlTypesWrapper, argc, argv);

  // register all the solvers
  DlWrapper dlSolverWrapper;
  loadStandardSolver(dlSolverWrapper, argc, argv);

  MainWindow mw;
  mw.updateDisplayedSolvers();
  mw.show();

  // redirect the output that normally goes to cerr to the textedit in the viewer
  StreamRedirect redirect(cerr, mw.plainTextEdit);

  // setting up the optimizer
  SparseOptimizer* optimizer = new SparseOptimizer();
  mw.viewer->graph = optimizer;

  // set up the GUI action
  GuiHyperGraphAction guiHyperGraphAction;
  guiHyperGraphAction.viewer = mw.viewer;
  optimizer->addPostIterationAction(&guiHyperGraphAction);

  if (inputFilename.size() > 0) {
    mw.loadFromFile(QString::fromStdString(inputFilename));
  }

  while (mw.isVisible()) {
    guiHyperGraphAction.dumpScreenshots = mw.actionDump_Images->isChecked();
    qapp.processEvents();
    SleepThread::msleep(10);
  }

  delete optimizer;

  // destroy all the singletons
  //Factory::destroy();
  //OptimizationAlgorithmFactory::destroy();
  //HyperGraphActionLibrary::destroy();

  return 0;
}
开发者ID:mischumok,项目名称:g2o,代码行数:59,代码来源:g2o_viewer.cpp

示例5: messageToCommandArgs

static CommandArgs messageToCommandArgs(const ofxOscMessage& message) {
  CommandArgs args;
  for (int i = 0; i < message.getNumArgs(); ++i) {
    auto arg = messageArgToCommandArg(message, i);
    args.add(arg);
  }
  return args;
}
开发者ID:t3kt,项目名称:memory,代码行数:8,代码来源:OscController.cpp

示例6: frameworkMessage

void ProxyScheduler::frameworkMessage(SchedulerDriver* driver,
                                      const ExecutorID& executorId,
                                      const SlaveID& slaveId,
                                      const std::string& data)
{
    CommandArgs args;
    PUSH_MSG(args, executorId, "ExecutorID");
    PUSH_MSG(args, slaveId, "SlaveID");
    args.push_back(CommandArg(data));

    dispatcher_->send( MesosCommand("frameworkMessage", args) );
}
开发者ID:ByteFoundryAU,项目名称:perl-mesos,代码行数:12,代码来源:ProxyScheduler.cpp

示例7: executorLost

void ProxyScheduler::executorLost(SchedulerDriver* driver,
                                  const ExecutorID& executorId,
                                  const SlaveID& slaveId,
                                  int status)
{
    CommandArgs args;
    PUSH_MSG(args, executorId, "ExecutorID");
    PUSH_MSG(args, slaveId, "SlaveID");
    args.push_back(CommandArg(std::to_string(status)));

    dispatcher_->send( MesosCommand("executorLost", args) );
}
开发者ID:ByteFoundryAU,项目名称:perl-mesos,代码行数:12,代码来源:ProxyScheduler.cpp

示例8: resourceOffers

void ProxyScheduler::resourceOffers(SchedulerDriver* driver,
                                    const std::vector<Offer>& offers)
{
    CommandArgs args;
    std::vector<std::string> strings;
    for (std::vector<Offer>::const_iterator it = offers.begin(); it != offers.end(); ++it) {
        strings.push_back(it->SerializeAsString());
    }
    args.push_back( CommandArg(strings, "Offer") );

    dispatcher_->send( MesosCommand("resourceOffers", args) );
}
开发者ID:ByteFoundryAU,项目名称:perl-mesos,代码行数:12,代码来源:ProxyScheduler.cpp

示例9: main

int main(int argc, char** argv) {
  CommandArgs arg;


  std::string outputFilename;
  std::string inputFilename;

  arg.param("o", outputFilename, "", "output file name"); 
  arg.paramLeftOver("input-filename ", inputFilename, "", "graph file to read", true);
  arg.parseArgs(argc, argv);
  OptimizableGraph graph;
  if (!graph.load(inputFilename.c_str())){
    cerr << "Error: cannot load a file from \"" << inputFilename << "\", aborting." << endl;
    return 0;
  }
  HyperGraph::EdgeSet removedEdges;
  HyperGraph::VertexSet removedVertices;
  for (HyperGraph::EdgeSet::iterator it = graph.edges().begin(); it!=graph.edges().end(); it++) {
    HyperGraph::Edge* e = *it;
    EdgeSE2PointXY* edgePointXY = dynamic_cast<EdgeSE2PointXY*>(e);
    if (edgePointXY) {
      VertexSE2* pose    = dynamic_cast<VertexSE2*>(edgePointXY->vertex(0));
      VertexPointXY* landmark = dynamic_cast<VertexPointXY*>(edgePointXY->vertex(1));
      FeaturePointXYData * feature = new FeaturePointXYData();
      feature->setPositionMeasurement(edgePointXY->measurement());
      feature->setPositionInformation(edgePointXY->information());
      pose->addUserData(feature); 
      removedEdges.insert(edgePointXY);
      removedVertices.insert(landmark);
    }
  }
  
  for (HyperGraph::EdgeSet::iterator it = removedEdges.begin(); it!=removedEdges.end(); it++){
    OptimizableGraph::Edge* e = dynamic_cast<OptimizableGraph::Edge*>(*it);
    graph.removeEdge(e);
  }

  for (HyperGraph::VertexSet::iterator it = removedVertices.begin(); it!=removedVertices.end(); it++){
    OptimizableGraph::Vertex* v = dynamic_cast<OptimizableGraph::Vertex*>(*it);
    graph.removeVertex(v);
  }

  
  if (outputFilename.length()){
    graph.save(outputFilename.c_str());
  }
 
}
开发者ID:9578577,项目名称:g2o_frontend,代码行数:48,代码来源:g2o_anonymize_observations.cpp

示例10: Run

	virtual bool Run(P4Task& task, const CommandArgs& args)
	{
		if (!task.IsConnected()) // Cannot login without being connected
		{
			Conn().Log().Info() << "Cannot login when not connected" << Endl;
			return false;
		}
		
		ClearStatus();
		
		m_LoggedIn = false;
		m_Password = task.GetP4Password();
		m_CheckingForLoggedIn = args.size() > 1;
		const string cmd = string("login") + (m_CheckingForLoggedIn ? string(" " ) + args[1] : string());

		if (!task.CommandRun(cmd, this) && !m_CheckingForLoggedIn)
		{
			string errorMessage = GetStatusMessage();			
			Conn().Log().Notice() << "ERROR: " << errorMessage << Endl;
		}
		
		if (m_CheckingForLoggedIn)
			Conn().Log().Debug() << "Is logged in: " << (m_LoggedIn ? "yes" : "no") << Endl;
		else
			Conn().Log().Info() << "Login " << (m_LoggedIn ? "succeeded" : "failed") << Endl;

		m_CheckingForLoggedIn = false;
		return m_LoggedIn;
	}
开发者ID:syscobra,项目名称:VersionControlPlugins,代码行数:29,代码来源:P4LoginCommand.cpp

示例11: GetStatus

bool P4StatusCommand::Run(P4Task& task, const CommandArgs& args)
{
	// Since the status command is use to check for online state we start out by
	// forcing online state to true and check if it has been set to false in the
	// end to determine if we should send online notifications.
	bool wasOnline = P4Task::IsOnline();
	P4Task::SetOnline(true);
	
	ClearStatus();

	bool recursive = args.size() > 1;
	Pipe().Log().Info() << "StatusCommand::Run()" << unityplugin::Endl;
			
	VersionedAssetList assetList;
	Pipe() >> assetList;
	
	RunAndSend(task, assetList, recursive);
	Pipe() << GetStatus();

	if (P4Task::IsOnline() && !wasOnline)
	{
		// If set to online already we cannot notify as online so we fake an offline state.
		P4Task::SetOnline(false);
		P4Task::NotifyOnline();
	}

	Pipe().EndResponse();

	return true;
}
开发者ID:Kezeali,项目名称:VersionControlPlugins,代码行数:30,代码来源:P4StatusCommand.cpp

示例12: stringWriter_

	const StringWriterPtr RandomService::commandRandom(const CommandArgs& nCommandArgs)
	{
		StringWriterPtr stringWriter_(new StringWriter());
		nCommandArgs.runStringWriter(stringWriter_);
		stringWriter_->startClass("result");
		const string& strMin_ = nCommandArgs.getCommandArg(1);
		const string& strMax_ = nCommandArgs.getCommandArg(2);
		const __i32 minValue_ = __convert<string, __i32>(strMin_);
		const __i32 maxValue_ = __convert<string, __i32>(strMax_);
		stringWriter_->runString(strMin_, "strMin");
		stringWriter_->runInt32(minValue_, "minValue");
		stringWriter_->runString(strMax_, "strMax");
		stringWriter_->runInt32(maxValue_, "maxValue");
		stringWriter_->finishClass();
		stringWriter_->runClose();
		return stringWriter_;
	}
开发者ID:lenglengai,项目名称:wanmei,代码行数:17,代码来源:RandomService.cpp

示例13: main

int main(int argc, char** argv)
{
  OptimizableGraph::initMultiThreading();
  QApplication qapp(argc, argv);

  CommandArgs arg;
#ifndef G2O_DISABLE_DYNAMIC_LOADING_OF_LIBRARIES
  string dummy;
  arg.param("solverlib", dummy, "", "specify a solver library which will be loaded");
  arg.param("typeslib", dummy, "", "specify a types library which will be loaded");
  // loading the standard solver /  types
  DlWrapper dlTypesWrapper;
  loadStandardTypes(dlTypesWrapper, argc, argv);
  // register all the solvers
  DlWrapper dlSolverWrapper;
  loadStandardSolver(dlSolverWrapper, argc, argv);
#endif

  // run the viewer
  return RunG2OViewer::run(argc, argv, arg);
}
开发者ID:2maz,项目名称:g2o,代码行数:21,代码来源:g2o_viewer.cpp

示例14: main

int main(int argc, char** argv)
{
  bool pcg;
  int updateEachN;
  bool vis;
  bool verbose;
  // command line parsing
  CommandArgs arg;
  arg.param("update", updateEachN, 10, "update the graph after inserting N nodes");
  arg.param("pcg", pcg, false, "use PCG instead of Cholesky");
  arg.param("v", verbose, false, "verbose output of the optimization process");
  arg.param("g", vis, false, "gnuplot visualization");
  
  arg.parseArgs(argc, argv);

  SparseOptimizerOnline optimizer(pcg);
  //SparseOptimizer optimizer;
  optimizer.setVerbose(verbose);
  optimizer.setForceStopFlag(&hasToStop);
  optimizer.vizWithGnuplot = vis;

  G2oSlamInterface slamInterface(&optimizer);
  slamInterface.setUpdateGraphEachN(updateEachN);

  SlamParser::ParserInterface parserInterface(&slamInterface);

  while (parserInterface.parseCommand(cin))
  {
    // do something additional if needed
  }

  return 0;
}
开发者ID:2maz,项目名称:g2o,代码行数:33,代码来源:g2o_online.cpp

示例15:

    bool P4EditCommand::Run(P4Task &task)
    {
        CommandArgs myArgs;

        // Append changelist if available
        if(!m_changelist.empty())
        {
            myArgs.emplace_back("-c");
            myArgs.emplace_back(m_changelist);
        }

        // Append custom arguments
        std::copy(m_customArgs.begin(), m_customArgs.end(), std::back_inserter(myArgs));

        // Append paths
        for(auto &path : m_paths)
        {
            myArgs.emplace_back(path);
        }

        return task.runP4Command("edit", myArgs, this);
    }
开发者ID:sipe9,项目名称:PerforceAssist,代码行数:22,代码来源:P4EditCommand.cpp


注:本文中的CommandArgs类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。