Example #1
14
	void defineOptions(OptionSet& options) {
		ServerApplication::defineOptions(options);

		options.addOption(
			Option("log", "l", "Log level argument, must be beetween 0 and 8 : nothing, fatal, critic, error, warn, note, info, debug, trace. Default value is 6 (info), all logs until info level are displayed.")
				.required(false)
				.argument("level")
				.repeatable(false));

		options.addOption(
			Option("dump", "d", "Enables packet traces in logs. Optional arguments are 'middle' or 'all' respectively to displays just middle packet process or all packet process. If no argument is given, just outside packet process will be dumped.",false,"middle|all",false)
				.repeatable(false));

		options.addOption(
			Option("cirrus", "c", "Cirrus address to activate a 'man-in-the-middle' developer mode in bypassing flash packets to the official cirrus server of your choice, it's a instable mode to help Cumulus developers, \"p2p.rtmfp.net:10000\" for example. By adding the 'dump' argument, you will able to display Cirrus/Flash packet exchange in your logs (see 'dump' argument).",false,"address",true)
				.repeatable(false));

		options.addOption(
			Option("middle", "m","Enables a 'man-in-the-middle' developer mode between two peers. It's a instable mode to help Cumulus developers. By adding the 'dump' argument, you will able to display Flash/Flash packet exchange in your logs (see 'dump' argument).")
				.repeatable(false));

		options.addOption(
			Option("help", "h", "Displays help information about command-line usage.")
				.required(false)
				.repeatable(false));
	}
Example #2
0
void NetworkProcess::deleteWebsiteData(SessionID sessionID, OptionSet<WebsiteDataType> websiteDataTypes, std::chrono::system_clock::time_point modifiedSince, uint64_t callbackID)
{
#if PLATFORM(COCOA)
    if (websiteDataTypes.contains(WebsiteDataType::HSTSCache)) {
        if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
            clearHSTSCache(*networkStorageSession, modifiedSince);
    }
#endif

    if (websiteDataTypes.contains(WebsiteDataType::Cookies)) {
        if (auto* networkStorageSession = SessionTracker::storageSession(sessionID))
            deleteAllCookiesModifiedSince(*networkStorageSession, modifiedSince);
    }

    auto completionHandler = [this, callbackID] {
        parentProcessConnection()->send(Messages::NetworkProcessProxy::DidDeleteWebsiteData(callbackID), 0);
    };

    if (websiteDataTypes.contains(WebsiteDataType::DiskCache) && !sessionID.isEphemeral()) {
        clearDiskCache(modifiedSince, WTFMove(completionHandler));
        return;
    }

    completionHandler();
}
Example #3
0
void check_ortho::defineOptions(OptionSet& options)
{
	Application::defineOptions(options);

	options.addOption(
		Option("help", "h", "mostra le informazioni sui parametri da specificare")
			.required(false)
			.repeatable(false)
			.callback(OptionCallback<check_ortho>(this, &check_ortho::handleHelp)));

		
	options.addOption(
		Option("dir", "d", "Specifica la cartella del progetto")
			.required(false)
			.repeatable(false)
			.argument("value")
			.callback(OptionCallback<check_ortho>(this, &check_ortho::handlePrjDir)));
	
	options.addOption(
		Option("img", "i", "Specifica la cartella delle ortho immagini")
			.required(false)
			.repeatable(false)
			.argument("value")
			.callback(OptionCallback<check_ortho>(this, &check_ortho::handleImgDir)));
	
	//options.addOption(
	//	Option("scale", "s", "Specifica la scala di lavoro")
	//		.required(false)
	//		.repeatable(false)
	//		.argument("value")
	//		.callback(OptionCallback<check_ortho>(this, &check_ortho::handleScale)));
}
Example #4
0
void BeeServer::defineOptions(OptionSet& options)
{
	ServerApplication::defineOptions(options);

	options.addOption(
		Option("help", "h", "display help information on command line arguments")
		.required(false)
		.repeatable(false)
		.callback(OptionCallback<BeeServer>(this, &BeeServer::handleHelp)));

	options.addOption(
		Option("stop", "stop", "stop process.")
		.required(false)
		.repeatable(false)
		.argument("taskids w/o arguments", false)
		.callback(OptionCallback<BeeServer>(this, &BeeServer::stop)));

	options.addOption(
		Option("start", "start", "start process.")
		.required(false)
		.repeatable(false)
		.argument("taskids w/o arguments", false)
		.callback(OptionCallback<BeeServer>(this, &BeeServer::start)));

	options.addOption(
		Option("query", "q", "query process state.")
		.required(false)
		.repeatable(false)
		.argument("taskids w/o arguments", false)
		.callback(OptionCallback<BeeServer>(this, &BeeServer::query)));
}
Example #5
0
File: TweetApp.cpp Project: 119/vdc
	void defineOptions(OptionSet& options)
	{
		Application::defineOptions(options);

		options.addOption(
			Option("help", "h", "display help information on command line arguments")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<TweetApp>(this, &TweetApp::handleHelp)));

		options.addOption(
			Option("username", "u", "specify the Twitter user/account name")
				.required(true)
				.repeatable(false)
				.argument("account")
				.callback(OptionCallback<TweetApp>(this, &TweetApp::handleUsername)));
				
		options.addOption(
			Option("password", "p", "specify the Twitter password")
				.required(true)
				.repeatable(false)
				.argument("password")
				.callback(OptionCallback<TweetApp>(this, &TweetApp::handlePassword)));

		options.addOption(
			Option("message", "m", "specify the status message")
				.required(false)
				.repeatable(true)
				.argument("message")
				.callback(OptionCallback<TweetApp>(this, &TweetApp::handleMessage)));
	}
	void defineOptions(OptionSet& options)
	{
		Application::defineOptions(options);

		options.addOption(
			Option("help", "h", "display help information on command line arguments")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<configuracao>(this, &configuracao::handleHelp)));

		options.addOption(
			Option("define", "D", "define a configuration property")
				.required(false)
				.repeatable(true)
				.argument("name=value")
				.callback(OptionCallback<configuracao>(this, &configuracao::handleDefine)));
				
		options.addOption(
			Option("config-file", "f", "load configuration data from a file")
				.required(false)
				.repeatable(true)
				.argument("file")
				.callback(OptionCallback<configuracao>(this, &configuracao::handleConfig)));

		options.addOption(
			Option("bind", "b", "bind option value to test.property")
				.required(false)
				.repeatable(false)
				.argument("value")
				.binding("test.property"));
	}
