• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ param函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: main

//---------------------------------------------------------------------------
int main(int argc, char *argv[])
{
	printf("\n");

		// Set up the dprintf stuff to write to stderr, so that Condor
		// libraries which use it will write to the right place...
	dprintf_set_tool_debug("TOOL", 0);
	set_debug_flags(NULL, D_ALWAYS | D_NOHEADER);
	config();

		// Initialize our Distribution object -- condor vs. hawkeye, etc.
	myDistro->Init( argc, argv );

		// Load command-line arguments into the deepOpts and shallowOpts
		// structures.
	SubmitDagDeepOptions deepOpts;
	SubmitDagShallowOptions shallowOpts;

		// We're setting strScheddDaemonAdFile and strScheddAddressFile
		// here so that the classad updating feature (see gittrac #1782)
		// works properly.  The problem is that the schedd daemon ad and
		// address files are normally defined relative to the $LOG value.
		// Because we specify a different log directory on the condor_dagman
		// command line, if we don't set the values here, condor_dagman
		// won't be able to find those files when it tries to communicate
		/// with the schedd.  wenger 2013-03-11
	shallowOpts.strScheddDaemonAdFile = param( "SCHEDD_DAEMON_AD_FILE" );
	shallowOpts.strScheddAddressFile = param( "SCHEDD_ADDRESS_FILE" );
	parseCommandLine(deepOpts, shallowOpts, argc, argv);

	int tmpResult;

		// Recursively run ourself on nested DAGs.  We need to do this
		// depth-first so all of the lower-level .condor.sub files already
		// exist when we check for log files.
	if ( deepOpts.recurse ) {
		bool useOldDagReader = param_boolean( "DAGMAN_USE_OLD_DAG_READER",
					false );
		if ( useOldDagReader ) {
			tmpResult = doRecursion( deepOpts, shallowOpts );
		} else {
			tmpResult = doRecursionNew( deepOpts, shallowOpts );
		}
		if ( tmpResult != 0) {
			fprintf( stderr, "Recursive submit(s) failed; exiting without "
						"attempting top-level submit\n" );
			return tmpResult;
		}
	}
	
		// Further work to get the shallowOpts structure set up properly.
	tmpResult = setUpOptions( deepOpts, shallowOpts );
	if ( tmpResult != 0 ) return tmpResult;

		// Check whether the output files already exist; if so, we may
		// abort depending on the -f flag and whether we're running
		// a rescue DAG.
	ensureOutputFilesExist( deepOpts, shallowOpts );

		// Make sure that all node jobs have log files, the files
		// aren't on NFS, etc.

		// Note that this MUST come after recursion, otherwise we'd
		// pass down the "preserved" values from the current .condor.sub
		// file.
	if ( deepOpts.updateSubmit ) {
		tmpResult = getOldSubmitFlags( shallowOpts );
		if ( tmpResult != 0 ) return tmpResult;
	}

		// Write the actual submit file for DAGMan.
	writeSubmitFile( deepOpts, shallowOpts );

	return submitDag( shallowOpts );
}
开发者ID:cwmartin,项目名称:htcondor,代码行数:76,代码来源:condor_submit_dag.cpp


示例2: main

int main( int argc, char** argv )
{
    Argument param( argc, argv );
    param.exec();
    
    kvs::File fileOri( param.filename_ori );
    kvs::File fileEva( param.filename_eva );
    
    kvs::StructuredVolumeObject* ori_volume = NULL;
    kvs::UnstructuredVolumeObject* eva_volume = NULL;
    
    if( fileOri.extension() == "kvsml" )
    {
        ori_volume = new kvs::StructuredVolumeImporter( param.filename_ori );
        std::cout << "use kvsml volume data as original data" << std::endl;
    }
    else if( fileOri.extension() == "vld" )
    {
        ori_volume = new kun::VldImporter( param.filename_ori );
        std::cout << "use vld volume data as original data" << std::endl;
    }
    
    size_t nx = ori_volume->resolution().x();
    size_t ny = ori_volume->resolution().y();
    size_t nz = ori_volume->resolution().z();
    
    if( fileEva.extension() == "kvsml")
    {
        eva_volume = new kvs::UnstructuredVolumeImporter( param.filename_eva );
        std::cout << "use kvsml volume data as evaluation data" << std::endl;
    }
    else if( fileEva.extension() == "zk" )
    {    
        eva_volume = new kun::BlockLoader( param.filename_eva );
        std::cout << "use zk volume data as evaluation data" << std::endl;
    }
    
    float max_value = (float)ori_volume->maxValue();
    float min_value = (float)ori_volume->minValue();
    std::cout << "max valume of the compressed volume:" << max_value << std::endl;
    std::cout << "min valume of the compressed volume:" << min_value << std::endl;
    
    float* ori_values = new float[nx * ny * nz];
    ori_values = (float*)ori_volume->values().pointer();
    
    size_t NCells = eva_volume->ncells();
    kvs::TetrahedralCell<float>* cell = new kvs::TetrahedralCell<float>( eva_volume );
    
    kvs::ValueArray<float> eva_values;
    eva_values.allocate( nx * ny * nz );
    
    for ( size_t count = 0; count < NCells ; count++ )
    {
        cell->bindCell( count );
    
        kvs::Vector3f minf, maxf;
        kvs::Vector3i mini, maxi;
        CalcBoundingBox( cell, minf, maxf );
        
        for ( int a = 0; a < 3; ++a )
        {
            mini[a] = kvs::Math::Floor( minf[a] ); 
            maxi[a] = kvs::Math::Ceil( maxf[a] ); 
        }
        
        if ( mini.x() < 0 || maxi.x() > (float)nx ) std::cout << "x out" << std::endl;
        if ( mini.y() < 0 || maxi.y() > (float)ny ) std::cout << "y out" << std::endl;
        if ( mini.z() < 0 || maxi.z() > (float)nz ) std::cout << "z out" << std::endl;
        
        for ( int k = mini.z(); k <= maxi.z(); k++ )
            for ( int j = mini.y(); j <= maxi.y(); j ++ )
                for ( int i = mini.x(); i <= maxi.x(); i ++ )
                {
                    cell->setGlobalPoint( kvs::Vector3f( i, j, k ) );
                    kvs::Vector3f local = cell->localPoint();
                    if ( !(local.x() < 0 || local.y() < 0 || local.z() < 0 || 1 - local.x() + local.y() + local.z() < 0 ) )
                    {
                        int index = i + j * nx + k * nx * ny;
                        eva_values[ index ] = cell->scalar();
                    }
                }
    }
    
    //Calculate the error
    float error = 0;
    float average_error = 0;    
    for ( unsigned int i = 0; i < nx * ny * nz; i ++ )
    {
        error += fabs(eva_values[i] - ori_values[i]) / ( max_value - min_value ) ;
    }
    average_error = error / ( nx * ny * nz );
    
    std::cout << "whole error: " << error << std::endl;
    std::cout << "The average error is: " << average_error << std::endl;
}
开发者ID:zkbreeze,项目名称:VisKun,代码行数:95,代码来源:main.cpp


