本文整理汇总了C++中setConfig函数的典型用法代码示例。如果您正苦于以下问题:C++ setConfig函数的具体用法?C++ setConfig怎么用?C++ setConfig使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setConfig函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: lazy
Field::Field(const TCHAR* Name, const TCHAR* Value, int _config, const bool duplicateValue):
lazy(false)
{
CND_PRECONDITION(Name != NULL, "Name cannot be NULL");
CND_PRECONDITION(Value != NULL, "value cannot be NULL");
CND_PRECONDITION(_tcslen(Value)>0 && _tcslen(Name)>0, "name and value cannot both be empty");
/*
if (_config & INDEX_NO && _config & STORE_NO)
_CLTHROWA(CL_ERR_IllegalArgument,"it doesn't make sense to have a field that is neither indexed nor stored");
if (_config & INDEX_NO && _config & TERMVECTOR_YES)
_CLTHROWA(CL_ERR_IllegalArgument,"cannot store term vector information for a field that is not indexed");
*/
_name = CLStringIntern::intern( Name );
if (duplicateValue)
fieldsData = stringDuplicate( Value );
else
fieldsData = (void*)Value;
valueType = VALUE_STRING;
boost=1.0f;
//config = INDEX_TOKENIZED; // default Field is tokenized and indexed
setConfig(_config);
}
示例2: printf
/*--------------------------------------------------------------------------*/
void engine::start ( int argc , char **argv,bool sg){
int P,p,q;
config.getCmdLine(argc,argv);
P =config.P;
p =config.p;
q =config.q;
time_out = config.to;
printf("Engine start, pure-mpi=%d\n",config.pure_mpi);
ProcessGrid *_PG = new ProcessGrid(P,p,q);
ProcessGrid &PG=*_PG;
DataHostPolicy *hpData = new DataHostPolicy (DataHostPolicy::BLOCK_CYCLIC , PG );
TaskHostPolicy *hpTask = new TaskHostPolicy (TaskHostPolicy::WRITE_DATA_OWNER , PG );
ContextHostPolicy *hpContext = new ContextHostPolicy (ContextHostPolicy::ALL_ENTER , PG );
TaskReadPolicy *hpTaskRead= new TaskReadPolicy (TaskReadPolicy::ALL_READ_ALL , PG );
TaskAddPolicy *hpTaskAdd = new TaskAddPolicy (TaskAddPolicy::WRITE_DATA_OWNER , PG );
glbCtx.setPolicies(hpData,hpTask,hpContext,hpTaskRead,hpTaskAdd);
glbCtx.setConfiguration(&config);
if ( config.pure_mpi )
sg = true;
else
sg= false;
setConfig(&config,sg);
doProcess();
}
示例3: qCCritical
bool EglHwcomposerBackend::initBufferConfigs()
{
const EGLint config_attribs[] = {
EGL_RED_SIZE, 8,
EGL_GREEN_SIZE, 8,
EGL_BLUE_SIZE, 8,
EGL_ALPHA_SIZE, 8,
EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT,
EGL_NONE,
};
EGLint count;
EGLConfig configs[1024];
if (eglChooseConfig(eglDisplay(), config_attribs, configs, 1, &count) == EGL_FALSE) {
qCCritical(KWIN_HWCOMPOSER) << "choose config failed";
return false;
}
if (count != 1) {
qCCritical(KWIN_HWCOMPOSER) << "choose config did not return a config" << count;
return false;
}
setConfig(configs[0]);
return true;
}
示例4: if
void ConfigSubscriptions::buttonClicked (Button* buttonThatWasClicked)
{
//[UserbuttonClicked_Pre]
//[/UserbuttonClicked_Pre]
if (buttonThatWasClicked == subscribeButton)
{
//[UserButtonCode_subscribeButton] -- add your button handler code here..
//[/UserButtonCode_subscribeButton]
}
else if (buttonThatWasClicked == ignoreButton)
{
//[UserButtonCode_ignoreButton] -- add your button handler code here..
//[/UserButtonCode_ignoreButton]
}
//[UserbuttonClicked_Post]
bool should_subscribe = this->subscribeButton->getToggleState() ;
bool should_ignore = this->ignoreButton->getToggleState() ;
int subscribe_mode = (should_ignore) ? NJClient::SUBSCRIBE_DENY :
(should_subscribe)? NJClient::SUBSCRIBE_ALL :
NJClient::SUBSCRIBE_NONE ;
setConfig(CONFIG::SUBSCRIBE_MODE_KEY , var(subscribe_mode)) ;
//[/UserbuttonClicked_Post]
}
示例5: assert
void CBankInstanceConstructor::configureObject(CGObjectInstance * object, CRandomGenerator & rng) const
{
//logGlobal->debugStream() << "Seed used to configure bank is " << rng.nextInt();
auto bank = dynamic_cast<CBank*>(object);
bank->resetDuration = bankResetDuration;
si32 totalChance = 0;
for (auto & node : levels)
totalChance += node["chance"].Float();
assert(totalChance != 0);
si32 selectedChance = rng.nextInt(totalChance - 1);
//logGlobal->debugStream() << "Selected chance for bank config is " << selectedChance;
for (auto & node : levels)
{
if (selectedChance < node["chance"].Float())
{
bank->setConfig(generateConfig(node, rng));
}
else
{
selectedChance -= node["chance"].Float();
}
}
}
示例6: QObject
MachineConfigObject::MachineConfigObject(QObject *parent, MachineConfig *config)
: QObject(parent)
, myConfig(0)
{
setConfig(config);
connect(config, SIGNAL(optionChanged(QString, QString, QString, QVariant)),this,SLOT(configChanged(QString, QString, QString, QVariant)));
}
示例7: throw
//__________________________________________________________________________
void Speller::Aspell::Suggest::init(const std::string& lang,
const std::string& jargon,
const std::string& encoding)
throw( std::invalid_argument, std::runtime_error )
{
// Save aspell configuration values
flang = lang;
fjargon = jargon;
fencoding = encoding;
fconfig = new_aspell_config();
try
{
setConfig();
}
catch( const std::invalid_argument& err )
{
throw err;
}
AspellCanHaveError* ret = new_aspell_speller( fconfig );
delete_aspell_config( fconfig );
if( aspell_error_number( ret ) != 0 )
{
delete_aspell_can_have_error( ret );
throw std::runtime_error( "(Aspell::Speller::Suggest::init"
"): Error in creating speller." );
}
else
{
fspeller = to_aspell_speller( ret );
fconfig = aspell_speller_config( fspeller );
}
}
示例8: onResourceInitialization
//! Initialize resources.
void
onResourceInitialization(void)
{
if (!getConstantParameters())
throw RestartNeeded(DTR("failed to get constant parameters"), c_restart_delay);
setConfig();
std::map<std::string, LED*>::iterator itr = m_led_by_name.begin();
for (unsigned i = 0; i < c_led_count; ++i)
setBrightness(itr->second, 0);
if (!m_args.led_patterns.empty())
{
uint8_t count = m_args.led_patterns.size();
UCTK::Frame frame;
frame.setId(PKT_ID_LED_PATTERN);
frame.setPayloadSize(1 + (count * 2));
frame.set(count, 0);
for (size_t i = 0; i < count; ++i)
frame.set<uint16_t>(m_args.led_patterns[i], 1 + i * 2);
if (!m_ctl->sendFrame(frame))
throw RestartNeeded(DTR("failed to set LED patterns"), c_restart_delay);
}
m_wdog.reset();
setEntityState(IMC::EntityState::ESTA_NORMAL, Status::CODE_ACTIVE);
}
示例9: runtimeSetConfiguration
/******************************************************************************
Configures the device by setting it into the configured state.
Parameters:
cfgnum - configuration number to set
******************************************************************************/
static void runtimeSetConfiguration(uint8_t cfgnum)
{
// Set & save the desired configuration
setConfig(cfgnum);
// Acknowledge the request
txZLP();
}
示例10: CND_PRECONDITION
Field::Field(const TCHAR* Name, Reader* reader, bool store, bool index, bool token, const bool storeTermVector)
{
//Func - Constructor
//Pre - Name != NULL and contains the name of the field
// reader != NULL and contains a Reader
// store indicates if the field must be stored
// index indicates if the field must be indexed
// token indicates if the field must be tokenized
//Post - The instance has been created
CND_PRECONDITION(Name != NULL, "Name is NULL");
CND_PRECONDITION(reader != NULL, "reader is NULL");
_name = LStringIntern::intern( Name CL_FILELINE);
_stringValue = NULL;
_readerValue = reader;
_streamValue = NULL;
boost=1.0f;
omitNorms = false;
int cfg = 0;
if ( store )
cfg |= STORE_YES;
if ( index && token )
cfg |= INDEX_TOKENIZED;
else if ( index && !token )
cfg |= INDEX_UNTOKENIZED;
if ( storeTermVector )
_CLTHROWA(CL_ERR_IllegalArgument,"Stored term vector is deprecated with using this constructor");
setConfig(cfg);
}
示例11: Service
RabbitMQService::RabbitMQService (Glib::KeyFile &confFile) : Service (confFile)
{
sigset_t mask;
std::string address;
int port;
try {
address = confFile.get_string (RABBITMQ_GROUP, RABBITMQ_SERVER_ADDRESS);
} catch (const Glib::KeyFileError &err) {
GST_WARNING ("Setting default address %s to media server",
RABBITMQ_SERVER_ADDRESS_DEFAULT);
address = RABBITMQ_SERVER_ADDRESS_DEFAULT;
}
try {
port = confFile.get_integer (RABBITMQ_GROUP, RABBITMQ_SERVER_PORT);
check_port (port);
} catch (const Glib::KeyFileError &err) {
GST_WARNING ("Setting default port %d to media server",
RABBITMQ_SERVER_PORT_DEFAULT);
port = RABBITMQ_SERVER_PORT_DEFAULT;
}
this->address = address;
this->port = port;
setConfig (address, port);
this->confFile.load_from_data (confFile.to_data() );
sigemptyset (&mask);
sigaddset (&mask, SIGCHLD);
signalHandler = std::shared_ptr <SignalHandler> (new SignalHandler (mask,
std::bind (&RabbitMQService::childSignal, this, std::placeholders::_1) ) );
}
示例12: setConfig
void Musec::loadLanguage(const QString& lang)
{
qApp->removeTranslator(fTranslator);
fTranslator->load(QLocale(lang), "musec", "_", ":/locales");
setConfig("lang", lang);
qApp->installTranslator(fTranslator);
}
示例13: _setName
MockReplicaSet::MockReplicaSet(const string& setName, size_t nodes):
_setName(setName) {
ReplConfigMap replConfig;
for (size_t n = 0; n < nodes; n++) {
std::stringstream str;
str << "$" << setName << n << ":27017";
const string hostName(str.str());
if (n == 0) {
_primaryHost = hostName;
}
MockRemoteDBServer* mockServer = new MockRemoteDBServer(hostName);
_nodeMap[hostName] = mockServer;
MockConnRegistry::get()->addServer(mockServer);
ReplSetConfig::MemberCfg config;
config.h = HostAndPort(hostName);
replConfig.insert(std::make_pair(hostName, config));
}
setConfig(replConfig);
}
示例14: setup
/**************************************************
* Configure the Pi / touchIt
**************************************************/
void setup()
{
unsigned char len = 0;
unsigned char dir = IN;
static const char dir_str[] = "in\0out";
signal (SIGINT, exitHandler);
// Open the I2C bus (enable file access)
char *filename = (char *)"/dev/i2c-1";
if((file_i2c = open(filename, O_RDWR)) < 0)
{
printf("setup(): Failed to open the i2c bus\n");
return;
}
if(ioctl(file_i2c, I2C_SLAVE, TCHADD1) < 0)
{
printf("Failed to acquire bus access and/or talk to slave\n");
return;
}
// Enable GPIO to read touchIt 'int' pin
if((file_gpio = open("/sys/class/gpio/export", O_WRONLY)) < 0)
{
printf("setup(): Failed to open export for writing\n");
return;
}
else
{
len = snprintf(buffer, BUFMAX, "%d", intPin);
write(file_gpio, buffer, len);
close(file_gpio);
}
// Configure GPIO Direction as input
snprintf(buffer, DIRMAX, "/sys/class/gpio/gpio%d/direction", intPin);
if((file_gpio = open(buffer, O_WRONLY)) < 0)
{
printf("setup(): Failed to open gpio direction for writing\n");
return;
}
else
{
write(file_gpio, &dir_str[IN == dir ? 0:3], IN == dir ? 2:3);
close(file_gpio);
}
// Open gpio file for reading
snprintf(buffer, DIRMAX, "/sys/class/gpio/gpio%d/value", intPin);
if((file_gpio = open(buffer, O_RDONLY)) < 0)
{
printf("gpioRead(): failed to open gpio value for reading\n");
return;
}
getVersion();
setConfig(XMOVE | YMOVE);
}
示例15: cannyHighThresh
ImageProcessor::ImageProcessor(SkinCamConfig aConfig)
:mouseClickNbhrd(7), cannyHighThresh(127), cannyLowThresh(127), cannyImage(0), medianKernel(7),
autoSelectCannyImage(false), lastSharpestBand(0),
distLowEnd(aConfig.distanceLowEnd), distHighEnd(aConfig.distanceHighEnd)
{
setConfig(aConfig);
}