Example #7
0
	void defineOptions(OptionSet& options)
	{
		ServerApplication::defineOptions(options);

		options.addOption(
			Option("help", "h", "display help information on command line arguments")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::handleHelp)));
		options.addOption(
			Option("server", "S", "running in server mode")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::startServer)));
		options.addOption(
			Option("host", "H", "IP of FileTransfer server")
				.required(false)
				.repeatable(false)
				.argument("IP address (x.x.x.x)")
				.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setHost)));
		options.addOption(
			Option("port", "P", "Port of FileTransfer server")
				.required(false)
				.repeatable(false)
				.argument("port number")
				.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setPort)));
		options.addOption(
			Option("file", "F", "file path to transfer")
				.required(false)
				.repeatable(false)
				.argument("file")
				.callback(OptionCallback<FileTransferApp>(this, &FileTransferApp::setFile)));
	}
Example #8
0
	void defineOptions(OptionSet& options)
	{
		Application::defineOptions(options);

		options.addOption(
			Option("help", "h", "Display help information on command line arguments.")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleHelp)));

		options.addOption(
			Option("output", "o", "Specify base directory for extracted files.")
				.required(false)
				.repeatable(false)
				.argument("path")
				.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleOutput)));
				
		options.addOption(
			Option("list", "l", "List files and directories in archive.")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleList)));

		options.addOption(
			Option("extract", "x", "Extract single file or entire archive.")
				.required(false)
				.repeatable(false)
				.argument("file", false)
				.callback(OptionCallback<Un7zipApp>(this, &Un7zipApp::handleExtract)));
	}
