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


C++ configuration函数代码示例

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


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

示例1: runComparisions

void
runComparisions(nemo::Network* net)
{
	/* No need to always test all these, so just skip some random proportion of
	 * these */
	rng_t rng;
	rng.seed(uint32_t(std::time(0)));
	brng_t skip(rng, boost::bernoulli_distribution<double>(0.8));
	unsigned duration = 2;

	/* simulations should produce repeatable results both with the same
	 * partition size and with different ones. */
	{
		bool stdp_conf[2] = { false, true };
		unsigned psize_conf[3] = { 1024, 512, 256 };

		for(unsigned si=0; si < 2; ++si)
		for(unsigned pi1=0; pi1 < 3; ++pi1) 
		for(unsigned pi2=0; pi2 < 3; ++pi2) {
			if(skip()) {
				continue;
			}
			nemo::Configuration conf1 = configuration(stdp_conf[si], psize_conf[pi1]);
			nemo::Configuration conf2 = configuration(stdp_conf[si], psize_conf[pi2]);
			compareSimulations(net, conf1, net, conf2, duration, stdp_conf[si]);
		}
	}

}
开发者ID:MogeiWang,项目名称:nemosim,代码行数:29,代码来源:test.cpp

示例2: configuration

QString AMScanActionInfo::dbLoadWarnings() const {
    if(configuration()) {
        return configuration()->dbLoadWarnings();
    } else {
        return QString("An unknown error occured loading the scan configuration");
    }
}
开发者ID:anukat2015,项目名称:acquaman,代码行数:7,代码来源:AMScanActionInfo.cpp

示例3: LOG_ERROR_S

bool WServer::start()
{
  if (isRunning()) {
    LOG_ERROR_S(this, "start(): server already started!");
    return false;
  }

  LOG_INFO_S(this, "initializing " <<
	     (impl_->sessionId_.empty() ? "shared" : "dedicated") <<
	     " wtfcgi session process");

  if (configuration().webSockets()) {
    LOG_ERROR_S(this, "FastCGI does not support web-sockets, disabling");
    configuration().setWebSockets(false);
  }

  configuration().setNeedReadBodyBeforeResponse(true);

  if (signal(SIGTERM, Wt::handleSigTerm) == SIG_ERR)
    LOG_ERROR_S(this, "cannot catch SIGTERM: signal(): " << strerror(errno));
  if (signal(SIGUSR1, Wt::handleSigUsr1) == SIG_ERR) 
    LOG_ERROR_S(this, "cannot catch SIGUSR1: signal(): " << strerror(errno));
  if (signal(SIGHUP, Wt::handleSigHup) == SIG_ERR) 
    LOG_ERROR_S(this, "cannot catch SIGHUP: signal(): " << strerror(errno));

  webController_ = new Wt::WebController(*this, impl_->sessionId_, false);

  impl_->run();

  return false;
}
开发者ID:ReWeb3D,项目名称:wt,代码行数:31,代码来源:WServer.C

示例4: setCatchSignals

bool WServer::start()
{
  setCatchSignals(!impl_->serverConfiguration_->gdb());

  if (isRunning()) {
    LOG_ERROR("start(): server already started!");
    return false;
  }

  LOG_INFO("initializing built-in wthttpd");

#ifndef WIN32
  srand48(getpid());
#endif

  // Override configuration settings
  configuration().setRunDirectory(std::string());

  configuration().setUseSlashExceptionForInternalPaths
    (impl_->serverConfiguration_->defaultStatic());
  
  if (!impl_->serverConfiguration_->sessionIdPrefix().empty())
    configuration().setSessionIdPrefix(impl_->serverConfiguration_
				       ->sessionIdPrefix());

  configuration().setDefaultEntryPoint(impl_->serverConfiguration_
				       ->deployPath());

  if (impl_->serverConfiguration_->threads() != -1)
    configuration().setNumThreads(impl_->serverConfiguration_->threads());

  try {
    impl_->server_ = new http::server::Server(*impl_->serverConfiguration_,
					      *this);

#ifndef WT_THREADED
    LOG_WARN("No boost thread support, running in main thread.");
#endif // WT_THREADED

    webController_->start();

    ioService().start();

#ifndef WT_THREADED
    delete impl_->server_;
    impl_->server_ = 0;

    ioService().stop();

    return false;
#else
    return true;
#endif // WT_THREADED

  } catch (asio_system_error& e) {
    throw Exception(std::string("Error (asio): ") + e.what());
  } catch (std::exception& e) {
    throw Exception(std::string("Error: ") + e.what());
  }
}
开发者ID:Dinesh-Ramakrishnan,项目名称:wt,代码行数:60,代码来源:WServer.C

