本文整理汇总了C++中Name函数的典型用法代码示例。如果您正苦于以下问题:C++ Name函数的具体用法?C++ Name怎么用?C++ Name使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Name函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: i18n
QString GeneratedVector::descriptionTip() const {
return i18n("Generated Vector: %1\n"
" %2 values from %3 to %4").arg(Name()).arg(length()).arg(_v[0]).arg(_v[length()-1]);
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:4,代码来源:generatedvector.cpp
示例2: return
// calculates which video dir to use
bool cVideoDirectory::GetPreferedVideoDir(void)
{
cVideoDirectory d;
int nDirs = 1,
vidUse = Setup.nVidPrefer;
int i, top, topFree, x;
if (name == NULL)
return(false);
// count available video dirs
while (d.Next() == true)
nDirs++;
if (vidUse > nDirs)
vidUse = nDirs;
// check for prefered video dir
for (i = 0, top = -1, topFree = 0; i < vidUse; i++) {
if (IsVidDirOK(i, &x) == true) {
if (top == -1) {
// nothing set yet, use first 'ok' dir
top = i;
topFree = x;
}
else {
// check if we got a higher priority
if (Setup.VidPreferPrio[ i ] >= Setup.VidPreferPrio[ top ]) {
top = i;
topFree = x;
}
// check if we got same priority but more space
else if (Setup.VidPreferPrio[ i ] == Setup.VidPreferPrio[ top ] && x >= topFree) {
top = i;
topFree = x;
}
}
}
}
if (top == -1) {
isyslog("VidPrefer: no prefered video directory could be determined!");
// something went wrong here...
// let VDR determine the video directory
int MaxFree = FreeMB();
while (Next()) {
int Free = FreeDiskSpaceMB(Name());
if (Free > MaxFree) {
Store();
MaxFree = Free;
}
}
}
else {
isyslog("VidPrefer: prefered video directory '%d' set.", top);
if (stored != NULL)
free(stored);
stored = GetVidPath(top);
}
return true;
}
开发者ID:suborb,项目名称:reelvdr,代码行数:66,代码来源:videodir.c
示例3: roo_fitWH
//.........这里部分代码省略.........
RooFitResult *res1 = m->save();
// Re-diced data
// Int_t nevt=static_cast<int>(istat);
// RooDataSet *gtest = model->generate(x,nevt);
// Fitting
// RooFitResult * res1 = model.fitTo(test,Minos(kFALSE), Save());
// res1->Print();
if(makePlots) {
// Temp PDF for plotting purposes
// RooAddPdf temp("temp","component 1",RooArgList(*h1,*h2,*h3),RooArgList(*f1,*f2)) ;
// Plotting
gROOT->SetStyle("Plain");
gStyle->SetOptFit(0);
gStyle->SetOptTitle(0);
gStyle->SetOptStat(0); //gStyle->SetCanvasDefH(600); //Height of canvas
//gStyle->SetCanvasDefW(600); //Width of canvas
if(charge.at(j) == "Plus") { c0->cd();
//c0->Divide(2,1);c0->cd(1);
}
if(charge.at(j) == "Minus") { c1->cd();
//c1->Divide(2,1);c1->cd(1);
}
//RooPlot* frame = new RooPlot(0.0,1.3,0,800);
RooPlot* frame = x.frame();
test.plotOn(frame,Name("data"));
model->plotOn(frame,Name("model"));
// model->paramOn(frame);//, Format("NELU", AutoPrecision(2)), Layout(0.1,0.5,0.9));
// h1.plotOn(frame);
// h2.plotOn(frame);
// h3.plotOn(frame);
// model->plotOn(frame, Components(h1),LineColor(kRed),LineStyle(kDashed));
// temp->plotOn(frame, Components(h2),LineColor(kGreen),LineStyle(kDashed));
// temp->plotOn(frame, Components(h3),LineColor(kYellow),LineStyle(kDashed));
if (addbkg) {
// model->plotOn(frame, Components(h1),FillColor(5),DrawOption("F"));
//model->plotOn(frame,Components(*bkg),FillColor(5),DrawOption(""));
}
hdata->GetYaxis()->SetTitle("Events / 0.1");
if(charge.at(j) == "Plus") { hdata->GetXaxis()->SetTitle("#it{L_{P}}(#mu^{+})");}
if(charge.at(j) == "Minus") {hdata->GetXaxis()->SetTitle("#it{L_{P}}(#mu^{-})");}
hdata->GetXaxis()->SetTitleSize(0.06);
hdata->GetXaxis()->SetTitleOffset(1.);
hdata->GetYaxis()->SetTitleSize(0.06);
hdata->GetYaxis()->SetTitleOffset(1.2);
hdata->GetXaxis()->SetLabelSize(0.055);
hdata->GetYaxis()->SetLabelSize(0.055);
hdata->GetXaxis()->SetRangeUser(0.0,1.29);
hdata->GetYaxis()->SetRangeUser(0.0,600);
hdata->SetMarkerStyle(20);
// mc1->Draw("same");
// Goodness-of-fit
Double_t chi2= frame->chiSquare("model","data",3);
开发者ID:bluejelibaby,项目名称:AnalysisV2,代码行数:67,代码来源:roo_fitWH.C
示例4: LLOG
void TopWindow::Open(Ctrl *owner)
{
LLOG("TopWindow::Open");
GuiLock __;
if(dokeys && (!GUI_AKD_Conservative() || GetAccessKeysDeep() <= 1))
DistributeAccessKeys();
USRLOG(" OPEN " + Desc(this));
LLOG("OPEN " << Name() << " owner: " << UPP::Name(owner));
IgnoreMouseUp();
bool weplace = owner && center == 1 || center == 2 || !GetRect().IsEmpty();
if(fullscreen)
SetRect(0, 0, Xwidth, Xheight);
else
CenterRect(owner);
LLOG("Open NextRequest " << NextRequest(Xdisplay));
Create(owner, false, false);
XSetWMProperties (Xdisplay, GetWindow(), NULL, NULL, NULL, 0, NULL, NULL, NULL);
xminsize.cx = xmaxsize.cx = Null;
title2.Clear();
if(!weplace) {
LLOG("SyncCaption");
SyncCaption();
}
LLOG("SyncSizeHints");
size_hints->flags = 0;
SyncSizeHints();
Rect r = GetRect();
size_hints->x = r.left;
size_hints->y = r.top;
size_hints->width = r.Width();
size_hints->height = r.Height();
size_hints->win_gravity = StaticGravity;
size_hints->flags |= PPosition|PSize|PWinGravity;
if(owner) {
ASSERT(owner->IsOpen());
LLOG("XSetTransientForHint");
XSetTransientForHint(Xdisplay, GetWindow(), owner->GetWindow());
}
LLOG("XSetWMNormalHints");
XSetWMNormalHints(Xdisplay, GetWindow(), size_hints);
Atom protocols[3];
protocols[0] = XAtom("WM_DELETE_WINDOW");
protocols[1] = XAtom("WM_TAKE_FOCUS");
protocols[2] = XAtom("_NET_WM_PING");
LLOG("XSetWMProtocols");
XSetWMProtocols(Xdisplay, GetWindow(), protocols, 3);
String x = GetExeTitle().ToString();
const char *progname = ~x;
class_hint->res_name = (char *)progname;
class_hint->res_class = (char *)progname;
XSetClassHint(Xdisplay, GetWindow(), class_hint);
LLOG("WndShow(" << visible << ")");
WndShow(visible);
if(visible) {
XEvent e;
LLOG("XWindowEvent");
XWindowEvent(Xdisplay, top->window, VisibilityChangeMask, &e);
ignoretakefocus = true;
SetTimeCallback(500, THISBACK(EndIgnoreTakeFocus));
LLOG("SetWndFocus");
SetWndFocus();
for(int i = 0; i < 50; i++) {
// X11 tries to move our window, so ignore the first set of ConfigureNotify
// and move the window into position after FocusIn - but not if we want WM to
// place the window
if(weplace)
while(XCheckTypedWindowEvent(Xdisplay, top->window, ConfigureNotify, &e)) {
if(e.xconfigure.window != top->window)
ProcessEvent(&e);
}
if(XCheckTypedWindowEvent(Xdisplay, top->window, FocusIn, &e)) {
ProcessEvent(&e);
if(e.xfocus.window == top->window)
break;
}
Sleep(10);
}
}
if(weplace) {
WndSetPos(GetRect());
LLOG("SyncCaption");
SyncCaption();
}
LLOG(">Open NextRequest " << NextRequest(Xdisplay));
LLOG(">OPENED " << Name());
PlaceFocus();
StateH(OPEN);
Vector<int> fe = GetPropertyInts(top->window, XAtom("_NET_FRAME_EXTENTS"));
if(fe.GetCount() >= 4 &&
fe[0] >= 0 && fe[0] <= 16 && fe[1] >= 0 && fe[1] <= 16 && //fluxbox returns wrong numbers - quick&dirty workaround
fe[2] >= 0 && fe[2] <= 64 && fe[3] >= 0 && fe[3] <= 48)
{
GuiLock __;
windowFrameMargin.left = max(windowFrameMargin.left, fe[0]);
windowFrameMargin.right = max(windowFrameMargin.right, fe[1]);
windowFrameMargin.top = max(windowFrameMargin.top, fe[2]);
windowFrameMargin.bottom = max(windowFrameMargin.bottom, fe[3]);
}
if(IsOpen() && top)
top->owner = owner;
//.........这里部分代码省略.........
开发者ID:koz4k,项目名称:soccer,代码行数:101,代码来源:X11Top.cpp
示例5: fit2015
void fit2015(
TString FileName ="/afs/cern.ch/user/a/anstahll/work/public/ExpressStream2015/ppData/OniaTree_262163_262328.root",
int oniamode = 2, // oniamode-> 3: Z, 2: Upsilon and 1: J/Psi
bool isData = true, // isData = false for MC, true for Data
bool isPbPb = false, // isPbPb = false for pp, true for PbPb
bool doFit = false ,
bool inExcStat = true // if inExcStat is true, then the excited states are fitted
) {
InputOpt opt;
SetOptions(&opt, isData, isPbPb, oniamode,inExcStat);
if (isPbPb) {
FileName = "/afs/cern.ch/user/a/anstahll/work/public/ExpressStream2015/PbPbData/OniaTree_262548_262893.root";
} else {
FileName = "/afs/cern.ch/user/a/anstahll/work/public/ExpressStream2015/ppData/OniaTree_262163_262328.root";
}
int nbins = 1; //ceil((opt.dMuon->M->Max - opt.dMuon->M->Min)/binw);
if (oniamode==1){
nbins = 140;
} else if (oniamode==2) {
nbins = 70;
} else if (oniamode==3) {
nbins = 40;
}
RooWorkspace myws;
TH1F* hDataOS = new TH1F("hDataOS","hDataOS", nbins, opt.dMuon.M.Min, opt.dMuon.M.Max);
makeWorkspace2015(myws, FileName, opt, hDataOS);
RooRealVar* mass = (RooRealVar*) myws.var("invariantMass");
RooDataSet* dataOS_fit = (RooDataSet*) myws.data("dataOS");
RooDataSet* dataSS_fit = (RooDataSet*) myws.data("dataSS");
RooAbsPdf* pdf = NULL;
if (oniamode==3) { doFit=false; }
if (doFit) {
int sigModel=0, bkgModel=0;
if (isData) {
if (oniamode==1){
sigModel = inExcStat ? 2 : 3;
bkgModel = 1;
} else {
sigModel = inExcStat ? 1 : 3; // gaussian
bkgModel = 2;
}
} else {
if (oniamode==1){
sigModel = inExcStat ? 2 : 3; // gaussian
bkgModel = 2;
} else {
sigModel = inExcStat ? 2 : 3; // gaussian
bkgModel = 3;
}
}
if (opt.oniaMode==1) buildModelJpsi2015(myws, sigModel, bkgModel,inExcStat);
else if (opt.oniaMode==2) buildModelUpsi2015(myws, sigModel, bkgModel,inExcStat);
pdf =(RooAbsPdf*) myws.pdf("pdf");
RooFitResult* fitObject = pdf->fitTo(*dataOS_fit,Save(),Hesse(kTRUE),Extended(kTRUE)); // Fit
}
RooPlot* frame = mass->frame(Bins(nbins),Range(opt.dMuon.M.Min, opt.dMuon.M.Max));
RooPlot* frame2 = NULL;
dataSS_fit->plotOn(frame, Name("dataSS_FIT"), MarkerColor(kRed), LineColor(kRed), MarkerSize(1.2));
dataOS_fit->plotOn(frame, Name("dataOS_FIT"), MarkerColor(kBlue), LineColor(kBlue), MarkerSize(1.2));
if (doFit) {
pdf->plotOn(frame,Name("thePdf"),Normalization(dataOS_fit->sumEntries(),RooAbsReal::NumEvent));
RooHist *hpull = frame -> pullHist(0,0,true);
hpull -> SetName("hpull");
frame2 = mass->frame(Title("Pull Distribution"),Bins(nbins),Range(opt.dMuon.M.Min,opt.dMuon.M.Max));
frame2 -> addPlotable(hpull,"PX");
}
drawPlot(frame,frame2, pdf, opt, doFit,inExcStat);
TString OutputFileName = "";
if (isPbPb) {
FileName = "/afs/cern.ch/user/a/anstahll/work/public/ExpressStream2015/PbPbData/OniaTree_262548_262893.root";
opt.RunNb.Start=262548;
opt.RunNb.End=262893;
if (oniamode==1) {OutputFileName = (TString)("JPSIPbPbDataset.root");}
if (oniamode==2) {OutputFileName = (TString)("YPbPbDataset.root");}
if (oniamode==3) {OutputFileName = (TString)("ZPbPbDataset.root");}
} else {
FileName = "/afs/cern.ch/user/a/anstahll/work/public/ExpressStream2015/ppData/OniaTree_262163_262328.root";
opt.RunNb.Start=262163;
opt.RunNb.End=262328;
if (oniamode==1) {OutputFileName = (TString)("JPSIppDataset.root");}
if (oniamode==2) {OutputFileName = (TString)("YppDataset.root");}
if (oniamode==3) {OutputFileName = (TString)("ZppDataset.root");}
}
TFile* oFile = new TFile(OutputFileName,"RECREATE");
oFile->cd();
hDataOS->Write("hDataOS");
dataOS_fit->Write("dataOS_FIT");
//.........这里部分代码省略.........
开发者ID:CMS-HIN-dilepton,项目名称:Dimuons,代码行数:101,代码来源:fit2015.C
示例6: Parameters
//---------------------------------------------------------
bool CClip_Points::On_Execute(void)
{
int Method, iField;
CSG_Shapes *pPoints, *pPolygons, *pClip;
CSG_Parameter_Shapes_List *pClips;
//-----------------------------------------------------
pPoints = Parameters("POINTS") ->asShapes();
pPolygons = Parameters("POLYGONS") ->asShapes();
pClips = Parameters("CLIPS") ->asShapesList();
Method = Parameters("METHOD") ->asInt();
iField = Parameters("FIELD") ->asInt();
//-----------------------------------------------------
if( !pPoints->is_Valid() )
{
Message_Add(_TL("Invalid points layer."));
return( false );
}
else if( !pPolygons->is_Valid() )
{
Message_Add(_TL("Invalid polygon layer."));
return( false );
}
//-----------------------------------------------------
if( iField >= pPolygons->Get_Field_Count() )
{
iField = -1;
}
pClips->Del_Items();
if( Method == 0 )
{
pClip = SG_Create_Shapes(SHAPE_TYPE_Point, CSG_String::Format(SG_T("%s [%s]"), pPoints->Get_Name(), pPolygons->Get_Name()), pPoints);
if( iField >= 0 )
{
pClip->Add_Field(pPolygons->Get_Field_Name(iField), pPolygons->Get_Field_Type(iField));
}
}
//-----------------------------------------------------
for(int iPolygon=0; iPolygon<pPolygons->Get_Count() && Set_Progress(iPolygon, pPolygons->Get_Count()); iPolygon++)
{
CSG_Shape_Polygon *pPolygon = (CSG_Shape_Polygon *)pPolygons->Get_Shape(iPolygon);
if( Method == 1 )
{
CSG_String Name(pPoints->Get_Name());
Name += iField >= 0
? CSG_String::Format(SG_T(" [%s]"), pPolygon->asString(iField))
: CSG_String::Format(SG_T(" [%00d]"), 1 + pClips->Get_Count());
pClip = SG_Create_Shapes(SHAPE_TYPE_Point, Name, pPoints);
if( iField >= 0 )
{
pClip->Add_Field(pPolygons->Get_Field_Name(iField), pPolygons->Get_Field_Type(iField));
}
}
for(int iPoint=0; iPoint<pPoints->Get_Count() && Process_Get_Okay(false); iPoint++)
{
CSG_Shape *pPoint = pPoints->Get_Shape(iPoint);
if( pPolygon->Contains(pPoint->Get_Point(0)) )
{
pPoint = pClip->Add_Shape(pPoint, SHAPE_COPY);
if( iField >= 0 )
{
pPoint->Set_Value(pPoints->Get_Field_Count(), pPolygon->asString(iField));
}
}
}
if( Method == 1 )
{
if( pClip->Get_Count() > 0 )
{
pClips->Add_Item(pClip);
}
else
{
delete(pClip);
}
}
}
//-----------------------------------------------------
if( Method == 0 )
{
if( pClip->Get_Count() > 0 )
{
//.........这里部分代码省略.........
开发者ID:johanvdw,项目名称:saga-debian,代码行数:101,代码来源:Clip_Points.cpp
示例7: result
SchemaElementDefinition HistoricElementSecurityData::elementDefinition() const
{
::blpapi_DataType_t dtype = (::blpapi_DataType_t)this->datatype();
SchemaElementDefinition result(dtype, Name("HistoricalDataTable"));
return result;
}
开发者ID:red2901,项目名称:sandbox,代码行数:6,代码来源:HistoricElementSecurityData.cpp
示例8: MuMcPrVKFV2012
/**
* 1. Data sample : pp200 W->e nu with pile-up corresponding to 1 MHz min. bias
* events, 50 K event y2011, 10 K event y2012.
*
* 2. Proof of principal: no pile-up for both PPV and KFV
*
* a. Reconstructed primary track multiplicity versus corresponding MC
* "reconstructable" (i.e. in n STAR acceptance,no. TPC MC hits >= 15) tracks
* multiplicity.
*
* b. Corrected reconstructed primary track multiplicity (i.e. multiplied by
* QA/100.) versus corresponding MC "reconstructable" (i.e. in n STAR
* acceptance,no. TPC MC hits >= 15) tracks multiplicity.
*
* c. Efficiency primary vertex reconstruction versus MC "reconstructable"
* tracks multiplicity.
*
* 3. With pileup. repeat above (a-c) with old ranking scheme for
*
* I. Any reconstructed primary vertex which is matched with MC trigger
* vertex (MC = 1)
*
* II. The best (in sense of ranking) reconstructed primary vertex which is
* matched with MC trigger vertex (MC = 1)
*
* III. The best (in sense of ranking) reconstructed primary vertex which is
* not matched with MC trigger vertex (MC != 1)
*
* 4. With pileup. repeat above (a-c) with new ranking scheme for cases I-III
*/
void MuMcPrVKFV2012(Long64_t nevent, const char *file, const std::string& outFile, bool fillNtuple)
{
#ifdef __TMVA__
boost::replace_last(outFile, ".root", "");
outFile += ".TMVArank.root";
// create a set of variables and declare them to the reader
// - the variable names must corresponds in name and type to
// those given in the weight file(s) that you use
TString separator(":");
TString Vnames(vnames);
TObjArray *array = Vnames.Tokenize(separator);
std::vector<std::string> inputVars;
TIter next(array);
TObjString *objs;
while ((objs = (TObjString *) next())) {
std::cout << objs->GetString() << std::endl;
}
inputVars.push_back("beam");
inputVars.push_back("postx");
inputVars.push_back("prompt");
inputVars.push_back("cross");
inputVars.push_back("tof");
inputVars.push_back("notof");
inputVars.push_back("EEMC");
inputVars.push_back("noEEMC");
inputVars.push_back("chi2");
std::vector<double> *inputVec = new std::vector<double>( inputVars.size() );
IClassifierReader *classReader = new ReadBDT( inputVars );
#endif /* __TMVA__ */
TFile *fOut = TFile::Open(outFile.c_str(), "recreate");
data_t data;
// Book histograms
const int nMcRecMult = 75;
TArrayD xMult(nMcRecMult + 1);
xMult[0] = -0.5;
for (int i = 1; i <= nMcRecMult; i++) {
if (xMult[i - 1] < 50) xMult[i] = xMult[i - 1] + 1; // 1 - 50
else if (xMult[i - 1] < 100) xMult[i] = xMult[i - 1] + 2; // 51 - 75
else if (xMult[i - 1] < 200) xMult[i] = xMult[i - 1] + 10; // 76 - 85
else xMult[i] = xMult[i - 1] + 100; // 86 -100
}
TH1D *McRecMulT = new TH1D("McRecMulT", "Reconstructable multiplicity for trigger Mc Vertex", nMcRecMult, xMult.GetArray());
struct Name_t {
const Char_t *Name;
const Char_t *Title;
};
const Name_t HCases[3] = {
{"Any", "Any vertex matched with MC == 1"},
{"Good", "The best rank vertex with MC == 1"},
{"Bad", "The best rank vertex with MC != 1"}
};
const Name_t Plots[4] = {
{"Mult" , "the reconstructed (uncorrected) track multiplicity versus Reconstructable multiplicity"},
{"MultQA" , "the reconstructed (corrected for QA) track multiplicity versus Reconstructable multiplicity"},
{"McRecMul", "Reconstructable multiplicity"},
{"YvsX" , "Bad versus Good value"}
};
/* h p */
TH1 *hists[3][4];
//.........这里部分代码省略.........
开发者ID:star-bnl,项目名称:star-travex,代码行数:101,代码来源:MuMcPrVKFV2012.C
示例9: Name
//DEBUG.
void GaugeGroup::Display() const
{
Name().Display();
}//Close Display.
开发者ID:EUCOS,项目名称:ff-framework,代码行数:5,代码来源:GaugeGroup.cpp
示例10: main
int
main(int argc, char* argv[])
{
Options options;
options.freshnessPeriod = getMinimumFreshnessPeriod();
options.shouldLimitSatisfied = false;
options.nMaxPings = 0;
options.shouldPrintTimestamp = false;
options.payloadSize = 0;
namespace po = boost::program_options;
po::options_description visibleOptDesc("Allowed options");
visibleOptDesc.add_options()
("help,h", "print this message and exit")
("version,V", "display version and exit")
("freshness,x", po::value<int>(),
("set freshness period in milliseconds (minimum " +
std::to_string(getMinimumFreshnessPeriod().count()) + " ms)").c_str())
("satisfy,p", po::value<int>(&options.nMaxPings), "set maximum number of pings to be satisfied")
("timestamp,t", "log timestamp with responses")
("size,s", po::value<int>(&options.payloadSize), "specify size of response payload")
;
po::options_description hiddenOptDesc("Hidden options");
hiddenOptDesc.add_options()
("prefix", po::value<std::string>(), "prefix to register")
;
po::options_description optDesc("Allowed options");
optDesc.add(visibleOptDesc).add(hiddenOptDesc);
try {
po::positional_options_description optPos;
optPos.add("prefix", -1);
po::variables_map optVm;
po::store(po::command_line_parser(argc, argv).options(optDesc).positional(optPos).run(), optVm);
po::notify(optVm);
if (optVm.count("help") > 0) {
usage(visibleOptDesc);
}
if (optVm.count("version") > 0) {
std::cout << "ndnpingserver " << tools::VERSION << std::endl;
exit(0);
}
if (optVm.count("prefix") > 0) {
options.prefix = Name(optVm["prefix"].as<std::string>());
}
else {
std::cerr << "ERROR: No prefix specified" << std::endl;
usage(visibleOptDesc);
}
if (optVm.count("freshness") > 0) {
options.freshnessPeriod = time::milliseconds(optVm["freshness"].as<int>());
if (options.freshnessPeriod.count() < getMinimumFreshnessPeriod().count()) {
std::cerr << "ERROR: Specified FreshnessPeriod is less than the minimum "
<< getMinimumFreshnessPeriod() << std::endl;
usage(visibleOptDesc);
}
}
if (optVm.count("satisfy") > 0) {
options.shouldLimitSatisfied = true;
if (options.nMaxPings < 1) {
std::cerr << "ERROR: Maximum number of pings to satisfy must be greater than 0" << std::endl;
usage(visibleOptDesc);
}
}
if (optVm.count("timestamp") > 0) {
options.shouldPrintTimestamp = true;
}
if (optVm.count("size") > 0) {
if (options.payloadSize < 0) {
std::cerr << "ERROR: Payload size must be greater than or equal to 0" << std::endl;
usage(visibleOptDesc);
}
}
}
catch (const po::error& e) {
std::cerr << "ERROR: " << e.what() << std::endl;
usage(visibleOptDesc);
}
std::cout << "PING SERVER " << options.prefix << std::endl;
return Runner(options).run();
}
开发者ID:CSUL,项目名称:ndn-tools,代码行数:94,代码来源:ndn-ping-server.cpp
示例11: ReportError
void
VideoProducer::NodeRegistered()
{
if (fInitStatus != B_OK) {
ReportError(B_NODE_IN_DISTRESS);
return;
}
/* Set up the parameter web */
//TODO: remove and put sensible stuff there
BParameterWeb *web = new BParameterWeb();
BParameterGroup *main = web->MakeGroup(Name());
BParameterGroup *g;
/*
g = main->MakeGroup("Color");
BDiscreteParameter *state = g->MakeDiscreteParameter(
P_COLOR, B_MEDIA_RAW_VIDEO, "Color", "Color");
state->AddItem(B_HOST_TO_LENDIAN_INT32(0x00ff0000), "Red");
state->AddItem(B_HOST_TO_LENDIAN_INT32(0x0000ff00), "Green");
state->AddItem(B_HOST_TO_LENDIAN_INT32(0x000000ff), "Blue");
*/
BParameter *p;
g = main->MakeGroup("Info");
p = g->MakeTextParameter(
P_INFO, B_MEDIA_RAW_VIDEO, "", "Info", 256);
int32 id = P_LAST;
if (fCamDevice) {
#ifndef SINGLE_PARAMETER_GROUP
main = web->MakeGroup("Device");
#endif
fCamDevice->AddParameters(main, id);
if (fCamDevice->Sensor()) {
#ifndef SINGLE_PARAMETER_GROUP
main = web->MakeGroup("Sensor");
#endif
fCamDevice->Sensor()->AddParameters(main, id);
}
}
fColor = B_HOST_TO_LENDIAN_INT32(0x00ff0000);
fLastColorChange = system_time();
/* After this call, the BControllable owns the BParameterWeb object and
* will delete it for you */
SetParameterWeb(web);
fOutput.node = Node();
fOutput.source.port = ControlPort();
fOutput.source.id = 0;
fOutput.destination = media_destination::null;
strcpy(fOutput.name, Name());
/* Tailor these for the output of your device */
fOutput.format.type = B_MEDIA_RAW_VIDEO;
fOutput.format.u.raw_video = media_raw_video_format::wildcard;
fOutput.format.u.raw_video.interlace = 1;
fOutput.format.u.raw_video.display.format = B_RGB32;
fOutput.format.u.raw_video.field_rate = FIELD_RATE; // XXX: mmu
/* Start the BMediaEventLooper control loop running */
Run();
}
开发者ID:AmirAbrams,项目名称:haiku,代码行数:66,代码来源:Producer.cpp
示例12: asz
Size BarPane::Repos(bool _horz, int maxsize)
{
horz = _horz;
maxsize -= 2 * (horz ? hmargin : vmargin);
int bmargin = horz ? vmargin : hmargin;
breakpos.Clear();
Size asz(0, 0);
VeHo(asz) = bmargin;
Array<Item>::Iterator q = item.Begin();
while(q < item.End()) {
Size psz(0, 0);
Array<Item>::Iterator f = q;
while(q < item.End()) {
if(q->ctrl == NULL && IsNull(q->gapsize)) {
q++;
break;
}
int gapsize = q->gapsize;
if(gapsize == INT_MAX && q->ctrl == NULL) {
if(maxsize == INT_MAX) {
q++;
break;
}
gapsize = 0;
Array<Item>::Iterator w = q + 1;
while(w < item.End()) {
if(!w->ctrl) break;
Size sz = w->ctrl->GetMinSize();
if(HoVe(psz) + gapsize + HoVe(sz) > maxsize) break;
gapsize += HoVe(sz);
w++;
}
gapsize = maxsize - gapsize - HoVe(psz);
}
Size sz = q->ctrl ? q->ctrl->GetMinSize()
: Size(horz ? gapsize : 0, horz ? 0 : gapsize);
if(HoVe(sz) == INT_MAX)
HoVe(sz) = maxsize - HoVe(psz);
if(HoVe(psz) + HoVe(sz) > maxsize && HoVe(psz)) {
while(q < item.End() && q->ctrl == NULL && !IsNull(q->gapsize))
q++;
break;
}
VeHo(psz) = max(VeHo(psz), VeHo(sz));
if(q->ctrl) {
if(horz)
q->ctrl->LeftPos(psz.cx + hmargin, sz.cx);
else
q->ctrl->TopPos(psz.cy + vmargin, sz.cy);
}
HoVe(psz) += HoVe(sz);
q++;
}
int& bp = VeHo(asz);
if(bp > bmargin) {
breakpos.Add(bp + bmargin);
bp += 2 + 2 * bmargin;
}
while(f != q) {
if(f->ctrl) {
if(horz)
f->ctrl->TopPos(bp, psz.cy);
else
f->ctrl->LeftPos(bp, psz.cx);
}
f++;
}
bp += VeHo(psz);
HoVe(asz) = max(HoVe(asz), HoVe(psz));
}
VeHo(asz) += bmargin;
HoVe(asz) += horz ? 2 * hmargin : 2 * vmargin;
LLOG("Repos " << Name() << " " << asz);
return asz;
}
开发者ID:AbdelghaniDr,项目名称:mirror,代码行数:75,代码来源:Bar.cpp
示例13: atoi
int GButton::Value()
{
return atoi(Name());
}
开发者ID:FEI17N,项目名称:Lgi,代码行数:4,代码来源:GButton.cpp
示例14: visitBlock
void visitBlock(Block *curr) {
if (curr->name.is() && branchesSeen.count(curr->name) == 0) {
curr->name = Name();
}
}
开发者ID:brson,项目名称:binaryen,代码行数:5,代码来源:RemoveUnusedNames.cpp
示例15: Check
void GRPCHANGECommand::Execute()
{
SetFunction set = Check();
auto gids = acl::Group::GetGIDs(args[1]);
if (gids.empty())
{
control.Format(ftp::ActionNotOkay, "No group's exist matching that criteria.");
throw cmd::NoPostScriptError();
}
for (auto gid : gids)
{
auto group = acl::Group::Load(gid);
if (group)
{
set(*group);
logs::Siteop(client.User().Name(), "changed '%1%' for '%2%' to '%3%'", args[2], group->Name(), display);
}
}
assert(!display.empty());
control.Format(ftp::CommandOkay, "Setting %1% changed for %2%: %3%", args[2],
gids.size() == 1 ? acl::GIDToName(gids[0]) :
util::Format()("%i groups", gids.size()), display);
}
开发者ID:arrrrrrr,项目名称:ebftpd,代码行数:26,代码来源:grpchange.cpp
示例16: LLOG
bool Ctrl::SetFocus()
{
GuiLock __;
LLOG("Ctrl::SetFocus(" << Name() << ")");
return SetFocus0(true);
}
开发者ID:guowei8412,项目名称:upp-mirror,代码行数:6,代码来源:CtrlKbd.cpp
示例17: pow
void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) {
// Apply spring physics to the overscroll as time goes on.
// Note: this method of sampling isn't perfectly smooth, as it assumes
// a constant velocity over 'aDelta', instead of an accelerating velocity.
// (The way we applying friction to flings has the same issue.)
// Hooke's law with damping:
// F = -kx - bv
// where
// k is a constant related to the stiffness of the spring
// The larger the constant, the stiffer the spring.
// x is the displacement of the end of the spring from its equilibrium
// In our scenario, it's the amount of overscroll on the axis.
// b is a constant that provides damping (friction)
// v is the velocity of the point at the end of the spring
// See http://gafferongames.com/game-physics/spring-physics/
const float kSpringStiffness = gfxPrefs::APZOverscrollSpringStiffness();
const float kSpringFriction = gfxPrefs::APZOverscrollSpringFriction();
// Apply spring force.
float springForce = -1 * kSpringStiffness * mOverscroll;
// Assume unit mass, so force = acceleration.
float oldVelocity = mVelocity;
mVelocity += springForce * aStepDurationMilliseconds;
// Apply dampening.
mVelocity *= pow(double(1 - kSpringFriction), aStepDurationMilliseconds);
AXIS_LOG("%p|%s sampled overscroll animation, leaving velocity at %f\n",
mAsyncPanZoomController, Name(), mVelocity);
// At the peak of each oscillation, record new offset and scaling factors for
// overscroll, to ensure that GetOverscroll always returns a value of the
// same sign, and that this value is correctly adjusted as the spring is
// dampened.
bool velocitySignChange = (oldVelocity * mVelocity) < 0;
if (mFirstOverscrollAnimationSample == 0.0f) {
mFirstOverscrollAnimationSample = mOverscroll;
// It's possible to start sampling overscroll with velocity == 0, or
// velocity in the opposite direction of overscroll, so make sure we
// correctly record the peak in this case.
if (mOverscroll != 0 && ((mOverscroll > 0 ? oldVelocity : -oldVelocity) <= 0.0f)) {
velocitySignChange = true;
}
}
if (velocitySignChange) {
bool oddOscillation = (mOverscroll.value * mFirstOverscrollAnimationSample.value) < 0.0f;
mLastOverscrollPeak = oddOscillation ? mOverscroll : -mOverscroll;
mOverscrollScale = 2.0f;
}
// Adjust the amount of overscroll based on the velocity.
// Note that we allow for oscillations.
mOverscroll += (mVelocity * aStepDurationMilliseconds);
// Our mechanism for translating a set of mOverscroll values that oscillate
// around zero to a set of GetOverscroll() values that have the same sign
// (so content is always stretched, never compressed) assumes that
// mOverscroll does not exceed mLastOverscrollPeak in magnitude. If our
// calculations were exact, this would be the case, as a dampened spring
// should never attain a displacement greater in magnitude than a previous
// peak. In our approximation calculations, however, this may not hold
// exactly. To ensure the assumption is not violated, we clamp the magnitude
// of mOverscroll.
if (mLastOverscrollPeak != 0 && fabs(mOverscroll) > fabs(mLastOverscrollPeak)) {
mOverscroll = (mOverscroll >= 0) ? fabs(mLastOverscrollPeak) : -fabs(mLastOverscrollPeak);
}
}
开发者ID:RobertJGabriel,项目名称:Waterfox,代码行数:67,代码来源:Axis.cpp
示例18: do_name
/** Rename something.
* \verbatim
* This implements @name.
* \endverbatim
* \param player the enactor.
* \param name current name of object to rename.
* \param newname_ new name for object.
*/
void
do_name(dbref player, const char *name, char *newname_)
{
dbref thing;
char oldname[BUFFER_LEN];
char *newname = NULL;
char *alias = NULL;
PE_REGS *pe_regs;
if ((thing = match_controlled(player, name)) == NOTHING)
return;
/* check for bad name */
if ((*newname_ == '\0') || strchr(newname_, '[')) {
notify(player, T("Give it what new name?"));
return;
}
switch (Typeof(thing)) {
case TYPE_PLAYER:
switch (
ok_object_name(newname_, player, thing, TYPE_PLAYER, &newname, &alias)) {
case OPAE_INVALID:
case OPAE_NULL:
notify(player, T("You can't give a player that name or alias."));
if (newname)
mush_free(newname, "name.newname");
if (alias)
mush_free(alias, "name.newname");
return;
case OPAE_TOOMANY:
notify(player, T("Too many aliases."));
mush_free(newname, "name.newname");
return;
case OPAE_SUCCESS:
break;
}
break;
case TYPE_EXIT:
if (ok_object_name(newname_, player, thing, TYPE_EXIT, &newname, &alias) !=
OPAE_SUCCESS) {
notify(player, T("That is not a reasonable name."));
if (newname)
mush_free(newname, "name.newname");
if (alias)
mush_free(alias, "name.newname");
return;
}
break;
case TYPE_THING:
case TYPE_ROOM:
if (!ok_name(newname_, 0)) {
notify(player, T("That is not a reasonable name."));
return;
}
newname = mush_strdup(trim_space_sep(newname_, ' '), "name.newname");
break;
default:
/* Should never occur */
notify(player, T("I don't see that here."));
return;
}
/* Actually change it */
mush_strncpy(oldname, Name(thing), BUFFER_LEN);
if (IsPlayer(thing)) {
do_log(LT_CONN, 0, 0, "Name change by %s(#%d) to %s", Name(thing), thing,
newname);
if (Suspect(thing) && strcmp(Name(thing), newname) != 0)
flag_broadcast("WIZARD", 0,
T("Broadcast: Suspect %s changed name to %s."),
Name(thing), newname);
reset_player_list(thing, newname, alias);
}
set_name(thing, newname);
if (alias) {
if (*alias == ALIAS_DELIMITER) {
do_set_atr(thing, "ALIAS", NULL, player, 0);
} else {
/* New alias to set */
do_set_atr(thing, "ALIAS", alias, player, 0);
}
mush_free(alias, "name.newname");
}
queue_event(player, "OBJECT`RENAME", "%s,%s,%s", unparse_objid(thing),
newname, oldname);
if (!AreQuiet(player, thing))
notify(player, T("Name set."));
pe_regs = pe_regs_create(PE_REGS_ARG, "do_name");
pe_regs_setenv_nocopy(pe_regs, 0, oldname);
//.........这里部分代码省略.........
开发者ID:captdeaf,项目名称:pennmush,代码行数:101,代码来源:set.c
示例19: AXIS_LOG
void Axis::SetVelocity(float aVelocity) {
AXIS_LOG("%p|%s direct-setting velocity to %f\n",
mAsyncPanZoomController, Name(), aVelocity);
mVelocity = aVelocity;
}
开发者ID:RobertJGabriel,项目名称:Waterfox,代码行数:5,代码来源:Axis.cpp
示例20: connect_player
/** Check to see if someone can connect to a player.
* \param d DESC the connect attempt is being made for
* \param name name of player to connect to.
* \param password password of player to connect to.
* \param host host from which connection is being attempted.
* \param ip ip address from which connection is being attempted.
* \param errbuf buffer to return connection errors.
* \return dbref of connected player object or NOTHING for failure
* (with reason for failure returned in errbuf).
*/
dbref
connect_player(DESC *d, const char *name, const char *password,
const char *host, const char *ip, char *errbuf)
{
dbref player;
int count;
/* Default error */
strcpy(errbuf,
T("Either that player does not exist, or has a different password."));
if (!name || !*name)
return NOTHING;
/* validate name */
if ((player = lookup_player(name)) == NOTHING) {
/* Invalid player names are failures, too. */
count = mark_failed(ip);
strcpy(errbuf, T("There is no player with that name."));
queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d,%s",
d->descriptor, ip, count, "invalid player", -1, name);
return NOTHING;
}
/* See if player is allowed to connect like this */
if (Going(player) || Going_Twice(player)) {
do_log(LT_CONN, 0, 0,
"Connection to GOING player %s not allowed from %s (%s)",
Name(player), host, ip);
queue_event(SYSEVENT, "SOCKET`LOGINFAIL", "%d,%s,%d,%s,#%d", d-
|
请发表评论