Example #9
0
void FillMissingOptionDefaults() {
    OptionSet* options = OptionSet::getOptions(SIRIKATA_OPTIONS_MODULE,NULL);

    // Parse command line once to make sure we have the right config
    // file. On this pass, use defaults so everything gets filled in.
    options->fillMissingDefaults();
}
ToolResult ToolMain( OptionSet& options, istream& in, ostream& out )
{
  ToolResult result = noError;
  string transmissionList = options.getopt( "-t|-T|--transmit", "spd" );
  bool transmitStates = ( transmissionList.find_first_of( "sS" ) != string::npos ),
       transmitParameters = ( transmissionList.find_first_of( "pP" ) != string::npos ),
       transmitData = ( transmissionList.find_first_of( "dD" ) != string::npos ),
       calibrateData = !options.findopt( "-r|-R|--raw" );
  string paramFileName = options.getopt( "-p|-P|--parameters", "" );
  string offsetString = options.getopt( "-s|-S|--start", "" );
  string durationString = options.getopt( "-d|-D|--duration", "" );

  // Read the BCI2000 header.
  string token;
  int headerLength,
      sourceCh,
      stateVectorLength;
  SignalType dataFormat;
  StateList states;
  enum { v10, v11 } fileFormatVersion = v10;

  bool legalInput = in >> token;
  if( legalInput && token == "BCI2000V=" )
  {
    legalInput = legalInput &&
      in >> token;
    if( token == "1.1" )
      fileFormatVersion = v11;
    else
      legalInput = false;
    legalInput = legalInput &&
      in >> token;
  }
AlwaysLocationUpdatePolicy::AlwaysLocationUpdatePolicy(const String& args)
    : LocationUpdatePolicy(),
      mServerSubscriptions(this),
      mObjectSubscriptions(this)
{
    OptionSet* optionsSet = OptionSet::getOptions(ALWAYS_POLICY_OPTIONS,NULL);
    optionsSet->parse(args);
}
Example #12
0
static OH::Storage* createCassandraStorage(ObjectHostContext* ctx, const String& args) {
    OptionSet* optionsSet = OptionSet::getOptions("cassandrastorage",NULL);
    optionsSet->parse(args);

    String host = optionsSet->referenceOption("host")->as<String>();
    int32 port = optionsSet->referenceOption("port")->as<int32>();

    return new OH::CassandraStorage(ctx, host, port);
}
Example #13
0
static OH::PersistedObjectSet* createCassandraPersistedObjectSet(ObjectHostContext* ctx, const String& args) {
    OptionSet* optionsSet = OptionSet::getOptions("cassandrapersistedset",NULL);
    optionsSet->parse(args);

    String host = optionsSet->referenceOption("host")->as<String>();
    int32 port = optionsSet->referenceOption("port")->as<int32>();
    String ohid = optionsSet->referenceOption("ohid")->as<String>();

    return new OH::CassandraPersistedObjectSet(ctx, host, port, ohid);
}
Example #14
0
static ObjectFactory* createCassandraObjectFactory(ObjectHostContext* ctx, ObjectHost* oh, const SpaceID& space, const String& args) {
    OptionSet* optionsSet = OptionSet::getOptions("cassandrafactory",NULL);
    optionsSet->parse(args);

    String host = optionsSet->referenceOption("host")->as<String>();
    int32 port = optionsSet->referenceOption("port")->as<int32>();
    String ohid = optionsSet->referenceOption("ohid")->as<String>();

    return new CassandraObjectFactory(ctx, oh, space, host, port, ohid);
}
Example #15
0
SaveFilter::SaveFilter(const String& args) {
    Sirikata::InitializeClassOptions ico("save_filter", NULL,
        new OptionValue("filename","",Sirikata::OptionValueType<String>(),"Name of file to save to."),
        new OptionValue("format","colladamodels",Sirikata::OptionValueType<String>(),"Format to save to."),
        NULL);

    OptionSet* optionSet = OptionSet::getOptions("save_filter",NULL);
    optionSet->parse(args);

    mFilename = optionSet->referenceOption("filename")->as<String>();
    mFormat = optionSet->referenceOption("format")->as<String>();
}
Example #16
0
//============================================================================//
void SmitlabService::defineOptions(OptionSet& options)
{

    ServerApplication::defineOptions(options);

    options.addOption(Option("help",        "h",
        "display help information for command line arguments"));

    options.addOption(Option("config-file", "f",
        "load configuration data from a file", false, "path", true));

}
EncodedValue EncodingTraits<Test::PlatformEvent::OtherType>::encodeValue(const OptionSet<Test::PlatformEvent::OtherType>& enumValue)
{
    EncodedValue encodedValue = EncodedValue::createArray();
    if (enumValue.contains(Test::PlatformEvent::OtherType::Mouse))
        encodedValue.append<String>(ASCIILiteral("Mouse"));
    if (enumValue.contains(Test::PlatformEvent::OtherType::Key))
        encodedValue.append<String>(ASCIILiteral("Key"));
    if (enumValue.contains(Test::PlatformEvent::OtherType::Touch))
        encodedValue.append<String>(ASCIILiteral("Touch"));
    if (enumValue.contains(Test::PlatformEvent::OtherType::Wheel))
        encodedValue.append<String>(ASCIILiteral("Wheel"));

    return encodedValue;
}
Example #18
0
Prox::QueryHandler<SimulationTraits>* QueryHandlerFactory(const String& type, const String& args) {
    static OptionValue* branching = NULL;
    static OptionValue* rebuild_batch_size = NULL;
    if (branching == NULL) {
        branching = new OptionValue("branching", "10", Sirikata::OptionValueType<uint32>(), "Number of children each node should have.");
        rebuild_batch_size = new OptionValue("rebuild-batch-size", "10", Sirikata::OptionValueType<uint32>(), "Number of queries to transition on each iteration when rebuilding. Keep this small to avoid long latencies between updates.");
        Sirikata::InitializeClassOptions ico("query_handler", NULL,
            branching,
            rebuild_batch_size,
            NULL);
    }

    assert(branching != NULL);

    // Since these options end up being shared if you instantiate multiple
    // QueryHandlers, reset them each time.
    branching->unsafeAs<uint32>() = 10;

    OptionSet* optionsSet = OptionSet::getOptions("query_handler", NULL);
    optionsSet->parse(args);

    if (type == "brute") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::BruteForceQueryHandler<SimulationTraits>::Constructor(), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtree") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeAngleQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>()), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreedist" || type == "dist") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeDistanceQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>()), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreecut") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeCutQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>(), false), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else if (type == "rtreecutagg") {
        return new Prox::RebuildingQueryHandler<SimulationTraits>(
            Prox::RTreeCutQueryHandler<SimulationTraits>::Constructor(branching->unsafeAs<uint32>(), true), rebuild_batch_size->unsafeAs<uint32>()
        );
    }
    else {
        return NULL;
    }
}
/*! Removes the option \a name from \a optSet. If the option is not present
    \c false is returned, \c true otherwise.

    \param[in] optSet OptionSet to modify.
    \param[in] name   Name of the option.
    \return Whether the option was successfully removed.
 */