示例5: assert

void Field::write(const H5::CommonFG &loc, const H5::H5Location &parent) const {
  assert(invariant());
  auto group = loc.createGroup(name());
  H5::createAttribute(group, "type", project()->enumtype, "Field");
  H5::createAttribute(group, "name", name());
  // H5::createHardLink(group, "project", parent, ".");
  H5::createHardLink(group, "..", parent, ".");
  H5::createSoftLink(group, "project", "..");
  // H5::createHardLink(group, "configuration", parent,
  //                    "configurations/" + configuration->name());
  H5::createSoftLink(group, "configuration",
                     "../configurations/" + configuration()->name());
  H5::createHardLink(group, "project/configurations/" +
                                configuration()->name() + "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "manifold", parent,
  //                    "manifolds/" + manifold->name());
  H5::createSoftLink(group, "manifold", "../manifolds/" + manifold()->name());
  H5::createHardLink(group,
                     "project/manifolds/" + manifold()->name() + "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "tangentspace", parent,
  //                    "tangentspaces/" + tangentspace->name());
  H5::createSoftLink(group, "tangentspace",
                     "../tangentspaces/" + tangentspace()->name());
  H5::createHardLink(group, "project/tangentspaces/" + tangentspace()->name() +
                                "/fields",
                     name(), group, ".");
  // H5::createHardLink(group, "tensortype", parent,
  //                    "tensortypes/" + tensortype->name());
  H5::createSoftLink(group, "tensortype",
                     "../tensortypes/" + tensortype()->name());
  H5::createGroup(group, "discretefields", discretefields());
}
开发者ID:eschnett,项目名称:SimulationIO,代码行数:34,代码来源:Field.cpp

示例6: switch

 Array DifferentialEvolution::getMutationProbabilities(
                         const std::vector<Candidate> & population) const {
     Array mutationProbabilities = currGenCrossover_;
     switch (configuration().crossoverType) {
       case Normal:
         break;
       case Binomial:
         mutationProbabilities = currGenCrossover_
             * (1.0 - 1.0 / population.front().values.size())
             + 1.0 / population.front().values.size();
         break;
       case Exponential:
         for (Size coIter = 0;coIter< currGenCrossover_.size(); coIter++){
             mutationProbabilities[coIter] =
                 (1.0 - std::pow(currGenCrossover_[coIter],
                                 (int) population.front().values.size()))
                 / (population.front().values.size()
                    * (1.0 - currGenCrossover_[coIter]));
         }
         break;
       default:
         QL_FAIL("Unknown crossover type ("
                 << Integer(configuration().crossoverType) << ")");
         break;
     }
     return mutationProbabilities;
 }
开发者ID:ChinaQuants,项目名称:quantlib-old,代码行数:27,代码来源:differentialevolution.cpp

示例7: log_error

        trainer_result_t batch_trainer_t::train(
                const task_t& task, const fold_t& fold, const loss_t& loss, size_t nthreads, const string_t& criterion,
                model_t& model) const
        {
                if (fold.second != protocol::train)
                {
                        log_error() << "batch trainer: can only train models with training samples!";
                        return trainer_result_t();
                }

                // initialize the model
                model.resize(task, true);
                model.random_params();

                // prune training & validation data
                sampler_t tsampler(task);
                tsampler.setup(fold).setup(sampler_t::atype::annotated);

                sampler_t vsampler(task);
                tsampler.split(80, vsampler);

                if (tsampler.empty() || vsampler.empty())
                {
                        log_error() << "batch trainer: no annotated training samples!";
                        return trainer_result_t();
                }

                // parameters
                const size_t iterations = math::clamp(text::from_params<size_t>(configuration(), "iters", 1024), 4, 4096);
                const scalar_t epsilon = math::clamp(text::from_params<scalar_t>(configuration(), "eps", 1e-4), 1e-8, 1e-3);

                const optim::batch_optimizer optimizer = text::from_string<optim::batch_optimizer>
                        (text::from_params<string_t>(configuration(), "opt", "lbfgs"));

                // train the model
                const trainer_result_t result = ncv::batch_train(
                        model, task, tsampler, vsampler, nthreads,
                        loss, criterion, optimizer, iterations, epsilon);

                const trainer_state_t state = result.optimum_state();

                log_info() << "optimum [train = " << state.m_tvalue << "/" << state.m_terror_avg
                           << ", valid = " << state.m_vvalue << "/" << state.m_verror_avg
                           << ", epoch = " << result.optimum_epoch()
                           << ", config = " << text::concatenate(result.optimum_config(), "/")
                           << "].";

                // OK
                if (result.valid())
                {
                        model.load_params(result.optimum_params());
                }
                return result;
        }
开发者ID:0x0all,项目名称:nanocv,代码行数:54,代码来源:batch_trainer.cpp

示例8: info

void xmppClient::slotHostInfoFinished(const QHostInfo &hostInfo)
{
    if (!hostInfo.addresses().isEmpty()) {
        info(QString("Found TURN server %1 port %2 for domain %3").arg(hostInfo.addresses().first().toString(), QString::number(m_turnPort), configuration().domain()));
        callManager->setTurnServer(hostInfo.addresses().first(), m_turnPort);
        callManager->setTurnUser(configuration().user());
        callManager->setTurnPassword(configuration().password());
    }
    m_turnFinished = true;
    startCall();
}
开发者ID:ninoles,项目名称:qxmpp,代码行数:11,代码来源:example_4_callHandling.cpp

示例9: processor

void CppEditorDocument::setPreprocessorSettings(const CppTools::ProjectPart::Ptr &projectPart,
        const QByteArray &defines)
{
    const auto parser = processor()->parser();
    QTC_ASSERT(parser, return);
    if (parser->projectPart() != projectPart || parser->configuration().editorDefines != defines) {
        CppTools::BaseEditorDocumentParser::Configuration config = parser->configuration();
        config.manuallySetProjectPart = projectPart;
        config.editorDefines = defines;
        parser->setConfiguration(config);

        emit preprocessorSettingsChanged(!defines.trimmed().isEmpty());
    }
}
开发者ID:acacid,项目名称:qt-creator,代码行数:14,代码来源:cppeditordocument.cpp

示例10: warning

void ChatClient::_q_hostInfoFinished(const QHostInfo &hostInfo)
{
    if (hostInfo.addresses().isEmpty()) {
        warning(QString("Could not lookup TURN server %1").arg(hostInfo.hostName()));
        return;
    }

    QXmppCallManager *callManager = findExtension<QXmppCallManager>();
    if (callManager) {
        callManager->setTurnServer(hostInfo.addresses().first(), d->turnPort);
        callManager->setTurnUser(configuration().user());
        callManager->setTurnPassword(configuration().password());
    }
}
开发者ID:tshipa,项目名称:wilink,代码行数:14,代码来源:client.cpp

示例11: throw

/**
 * Sets any parameter in a user configuration file. Also creates a configuration file if it is missing.
 *
 * @param paramName name of parameter that needs to be changed or created.
 * @param value value for changing or adding to a given parameter. If value is an empty string, the walue for a given parameter will be erased.
 * @throws IOException exception is thrown if reading, writing or creating of a user configuration file fails.
 */
void digidoc::XmlConf::setUserConf(const std::string &paramName, const std::string &value) throw(IOException)
{
    Param newParam(value, paramName);
    std::auto_ptr< ::Configuration > conf;
    Configuration::ParamSequence paramSeq;

    try
    {
        if(util::File::fileExists(USER_CONF_LOC))
        {
            
            //open user conf file
            conf = configuration (USER_CONF_LOC, xml_schema::Flags::dont_initialize);
            paramSeq = conf->param();
            Configuration::ParamSequence::iterator it;

            for( it = paramSeq.begin(); it != paramSeq.end(); it++)
            {
                if (paramName.compare(it->name()) == 0)
                {
                    paramSeq.erase(it);
                    break;
                }
            }
            if (value.size()) //if it's a new parameter
                paramSeq.push_back(newParam);
        }
        else
        {
            //Check if directory exists
            if (!util::File::directoryExists(getUserConfDir()))
                util::File::createDirectory(getUserConfDir());

            //create a new file
            //copy global conf and erase data
            conf = configuration (DEFAULT_CONF_LOC, xml_schema::Flags::dont_initialize);
            Configuration::OcspSequence ocspSeq;
            paramSeq.push_back(newParam);
            conf->ocsp(ocspSeq); //replace all ocsp data with empty ocsp sequence
        }
        conf->param(paramSeq); //replace all param data with new modified param sequence
    }
    catch (const xml_schema::Exception& e)
    {
        std::ostringstream oss;
        oss << e;
        THROW_IOEXCEPTION("(in set %s) Failed to parse configuration: %s", paramName.c_str(), oss.str().c_str());
    }
    serializeUserConf(*conf);
}
开发者ID:Krabi,项目名称:idkaart_public,代码行数:57,代码来源:XmlConf.cpp

示例12: OVR_DEBUG_LOG

bool LatencyTest::SetDevice(LatencyTestDevice* device)
{

    if (device != Device)
    {
        if (device != NULL)
        {
            if (device->GetMessageHandler() != NULL)
            {
                OVR_DEBUG_LOG(
                    ("LatencyTest::AttachToDevice failed - device %p already has handler", device));
                return false;
            }
        }

        if (Device != NULL)
        {
            Device->SetMessageHandler(0);
        }
        Device = device;

        if (Device != NULL)
        {
            Device->SetMessageHandler(&Handler);

            // Set trigger threshold.
            LatencyTestConfiguration configuration(SENSOR_DETECT_THRESHOLD, false);     // No samples streaming.
            Device->SetConfiguration(configuration, true);
        }
    }

    return true;
}
开发者ID:ReallyRad,项目名称:ofxOculusRift,代码行数:33,代码来源:Util_LatencyTest.cpp

示例13: testNonContigousNeuronIndices

void
testNonContigousNeuronIndices(backend_t backend, unsigned n0, unsigned nstep)
{
	unsigned ncount = 1000;
	bool stdp = false;

	boost::scoped_ptr<nemo::Network> net0(createRing(ncount, 0, false, nstep));
	boost::scoped_ptr<nemo::Network> net1(createRing(ncount, n0, false, nstep));

	std::vector<unsigned> cycles0, cycles1;
	std::vector<unsigned> fired0, fired1;

	unsigned seconds = 2;
	nemo::Configuration conf = configuration(false, 1024, backend);

	runSimulation(net0.get(), conf, seconds, &cycles0, &fired0, stdp, std::vector<unsigned>(1, 0));
	runSimulation(net1.get(), conf, seconds, &cycles1, &fired1, stdp, std::vector<unsigned>(1, n0));

	/* The results should be the same, except firing indices
	 * should have the same offset. */
	BOOST_REQUIRE_EQUAL(cycles0.size(), cycles1.size());
	BOOST_REQUIRE_EQUAL(fired0.size(), seconds*ncount);
	BOOST_REQUIRE_EQUAL(fired1.size(), seconds*ncount);

	for(unsigned i = 0; i < cycles0.size(); ++i) {
		BOOST_REQUIRE_EQUAL(cycles0.at(i), cycles1.at(i));
		BOOST_REQUIRE_EQUAL(fired0.at(i), fired1.at(i) - n0);
	}

	//! \todo also add ring networks with different steps.
}
开发者ID:MogeiWang,项目名称:nemosim,代码行数:31,代码来源:test.cpp

示例14: rawDisplayMatrixStream

void rawDisplayMatrixStream(const Matrix *inputMatrix)
{
  const Ring *R = inputMatrix->get_ring();
  const PolyRing *P = R->cast_to_PolyRing();
  if (P == 0) 
    {
      ERROR("expected a polynomial ring");
      return;
    }
  int charac = P->charac();
  int nvars = P->n_vars();
#if defined(HAVE_MATHICGB)
  mgb::GroebnerConfiguration configuration(charac, nvars);
  mgb::GroebnerInputIdealStream input(configuration);

  std::ostringstream computedStr;
  mgb::IdealStreamLog<> computed(computedStr, charac, nvars);
  mgb::IdealStreamChecker<decltype(computed)> checked(computed);

  matrixToStream(inputMatrix, checked); 

  std::cout << "result: " << std::endl;
  std::cout << computedStr.str() << std::endl;
#endif
}
开发者ID:ChristineJost,项目名称:M2,代码行数:25,代码来源:x-gb.cpp

示例15: runRing

void
runRing(backend_t backend, unsigned ncount, unsigned delay)
{
	/* Make sure we go around the ring at least a couple of times */
	const unsigned duration = ncount * 5 / 2;

	nemo::Configuration conf = configuration(false, 1024);
	setBackend(backend, conf);
	boost::scoped_ptr<nemo::Network> net(createRing(ncount, 0, false, 1, delay));
	boost::scoped_ptr<nemo::Simulation> sim(nemo::simulation(*net, conf));

	/* Stimulate a single neuron to get the ring going */
	sim->step(std::vector<unsigned>(1, 0));

	for(unsigned ms=1; ms < duration; ++ms) {
		const std::vector<unsigned>& fired = sim->step();
		if(delay == 1) {
			BOOST_CHECK_EQUAL(fired.size(), 1U);
			BOOST_REQUIRE_EQUAL(fired.front(), ms % ncount);
		} else if(ms % delay == 0) {
			BOOST_CHECK_EQUAL(fired.size(), 1U);
			BOOST_REQUIRE_EQUAL(fired.front(), (ms / delay) % ncount);
		} else {
			BOOST_CHECK_EQUAL(fired.size(), 0U);
		}
	}
}
开发者ID:MogeiWang,项目名称:nemosim,代码行数:27,代码来源:test.cpp


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