示例3: switch

/* static */
wxString wxFileType::ExpandCommand(const wxString& command,
                                   const wxFileType::MessageParameters& params)
{
    bool hasFilename = false;

    wxString str;
    for ( const wxChar *pc = command.c_str(); *pc != wxT('\0'); pc++ ) {
        if ( *pc == wxT('%') ) {
            switch ( *++pc ) {
                case wxT('s'):
                    // '%s' expands into file name (quoted because it might
                    // contain spaces) - except if there are already quotes
                    // there because otherwise some programs may get confused
                    // by double double quotes
#if 0
                    if ( *(pc - 2) == wxT('"') )
                        str << params.GetFileName();
                    else
                        str << wxT('"') << params.GetFileName() << wxT('"');
#endif
                    str << params.GetFileName();
                    hasFilename = true;
                    break;

                case wxT('t'):
                    // '%t' expands into MIME type (quote it too just to be
                    // consistent)
                    str << wxT('\'') << params.GetMimeType() << wxT('\'');
                    break;

                case wxT('{'):
                    {
                        const wxChar *pEnd = wxStrchr(pc, wxT('}'));
                        if ( pEnd == NULL ) {
                            wxString mimetype;
                            wxLogWarning(_("Unmatched '{' in an entry for mime type %s."),
                                         params.GetMimeType().c_str());
                            str << wxT("%{");
                        }
                        else {
                            wxString param(pc + 1, pEnd - pc - 1);
                            str << wxT('\'') << params.GetParamValue(param) << wxT('\'');
                            pc = pEnd;
                        }
                    }
                    break;

                case wxT('n'):
                case wxT('F'):
                    // TODO %n is the number of parts, %F is an array containing
                    //      the names of temp files these parts were written to
                    //      and their mime types.
                    break;

                default:
                    wxLogDebug(wxT("Unknown field %%%c in command '%s'."),
                               *pc, command.c_str());
                    str << *pc;
            }
        }
        else {
            str << *pc;
        }
    }

    // metamail(1) man page states that if the mailcap entry doesn't have '%s'
    // the program will accept the data on stdin so normally we should append
    // "< %s" to the end of the command in such case, but not all commands
    // behave like this, in particular a common test is 'test -n "$DISPLAY"'
    // and appending "< %s" to this command makes the test fail... I don't
    // know of the correct solution, try to guess what we have to do.

    // test now carried out on reading file so test should never get here
    if ( !hasFilename && !str.empty()
#ifdef __UNIX__
                      && !str.StartsWith(_T("test "))
#endif // Unix
       ) {
        str << wxT(" < '") << params.GetFileName() << wxT('\'');
    }

    return str;
}
开发者ID:jonntd,项目名称:dynamica,代码行数:84,代码来源:mimecmn.cpp


示例4: eval_to

 void eval_to(dense_matrix<real_type>& result) const {
   result = param();
 }
开发者ID:libgm,项目名称:libgm,代码行数:3,代码来源:matrix_view.hpp


示例5: main