bool
IOFileTypeBase::unsetOption(OptionSet &optSet, const std::string &name)
{
    bool                retVal = false;
    OptionSet::iterator oIt    = optSet.find(name);
    
    if(oIt != optSet.end())
    {
        optSet.erase(oIt);
        retVal = true;
    }
    
    return retVal;
}
Example #20
0
void ServerApplication::defineOptions(OptionSet& options)
{
	Application::defineOptions(options);

	options.addOption(
		Option("daemon", "", "run application as a daemon")
			.required(false)
			.repeatable(false));

	options.addOption(
		Option("pidfile", "", "write PID to given file")
			.required(false)
			.repeatable(false)
			.argument("path"));
}
ByteTransferScenario::ByteTransferScenario(const String &options):mStartTime(Time::epoch()){
    mNumTotalPings=0;
    mContext=NULL;
    mObjectTracker = NULL;

    BTSInitOptions(this);
    OptionSet* optionsSet = OptionSet::getOptions("DistributedPingScenario",this);
    optionsSet->parse(options);
    mSameObjectHostPings=optionsSet->referenceOption("allow-same-object-host")->as<bool>();
    mForceSameObjectHostPings=optionsSet->referenceOption("force-same-object-host")->as<bool>();
    mPacketSize=optionsSet->referenceOption("packet-size")->as<size_t>();

    mPort=OBJECT_PORT_PING;
    mGeneratePings=std::tr1::bind(&ByteTransferScenario::generatePings,this);
}
	void defineOptions(OptionSet& options) {
		Application::defineOptions(options);
		options.addOption(
			Option("help", "h", "display help information")
			.required(false)
			.repeatable(false)
			.callback(OptionCallback<WebSocketClient>(this, &WebSocketClient::HandleHelp)));

		options.addOption(
			Option("uri", "u", "Address to server e.g. ws://127.0.0.1:3001/")
			.required(true)
			.repeatable(false)
			.argument("addr")
			.callback(OptionCallback<WebSocketClient>(this, &WebSocketClient::HandleURI)));
	}
/*! Attempts to return the \a value associated with option \a name
    in \a optSet. If the option is not present \c false is returned,
    \c true otherwise and only in this case value is being set.
    
    \param[in] optSet OptionSet to read.
    \param[in] name   Name of the option.
    \param[out] value Value of option.
    \return Whether the option is present.
 */
bool
IOFileTypeBase::getOption(
    const OptionSet &optSet, std::string const &name, std::string &value)
{
    bool                      retVal = false;
    OptionSet::const_iterator oIt    = optSet.find(name);
    
    if(oIt != optSet.end())
    {
        value  = oIt->second.optValue;
        retVal = true;
    }
    
    return retVal;
}
Example #24
0
File: pkill.cpp Project: 12307/poco
	void defineOptions(OptionSet& options)
	{
		Application::defineOptions(options);

		options.addOption(
			Option("help", "h", "Display help information on command line arguments.")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<ProcessKillerApp>(this, &ProcessKillerApp::handleHelp)));

		options.addOption(
			Option("friendly", "f", "Kindly ask application to shut down.")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<ProcessKillerApp>(this, &ProcessKillerApp::handleFriendly)));
	}
Example #25
0
bool Options::IsASubset(const OptionSet &set_a, const OptionSet &set_b) {
  bool is_a_subset = true;
  OptionSet::const_iterator pos_a;
  OptionSet::const_iterator pos_b;

  // set_a is a subset of set_b if every member of set_a is also a member of
  // set_b

  for (pos_a = set_a.begin(); pos_a != set_a.end() && is_a_subset; ++pos_a) {
    pos_b = set_b.find(*pos_a);
    if (pos_b == set_b.end())
      is_a_subset = false;
  }

  return is_a_subset;
}
Example #26
0
size_t Options::OptionsSetDiff(const OptionSet &set_a, const OptionSet &set_b,
                               OptionSet &diffs) {
  size_t num_diffs = 0;
  OptionSet::const_iterator pos_a;
  OptionSet::const_iterator pos_b;

  for (pos_a = set_a.begin(); pos_a != set_a.end(); ++pos_a) {
    pos_b = set_b.find(*pos_a);
    if (pos_b == set_b.end()) {
      ++num_diffs;
      diffs.insert(*pos_a);
    }
  }

  return num_diffs;
}
Example #27
0
	void defineOptions(OptionSet& options)
	{
		Application::defineOptions(options);

		options.addOption(
			Option("help", "h", "display help information on command line arguments")
				.required(false)
				.repeatable(false)
				.callback(OptionCallback<ZipApp>(this, &ZipApp::handleHelp)));

		options.addOption(
			Option("file", "f", "specifies the output zip file")
				.required(true)
				.repeatable(false)
				.argument("filename")
				.callback(OptionCallback<ZipApp>(this, &ZipApp::handleFile)));
	}
Example #28
0
	void defineOptions(OptionSet& options)
	{
		options.addOption(
			Option("help", "h", "display help")
			.required(false)
			.repeatable(false)
			);
	}
Example #29
0
void ServerApplication::defineOptions(OptionSet& options)
{
	Application::defineOptions(options);

	options.addOption(
		Option("daemon", "", "Run application as a daemon.")
			.required(false)
			.repeatable(false)
			.callback(OptionCallback<ServerApplication>(this, &ServerApplication::handleDaemon)));

	options.addOption(
		Option("pidfile", "", "Write the process ID of the application to given file.")
			.required(false)
			.repeatable(false)
			.argument("path")
			.callback(OptionCallback<ServerApplication>(this, &ServerApplication::handlePidFile)));
}
void NFIOOptions::init(const OptionSet &options)
{
    // init default parameters
    _inlineTextures             = true;
    _compressTextures           = false;
    _texturesCompressionQuality = 75;
    _texturesImageType          = "jpeg",
    _quantizePositions          = Quantizer::QRES_OFF;
    _quantizeNormals            = Quantizer::QRES_OFF;
    _quantizeTexCoords          = Quantizer::QRES_OFF;
    _packIndices                = false;
    _unpack16BitIndices         = false;
    
    OptionSet::const_iterator oIt  = options.begin();
    OptionSet::const_iterator oEnd = options.end  ();
    
    for(; oIt != oEnd; ++oIt)
    {
        if(oIt->first == "inlineTextures")
            _inlineTextures = getBoolOption(oIt->second);
        
        if(oIt->first == "compressTextures")
            _compressTextures = getBoolOption(oIt->second);
            
        if(oIt->first == "texturesCompressionQuality")
            _texturesCompressionQuality = getValue<UInt32>(oIt->second, 75);
            
        if(oIt->first == "texturesImageType")
            _texturesImageType = getValue<std::string>(oIt->second, "jpeg");
            
        if(oIt->first == "quantizePositions")
            _quantizePositions = getQuantizeOption(oIt->second);

        if(oIt->first == "quantizeNormals")
            _quantizeNormals = getQuantizeOption(oIt->second);
            
        if(oIt->first == "quantizeTexCoords")
            _quantizeTexCoords = getQuantizeOption(oIt->second);
            
        if(oIt->first == "packIndices")
            _packIndices = getBoolOption(oIt->second);
            
        if(oIt->first == "unpack16BitIndices")
            _unpack16BitIndices = getBoolOption(oIt->second);
    }
}