本文整理汇总了C++中cfg函数的典型用法代码示例。如果您正苦于以下问题:C++ cfg函数的具体用法?C++ cfg怎么用?C++ cfg使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cfg函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Init
void UserActions::Init()
{
m_actionNames.clear();
m_actionNames.push_back(_("none"));
m_actionNames.push_back(_("highlight"));
m_actionNames.push_back(_("notify login/out"));
m_actionNames.push_back(_("ignore chat"));
m_actionNames.push_back(_("ignore pm"));
m_actionNames.push_back(_("autokick"));
m_actionNames.push_back(_("notify hosted battle"));
m_actionNames.push_back(_("notify status change"));
m_configActionNames.clear();
m_configActionNames.push_back(_T("none"));
m_configActionNames.push_back(_T("highlight"));
m_configActionNames.push_back(_T("notify_login"));
m_configActionNames.push_back(_T("ignore_chat"));
m_configActionNames.push_back(_T("ignore_pm"));
m_configActionNames.push_back(_T("autokick"));
m_configActionNames.push_back(_T("notify_hosted"));
m_configActionNames.push_back(_T("notify_status"));
m_actionTooltips.clear();
m_actionTooltips.push_back(_("no action at all"));
m_actionTooltips.push_back(_("highlight user in nick list and battles he participates in"));
m_actionTooltips.push_back(_("popup a message box when user logs in/out from the server"));
m_actionTooltips.push_back(_("you won't see message by these users in normal channels"));
m_actionTooltips.push_back(_("ignore private messages of these users, no pm window will open if any of these try to contact you privately"));
m_actionTooltips.push_back(_("automatically kick users from battles hosted by yourself"));
m_actionTooltips.push_back(_("popup a message box when user hosts a new battle"));
m_actionTooltips.push_back(_("popup a message box when user changes away status"));
// setup if empty
if (!cfg().Exists(_T( "/Groups"))) {
AddGroup(_("Default"));
AddGroup(_("Ignore PM"));
ChangeAction(_("Ignore PM"), UserActions::ActIgnorePM);
AddGroup(_("Ignore chat"));
ChangeAction(_("Ignore chat"), UserActions::ActIgnoreChat);
AddGroup(_("Battle Autokick"));
ChangeAction(_("Battle Autokick"), UserActions::ActAutokick);
AddGroup(_("Friends"));
ChangeAction(_("Friends"), UserActions::ActNotifBattle);
ChangeAction(_("Friends"), UserActions::ActHighlight);
ChangeAction(_("Friends"), UserActions::ActNotifLogin);
// TODO select better color
SetGroupColor(_("Friends"), wxColour(0, 0, 255));
}
// read
m_groupNames = GetGroups();
m_groupMap.clear();
m_groupActions.clear();
m_actionsGroups.clear();
m_actionsPeople.clear();
m_knownUsers.Clear();
for (unsigned int i = 0; i < m_groupNames.GetCount(); ++i) {
wxString name = m_groupNames[i];
m_groupMap[name] = GetPeopleList(name);
for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
wxString user = m_groupMap[name][k];
m_knownUsers.Add(user);
m_peopleGroup[user] = name;
}
m_groupActions[name] = GetGroupActions(name);
}
for (size_t i = 0; i < m_actionNames.size(); ++i) {
UserActions::ActionType cur = (UserActions::ActionType)(1 << i);
wxArrayString tmp;
for (unsigned int j = 0; j < m_groupNames.GetCount(); ++j) {
wxString name = m_groupNames[j];
if ((m_groupActions[name] & cur) != 0) {
tmp.Add(name);
for (unsigned int k = 0; k < m_groupMap[name].GetCount(); ++k) {
m_actionsPeople[cur].Add((m_groupMap[name])[k]);
}
}
}
tmp.Sort();
m_actionsGroups[cur] = tmp;
}
m_actionsGroups[ActNone] = m_groupNames;
m_groupNames.Sort();
m_knownUsers.Sort();
}
示例2: cfg
SplitterGUI::~SplitterGUI()
{
KConfigGroup cfg(KSharedConfig::openConfig(), QStringLiteral("Splitter"));
cfg.writeEntry("OverWriteFiles", overwriteCb->isChecked());
}
示例3: tidyDocCleanAndRepair
int tidyDocCleanAndRepair( TidyDocImpl* doc )
{
Bool word2K = cfgBool( doc, TidyWord2000 );
Bool logical = cfgBool( doc, TidyLogicalEmphasis );
Bool clean = cfgBool( doc, TidyMakeClean );
Bool dropFont = cfgBool( doc, TidyDropFontTags );
Bool htmlOut = cfgBool( doc, TidyHtmlOut );
Bool xmlOut = cfgBool( doc, TidyXmlOut );
Bool xhtmlOut = cfgBool( doc, TidyXhtmlOut );
Bool xmlDecl = cfgBool( doc, TidyXmlDecl );
Bool tidyMark = cfgBool( doc, TidyMark );
Bool tidyXmlTags = cfgBool( doc, TidyXmlTags );
Bool wantNameAttr = cfgBool( doc, TidyAnchorAsName );
Bool mergeEmphasis = cfgBool( doc, TidyMergeEmphasis );
Node* node;
if (tidyXmlTags)
return tidyDocStatus( doc );
/* simplifies <b><b> ... </b> ...</b> etc. */
if ( mergeEmphasis )
TY_(NestedEmphasis)( doc, &doc->root );
/* cleans up <dir>indented text</dir> etc. */
TY_(List2BQ)( doc, &doc->root );
TY_(BQ2Div)( doc, &doc->root );
/* replaces i by em and b by strong */
if ( logical )
TY_(EmFromI)( doc, &doc->root );
if ( word2K && TY_(IsWord2000)(doc) )
{
/* prune Word2000's <![if ...]> ... <![endif]> */
TY_(DropSections)( doc, &doc->root );
/* drop style & class attributes and empty p, span elements */
TY_(CleanWord2000)( doc, &doc->root );
TY_(DropEmptyElements)(doc, &doc->root);
}
/* replaces presentational markup by style rules */
if ( clean || dropFont )
TY_(CleanDocument)( doc );
/* Move terminating <br /> tags from out of paragraphs */
/*! Do we want to do this for all block-level elements? */
/* This is disabled due to http://tidy.sf.net/bug/681116 */
#if 0
FixBrakes( doc, TY_(FindBody)( doc ));
#endif
/* Reconcile http-equiv meta element with output encoding */
if (cfg( doc, TidyOutCharEncoding) != RAW
#ifndef NO_NATIVE_ISO2022_SUPPORT
&& cfg( doc, TidyOutCharEncoding) != ISO2022
#endif
)
TY_(VerifyHTTPEquiv)( doc, TY_(FindHEAD)( doc ));
if ( !TY_(CheckNodeIntegrity)( &doc->root ) )
TidyPanic( doc->allocator, integrity );
/* remember given doctype for reporting */
node = TY_(FindDocType)(doc);
if (node)
{
AttVal* fpi = TY_(GetAttrByName)(node, "PUBLIC");
if (AttrHasValue(fpi))
{
if (doc->givenDoctype)
TidyDocFree(doc, doc->givenDoctype);
doc->givenDoctype = TY_(tmbstrdup)(doc->allocator,fpi->value);
}
}
if ( doc->root.content )
{
/* If we had XHTML input but want HTML output */
if ( htmlOut && doc->lexer->isvoyager )
{
Node* node = TY_(FindDocType)(doc);
/* Remove reference, but do not free */
if (node)
TY_(RemoveNode)(node);
}
if (xhtmlOut && !htmlOut)
{
TY_(SetXHTMLDocType)(doc);
/* TY_(FixAnchors)(doc, &doc->root, wantNameAttr, yes); */
TY_(FixXhtmlNamespace)(doc, yes);
TY_(FixLanguageInformation)(doc, &doc->root, yes, yes);
}
else
{
TY_(FixDocType)(doc);
TY_(FixAnchors)(doc, &doc->root, wantNameAttr, yes);
TY_(FixXhtmlNamespace)(doc, no);
//.........这里部分代码省略.........
示例4: regionizeFunc
/**
* Regionize a func, so that each node and each arc in its TransCFG is
* "covered". A node is covered if any region contains it. An arc T1->T2
* is covered if either:
*
* a) T1 and T2 are in the same region R and T2 immediately follows
* T1 in R.
* b) T2 is the head (first translation) of a region.
*
* Basic algorithm:
*
* 1) sort nodes in decreasing weight order
* 2) for each node N:
* 2.1) if N and all its incoming arcs are covered, then continue
* 2.2) select a region starting at this node and mark nodes/arcs as
* covered appropriately
*/
void regionizeFunc(const Func* func,
JIT::TranslatorX64* tx64,
RegionVec& regions) {
assert(RuntimeOption::EvalJitPGO);
FuncId funcId = func->getFuncId();
ProfData* profData = tx64->profData();
TransCFG cfg(funcId, profData, tx64->getSrcDB(), tx64->getJmpToTransIDMap());
if (Trace::moduleEnabled(HPHP::Trace::pgo, 5)) {
string dotFileName = folly::to<string>("/tmp/func-cfg-", funcId, ".dot");
cfg.print(dotFileName, funcId, profData, nullptr);
FTRACE(5, "regionizeFunc: initial CFG for func {} saved to file {}\n",
funcId, dotFileName);
}
TransCFG::ArcPtrVec arcs = cfg.arcs();
vector<TransID> nodes = cfg.nodes();
std::sort(nodes.begin(), nodes.end(),
[&](TransID tid1, TransID tid2) -> bool {
if (cfg.weight(tid1) != cfg.weight(tid2)) {
return cfg.weight(tid1) > cfg.weight(tid2);
}
// In case of ties, pick older translations first, in an
// attempt to start loops at their headers.
return tid1 < tid2;
});
TransCFG::ArcPtrSet coveredArcs;
TransIDSet coveredNodes;
TransIDSet heads;
TransIDToRegionMap headToRegion;
RegionToTransIDsMap regionToTransIds;
regions.clear();
for (auto node : nodes) {
if (!setContains(coveredNodes, node) ||
!allArcsCovered(cfg.inArcs(node), coveredArcs)) {
TransID newHead = node;
FTRACE(6, "regionizeFunc: selecting trace to cover node {}\n", newHead);
TransIDSet selectedSet;
TransIDVec selectedVec;
RegionDescPtr region = selectHotTrace(newHead, profData, cfg,
selectedSet, &selectedVec);
profData->setOptimized(profData->transSrcKey(newHead));
assert(selectedVec.size() > 0 && selectedVec[0] == newHead);
regions.push_back(region);
heads.insert(newHead);
markCovered(cfg, selectedVec, heads, coveredNodes, coveredArcs);
regionToTransIds[region] = selectedVec;
headToRegion[newHead] = region;
FTRACE(6, "regionizeFunc: selected trace: {}\n",
folly::join(", ", selectedVec));
}
}
assert(coveredNodes.size() == cfg.nodes().size());
assert(coveredArcs.size() == arcs.size());
sortRegion(regions, func, cfg, profData, headToRegion, regionToTransIds);
if (debug && Trace::moduleEnabled(HPHP::Trace::pgo, 5)) {
FTRACE(5, "\n--------------------------------------------\n"
"regionizeFunc({}): computed regions:\n", funcId);
for (auto region : regions) {
FTRACE(5, "{}\n\n", show(*region));
}
}
}
示例5: cfg
void KisSplashScreen::toggleShowAtStartup(bool toggle)
{
KConfigGroup cfg( KSharedConfig::openConfig(), "SplashScreen");
cfg.writeEntry("HideSplashAfterStartup", toggle);
}
示例6: main
int main( int argc, char* argv[] ) {
std::cout << std::endl << std::endl;
std::cout << "------------------------------------------------------" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "| Running runZGAnalysis |" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "| |" << std::endl;
std::cout << "------------------------------------------------------" << std::endl;
std::cout << std::endl << std::endl;
if( argc<2 ) {
std::cout << "USAGE: ./runZGAnalysis [configFileName] [data/MC]" << std::endl;
std::cout << "Exiting." << std::endl;
exit(11);
}
std::string configFileName(argv[1]);
ZGConfig cfg(configFileName);
bool onlyData = false;
bool onlyMC = false;
bool onlySignal = false;
bool noSignals = false;
if( argc > 2 ) {
std::string dataMC(argv[2]);
if( dataMC=="data" ) onlyData = true;
else if( dataMC=="MC" || dataMC=="mc" ) onlyMC = true;
else if( dataMC=="mcbg" || dataMC=="mcBG" || dataMC=="MCBG" || dataMC=="mc_bg" || dataMC=="MC_BG" ) {
onlyMC = true;
noSignals = true;
} else if( dataMC=="signal" ) onlySignal = true;
else {
std::cout << "-> You passed a second argument that isn't 'data', nor 'MC', nor 'signal', so I don't know what to do about it." << std::endl;
}
} else {
std::cout << "-> Will run on both data and MC." << std::endl;
}
if( onlyMC ) {
std::cout << "-> Will run only on MC." << std::endl;
if( noSignals ) {
std::cout << "-> Will skip signal." << std::endl;
}
}
if( onlyData ) {
std::cout << "-> Will run only on data." << std::endl;
}
std::string outputdir = cfg.getEventYieldDir();
system(Form("mkdir -p %s", outputdir.c_str()));
std::string outfileName(Form("%s/trees_tmp.root", outputdir.c_str()));
TFile* outfile = TFile::Open(outfileName.c_str(), "update");
outfile->cd();
if( !onlyData && !onlySignal ) { // run on MC
std::string samplesFileName = "../samples/samples_" + cfg.mcSamples() + ".dat";
std::cout << std::endl << std::endl;
std::cout << "-> Loading samples from file: " << samplesFileName << std::endl;
std::vector<ZGSample> fSamples = ZGSample::loadSamples(samplesFileName);
//std::vector<ZGSample> fSamples = ZGSample::loadSamples(samplesFileName, 100, 999);
if( fSamples.size()==0 ) {
std::cout << "There must be an error: samples is empty!" << std::endl;
exit(120);
}
//addTreeToFile( outfile, "zg", fSamples, cfg);
addTreeToFile( outfile, "zg", fSamples, cfg, 851, 852 );
addTreeToFile( outfile, "dy", fSamples, cfg, 700, 710 );
//addTreeToFile( outfile, "top", fSamples, cfg, 300, 499 ); // irrelevant
std::cout << "-> Done looping on MC samples." << std::endl;
//.........这里部分代码省略.........
示例7: ActiveCharacter
void Parachute::Refresh()
{
if (Game::GetInstance()->GetRemainingTime() <= 0)
return;
if (Game::GetInstance()->ReadState() != Game::PLAYING)
return;
Character& active = ActiveCharacter();
Double speed = active.GetSpeedXY().Norm();
if (active.FootsInVacuum() && speed.IsNotZero()) { // We are falling
if (!open && (speed > GameMode::GetInstance()->safe_fall)) { // with a sufficient speed
if (EnoughAmmo() && !m_used_this_turn) { // We have enough ammo => start opening the parachute
if (!m_used_this_turn) {
UseAmmo();
m_used_this_turn = true;
}
active.SetAirResistFactor(cfg().air_resist_factor);
active.SetWindFactor(cfg().wind_factor);
open = true;
img->animation.SetPlayBackward(false);
img->Start();
active.SetSpeedXY(Point2d(0,0));
active.SetMovement("parachute");
Camera::GetInstance()->FollowObject(&active);
}
}
} else { // We are on the ground
if (open) { // The parachute is opened
active.SetMovement("walk");
if (!closing) { // We have just hit the ground. Start closing animation
img->animation.SetPlayBackward(true);
img->animation.SetShowOnFinish(SpriteAnimation::show_blank);
img->Start();
closing = true;
return;
} else { // The parachute is closing
if (img->IsFinished()) {
// The animation is finished... We are done with the parachute
open = false;
closing = false;
UseAmmoUnit();
}
}
}
m_used_this_turn = false;
}
if (open) {
active.UpdateLastMovingTime();
// If parachute is open => character can move a little to the left or to the right
const LRMoveIntention * lr_move_intention = active.GetLastLRMoveIntention();
if (lr_move_intention) {
LRDirection direction = lr_move_intention->GetDirection();
active.SetDirection(direction);
if (direction == DIRECTION_LEFT)
active.SetExternForce(-cfg().force_side_displacement, 0.0);
else
active.SetExternForce(cfg().force_side_displacement, 0.0);
}
}
}
示例8: autil
arith_util & autil() { return cfg().m_autil; }
示例9: wxPanel
//.........这里部分代码省略.........
bCustomColorsSizer->Add(m_test_text, 1, wxALL | wxEXPAND, 5);
m_custom_colors->SetSizer(bCustomColorsSizer);
m_custom_colors->Layout();
bCustomColorsSizer->Fit(m_custom_colors);
bColorsVSizer->Add(m_custom_colors, 1, wxEXPAND | wxALL, 0);
wxBoxSizer* bFontNameSizer;
bFontNameSizer = new wxBoxSizer(wxHORIZONTAL);
m_font_label = new wxStaticText(this, wxID_ANY, _("Font:"), wxDefaultPosition, wxDefaultSize, 0);
m_font_label->Wrap(-1);
bFontNameSizer->Add(m_font_label, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
m_fontname = new wxStaticText(this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
m_fontname->Wrap(-1);
bFontNameSizer->Add(m_fontname, 0, wxALL | wxALIGN_CENTER_VERTICAL, 5);
m_select_font = new wxButton(this, ID_SELFONT, _("Select..."), wxDefaultPosition, wxDefaultSize, wxBU_EXACTFIT);
bFontNameSizer->Add(m_select_font, 0, wxALL, 5);
bColorsVSizer->Add(bFontNameSizer, 0, wxEXPAND, 5);
sbColorsSizer->Add(bColorsVSizer, 1, wxEXPAND, 5);
m_main_sizer->Add(sbColorsSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT | wxTOP, 5);
wxStaticBoxSizer* sbBehaviorSizer;
sbBehaviorSizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, _("Behavior")), wxHORIZONTAL);
m_irc_colors = new wxCheckBox(this, wxID_ANY, _("Enable Irc colors in chat messages"), wxDefaultPosition, wxDefaultSize, 0);
m_irc_colors->SetValue(sett().GetUseIrcColors());
sbBehaviorSizer->Add(m_irc_colors, 0, wxALL, 5);
#ifndef DISABLE_SOUND
m_play_sounds = new wxCheckBox(this, ID_PLAY_SOUNDS, _("Play notification sounds"), wxDefaultPosition, wxDefaultSize, 0);
m_play_sounds->SetValue(sett().GetChatPMSoundNotificationEnabled());
sbBehaviorSizer->Add(m_play_sounds, 0, wxALL, 5);
#endif
m_broadcast_check = new wxCheckBox(this, wxID_ANY, _("Copy server messages in current channel"), wxDefaultPosition, wxDefaultSize, 0);
m_broadcast_check->SetValue(cfg().ReadBool(_T("/Chat/BroadcastEverywhere")));
sbBehaviorSizer->Add(m_broadcast_check, 0, wxALL, 5);
m_main_sizer->Add(sbBehaviorSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5);
wxBoxSizer* bBotomSizer;
bBotomSizer = new wxBoxSizer(wxHORIZONTAL);
wxStaticBoxSizer* sbChatLogSizer;
wxStaticBox* sbChatLog = new wxStaticBox(this, -1, _("Chat logs"));
sbChatLogSizer = new wxStaticBoxSizer(sbChatLog, wxVERTICAL);
m_save_logs = new wxCheckBox(this, wxID_ANY, _("Save chat logs"), wxDefaultPosition, wxDefaultSize, 0);
m_save_logs->SetValue(cfg().ReadBool(_T("/ChatLog/chatlog_enable")));
sbChatLogSizer->Add(m_save_logs, 0, wxALL, 5);
wxBoxSizer* m_num_lines_sizer = new wxBoxSizer(wxHORIZONTAL);
m_num_lines = new wxSpinCtrl(this, wxID_ANY);
m_num_lines_lbl = new wxStaticText(this, wxID_ANY, _("approx. number of lines loaded from log into chat"), wxDefaultPosition, wxDefaultSize, 0);
m_num_lines_sizer->Add(m_num_lines);
m_num_lines_sizer->Add(m_num_lines_lbl, 0, wxLEFT | wxALIGN_CENTER_VERTICAL, 5);
sbChatLogSizer->Add(m_num_lines_sizer, 0, wxALL, 5);
bBotomSizer->Add(sbChatLogSizer, 1, wxEXPAND | wxRIGHT, 5);
wxStaticBoxSizer* sbHighlightSizer;
sbHighlightSizer = new wxStaticBoxSizer(new wxStaticBox(this, -1, _("Highlight words")), wxVERTICAL);
m_hilight_words_label = new wxStaticText(this, wxID_ANY, _("Words to highlight in chat:"), wxDefaultPosition, wxDefaultSize, 0);
m_hilight_words_label->Wrap(-1);
sbHighlightSizer->Add(m_hilight_words_label, 0, wxALL, 5);
sbHighlightSizer->Add(0, 0, 1, wxEXPAND, 5);
m_highlight_words = new wxTextCtrl(this, ID_HIWORDS, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0);
m_highlight_words->SetToolTip(_("enter a ; seperated list"));
sbHighlightSizer->Add(m_highlight_words, 0, wxALL | wxEXPAND, 5);
m_highlight_req = new wxCheckBox(this, ID_HL_REQ, _("Additionally play sound/flash titlebar "), wxDefaultPosition, wxDefaultSize, 0);
sbHighlightSizer->Add(m_highlight_req, 0, wxALL | wxEXPAND, 5);
bBotomSizer->Add(sbHighlightSizer, 1, wxEXPAND, 5);
m_main_sizer->Add(bBotomSizer, 0, wxEXPAND | wxBOTTOM | wxRIGHT | wxLEFT, 5);
m_main_sizer->Add(0, 0, 1, wxEXPAND | wxALL, 5);
SetSizer(m_main_sizer);
DoRestore();
UpdateTextSample();
UpdateFontLabel();
Layout();
}
示例10: cfg
MYExchange::MYExchange(struct my_xchg_cfg& _cfg)
{
MYExConfigData cfg(_cfg);
void* fn;
CreateTradeTunnelFuncType create_trd_tunnel;
MYExchangeLogUtil::Start("my_exchange_fut_op", 0);
m_tnl_hdl = NULL;
// 构建通道
cur_tunnel_index_ = 0;
max_tunnel_index_ = 0;
pp_tunnel_ = new MYTunnelInterface*[2];
pp_tunnel_[1] = NULL;
while (max_tunnel_index_ < 1)
{
void* hdl;
/* dlopen */
hdl = dlopen(_cfg.tunnel_so_path, RTLD_NOW);
if (NULL == hdl)
{
fprintf(stderr, "Failed to dlopen %s, %s \n", _cfg.tunnel_so_path, dlerror());
break;
}
m_tnl_hdl = hdl;
fn = dlsym(hdl, "CreateTradeTunnel");
if (NULL == fn)
{
fprintf(stderr, "Failed to dlsym CreateTradeTunnel: %s \n", dlerror());
break;
}
create_trd_tunnel = CreateTradeTunnelFuncType(fn);
pp_tunnel_[max_tunnel_index_] = create_trd_tunnel(_cfg.tunnel_cfg_path);
if (NULL == pp_tunnel_[max_tunnel_index_])
{
fprintf(stderr, "Failed to create_trd_tunnel by config : %s\n", _cfg.tunnel_cfg_path);
break;
}
/* dlsym, get address of CreateTradeTunnel */
//pp_tunnel_[max_tunnel_index_] = CreateTradeTunnel(cfg.tunnel_cfg_path);
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((OrderRespondHandler) std::bind(&MYExchange::OrderRespond, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((CancelRespondHandler) std::bind(&MYExchange::CancelRespond, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((OrderReturnHandler) std::bind(&MYExchange::OrderReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((TradeReturnHandler) std::bind(&MYExchange::TradeReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(PositionReturnHandler) std::bind(&MYExchange::SendPositionReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(OrderDetailReturnHandler) std::bind(&MYExchange::SendOrderDetailReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(TradeDetailReturnHandler) std::bind(&MYExchange::SendTradeDetailReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(ContractInfoReturnHandler) std::bind(&MYExchange::SendContractReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(RspOfReqForQuoteHandler) std::bind(&MYExchange::ReqForQuoteRespond, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((RtnForQuoteHandler) std::bind(&MYExchange::ForQuoteRtn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(CancelQuoteRspHandler) std::bind(&MYExchange::CancelQuoteRespond, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(InsertQuoteRspHandler) std::bind(&MYExchange::InsertQuoteRespond, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler((QuoteReturnHandler) std::bind(&MYExchange::QuoteReturn, this, std::placeholders::_1));
pp_tunnel_[max_tunnel_index_]->SetCallbackHandler(
(QuoteTradeReturnHandler) std::bind(&MYExchange::QuoteTradeReturn, this, std::placeholders::_1));
++max_tunnel_index_;
}
// 构造数据管理对象
p_order_manager_ = new MYOrderDataManager();
p_position_manager_ = new MYPositionDataManager();
p_order_req_ = new MYOrderReq(this, p_order_manager_, p_position_manager_, cfg);
p_order_rsp_ = new MYOrderRsp(this, p_order_manager_, p_position_manager_, p_order_req_);
// 接口无需暴露的内部实现,隐藏在实现类中,避免接口的修改
my_exchange_inner_imp_ = new MYExchangeInnerImp(pp_tunnel_[0], cfg, max_tunnel_index_);
my_exchange_inner_imp_->qry_pos_flag = false;
my_exchange_inner_imp_->qry_order_flag = false;
my_exchange_inner_imp_->qry_trade_flag = false;
my_exchange_inner_imp_->qry_contract_flag = false;
if (max_tunnel_index_ > 0)
{
investorid = pp_tunnel_[0]->GetClientID();
}
// TODO: wangying modify here to support saving each strategy's position respectively
// init model position by ev file of model
if (cfg.Position_policy().InitPosByEvfile())
{
my_exchange_inner_imp_->InitModelPosByEvFile();
}
// 读取历史仓位数据,init仓位数据
if (max_tunnel_index_ > 0 && cfg.Position_policy().init_pos_at_start)
{
std::thread t_qry_pos(&MYExchangeInnerImp::QryPosForInit, my_exchange_inner_imp_);
t_qry_pos.detach();
//.........这里部分代码省略.........
示例11: baseCfg
void VTerrainDecorationEntityModel::RecreateIRShaders(VisSurface_cl* pSurface, VShaderEffectLib* pEffectLib)
{
if (pSurface == NULL)
return;
// check for supported transparency types
if (pSurface->GetTransparencyType() != VIS_TRANSP_NONE &&
pSurface->GetTransparencyType() != VIS_TRANSP_ALPHATEST &&
pSurface->GetTransparencyType() != VIS_TRANSP_ALPHA)
return;
char szParam[1024];
VTechniqueConfig baseCfg("INSTANCING;WIND", NULL);
// if (Vision::Renderer.GetCurrentRendererNode() != NULL && Vision::Renderer.GetRendererNode()->GetMultisampleMode() != VVIDEO_MULTISAMPLE_OFF)
// baseCfg.AddInclusionTag("MSAA");
switch (pSurface->GetGeometryTopology())
{
case VisSurface_cl::VGT_3DMesh:
baseCfg.AddInclusionTag("GEO_3D");
break;
default:
Vision::Error.Warning("VTerrainDecorationEntityModel::RecreateIRShaders: Only 3DMesh geometry topology is supported");
return;
}
hkvVec4 vWindPhaseParams(0.0071f, 0.0092f, 0.0f, 0.0f);
const hkvAlignedBBox& bbox = m_spMesh->GetBoundingBox();
if (bbox.isValid())
vWindPhaseParams.w = -bbox.m_vMin.z;
{
// 1. Assign G-Pass pass technique
////////////////////////////////////
szParam[0] = '\0';
// Get params needed for IR shader creation from IR renderer
char* pszParamPos = GetParamStringForIRSurface(pSurface, szParam);
pszParamPos += sprintf(pszParamPos, "WindPhaseParams=%g,%g,%g,%g;", vWindPhaseParams.x, vWindPhaseParams.y, vWindPhaseParams.z, vWindPhaseParams.w);
VTechniqueConfig cfg(baseCfg);
bool bHasMaterialTex = pSurface->GetAuxiliaryTextureCount() >= 1 && pSurface->GetAuxiliaryTexture(0) != NULL;
bool bHasHotSpotTex = pSurface->GetAuxiliaryTextureCount() >= 2 && pSurface->GetAuxiliaryTexture(1) != NULL;
if (bHasMaterialTex)
{
// --- Thermal params are taken from auxiliary texture
cfg.AddInclusionTag("AUX_TEX");
}
else
{
int iMaterialID = 0;
if (pSurface->GetMesh() != NULL)
iMaterialID = (int)pSurface->GetMesh()->GetBaseSubmesh(0)->GetGeometryInfo().m_sUserFlags;
// --- Thermal params are taken from submesh user flags
pszParamPos += sprintf(pszParamPos, "ThermalMaterialID=%i;", iMaterialID);
}
if (bHasHotSpotTex)
cfg.AddInclusionTag("HEATING_POWER");
VCompiledEffect* pFX = Vision::Shaders.CreateEffect("InitialPass", szParam, EFFECTCREATEFLAG_NONE, pEffectLib);
if (pFX == NULL)
{
Vision::Error.Warning("VTerrainDecorationEntityModel::RecreateIRShaders: Failed to create InitialPass effect");
return;
}
VCompiledTechnique* pTechnique = pFX->FindCompatibleTechnique(&cfg);
if (pTechnique == NULL)
{
Vision::Error.Warning("VTerrainDecorationEntityModel::RecreateIRShaders: No compatible technique found; using default technique");
pTechnique = pFX->GetDefaultTechnique(); // find default technique
}
VASSERT(pTechnique != NULL && pTechnique->GetShaderCount() == 1);
pTechnique->GetShader(0)->m_bModified = true;
m_spInstancingTechIRMainPass = pTechnique;
}
{
// 2. Assign Pre-Pass pass technique
/////////////////////////////////////
szParam[0] = '\0';
char* pszParamPos = szParam;
pszParamPos += sprintf(pszParamPos, "WindPhaseParams=%g,%g,%g,%g;", vWindPhaseParams.x, vWindPhaseParams.y, vWindPhaseParams.z, vWindPhaseParams.w);
VTechniqueConfig cfg(baseCfg);
if (pSurface->GetTransparencyType() == VIS_TRANSP_ALPHATEST || pSurface->GetTransparencyType() == VIS_TRANSP_ALPHA)
{
cfg.AddInclusionTag("ALPHATEST");
pszParamPos += sprintf(pszParamPos, "AlphaTestThreshold=%g;", pSurface->GetAlphaTestThreshold());
}
//.........这里部分代码省略.........
示例12: AddToWorklist
bool AggressiveDCEPass::AggressiveDCE(Function* func) {
// Mark function parameters as live.
AddToWorklist(&func->DefInst());
func->ForEachParam(
[this](const Instruction* param) {
AddToWorklist(const_cast<Instruction*>(param));
},
false);
// Compute map from block to controlling conditional branch
std::list<BasicBlock*> structuredOrder;
cfg()->ComputeStructuredOrder(func, &*func->begin(), &structuredOrder);
ComputeBlock2HeaderMaps(structuredOrder);
bool modified = false;
// Add instructions with external side effects to worklist. Also add branches
// EXCEPT those immediately contained in an "if" selection construct or a loop
// or continue construct.
// TODO(greg-lunarg): Handle Frexp, Modf more optimally
call_in_func_ = false;
func_is_entry_point_ = false;
private_stores_.clear();
// Stacks to keep track of when we are inside an if- or loop-construct.
// When immediately inside an if- or loop-construct, we do not initially
// mark branches live. All other branches must be marked live.
std::stack<bool> assume_branches_live;
std::stack<uint32_t> currentMergeBlockId;
// Push sentinel values on stack for when outside of any control flow.
assume_branches_live.push(true);
currentMergeBlockId.push(0);
for (auto bi = structuredOrder.begin(); bi != structuredOrder.end(); ++bi) {
// If exiting if or loop, update stacks
if ((*bi)->id() == currentMergeBlockId.top()) {
assume_branches_live.pop();
currentMergeBlockId.pop();
}
for (auto ii = (*bi)->begin(); ii != (*bi)->end(); ++ii) {
SpvOp op = ii->opcode();
switch (op) {
case SpvOpStore: {
uint32_t varId;
(void)GetPtr(&*ii, &varId);
// Mark stores as live if their variable is not function scope
// and is not private scope. Remember private stores for possible
// later inclusion. We cannot call IsLocalVar at this point because
// private_like_local_ has not been set yet.
if (IsVarOfStorage(varId, SpvStorageClassPrivate) ||
IsVarOfStorage(varId, SpvStorageClassWorkgroup))
private_stores_.push_back(&*ii);
else if (!IsVarOfStorage(varId, SpvStorageClassFunction))
AddToWorklist(&*ii);
} break;
case SpvOpCopyMemory:
case SpvOpCopyMemorySized: {
uint32_t varId;
(void)GetPtr(ii->GetSingleWordInOperand(kCopyMemoryTargetAddrInIdx),
&varId);
if (IsVarOfStorage(varId, SpvStorageClassPrivate) ||
IsVarOfStorage(varId, SpvStorageClassWorkgroup))
private_stores_.push_back(&*ii);
else if (!IsVarOfStorage(varId, SpvStorageClassFunction))
AddToWorklist(&*ii);
} break;
case SpvOpLoopMerge: {
assume_branches_live.push(false);
currentMergeBlockId.push(
ii->GetSingleWordInOperand(kLoopMergeMergeBlockIdInIdx));
} break;
case SpvOpSelectionMerge: {
assume_branches_live.push(false);
currentMergeBlockId.push(
ii->GetSingleWordInOperand(kSelectionMergeMergeBlockIdInIdx));
} break;
case SpvOpSwitch:
case SpvOpBranch:
case SpvOpBranchConditional:
case SpvOpUnreachable: {
if (assume_branches_live.top()) {
AddToWorklist(&*ii);
}
} break;
default: {
// Function calls, atomics, function params, function returns, etc.
// TODO(greg-lunarg): function calls live only if write to non-local
if (!ii->IsOpcodeSafeToDelete()) {
AddToWorklist(&*ii);
}
// Remember function calls
if (op == SpvOpFunctionCall) call_in_func_ = true;
} break;
}
}
}
// See if current function is an entry point
for (auto& ei : get_module()->entry_points()) {
if (ei.GetSingleWordInOperand(kEntryPointFunctionIdInIdx) ==
func->result_id()) {
func_is_entry_point_ = true;
break;
}
}
//.........这里部分代码省略.........
示例13: CameraScene
SSAOScene::SSAOScene(Context * ctx):
CameraScene(ctx),
cryModel("assets/models/nanosuit/nanosuit.obj")
{
FramebufferConfiguration cfg(ctx->getWindowWidth(),ctx->getWindowHeight());
TextureConfig posBfrConfig("positionDepth",GL_RGBA16F,GL_RGBA,GL_FLOAT);
posBfrConfig.setTextureFilter(GL_NEAREST);
posBfrConfig.setWrapMode(GL_CLAMP_TO_EDGE);
TextureAttachment posBfr(posBfrConfig,GL_COLOR_ATTACHMENT0);
TextureConfig norBfrConfig("normal",GL_RGB16F,GL_RGB,GL_FLOAT);
posBfrConfig.setTextureFilter(GL_NEAREST);
TextureAttachment norBfr(norBfrConfig,GL_COLOR_ATTACHMENT1);
TextureConfig spec_albedoConfig("color",GL_RGBA,GL_RGBA,GL_FLOAT);
posBfrConfig.setTextureFilter(GL_NEAREST);
TextureAttachment spec_albedoBfr(spec_albedoConfig,GL_COLOR_ATTACHMENT2);
cfg.addTexturebuffer(posBfr);
cfg.addTexturebuffer(norBfr);
cfg.addTexturebuffer(spec_albedoBfr);
cfg.addRenderbuffer(RenderbufferAttachment(GL_DEPTH24_STENCIL8,GL_DEPTH_STENCIL_ATTACHMENT));
gBuffer.init(cfg);
FramebufferConfiguration aoConfig(ctx->getWindowWidth(),ctx->getWindowHeight());
TextureConfig aoTexture("occlusion",GL_RED,GL_RGB,GL_FLOAT);
aoTexture.setTextureFilter(GL_NEAREST);
TextureAttachment ssaoBufferAttachment(aoTexture,GL_COLOR_ATTACHMENT0);
aoConfig.addTexturebuffer(ssaoBufferAttachment);
ssaoBuffer.init(aoConfig);
GL_Logger::LogError("Could not configure ssaoBuffer");
//Blur buffer has same properties as ao buffer.
FramebufferConfiguration blurConfiguration(ctx->getWindowWidth(),ctx->getWindowHeight());
TextureConfig blurTexture("occlusion",GL_RED,GL_RGB,GL_FLOAT);
blurTexture.setTextureFilter(GL_NEAREST);
TextureAttachment blurBufferAttachment(blurTexture,GL_COLOR_ATTACHMENT0);
blurConfiguration.addTexturebuffer(blurBufferAttachment);
ssaoBlurBuffer.init(blurConfiguration);
std::uniform_real_distribution<GLfloat> randomFloats(0.0, 1.0); // random floats between 0.0 - 1.0
std::default_random_engine generator;
//Set up a noise texture
std::vector<glm::vec3> ssaoNoiseVec;
for (GLuint i = 0; i < 16; i++)
{
glm::vec3 noise(
randomFloats(generator) * 2.0 - 1.0,
randomFloats(generator) * 2.0 - 1.0,
0.0f);
ssaoNoiseVec.push_back(noise);
}
TextureConfig ssaoConfig("ssaoNoise",GL_RGB16F,GL_RGB,GL_FLOAT);
ssaoConfig.setWrapMode(GL_REPEAT);
ssaoConfig.setTextureFilter(GL_NEAREST);
ssaoNoise.init(ssaoConfig,&ssaoNoiseVec[0],4,4);
GL_Logger::LogError("Could not configure ssaoNoise");
deferredGBufferProg = createProgram("SSAO GBuffer fill program");
ssaoProgram = createProgram("SSAO creation program");
postProcessProg = createProgram("Display AO map program");
ssaoBlurProgram = createProgram("SSAO blur program");
finalPassProgram = createProgram("Final Pass Program");
geomPlane.transform.setScale(glm::vec3(20.0));
geomPlane.transform.setPosition(glm::vec3(0,-1,0));
cryModel.transform.setScale(glm::vec3(0.5));
cryModel.transform.setPosition(glm::vec3(0,0,3.5));
cryModel.transform.rotate(-M_PI/2, glm::vec3(1.0,0,0));
}
示例14: setRotation
void LnkProperties::done(int ok)
{
if ( ok ) {
bool changed=FALSE;
bool reloadMime=FALSE;
if ( lnk->name() != d->docname->text() ) {
lnk->setName(d->docname->text());
changed=TRUE;
}
if ( d->categoryEdit->isVisible() ) {
QArray<int> tmp = d->categoryEdit->newCategories();
if ( lnk->categories() != tmp ) {
lnk->setCategories( tmp );
changed = TRUE;
}
}
if ( !d->rotate->isHidden()) {
QString newrot;
if ( d->rotate->isChecked() ) {
int rot=0;
for(; rot<4; rot++) {
if (d->rotateButtons->find(rot)->isOn())
break;
}
newrot = QString::number((rot*90)%360);
}
if ( newrot != lnk->rotation() ) {
lnk-> setRotation(newrot);
changed = TRUE;
reloadMime = TRUE;
}
}
if ( d->arguments->text() != lnk->property( "Arguments" ) ) {
lnk->setProperty( "Arguments", d->arguments->text() );
changed = TRUE;
}
if ( d->preload->isHidden() && d->locationCombo->currentItem() != currentLocation ) {
moveLnk();
} else if ( changed ) {
lnk->writeLink();
}
if ( !d->preload->isHidden() ) {
Config cfg("Launcher");
cfg.setGroup("Preload");
QStringList apps = cfg.readListEntry("Apps",',');
QString exe = lnk->exec();
if ( apps.contains(exe) != d->preload->isChecked() ) {
if ( d->preload->isChecked() ) {
apps.append(exe);
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
"enablePreload()");
#endif
} else {
apps.remove(exe);
#ifndef QT_NO_COP
QCopEnvelope e("QPE/Application/"+exe.local8Bit(),
"quitIfInvisible()");
#endif
}
cfg.writeEntry("Apps",apps,',');
}
}
if ( reloadMime )
MimeType::updateApplications ( );
}
QDialog::done( ok );
}
示例15: Clear
bool CLangData::ReadTranslation(PCTSTR pszFile, bool bUpdateTranslation, bool bIgnoreVersion)
{
try
{
if(!bUpdateTranslation)
Clear();
// load data from file
icpf::config cfg(icpf::config::eIni);
const uint_t uiLangName = cfg.register_string(_T("Info/Lang Name"), _t(""));
const uint_t uiFontFace = cfg.register_string(_T("Info/Font Face"), _T(""));
const uint_t uiSize = cfg.register_signed_num(_T("Info/Size"), 0, 0, 0xffff);
const uint_t uiRTL = cfg.register_bool(_T("Info/RTL reading order"), false);
const uint_t uiHelpName = cfg.register_string(_T("Info/Help name"), _T(""));
const uint_t uiAuthor = cfg.register_string(_T("Info/Author"), _T(""));
const uint_t uiVersion = cfg.register_string(_T("Info/Format version"), _T("1"));
cfg.read(pszFile);
// we don't support old language versions unless requested specifically
if(!bIgnoreVersion)
{
const tchar_t* pszVersion = cfg.get_string(uiVersion);
if(_tcscmp(pszVersion, TRANSLATION_FORMAT_VERSION) != 0)
return false;
}
const tchar_t* psz = cfg.get_string(uiLangName);
if(!psz || psz[0] == _t('\0'))
return false;
SetLangName(psz);
psz = cfg.get_string(uiFontFace);
if(!psz || psz[0] == _t('\0'))
return false;
SetFontFace(psz);
ll_t ll = cfg.get_signed_num(uiSize);
if(ll == 0)
return false;
SetPointSize((WORD)ll);
SetDirection(cfg.get_bool(uiRTL));
psz = cfg.get_string(uiHelpName);
if(!psz || psz[0] == _t('\0'))
return false;
SetHelpName(psz);
psz = cfg.get_string(uiAuthor);
if(!psz || psz[0] == _t('\0'))
return false;
SetAuthor(psz);
m_bUpdating = bUpdateTranslation;
m_uiSectionID = 0;
if(!cfg.enum_properties(_t("*"), EnumAttributesCallback, this))
{
m_bUpdating = false;
return false;
}
m_bUpdating = false;
SetFilename(pszFile);
m_bModified = false;
return true;
}
catch(...)
{
return false;
}
}