int main(int argc, char **argv)
{
    enum ExitCode
    {
        /**
         * We start from 2, because QApplicationArgumentParser
         * uses 1.
         */
        QueryFailure = 2,
        StdOutFailure
    };

    const QCoreApplication app(argc, argv);
    QCoreApplication::setApplicationName(QLatin1String("xmlpatterns"));

    QXmlNamePool namePool;
    PatternistApplicationParser parser(argc, argv, namePool);
    parser.setApplicationDescription(QLatin1String("A tool for running XQuery queries."));
    parser.setApplicationVersion(QLatin1String("0.1"));

    QApplicationArgument param(QLatin1String("param"),
                               QXmlPatternistCLI::tr("Binds an external variable. The value is directly available using the variable reference: $name."),
                               qMetaTypeId<Parameter>());
    param.setMaximumOccurrence(-1);
    parser.addArgument(param);

    const QApplicationArgument noformat(QLatin1String("no-format"),
                                        QXmlPatternistCLI::tr("By default output is formatted for readability. When specified, strict serialization is performed."));
    parser.addArgument(noformat);

    const QApplicationArgument isURI(QLatin1String("is-uri"),
                                     QXmlPatternistCLI::tr("If specified, all filenames on the command line are interpreted as URIs instead of a local filenames."));
    parser.addArgument(isURI);

    const QApplicationArgument initialTemplateName(QLatin1String("initial-template"),
                                                   QXmlPatternistCLI::tr("The name of the initial template to call as a Clark Name."),
                                                   QVariant::String);
    parser.addArgument(initialTemplateName);

    /* The temporary object is required to compile with g++ 3.3. */
    QApplicationArgument queryURI = QApplicationArgument(QLatin1String("query/stylesheet"),
                                                         QXmlPatternistCLI::tr("A local filename pointing to the query to run. If the name ends with .xsl it's assumed "
                                                                               "to be an XSL-T stylesheet. If it ends with .xq, it's assumed to be an XQuery query. (In "
                                                                               "other cases it's also assumed to be an XQuery query, but that interpretation may "
                                                                               "change in a future release of Qt.)"),
                                                         QVariant::String);
    queryURI.setMinimumOccurrence(1);
    queryURI.setNameless(true);
    parser.addArgument(queryURI);

    QApplicationArgument focus = QApplicationArgument(QLatin1String("focus"),
                                                      QXmlPatternistCLI::tr("The document to use as focus. Mandatory "
                                                                            "in case a stylesheet is used. This option is "
                                                                            "also affected by the is-uris option."),
                                                      QVariant::String);
    focus.setMinimumOccurrence(0);
    focus.setNameless(true);
    parser.addArgument(focus);

    QApplicationArgument output(QLatin1String("output"),
                                QXmlPatternistCLI::tr("A local file to which the output should be written. "
                                                      "The file is overwritten, or if not exist, created. "
                                                      "If absent, stdout is used."),
                                qMetaTypeId<QIODevice *>());
    parser.addArgument(output);

    if(!parser.parse())
        return parser.exitCode();

    /* Get the query URI. */
    const QUrl effectiveURI(finalizeURI(parser, isURI, queryURI));

    QXmlQuery::QueryLanguage lang;

    if(effectiveURI.toString().endsWith(QLatin1String(".xsl")))
         lang = QXmlQuery::XSLT20;
    else
         lang = QXmlQuery::XQuery10;

    if(lang == QXmlQuery::XQuery10 && parser.has(initialTemplateName))
    {
        parser.message(QXmlPatternistCLI::tr("An initial template name cannot be specified when running an XQuery."));
        return QApplicationArgumentParser::ParseError;
    }

    QXmlQuery query(lang, namePool);

    query.setInitialTemplateName(qvariant_cast<QXmlName>(parser.value(initialTemplateName)));

    /* Bind external variables. */
    {
        const QVariantList parameters(parser.values(param));
        const int len = parameters.count();

        /* For tracking duplicates. */
        QSet<QString> usedParameters;

        for(int i = 0; i < len; ++i)
        {
            const Parameter p(qvariant_cast<Parameter>(parameters.at(i)));
//.........这里部分代码省略.........
开发者ID:2gis,项目名称:2gisqt5android,代码行数:101,代码来源:main.cpp


示例6: while

void command_line_parser::parse_options(void)
{
	while(const char* token = m_command_line.peek())
	{
		if (*token != '-')
			break;
		std::string param(m_command_line.read());
		logger().trace(corecpp::concat<std::string>({"parsing ", param}), __FILE__, __LINE__);
		if (param.substr(0,2) == "--")
		{
			std::string value = "";
			auto pos = param.find('=');
			if(pos == std::string::npos)
			{
				//param with no value => value is let to an empty string
				param = param.substr(2);
			}
			else
			{
				value = param.substr(pos);
				param = param.substr(2, param.length() - 2 - pos);
			}
			auto option = get_option(param);
			if (option == m_options.end())
				throw std::invalid_argument(param);
			if (option->require_value() && (pos == std::string::npos))
				throw value_error(param);
			option->read(value);
		}
		else if (param[0] == '-')
		{
			param = param.substr(1);
			const char* value = m_command_line.peek();
			if(value && *value == '-') //another option
				value = nullptr;
			//for loop because we can have multiple params
			for(auto iter = param.begin(); iter != param.end(); )
			{
				char shortname = *iter;
				auto option = get_option(shortname);
				if(option == m_options.end())
					throw std::invalid_argument(std::string(1, shortname));

				if (++iter == param.end())//last option => must give the value to it
				{
					if (!value && option->require_value())
						throw value_error(param);
					if (option->require_value())
					{
						value = m_command_line.read(); //consume the parameter
						option->read(value);
					}
					else
						option->read("");
				}
				else //not the last parameter => should not need a value
				{
					if (option->require_value())
						throw value_error(param);
					option->read("");
				}
			}
		}
	}
}
开发者ID:bountykiller,项目名称:corecpp,代码行数:65,代码来源:command_line.cpp


示例7: switch

void phillip_main_t::write_header() const
{
    auto write = [this](std::ostream *os)
    {
        (*os) << "<phillip>" << std::endl;
        (*os) << "<configure>" << std::endl;
        (*os) << "<version>" << VERSION << "</version>" << std::endl;

        auto get_time_stamp_exe = []() -> std::string
        {
            int year, month, day, hour, min, sec;
            std::string out;
            util::beginning_time(&year, &month, &day, &hour, &min, &sec);
            switch (month)
            {
            case 1:  out = "Jan"; break;
            case 2:  out = "Feb"; break;
            case 3:  out = "Mar"; break;
            case 4:  out = "Apr"; break;
            case 5:  out = "May"; break;
            case 6:  out = "Jun"; break;
            case 7:  out = "Jul"; break;
            case 8:  out = "Aug"; break;
            case 9:  out = "Sep"; break;
            case 10: out = "Oct"; break;
            case 11: out = "Nov"; break;
            case 12: out = "Dec"; break;
            default: throw;
            }
            return out + util::format(" %2d %4d %02d:%02d:%02d", day, year, hour, min, sec);
        };
        
        (*os)
            << "<time_stamp compiled=\"" << util::format("%s %s", __DATE__, __TIME__)
            << "\" executed=\"" << get_time_stamp_exe()
            << "\"></time_stamp>" << std::endl;

        (*os)
            << "<components lhs=\"" << m_lhs_enumerator->repr()
            << "\" ilp=\"" << m_ilp_convertor->repr()
            << "\" sol=\"" << m_ilp_solver->repr()
            << "\"></components>" << std::endl;

        const kb::knowledge_base_t *base = kb::knowledge_base_t::instance();
        (*os)
            << "<knowledge_base path=\"" << base->filename()
            << "\" size=\"" << base->num_of_axioms()
            << "\" max_distance=\"" << base->get_max_distance()
            << "\"></knowledge_base>" << std::endl;

        (*os)
            << "<params timeout_lhs=\"" << timeout_lhs().get()
            << "\" timeout_ilp=\"" << timeout_ilp().get()
            << "\" timeout_sol=\"" << timeout_sol().get()
            << "\" timeout_all=\"" << timeout_all().get()
            << "\" verbose=\"" << verbose();

        for (auto it = m_params.begin(); it != m_params.end(); ++it)
            (*os) << "\" " << it->first << "=\"" << it->second;

        for (auto it = m_flags.begin(); it != m_flags.end(); ++it)
            (*os) << "\" " << (*it) << "=\"yes";

#ifdef DISABLE_CANCELING
        (*os) << "\" disable_canceling=\"yes";
#endif

#ifdef DISABLE_HARD_TERM
        (*os) << "\" disable_hard_term=\"yes";
#endif

        (*os) << "\"></params>" << std::endl;

        (*os) << "</configure>" << std::endl;
    };

    auto f_write = [&](const std::string &key)
    {
        std::ofstream *fo(NULL);
        if ((fo = _open_file(param(key), (std::ios::out | std::ios::trunc))) != NULL)
        {
            write(fo);
            delete fo;
        }
    };

    f_write("path_lhs_out");
    f_write("path_ilp_out");
    f_write("path_sol_out");
    f_write("path_out");
    write(&std::cout);
}
开发者ID:disooqi,项目名称:phillip,代码行数:92,代码来源:phillip.cpp


示例8: RefreshProxyThruMyProxy


//.........这里部分代码省略.........

  args.AppendArg("--dn_as_username");

  args.AppendArg("--proxy_lifetime");	// hours
  args.AppendArg(6);

  args.AppendArg("--stdin_pass");

  args.AppendArg("--username");
  args.AppendArg(username);

  // Optional port argument
  if (myproxy_port) {
	  args.AppendArg("--psport");
	  args.AppendArg(myproxy_port);
  }

  // Optional credential name
  if	(	((X509Credential*)proxy->cred)->GetCredentialName() && 
  			( ((X509Credential*)proxy->cred)->GetCredentialName() )[0] ) {
	  args.AppendArg("--credname");
	  args.AppendArg(((X509Credential*)proxy->cred)->GetCredentialName());
  }


  // Create temporary file to store myproxy-get-delegation's stderr
  // The file will be owned by the "condor" user

  priv_state priv = set_condor_priv();
  proxy->get_delegation_err_filename = create_temp_file();
  if (proxy->get_delegation_err_filename == NULL) {
	dprintf (D_ALWAYS, "get_delegation create_temp_file() failed: %s\n",
			strerror(errno) );
	proxy->get_delegation_reset();
	return FALSE;
  }
  status = chmod (proxy->get_delegation_err_filename, 0600);
  if (status == -1) {
	dprintf (D_ALWAYS, "chmod() get_delegation_err_filename %s failed: %s\n",
			proxy->get_delegation_err_filename, strerror(errno) );
	proxy->get_delegation_reset();
	return FALSE;
  }


  proxy->get_delegation_err_fd = safe_open_wrapper_follow(proxy->get_delegation_err_filename,O_RDWR);
  if (proxy->get_delegation_err_fd == -1) {
    dprintf (D_ALWAYS, "Error opening get_delegation file %s: %s\n",
	     proxy->get_delegation_err_filename, strerror(errno) );
	proxy->get_delegation_reset();
	return FALSE;
  }
  set_priv (priv);


  int arrIO[3];
  arrIO[0]=proxy->get_delegation_password_pipe[0]; //stdin
  arrIO[1]=-1; //proxy->get_delegation_err_fd;
  arrIO[2]=proxy->get_delegation_err_fd; // stderr


  char * myproxy_get_delegation_pgm = param ("MYPROXY_GET_DELEGATION");
  if (!myproxy_get_delegation_pgm) {
    dprintf (D_ALWAYS, "MYPROXY_GET_DELEGATION not defined in config file\n");
    return FALSE;
  }
  MyString args_string;
  args.GetArgsStringForDisplay(&args_string);
  dprintf (D_ALWAYS, "Calling %s %s\n", myproxy_get_delegation_pgm, args_string.Value());

  int pid = daemonCore->Create_Process (
					myproxy_get_delegation_pgm,		// name
					args,				 			// args
					PRIV_USER_FINAL,				// priv
					myproxyGetDelegationReaperId,	// reaper_id
					FALSE,							// want_command_port
					FALSE,							// want_command_port
					&myEnv,							// env
					NULL,							// cwd		
					NULL,							// family_info
					NULL,							// sock_inherit_list
					arrIO);							// in/out/err streams
  													// nice_inc
													// job_opt_mask
  free (myproxy_get_delegation_pgm);
  myproxy_get_delegation_pgm = NULL;


  

  if (pid == FALSE) {
    dprintf (D_ALWAYS, "Failed to run myproxy-get-delegation\n");
	proxy->get_delegation_reset();
    return FALSE;
  }

  proxy->get_delegation_pid = pid;

  return TRUE;
}
开发者ID:blueskyll,项目名称:condor,代码行数:101,代码来源:credd.cpp


示例9: Init

void
Init() {
  char * tmp = param( "CRED_SUPER_USERS" );
  if( tmp ) {
    super_users.initializeFromString( tmp );
    free( tmp );
  } else {
#if defined(WIN32)
    super_users.initializeFromString("Administrator");
#else
    super_users.initializeFromString("root");
#endif
  }

  char * spool = param ("SPOOL");

  tmp = param ( "CRED_STORE_DIR" );
  if ( tmp ) {
    cred_store_dir = tmp;
  } else {
    cred_store_dir = dircat (spool, "cred");
  } 
  if ( spool != NULL ) {
	  free (spool);
  }

  tmp = param ( "CRED_INDEX_FILE" );
  if (tmp ) {
    cred_index_file = tmp;
  } else {
    cred_index_file = dircat (cred_store_dir, "cred-index");
  }

  // default 1 hr
  default_cred_expire_threshold = param_integer ("DEFAULT_CRED_EXPIRE_THRESHOLD", 3600);

	// default 1 minute
	CheckCredentials_interval =
		param_integer (
			"CRED_CHECK_INTERVAL",		// param name
			DEF_CRED_CHECK_INTERVAL		// default value, seconds
	  );

  struct stat stat_buff;
  if (stat (cred_store_dir, &stat_buff)) {
    dprintf (D_ALWAYS, "ERROR: Cred store directory %s does not exist\n", cred_store_dir);
    DC_Exit (1 );
  }

  if (stat (cred_index_file, &stat_buff)) {
    dprintf (D_ALWAYS, "Creating credential index file %s\n", cred_index_file);
    priv_state priv = set_root_priv();
    int fd = safe_open_wrapper_follow(cred_index_file, O_WRONLY | O_CREAT | O_TRUNC, 0600);
    if (fd != -1) {
      close (fd);
      set_priv (priv);
    } else {
      dprintf (D_ALWAYS, "ERROR: Unable to create credential index file %s\n", cred_index_file);
      set_priv (priv);
      DC_Exit (1 );
    }
  } else {
    if ((stat_buff.st_mode & (S_IRWXG | S_IRWXO)) ||
	(stat_buff.st_uid != getuid())) {
      dprintf (D_ALWAYS, "ERROR: Invalid ownership / permissions on credential index file %s\n", 
	       cred_index_file);
      DC_Exit (1 );
    }
  }

}
开发者ID:blueskyll,项目名称:condor,代码行数:71,代码来源:credd.cpp


示例10: param

app * pb_util::mk_at_least_k(unsigned num_args, expr * const * args, unsigned k) {
    parameter param(k);
    return m.mk_app(m_fid, OP_AT_LEAST_K, 1, &param, num_args, args, m.mk_bool_sort());
}
开发者ID:MikolasJanota,项目名称:z3,代码行数:4,代码来源:pb_decl_plugin.cpp


示例11: writeSubmitFile

//---------------------------------------------------------------------------
void writeSubmitFile(/* const */ SubmitDagDeepOptions &deepOpts,
			/* const */ SubmitDagShallowOptions &shallowOpts)
{
	FILE *pSubFile = safe_fopen_wrapper_follow(shallowOpts.strSubFile.Value(), "w");
	if (!pSubFile)
	{
		fprintf( stderr, "ERROR: unable to create submit file %s\n",
				 shallowOpts.strSubFile.Value() );
		exit( 1 );
	}

	const char *executable = NULL;
	MyString valgrindPath; // outside if so executable is valid!
	if ( shallowOpts.runValgrind ) {
		valgrindPath = which( valgrind_exe );
		if ( valgrindPath == "" ) {
			fprintf( stderr, "ERROR: can't find %s in PATH, aborting.\n",
				 		valgrind_exe );
			exit( 1 );
		} else {
			executable = valgrindPath.Value();
		}
	} else {
		executable = deepOpts.strDagmanPath.Value();
	}

    fprintf(pSubFile, "# Filename: %s\n", shallowOpts.strSubFile.Value());

    fprintf(pSubFile, "# Generated by condor_submit_dag ");
	shallowOpts.dagFiles.rewind();
	char *dagFile;
	while ( (dagFile = shallowOpts.dagFiles.next()) != NULL ) {
    	fprintf(pSubFile, "%s ", dagFile);
	}
    fprintf(pSubFile, "\n");

    fprintf(pSubFile, "universe\t= scheduler\n");
    fprintf(pSubFile, "executable\t= %s\n", executable);
	fprintf(pSubFile, "getenv\t\t= True\n");
	fprintf(pSubFile, "output\t\t= %s\n", shallowOpts.strLibOut.Value());
    fprintf(pSubFile, "error\t\t= %s\n", shallowOpts.strLibErr.Value());
    fprintf(pSubFile, "log\t\t= %s\n", shallowOpts.strSchedLog.Value());
#if !defined ( WIN32 )
    fprintf(pSubFile, "remove_kill_sig\t= SIGUSR1\n" );
#endif
    fprintf(pSubFile, "+%s\t= \"%s =?= $(cluster)\"\n",
				ATTR_OTHER_JOB_REMOVE_REQUIREMENTS, ATTR_DAGMAN_JOB_ID );

		// ensure DAGMan is automatically requeued by the schedd if it
		// exits abnormally or is killed (e.g., during a reboot)
	const char *defaultRemoveExpr = "( ExitSignal =?= 11 || "
				"(ExitCode =!= UNDEFINED && ExitCode >=0 && ExitCode <= 2))";
	MyString removeExpr(defaultRemoveExpr);
	char *tmpRemoveExpr = param("DAGMAN_ON_EXIT_REMOVE");
	if ( tmpRemoveExpr ) {
		removeExpr = tmpRemoveExpr;
		free(tmpRemoveExpr);
	}
    fprintf(pSubFile, "# Note: default on_exit_remove expression:\n");
	fprintf(pSubFile, "# %s\n", defaultRemoveExpr);
	fprintf(pSubFile, "# attempts to ensure that DAGMan is automatically\n");
	fprintf(pSubFile, "# requeued by the schedd if it exits abnormally or\n");
    fprintf(pSubFile, "# is killed (e.g., during a reboot).\n");
    fprintf(pSubFile, "on_exit_remove\t= %s\n", removeExpr.Value() );

    fprintf(pSubFile, "copy_to_spool\t= %s\n", shallowOpts.copyToSpool ?
				"True" : "False" );

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Be sure to change MIN_SUBMIT_FILE_VERSION in dagman_main.cpp
	// if the arguments passed to condor_dagman change in an
	// incompatible way!!
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	ArgList args;

	if ( shallowOpts.runValgrind ) {
		args.AppendArg("--tool=memcheck");
		args.AppendArg("--leak-check=yes");
		args.AppendArg("--show-reachable=yes");
		args.AppendArg(deepOpts.strDagmanPath.Value());
	}

	args.AppendArg("-f");
	args.AppendArg("-l");
	args.AppendArg(".");
	if ( shallowOpts.iDebugLevel != DEBUG_UNSET ) {
		args.AppendArg("-Debug");
		args.AppendArg(shallowOpts.iDebugLevel);
	}
	args.AppendArg("-Lockfile");
	args.AppendArg(shallowOpts.strLockFile.Value());
	args.AppendArg("-AutoRescue");
	args.AppendArg(deepOpts.autoRescue);
	args.AppendArg("-DoRescueFrom");
	args.AppendArg(deepOpts.doRescueFrom);
	if(!deepOpts.always_use_node_log) {
		args.AppendArg("-dont_use_default_node_log");
	}

//.........这里部分代码省略.........
开发者ID:cwmartin,项目名称:htcondor,代码行数:101,代码来源:condor_submit_dag.cpp


示例12: TEST_F

TEST_F(use_program_test, has_correct_params) {
  glUseProgram(1);
  auto first_invocation = s_stub.function_calls().front();
  ASSERT_EQ(first_invocation.param("program"), t_arg(1));
}
开发者ID:scones,项目名称:glew-mock,代码行数:5,代码来源:use_program.cpp


示例13: block_ndx

void AtmelSWIAnalyzerResults::GetTextsForPacketSegmentFrame(const Frame& f, DisplayBase display_base, std::vector<std::string>& texts)
{
	const int BUFF_SIZE = 128;
	char number_str[BUFF_SIZE];
	std::string tmpstr;

	texts.clear();

	// get the I/O block
	int block_ndx(static_cast<int>(f.mData2 & 0xffffffff));
	int block_offset(static_cast<int>(((f.mData2 >> 32) & 0xffffffff)));

	const SWI_Block& block(mBlocks[block_ndx]);

	SWI_PacketParam* param(PacketParams + f.mData1);

	switch (param->Type)
	{
	case PT_Opcode:

		AnalyzerHelpers::GetNumberString(block.Opcode, display_base, 8, number_str, BUFF_SIZE);

		texts.push_back(std::string("Opcode ") + param->Name + " (" + number_str + ")");

		texts.push_back(number_str);
		texts.push_back(param->Name);
		texts.push_back(std::string("Opcode ") + param->Name);
		texts.push_back(std::string(param->Name) + " (" + number_str + ")");

		break;
	case PT_RawBytes:
		{
		std::string array_str(GetByteArrayNumberStr(block.Data.begin() + block_offset, param->Length, display_base));

		texts.push_back(std::string(param->Name) + " (" + array_str + ")");

		texts.push_back(array_str);
		texts.push_back(param->Name);
		}

		break;
	case PT_Zone:
		{
		AnalyzerHelpers::GetNumberString(block.Opcode, display_base, 8, number_str, BUFF_SIZE);

		U8 zone = block.Data[block_offset] & 3;
		std::string zonestr("<unknown>");
		if (zone == 0)
			zonestr = "Config";
		else if (zone == 1)
			zonestr = "OTP";
		else if (zone == 2)
			zonestr = "Data";

		const char* lenstr;
		if (block.Data[block_offset] & 0x80)
			lenstr = "32 bytes";
		else
			lenstr = "4 bytes";

		texts.push_back("Zone " + zonestr + ", " + lenstr);

		texts.push_back(number_str);
		texts.push_back(std::string(param->Name) + " (" + number_str + ")");
		}
		break;
	case PT_Byte:
		AnalyzerHelpers::GetNumberString(block.Data[block_offset], display_base, 8, number_str, BUFF_SIZE);
		
		texts.push_back(std::string(param->Name) + " (" + number_str + ")");
		texts.push_back(param->Name);

		break;

	case PT_Status:
		AnalyzerHelpers::GetNumberString(block.Data[block_offset], display_base, 8, number_str, BUFF_SIZE);

		tmpstr = "<undefined>";
		if (block.Data[block_offset] == 0x00)
			tmpstr = "Command executed successfully";
		else if (block.Data[block_offset] == 0x01)
			tmpstr = "Checkmac miscompare";
		else if (block.Data[block_offset] == 0x03)
			tmpstr = "Parse error";
		else if (block.Data[block_offset] == 0x0F)
			tmpstr = "Execution error";
		else if (block.Data[block_offset] == 0x11)
			tmpstr = "Wake received properly";
		else if (block.Data[block_offset] == 0xFF)
			tmpstr = "CRC or communication error";
		else
			tmpstr = "Unknown status code";

		texts.push_back(std::string(param->Name) + " " + tmpstr + " (" + number_str + ")" );
		texts.push_back(std::string(param->Name) + " " + tmpstr);
		texts.push_back(std::string(param->Name) + " (" + number_str + ")");
		texts.push_back(tmpstr);
		texts.push_back(param->Name);

		break;
//.........这里部分代码省略.........
开发者ID:blargony,项目名称:RFFEAnalyzer,代码行数:101,代码来源:AtmelSWIAnalyzerResults.cpp


示例14: placingFootprint


//.........这里部分代码省略.........
				creature->sendSystemMessage("@player_structure:no_room"); //there is no room to place the structure here..

				return 1;
			}

			if (placingFootprint.containsPoint(xx0, yy0)
					|| placingFootprint.containsPoint(xx0, yy1)
					|| placingFootprint.containsPoint(xx1, yy0)
					|| placingFootprint.containsPoint(xx1, yy1)
					|| (xx0 == x0 && yy0 == y0 && xx1 == x1 && yy1 == y1)) {
				//info("placing footprint contains existing point", true);

				creature->sendSystemMessage("@player_structure:no_room"); //there is no room to place the structure here.

				return 1;
			}
		}
	}

	int rankRequired = serverTemplate->getCityRankRequired();

	if (city == NULL && rankRequired > 0) {
		creature->sendSystemMessage("@city/city:build_no_city"); // You must be in a city to place that structure.
		return 1;
	}

	if (city != NULL) {
		if (city->isZoningEnabled() && !city->hasZoningRights(creature->getObjectID())) {
			creature->sendSystemMessage("@player_structure:no_rights"); //You don't have the right to place that structure in this city. The mayor or one of the city milita must grant you zoning rights first.
			return 1;
		}

		if (rankRequired != 0 && city->getCityRank() < rankRequired) {
			StringIdChatParameter param("city/city", "rank_req"); // The city must be at least rank %DI (%TO) in order for you to place this structure.
			param.setDI(rankRequired);
			param.setTO("city/city", "rank" + String::valueOf(rankRequired));

			creature->sendSystemMessage(param);
			return 1;
		}

		if (serverTemplate->isCivicStructure() && !city->isMayor(creature->getObjectID()) ) {
				creature->sendSystemMessage("@player_structure:cant_place_civic");//"This structure must be placed within the borders of the city in which you are mayor."
				return 1;
		}

		if (serverTemplate->isUniqueStructure() && city->hasUniqueStructure(serverTemplate->getServerObjectCRC())) {
			creature->sendSystemMessage("@player_structure:cant_place_unique"); //This city can only support a single structure of this type.
			return 1;
		}
	}

	Locker _lock(deed, creature);


	if(serverTemplate->isDerivedFrom("object/building/faction_perk/base/shared_factional_building_base.iff")){
		Zone* zone = creature->getZone();
		if(zone == NULL)
			return 1;

		GCWManager* gcwMan = zone->getGCWManager();
		if(gcwMan == NULL)
			return 1;

		if(!gcwMan->canPlaceMoreBases(creature))
			return 1;
开发者ID:Nifdoolb,项目名称:Server,代码行数:67,代码来源:StructureManager.cpp


示例15: KeyHandleFromPrivateKey

// Convert a Private Key object into an opaque key handle, using AES Key Wrap
// with the long-lived aPersistentKey mixed with aAppParam to convert aPrivKey.
// The key handle's format is version || saltLen || salt || wrappedPrivateKey
static UniqueSECItem
KeyHandleFromPrivateKey(const UniquePK11SlotInfo& aSlot,
                        const UniquePK11SymKey& aPersistentKey,
                        uint8_t* aAppParam, uint32_t aAppParamLen,
                        const UniqueSECKEYPrivateKey& aPrivKey,
                        const nsNSSShutDownPreventionLock&)
{
  MOZ_ASSERT(aSlot);
  MOZ_ASSERT(aPersistentKey);
  MOZ_ASSERT(aAppParam);
  MOZ_ASSERT(aPrivKey);
  if (NS_WARN_IF(!aSlot || !aPersistentKey || !aPrivKey || !aAppParam)) {
    return nullptr;
  }

  // Generate a random salt
  uint8_t saltParam[kSaltByteLen];
  SECStatus srv = PK11_GenerateRandomOnSlot(aSlot.get(), saltParam,
                                            sizeof(saltParam));
  if (NS_WARN_IF(srv != SECSuccess)) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning,
            ("Failed to generate a salt, NSS error #%d", PORT_GetError()));
    return nullptr;
  }

  // Prepare the HKDF (https://tools.ietf.org/html/rfc5869)
  CK_NSS_HKDFParams hkdfParams = { true, saltParam, sizeof(saltParam),
                                   true, aAppParam, aAppParamLen };
  SECItem kdfParams = { siBuffer, (unsigned char*)&hkdfParams,
                        sizeof(hkdfParams) };

  // Derive a wrapping key from aPersistentKey, the salt, and the aAppParam.
  // CKM_AES_KEY_GEN and CKA_WRAP are key type and usage attributes of the
  // derived symmetric key and don't matter because we ignore them anyway.
  UniquePK11SymKey wrapKey(PK11_Derive(aPersistentKey.get(), CKM_NSS_HKDF_SHA256,
                                       &kdfParams, CKM_AES_KEY_GEN, CKA_WRAP,
                                       kWrappingKeyByteLen));
  if (NS_WARN_IF(!wrapKey.get())) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning,
            ("Failed to derive a wrapping key, NSS error #%d", PORT_GetError()));
    return nullptr;
  }

  UniqueSECItem wrappedKey(::SECITEM_AllocItem(/* default arena */ nullptr,
                                               /* no buffer */ nullptr,
                                               kWrappedKeyBufLen));
  if (NS_WARN_IF(!wrappedKey)) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning, ("Failed to allocate memory"));
    return nullptr;
  }

  UniqueSECItem param(PK11_ParamFromIV(CKM_NSS_AES_KEY_WRAP_PAD,
                                       /* default IV */ nullptr ));

  srv = PK11_WrapPrivKey(aSlot.get(), wrapKey.get(), aPrivKey.get(),
                         CKM_NSS_AES_KEY_WRAP_PAD, param.get(), wrappedKey.get(),
                         /* wincx */ nullptr);
  if (NS_WARN_IF(srv != SECSuccess)) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning,
            ("Failed to wrap U2F key, NSS error #%d", PORT_GetError()));
    return nullptr;
  }

  // Concatenate the salt and the wrapped Private Key together
  mozilla::dom::CryptoBuffer keyHandleBuf;
  if (NS_WARN_IF(!keyHandleBuf.SetCapacity(wrappedKey.get()->len + sizeof(saltParam) + 2,
                                           mozilla::fallible))) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning, ("Failed to allocate memory"));
    return nullptr;
  }

  // It's OK to ignore the return values here because we're writing into
  // pre-allocated space
  keyHandleBuf.AppendElement(SoftTokenHandle::Version1, mozilla::fallible);
  keyHandleBuf.AppendElement(sizeof(saltParam), mozilla::fallible);
  keyHandleBuf.AppendElements(saltParam, sizeof(saltParam), mozilla::fallible);
  keyHandleBuf.AppendSECItem(wrappedKey.get());

  UniqueSECItem keyHandle(::SECITEM_AllocItem(nullptr, nullptr, 0));
  if (NS_WARN_IF(!keyHandle)) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning, ("Failed to allocate memory"));
    return nullptr;
  }

  if (NS_WARN_IF(!keyHandleBuf.ToSECItem(/* default arena */ nullptr, keyHandle.get()))) {
    MOZ_LOG(gNSSTokenLog, LogLevel::Warning, ("Failed to allocate memory"));
    return nullptr;
  }
  return keyHandle;
}
开发者ID:ncalexan,项目名称:gecko-dev,代码行数:93,代码来源:U2FSoftTokenManager.cpp


示例16: ParseOptionalFloat

	void PartSysParser::ParseEmitter(const TabFileRecord& record) {
		auto systemName = record[COL_PARTSYS_NAME].AsString();

		auto& system = mSpecs[tolower(systemName)];
		// Create it on demand
		if (!system) {
			system = std::make_shared<PartSysSpec>(systemName);
		}

		// Add the emitter
		auto emitter = system->CreateEmitter(record[COL_EMITTER_NAME 

鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ param_boolean函数代码示例发布时间:2022-05-30
下一篇:
C++ parallelsDriverLock函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap