blob_id stringlengths 40 40 | directory_id stringlengths 40 40 | path stringlengths 3 264 | content_id stringlengths 40 40 | detected_licenses listlengths 0 85 | license_type stringclasses 2
values | repo_name stringlengths 5 140 | snapshot_id stringlengths 40 40 | revision_id stringlengths 40 40 | branch_name stringclasses 986
values | visit_date timestamp[us] | revision_date timestamp[us] | committer_date timestamp[us] | github_id int64 3.89k 681M ⌀ | star_events_count int64 0 209k | fork_events_count int64 0 110k | gha_license_id stringclasses 23
values | gha_event_created_at timestamp[us] | gha_created_at timestamp[us] | gha_language stringclasses 145
values | src_encoding stringclasses 34
values | language stringclasses 1
value | is_vendor bool 1
class | is_generated bool 2
classes | length_bytes int64 3 10.4M | extension stringclasses 122
values | content stringlengths 3 10.4M | authors listlengths 1 1 | author_id stringlengths 0 158 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f9b5ca0cc955310239e328ec62576564519c0b0d | 5cf7bb9a74875cd2a110fa3e1243b7c3f2e54753 | /EXTERNAL/MMPS_245/MMPS_245/cpp/fsurf_tools/randsurfsmooth.cpp | b620f5bf9e6199f921d8eeb7db457832a4c73dcd | [] | no_license | ekaestner/MMIL | 5c7dd8045550fe9cee41b1477f7c188916f29a5e | ce9d5bd01a38fd622719a787f28eb10dd66dff15 | refs/heads/master | 2023-04-27T20:36:30.815437 | 2023-04-23T17:49:53 | 2023-04-23T17:49:53 | 155,797,098 | 6 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 15,918 | cpp | /* randsurfsmooth.cpp: generate value at random vertex, smooth, calculate fwhm
created: 02/11/05 DH
last mod: 04/16/13 DH
purpose:
calculating fwhm for different smoothing steps
input:
options only
output:
stdout only
acknowledgements:
*/
#include "surflib.h"
#include "clustlib.h"
using namespace std;
#define MINARGC 3
#define INITVALUE 1000
#define RATIO(X,Y) ((float)X/(float)Y)
#ifdef Darwin
# define RAND_FLOAT(L,H) ((L)+RATIO(random(),INT_MAX)*((H)-(L)))
#else
# define RAND_FLOAT(L,H) ((L)+RATIO(random(),MAXINT)*((H)-(L)))
#endif
#define RAND_INT(H) (int)RAND_FLOAT(0,H)
#define SMALLFLOAT 1e-10
// todo: optional pdf (probability distribution function) output
/* global variables */
static char *progname = NULL;
/* parameter defaults */
char subj[STRLEN]=UNDEFSTR;
char instem[STRLEN]=UNDEFSTR;
char maskstem[STRLEN]=UNDEFSTR;
char outstem[STRLEN]=UNDEFSTR;
char indir[STRLEN]=".";
char maskdir[STRLEN]=".";
char outdir[STRLEN]=".";
char hemi[STRLEN]="rh";
char real_infix[STRLEN]="_r";
char imag_infix[STRLEN]="_i";
char surf[STRLEN]="white";
int niter = 1;
int minsmooth = 0;
int maxsmooth = 100;
int smoothinc = 10;
int growclusterflag = 0;
int heatflag = 0;
int complexflag = 0;
int dataflag = 0;
int maskflag = 0;
int outflag = 0;
float stdev = 1.0;
float heatsigma = 0;
/* functions */
void usage()
{
printf("\n");
printf("Usage: %s -subj subjname [options]\n",progname);
printf("\n");
printf(" Required parameters:\n");
printf(" -subj subjname subject name (can be ico)\n");
printf("\n");
printf(" Optional parameters:\n");
printf(" -instem instem omit extension, infixes, hemi:\n");
printf(" <instem>_{r,i}-{rh,lh}.w\n");
printf(" If instem not specified, will generate\n");
printf(" Gaussian noise instead\n");
printf(" -indir [.] input dir\n");
printf(" -maskstem maskstem stem for w file defining ROI\n");
printf(" -maskdir [.] dir containing mask file\n");
printf(" -outstem [randsmooth] text output file stem\n");
printf(" -outdir [.] output dir\n");
printf(" -growcluster grow cluster from non-zero seed\n");
printf(" -hemi [rh] hemisphere (rh or lh)\n");
printf(" -niter [1] number of iterations\n");
printf(" -minsmooth [0] minimum number of smoothing steps\n");
printf(" -maxsmooth [100] maximum number of smoothing steps\n");
printf(" -smoothinc [10] incremental increase in smooth steps\n");
printf(" -surf [white] surface used for area calculations\n");
printf(" -stdev [1.0] standard deviation of random values\n");
printf(" -heatsigma [0.0] sigma of heat keernel smoothing\n");
printf(" -avgdist use average distance for noise fwhm\n");
printf(" -complex complex (phase-encoded) data\n");
printf(" -quiet suppress messages\n");
printf("\n");
}
void parse_args(int argc, char **argv)
{
int i;
char tempstr[STRLEN];
char *pch;
progname = argv[0];
/* strip off path */
pch = strtok(progname,"/");
while (pch!=NULL) {
strcpy(tempstr,pch);
pch = strtok (NULL,"/");
}
strcpy(progname,tempstr);
if (argc<MINARGC) {usage(); exit(0);}
/* parse arguments */
for (i=1;i<argc;i++) {
if (argv[i][0]=='-') {
if ((MATCH(argv[i],"-subj") || MATCH(argv[i],"-name")) && i+1<argc){
strcpy(subj,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-instem") && i+1<argc) {
strcpy(instem,argv[i+1]); i++;
dataflag=1;
} else
if (MATCH(argv[i],"-maskstem") && i+1<argc){
strcpy(maskstem,argv[i+1]); i++;
maskflag=1;
} else
if (MATCH(argv[i],"-outstem") && i+1<argc){
strcpy(outstem,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-indir") && i+1<argc) {
strcpy(indir,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-outdir") && i+1<argc) {
strcpy(outdir,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-maskdir") && i+1<argc) {
strcpy(maskdir,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-hemi") && i+1<argc) {
strcpy(hemi,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-niter") && i+1<argc){
niter = atoi(argv[i+1]); i++;
} else
if (MATCH(argv[i],"-minsmooth") && i+1<argc){
minsmooth = atoi(argv[i+1]); i++;
} else
if (MATCH(argv[i],"-maxsmooth") && i+1<argc){
maxsmooth = atoi(argv[i+1]); i++;
} else
if (MATCH(argv[i],"-smoothinc") && i+1<argc){
smoothinc = atoi(argv[i+1]); i++;
} else
if (MATCH(argv[i],"-growcluster")){
growclusterflag = 1;
} else
if (MATCH(argv[i],"-heatsigma")){
heatsigma = atof(argv[i+1]); i++;
heatflag = 1;
} else
if (MATCH(argv[i],"-complex")){
complexflag = 1;
} else
if (MATCH(argv[i],"-surf") && i+1<argc) {
strcpy(surf,argv[i+1]); i++;
} else
if (MATCH(argv[i],"-stdev") && i+1<argc) {
stdev = atof(argv[i+1]); i++;
} else
if (MATCH(argv[i],"-quiet")){
setQuiet(1);
} else
ErrorExit(ERROR_BADPARM,"%s: ### parse error opt: %s\n",progname,argv[i]);
} else
ErrorExit(ERROR_BADPARM,"%s: ### parse error opt: %s\n",progname,argv[i]);
}
MsgPrintf("%s: starting to check arguments\n",progname);
/* check arguments */
if (MATCH(subj,UNDEFSTR))
ErrorExit(ERROR_BADPARM,"%s: ### subject name not specified ...quitting\n",
progname);
if (!FileExists(indir)) {
ErrorExit(ERROR_BADPARM,"%s: ### indir %s not found ...quitting\n",
progname,indir);
}
if(!isadir(indir)) {
ErrorExit(ERROR_BADPARM,"%s: ### %s exists, but not a dir ...quitting\n",
progname,indir);
}
if (!FileExists(maskdir)) {
ErrorExit(ERROR_BADPARM,"%s: ### maskdir %s not found ...quitting\n",
progname,maskdir);
}
if(!isadir(maskdir)) {
ErrorExit(ERROR_BADPARM,"%s: ### %s exists, but not a dir ...quitting\n",
progname,maskdir);
}
if (!MATCH(outstem,UNDEFSTR))
outflag=1;
if (!FileExists(outdir)) {
ErrorExit(ERROR_BADPARM,"%s: ### outdir %s not found ...quitting\n",
progname,outdir);
}
if(!isadir(outdir)) {
ErrorExit(ERROR_BADPARM,"%s: ### %s exists, but not a dir ...quitting\n",
progname,outdir);
}
if (!MATCH(hemi,"rh") && !MATCH(hemi,"lh"))
ErrorExit(ERROR_BADPARM,"%s: ### %s: hemi must be rh or lh\n",
progname,hemi);
if (maxsmooth < 0)
ErrorExit(ERROR_BADPARM,"%s: ### %s: maximum smooth steps (%d) must be >0\n",
progname,maxsmooth);
if (minsmooth > maxsmooth)
minsmooth = maxsmooth;
if (minsmooth < 0)
minsmooth = 0;
if (smoothinc <= 0)
ErrorExit(ERROR_BADPARM,"%s: ### %s: smooth increment (%d) must be >0\n",
progname,smoothinc);
if (niter < 0)
ErrorExit(ERROR_BADPARM,"%s: ### %s: number of iterations (%d) must be >0\n",
progname,niter);
if (heatflag && heatsigma <= 0)
ErrorExit(ERROR_BADPARM,"%s: ### %s: heat kernel sigma (%0.3f) must be >0\n",
progname,heatsigma);
MsgPrintf("%s: finished parsing arguments\n",progname);
}
float uniform ()
{
return ( (float)drand48() );
}
void normal (float * n1, float * n2)
{
float u1, u2;
float r;
u1 = 0.0;
while (u1 <= 0.0) {u1 = uniform();}
u2 = uniform();
#if 0
r = sqrt(-2.0*log(u1));
#else
r = stdev * sqrt(-2.0*log(u1));
#endif
*n1 = r * cos(2.0*M_PI*u2);
*n2 = r * sin(2.0*M_PI*u2);
}
void genRandSurf(MRIS *mris)
{
int k, nverts, nvertsdiv2;
float n1, n2;
nverts = mris->nvertices;
nvertsdiv2 = nverts/2;
for (k=0;k<nvertsdiv2;k++) {
normal(&n1,&n2);
mris->vertices[k].val = n1;
mris->vertices[k+nvertsdiv2].val = n2;
}
normal(&n1,&n2);
mris->vertices[nverts-1].val = n1;
}
void genRandSurf(MRIS *mris, int *maskverts, int nmaskverts)
{
int j,k, nvertsdiv2;
float n1, n2;
nvertsdiv2 = nmaskverts/2;
for (j=0;j<nvertsdiv2;j++) {
normal(&n1,&n2);
k=maskverts[j];
mris->vertices[k].val = n1;
k=maskverts[j+nvertsdiv2];
mris->vertices[k].val = n2;
}
normal(&n1,&n2);
k=maskverts[nmaskverts-1];
mris->vertices[k].val = n1;
}
void genCxRandSurf(MRIS *mris)
{
int k;
float n1, n2;
for (k=0;k<mris->nvertices;k++) {
normal(&n1,&n2);
mris->vertices[k].val = n1;
mris->vertices[k].imag_val = n2;
}
}
void genCxRandSurf(MRIS *mris, int *maskverts, int nmaskverts)
{
int j,k;
float n1, n2;
for (j=0;j<nmaskverts;j++) {
normal(&n1,&n2);
k=maskverts[j];
mris->vertices[k].val = n1;
mris->vertices[k].imag_val = n2;
}
}
int main(int argc, char **argv)
{
int i,j,k,nverts,nmaskverts=0,seedvert=0,s;
float *avgdiam, *stdevdiam;
MRIS *mris;
ClusterList clustlist;
Cluster clust;
int threshabsflag = 0;
float halfmax=0,diam,area;
float *maskvals=NULL;
int *maskverts=NULL;
float *vals=NULL, *imag_vals=NULL;
FILE *fp=NULL;
char tempstr[STRLEN];
int ecode=NO_ERROR;
parse_args(argc,argv);
randseed();
if(outflag) {
// open output file
sprintf(tempstr,"%s/%s.txt",outdir,outstem);
fp = fopen(tempstr,"w");
if(fp==NULL)
ErrorExit(ERROR_NOFILE,"%s: ### can't create file %s\n",progname,tempstr);
}
// load surface
MsgPrintf("%s: loading surface files\n",progname);
mris = openSurface(subj,hemi,surf);
nverts = mris->nvertices;
MsgPrintf("%s: nverts = %d\n",progname,nverts);
// load data
if(dataflag && !growclusterflag) {
if(complexflag) {
// read complex input files
MsgPrintf("%s: reading input files\n",progname);
vals = new float[nverts]; MTEST(vals);
sprintf(tempstr,"%s/%s%s-%s.w",indir,instem,real_infix,hemi);
ecode = readSurfVals(tempstr,vals,nverts);
if(ecode)
ErrorExit(ecode,"%s: ### error reading value file %s\n",
progname,tempstr);
imag_vals = new float[nverts]; MTEST(imag_vals);
sprintf(tempstr,"%s/%s%s-%s.w",indir,instem,imag_infix,hemi);
ecode = readSurfVals(tempstr,imag_vals,nverts);
if(ecode!=NO_ERROR)
ErrorExit(ecode,"%s: ### error reading value file %s\n",
progname,tempstr);
} else {
// read input file
MsgPrintf("%s: reading input file\n",progname);
vals = new float[nverts]; MTEST(vals);
sprintf(tempstr,"%s/%s-%s.w",indir,instem,hemi);
ecode = readSurfVals(tempstr,vals,nverts);
if(ecode)
ErrorExit(ecode,"%s: ### error reading value file %s\n",
progname,tempstr);
}
}
if(maskflag) {
MsgPrintf("%s: reading mask file\n",progname);
maskvals = new float[nverts]; MTEST(maskvals);
sprintf(tempstr,"%s/%s-%s.w",maskdir,maskstem,hemi);
ecode = readSurfVals(tempstr,maskvals,nverts);
if(ecode!=NO_ERROR)
ErrorExit(ecode,"%s: ### error reading mask file %s\n",
progname,tempstr);
MsgPrintf("%s: finished reading input files\n",progname);
for (k=0;k<nverts;k++) {
if(maskvals[k]>0) {
nmaskverts++;
mris->vertices[k].undefval=0;
} else {
mris->vertices[k].undefval=1;
}
}
MsgPrintf("%s: nmaskverts = %d\n",progname,nmaskverts);
maskverts = new int[nmaskverts]; MTEST(maskverts);
for (k=0,j=0;k<nverts;k++) {
if(maskvals[k]>0) maskverts[j++]=k;
}
} else {
nmaskverts = nverts;
maskverts = new int[nverts]; MTEST(maskverts);
for (k=0;k<nverts;k++) {
maskverts[k]=k;
mris->vertices[k].undefval=0;
}
}
// initialize arrays
avgdiam = new float[maxsmooth+1];
stdevdiam = new float[maxsmooth+1];
for (s=minsmooth;s<=maxsmooth;s++) {
avgdiam[s]=0;
stdevdiam[s]=0;
}
for (i=0;i<niter;i++) {
MsgPrintf("%s: ## iteration %d ##\n",progname,i);
MRISclearValues(mris);
if(growclusterflag) {
MsgPrintf("%s: generating value at random vertex\n",progname);
j = RAND_INT(nmaskverts);
seedvert = maskverts[j];
mris->vertices[seedvert].val = INITVALUE;
} else {
if(dataflag) {
MsgPrintf("%s: restoring original data values at each vertex\n",progname);
for (j=0;j<nmaskverts;j++) {
k=maskverts[j];
mris->vertices[k].val=vals[k];
if(complexflag)
mris->vertices[k].imag_val=imag_vals[k];
}
} else {
MsgPrintf("%s: generating random values at each vertex\n",progname);
if(maskflag)
if(complexflag)
genCxRandSurf(mris,maskverts,nmaskverts);
else
genRandSurf(mris,maskverts,nmaskverts);
else
if(complexflag)
genCxRandSurf(mris);
else
genRandSurf(mris);
}
}
// ROI smoothing to skip vertices outside of mask
if(minsmooth>0) {
if(complexflag)
MRISsmoothComplexValuesROI(mris,minsmooth);
// todo: heat kernel smoothing for complex values -- why bother?
else if(heatflag)
MRISsmoothValuesHeatROI(mris,minsmooth,heatsigma);
else
MRISsmoothValuesROI(mris,minsmooth);
}
for (s=minsmooth;s<=maxsmooth;s+=smoothinc) {
if(s>minsmooth) {
if(complexflag)
MRISsmoothComplexValuesROI(mris,smoothinc);
else if(heatflag)
MRISsmoothValuesHeatROI(mris,smoothinc,heatsigma);
else
MRISsmoothValuesROI(mris,smoothinc);
}
if(growclusterflag) {
initSurfClustIndices(mris);
halfmax = mris->vertices[seedvert].val/2;
clust.clear();
clust.addVertex(seedvert);
clust.growCluster(seedvert,mris,halfmax,threshabsflag);
clust.calcStats(mris);
area = clust.Area();
diam = 2*sqrt(area/M_PI);
MsgPrintf("%s: smooth=%d, clustverts=%d, area=%0.4f, diam=%0.4f\n",
progname,s,clust.size(),clust.Area(),diam);
} else {
if(complexflag)
diam=MRISgaussCxFWHM(mris,1);
else
diam=MRISgaussFWHM(mris,1);
MsgPrintf("%s: smooth=%d, fwhm=%0.4f\n",
progname,s,diam);
}
avgdiam[s]+=diam;
stdevdiam[s]+=diam*diam;
}
}
MsgPrintf("%s: iterations completed = %d\n",progname,niter);
MsgPrintf("%s: min smooth steps = %d\n",progname,minsmooth);
MsgPrintf("%s: max smooth steps = %d\n",progname,maxsmooth);
if(outflag)
MsgPrintf("%s: saving results to %s/%s.txt:\n",progname,outdir,outstem);
if(niter>1) {
if(outflag)
fprintf(fp,"smooth steps ; avg diam (mm) ; stdev\n");
printf("smooth steps ; avg diam (mm) ; stdev\n");
} else {
if(outflag)
fprintf(fp,"smooth steps ; avg diam (mm)\n");
printf("smooth steps ; avg diam (mm)\n");
}
for (s=minsmooth;s<=maxsmooth;s+=smoothinc) {
if(niter<=1) {
stdevdiam[s] = 0;
if(outflag)
fprintf(fp,"%d ; %0.10f\n",s,avgdiam[s]);
printf("%d ; %0.10f\n",s,avgdiam[s]);
} else {
stdevdiam[s] = (stdevdiam[s] - (avgdiam[s]*avgdiam[s])/niter)/(niter-1);
if(stdevdiam[s]<0)
stdevdiam[s]=0;
else
stdevdiam[s]=sqrt(stdevdiam[s]);
avgdiam[s]/=niter;
if(outflag)
fprintf(fp,"%d ; %0.10f ; %0.10f\n",s,avgdiam[s],stdevdiam[s]);
printf("%d ; %0.10f ; %0.10f\n",s,avgdiam[s],stdevdiam[s]);
}
}
// cleanup
if(dataflag) {
delete [] vals;
if(complexflag)
delete [] imag_vals;
}
if(maskflag) {
delete [] maskvals;
}
delete [] maskverts;
delete [] avgdiam;
delete [] stdevdiam;
if(outflag) fclose(fp);
MsgPrintf("\n%s: finished\n",progname);
}
| [
"erik.kaestner@gmail.com"
] | erik.kaestner@gmail.com |
447c0c59a9bd4a00639a1ba66d68e548d1c94105 | 6de7f1f0d9be7d0659902dc60c77dcaf332e927e | /src/libtsduck/dtv/descriptors/tsTargetSmartcardDescriptor.h | 595c17ab8eeffd5a2d25efcbdb455c30ba8488ca | [
"BSD-2-Clause"
] | permissive | ConnectionMaster/tsduck | ed41cd625c894dca96f9b64f7e18cc265ef7f394 | 32732db5fed5f663dfe68ffb6213a469addc9342 | refs/heads/master | 2023-08-31T20:01:00.538543 | 2022-09-30T05:25:02 | 2022-09-30T08:14:43 | 183,097,216 | 1 | 0 | BSD-2-Clause | 2023-04-03T23:24:45 | 2019-04-23T21:15:45 | C++ | UTF-8 | C++ | false | false | 3,314 | h | //----------------------------------------------------------------------------
//
// TSDuck - The MPEG Transport Stream Toolkit
// Copyright (c) 2005-2022, Thierry Lelegard
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
// 2. Redistributions in binary form must reproduce the above copyright
// notice, this list of conditions and the following disclaimer in the
// documentation and/or other materials provided with the distribution.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
// THE POSSIBILITY OF SUCH DAMAGE.
//
//----------------------------------------------------------------------------
//!
//! @file
//! Representation of a target_smartcard_descriptor (INT/UNT specific).
//!
//----------------------------------------------------------------------------
#pragma once
#include "tsAbstractDescriptor.h"
#include "tsIPv4Address.h"
#include "tsIPUtils.h"
namespace ts {
//!
//! Representation of a target_smartcard_descriptor (INT/UNT specific).
//!
//! This descriptor cannot be present in other tables than an INT or UNT
//! because its tag reuses an MPEG-defined one.
//!
//! @see ETSI EN 301 192, 8.4.5.5
//! @see ETSI TS 102 006, 9.5.2.1
//! @ingroup descriptor
//!
class TSDUCKDLL TargetSmartcardDescriptor : public AbstractDescriptor
{
public:
// TargetSmartcardDescriptor public members:
uint32_t super_CA_system_id; //!< Super CAS Id, as in DVB SimulCrypt.
ByteBlock private_data; //!< Private data bytes.
//!
//! Default constructor.
//!
TargetSmartcardDescriptor();
//!
//! Constructor from a binary descriptor.
//! @param [in,out] duck TSDuck execution context.
//! @param [in] bin A binary descriptor to deserialize.
//!
TargetSmartcardDescriptor(DuckContext& duck, const Descriptor& bin);
// Inherited methods
DeclareDisplayDescriptor();
protected:
// Inherited methods
virtual void clearContent() override;
virtual void serializePayload(PSIBuffer&) const override;
virtual void deserializePayload(PSIBuffer&) override;
virtual void buildXML(DuckContext&, xml::Element*) const override;
virtual bool analyzeXML(DuckContext&, const xml::Element*) override;
};
}
| [
"thierry@lelegard.fr"
] | thierry@lelegard.fr |
1e7eef25e1e50dbf48594241a544445bf203aa1c | d4e96aa48ddff651558a3fe2212ebb3a3afe5ac3 | /Modules/Core/Common/include/itkTreeIteratorClone.h | 47bcafc6a92a3271a6c4791048fbb4003e1833b4 | [
"SMLNJ",
"BSD-3-Clause",
"LicenseRef-scancode-free-unknown",
"LicenseRef-scancode-mit-old-style",
"LicenseRef-scancode-other-permissive",
"LicenseRef-scancode-unknown-license-reference",
"LicenseRef-scancode-warranty-disclaimer",
"NTP",
"IJG",
"GPL-1.0-or-later",
"libtiff",
"BSD-4.3TAHOE",
"... | permissive | nalinimsingh/ITK_4D | 18e8929672df64df58a6446f047e6ec04d3c2616 | 95a2eacaeaffe572889832ef0894239f89e3f303 | refs/heads/master | 2020-03-17T18:58:50.953317 | 2018-10-01T20:46:43 | 2018-10-01T21:21:01 | 133,841,430 | 0 | 0 | Apache-2.0 | 2018-05-17T16:34:54 | 2018-05-17T16:34:53 | null | UTF-8 | C++ | false | false | 4,725 | h | /*=========================================================================
*
* Copyright Insight Software Consortium
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef itkTreeIteratorClone_h
#define itkTreeIteratorClone_h
#include "itkMacro.h"
#include <iostream>
namespace itk
{
/** \class itkTreeIteratorClone
* \brief itkTreeIteratorClone class
* \ingroup DataRepresentation
* \ingroup ITKCommon
*/
template< typename TObjectType >
class TreeIteratorClone
{
public:
/** Typedefs */
typedef TreeIteratorClone< TObjectType > Self;
typedef TObjectType ObjectType;
/** Constructor */
TreeIteratorClone () { m_Pointer = 0; }
/** Copy constructor */
TreeIteratorClone (const TreeIteratorClone< ObjectType > & p)
{
m_Pointer = ITK_NULLPTR;
if ( p.m_Pointer != ITK_NULLPTR )
{
m_Pointer = p.m_Pointer->Clone();
}
}
/** Constructor to pointer p */
TreeIteratorClone (ObjectType *p)
{
m_Pointer = 0;
if ( p != ITK_NULLPTR )
{
m_Pointer = p->Clone();
}
}
/** Constructor to reference p */
TreeIteratorClone (const ObjectType & p)
{
m_Pointer = ITK_NULLPTR;
m_Pointer = const_cast< ObjectType * >( &p )->Clone();
}
/** Destructor */
~TreeIteratorClone ()
{
delete m_Pointer;
m_Pointer = ITK_NULLPTR;
}
/** Overload operator -> */
ObjectType * operator->() const { return m_Pointer; }
/** Test if the pointer has been initialized */
bool IsNotNull() const { return m_Pointer != 0; }
bool IsNull() const { return m_Pointer == 0; }
/** Template comparison operators. */
template< typename TR >
bool operator==(TR r) const { return ( m_Pointer == (ObjectType *)( r ) ); }
template< typename TR >
bool operator!=(TR r) const { return ( m_Pointer != (ObjectType *)( r ) ); }
/** Access function to pointer. */
ObjectType * GetPointer() const { return m_Pointer; }
/** Comparison of pointers. Less than comparison. */
bool operator<(const TreeIteratorClone & r) const { return (void *)m_Pointer < (void *)r.m_Pointer; }
/** Comparison of pointers. Greater than comparison. */
bool operator>(const TreeIteratorClone & r) const { return (void *)m_Pointer > (void *)r.m_Pointer; }
/** Comparison of pointers. Less than or equal to comparison. */
bool operator<=(const TreeIteratorClone & r) const { return (void *)m_Pointer <= (void *)r.m_Pointer; }
/** Comparison of pointers. Greater than or equal to comparison. */
bool operator>=(const TreeIteratorClone & r) const { return (void *)m_Pointer >= (void *)r.m_Pointer; }
/** Overload operator assignment. */
TreeIteratorClone & operator=(const TreeIteratorClone & r) { return this->operator=( r.GetPointer() ); }
/** Overload operator assignment. */
TreeIteratorClone & operator=(const ObjectType *r)
{
if ( m_Pointer != r )
{
delete m_Pointer;
m_Pointer = ITK_NULLPTR;
if ( r != ITK_NULLPTR )
{
m_Pointer = const_cast< ObjectType * >( r )->Clone();
}
}
return *this;
}
Self &
operator++()
{
if ( m_Pointer )
{
++( *m_Pointer );
}
return *this;
}
const Self
operator++(int)
{
if ( m_Pointer )
{
const Self oldValue(m_Pointer); // create a copy of the iterator behind
// the pointer (Clone())
++( *m_Pointer );
return oldValue;
}
}
/** Function to print object pointed to */
ObjectType * Print(std::ostream & os) const
{
// This prints the object pointed to by the pointer
( *m_Pointer ).Print(os);
return m_Pointer;
}
private:
/** The pointer to the object referred to by this smart pointer. */
ObjectType *m_Pointer;
};
template< typename T >
std::ostream & operator<<(std::ostream & os, TreeIteratorClone< T > p)
{
p.Print(os);
return os;
}
} // end namespace itk
#endif
| [
"ruizhi@csail.mit.edu"
] | ruizhi@csail.mit.edu |
2e4bee36b192d11b3a4515b4d9311c5606678953 | 86ec1329a33c7071267fc973023d988603b74387 | /include/Redis.h | 68e171e5aad24f226f62266dc2a712d8cbd14f71 | [] | no_license | xuaokun/spellCorrect | 0a0da9d64c9ed1caf0fb8df311054d960e15c3cd | e29a388d182aa1dffe349b569d78e73486b4807d | refs/heads/master | 2020-07-23T08:13:50.058184 | 2019-09-10T08:56:53 | 2019-09-10T08:56:53 | 203,904,051 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,411 | h | #ifndef _REDIS_H_
#define _REDIS_H_
#include <iostream>
#include <string.h>
#include <string>
#include <stdio.h>
#include <hiredis/hiredis.h>
using std::string;
class Redis{
public:
Redis()
:_connect(nullptr)
,_reply(nullptr)
{}
~Redis(){
if(_connect){
redisFree(_connect);
}
this->_connect=nullptr;
this->_reply=nullptr;
}
bool connect(string host,int port){
this->_connect=redisConnect(host.c_str(),port);
if(this->_connect!=NULL && this->_connect->err){
printf("connect error:%s\n",this->_connect->errstr);
return 0;
}
printf("Connect to redisServer Success\n");
return 1;
}
string get(string key){
this->_reply =(redisReply *)redisCommand(this->_connect,"GET %s",key.c_str());
printf("Succeed to execute command:get %s\n",key.c_str());
if(_reply->type == REDIS_REPLY_NIL){//没有收到任何查询结果
return string("-1");
}
string str = this->_reply->str;
freeReplyObject(this->_reply);
return str;
}
void set(string key,string value){
redisCommand(this->_connect,"SET %s %s",key.c_str(),value.c_str());
printf("Succeed to execute command:set %s val\n",key.c_str());
}
private:
redisContext* _connect;
redisReply* _reply;
};
#endif | [
"xuaokun1997@163.com"
] | xuaokun1997@163.com |
621676212529cfc00440025d1a550f09fccf67a8 | e11d62362decf103d16b5469a09f0d575bb5ccce | /ui/views/widget/desktop_aura/desktop_window_tree_host_platform.h | 7e426b43b21844c7df85202a1e008da6e6426d6b | [
"BSD-3-Clause"
] | permissive | nhiroki/chromium | 1e35fd8511c52e66f62e810c2f0aee54a20215c9 | e65402bb161a854e42c0140ac1ab3217f39c134e | refs/heads/master | 2023-03-13T18:09:40.765227 | 2019-09-10T06:06:31 | 2019-09-10T06:06:31 | 207,478,927 | 0 | 0 | BSD-3-Clause | 2019-09-10T06:12:21 | 2019-09-10T06:12:20 | null | UTF-8 | C++ | false | false | 6,551 | h | // Copyright 2018 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_
#define UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "ui/aura/window_tree_host_platform.h"
#include "ui/views/views_export.h"
#include "ui/views/widget/desktop_aura/desktop_window_tree_host.h"
namespace views {
class WindowEventFilter;
class VIEWS_EXPORT DesktopWindowTreeHostPlatform
: public aura::WindowTreeHostPlatform,
public DesktopWindowTreeHost {
public:
DesktopWindowTreeHostPlatform(
internal::NativeWidgetDelegate* native_widget_delegate,
DesktopNativeWidgetAura* desktop_native_widget_aura);
~DesktopWindowTreeHostPlatform() override;
// DesktopWindowTreeHost:
void Init(const Widget::InitParams& params) override;
void OnNativeWidgetCreated(const Widget::InitParams& params) override;
void OnWidgetInitDone() override;
void OnActiveWindowChanged(bool active) override;
std::unique_ptr<corewm::Tooltip> CreateTooltip() override;
std::unique_ptr<aura::client::DragDropClient> CreateDragDropClient(
DesktopNativeCursorManager* cursor_manager) override;
void Close() override;
void CloseNow() override;
aura::WindowTreeHost* AsWindowTreeHost() override;
void Show(ui::WindowShowState show_state,
const gfx::Rect& restore_bounds) override;
bool IsVisible() const override;
void SetSize(const gfx::Size& size) override;
void StackAbove(aura::Window* window) override;
void StackAtTop() override;
void CenterWindow(const gfx::Size& size) override;
void GetWindowPlacement(gfx::Rect* bounds,
ui::WindowShowState* show_state) const override;
gfx::Rect GetWindowBoundsInScreen() const override;
gfx::Rect GetClientAreaBoundsInScreen() const override;
gfx::Rect GetRestoredBounds() const override;
std::string GetWorkspace() const override;
gfx::Rect GetWorkAreaBoundsInScreen() const override;
void SetShape(std::unique_ptr<Widget::ShapeRects> native_shape) override;
void Activate() override;
void Deactivate() override;
bool IsActive() const override;
void Maximize() override;
void Minimize() override;
void Restore() override;
bool IsMaximized() const override;
bool IsMinimized() const override;
bool HasCapture() const override;
void SetZOrderLevel(ui::ZOrderLevel order) override;
ui::ZOrderLevel GetZOrderLevel() const override;
void SetVisibleOnAllWorkspaces(bool always_visible) override;
bool IsVisibleOnAllWorkspaces() const override;
bool SetWindowTitle(const base::string16& title) override;
void ClearNativeFocus() override;
Widget::MoveLoopResult RunMoveLoop(
const gfx::Vector2d& drag_offset,
Widget::MoveLoopSource source,
Widget::MoveLoopEscapeBehavior escape_behavior) override;
void EndMoveLoop() override;
void SetVisibilityChangedAnimationsEnabled(bool value) override;
NonClientFrameView* CreateNonClientFrameView() override;
bool ShouldUseNativeFrame() const override;
bool ShouldWindowContentsBeTransparent() const override;
void FrameTypeChanged() override;
void SetFullscreen(bool fullscreen) override;
bool IsFullscreen() const override;
void SetOpacity(float opacity) override;
void SetAspectRatio(const gfx::SizeF& aspect_ratio) override;
void SetWindowIcons(const gfx::ImageSkia& window_icon,
const gfx::ImageSkia& app_icon) override;
void InitModalType(ui::ModalType modal_type) override;
void FlashFrame(bool flash_frame) override;
bool IsAnimatingClosed() const override;
bool IsTranslucentWindowOpacitySupported() const override;
void SizeConstraintsChanged() override;
bool ShouldUpdateWindowTransparency() const override;
bool ShouldUseDesktopNativeCursorManager() const override;
bool ShouldCreateVisibilityController() const override;
// WindowTreeHost:
gfx::Transform GetRootTransform() const override;
// PlatformWindowDelegateBase:
void DispatchEvent(ui::Event* event) override;
void OnClosed() override;
void OnWindowStateChanged(ui::PlatformWindowState new_state) override;
void OnCloseRequest() override;
void OnActivationChanged(bool active) override;
base::Optional<gfx::Size> GetMinimumSizeForWindow() override;
base::Optional<gfx::Size> GetMaximumSizeForWindow() override;
protected:
// TODO(https://crbug.com/990756): move these methods back to private
// once DWTHX11 stops using them.
internal::NativeWidgetDelegate* native_widget_delegate() {
return native_widget_delegate_;
}
DesktopNativeWidgetAura* desktop_native_widget_aura() {
return desktop_native_widget_aura_;
}
// Accessor for DesktopNativeWidgetAura::content_window().
aura::Window* content_window();
// These are not general purpose methods and must be used with care. Please
// make sure you understand the rounding direction before using.
gfx::Rect ToDIPRect(const gfx::Rect& rect_in_pixels) const;
gfx::Rect ToPixelRect(const gfx::Rect& rect_in_dip) const;
private:
FRIEND_TEST_ALL_PREFIXES(DesktopWindowTreeHostPlatformTest, HitTest);
void Relayout();
void RemoveNonClientEventFilter();
Widget* GetWidget();
const Widget* GetWidget() const;
// There are platform specific properties that Linux may want to add.
virtual void AddAdditionalInitProperties(
const Widget::InitParams& params,
ui::PlatformWindowInitProperties* properties);
internal::NativeWidgetDelegate* const native_widget_delegate_;
DesktopNativeWidgetAura* const desktop_native_widget_aura_;
bool is_active_ = false;
base::string16 window_title_;
// We can optionally have a parent which can order us to close, or own
// children who we're responsible for closing when we CloseNow().
DesktopWindowTreeHostPlatform* window_parent_ = nullptr;
std::set<DesktopWindowTreeHostPlatform*> window_children_;
#if defined(OS_LINUX)
// A handler for events intended for non client area.
std::unique_ptr<WindowEventFilter> non_client_window_event_filter_;
#endif
base::WeakPtrFactory<DesktopWindowTreeHostPlatform> close_widget_factory_{
this};
base::WeakPtrFactory<DesktopWindowTreeHostPlatform> weak_factory_{this};
DISALLOW_COPY_AND_ASSIGN(DesktopWindowTreeHostPlatform);
};
} // namespace views
#endif // UI_VIEWS_WIDGET_DESKTOP_AURA_DESKTOP_WINDOW_TREE_HOST_PLATFORM_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
27c3e8b068c3e05231ef3f1fbd203ae19a3a897e | 5aecd1098bf6941216e19825059babf35306b0ea | /cvs/objects/util/base/include/data_definition_util.h | 5d22a5fe3cf98cff9d7273c60fcd919c0dd120fc | [
"ECL-2.0",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Silviameteoro/gcam-core | 151f3f8a850918a3ad74c1d95fd3ec52273a17eb | cc0ed1f976fb625ce34ef23b92e917922f4c0bd4 | refs/heads/master | 2023-08-09T14:39:38.278457 | 2021-09-13T14:35:12 | 2021-09-13T14:35:12 | 285,346,443 | 0 | 0 | NOASSERTION | 2020-08-05T16:29:50 | 2020-08-05T16:29:49 | null | UTF-8 | C++ | false | false | 17,678 | h | #ifndef _DATA_DEFINITION_UTIL_H_
#define _DATA_DEFINITION_UTIL_H_
#if defined(_MSC_VER)
#pragma once
#endif
/*
* LEGAL NOTICE
* This computer software was prepared by Battelle Memorial Institute,
* hereinafter the Contractor, under Contract No. DE-AC05-76RL0 1830
* with the Department of Energy (DOE). NEITHER THE GOVERNMENT NOR THE
* CONTRACTOR MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY
* LIABILITY FOR THE USE OF THIS SOFTWARE. This notice including this
* sentence must appear on any copies of this computer software.
*
* EXPORT CONTROL
* User agrees that the Software will not be shipped, transferred or
* exported into any country or used in any manner prohibited by the
* United States Export Administration Act or any other applicable
* export laws, restrictions or regulations (collectively the "Export Laws").
* Export of the Software may require some form of license or other
* authority from the U.S. Government, and failure to obtain such
* export control license may result in criminal liability under
* U.S. laws. In addition, if the Software is identified as export controlled
* items under the Export Laws, User represents and warrants that User
* is not a citizen, or otherwise located within, an embargoed nation
* (including without limitation Iran, Syria, Sudan, Cuba, and North Korea)
* and that User is not otherwise prohibited
* under the Export Laws from receiving the Software.
*
* Copyright 2011 Battelle Memorial Institute. All Rights Reserved.
* Distributed as open-source under the terms of the Educational Community
* License version 2.0 (ECL 2.0). http://www.opensource.org/licenses/ecl2.php
*
* For further details, see: http://www.globalchange.umd.edu/models/gcam/
*
*/
/*!
* \file data_definition_util.h
* \ingroup util
* \brief Header file for that provide Macros and other utilities to generate member
* variable definitions which can be manipulated at compile time and accessed
* in a generic way.
* \author Pralit Patel
*/
#include <string>
#include <boost/mpl/vector.hpp>
#include <boost/fusion/include/vector.hpp>
#include <boost/fusion/include/at.hpp>
#include <boost/fusion/include/mpl.hpp>
#include <boost/preprocessor/seq.hpp>
#include <boost/preprocessor/variadic/to_seq.hpp>
#include <boost/preprocessor/variadic/elem.hpp>
#include <boost/preprocessor/variadic/size.hpp>
#include <boost/preprocessor/facilities/empty.hpp>
#include <boost/preprocessor/control/iif.hpp>
#include <boost/preprocessor/punctuation/is_begin_parens.hpp>
#include "util/base/include/expand_data_vector.h"
/*!
* \brief An enumeration of flags that could be useful as tags on the various Data
* definitions.
* \details All Data definitions will have a flag of SIMPLE, ARRAY, or CONTAINER
* however even more flags may be added to give even more context about
* the definition such as SIMPLE | STATE which could then also be used to
* for instance search by in GCAMFusion.
*/
enum DataFlags {
/*!
* \brief A flag to indicate this Data definition is a simple member variable.
* \details A SIMPLE data would be something such as an int or std::string.
* Basically a kind of data that would not contain any further Data
* definitions (of interest during introspection) and would not make
* sense to be indexed into such as with ARRAY definitions.
*/
SIMPLE = 1 << 0,
/*!
* \brief A flag to indicate this Data definition is a simple array member variable.
* \details A ARRAY data would be something such as PeriodVector<double>.
* Basically a kind of data that would not contain any further Data
* definitions (of interest during introspection) however can be
* indexed, for instance to only get the double in 10th position.
*/
ARRAY = 1 << 1,
/*!
* \brief A flag to indicate this Data definition which contains a GCAM class
* that itself would have futher data definitions within it.
* \details A CONTAINER data would be something such as IDiscreteChoice* or
* std::vector<Subsector*> where by the choice function and subsector
* each have further Data member variables themselves. As implied
* earlier both "single containers" or "arrays of containers" can be
* tagged with just this flag (i.e. no need to add the ARRAY flag too).
*/
CONTAINER = 1 << 2,
/*!
* \brief A flag to indicate this Data is a "state" variable or in other words
* it's value changes during World.calc.
* \details This flag would generally be used in conjunction with a SIMPLE or
* ARRAY who's data type is Value or an array of Values. Data marked
* with this flag can be searched for and re-organized so that "state"
* can be managed centrally stored/restored for instance during partial
* derivative calculations.
*/
STATE = 1 << 3
// potentially more flags here such as to tag "non-parsable" Data etc
};
/*!
* \brief Basic structure for holding data members for GCAM classes.
* \details The idea behind this structure is that every data member
* has two important properties: the data itself and a name
* used to refer to it (e.g., in XML inputs). In addition
* there may be some additional compile time meta data that
* would be useful to generate code or search by in GCAM
* Fusion such as the data type or some combination from the
* enumeration DataFlags.
* This structure makes all of those available for inspection
* by other objects and functions.
*/
template<typename T, int DataFlagsDefinition>
struct Data {
Data( T& aData, const char* aDataName ):mDataName( aDataName ), mData( aData ){}
Data( T& aData, const std::string& aDataName ):mDataName( aDataName.c_str() ), mData( aData ){}
/*! \note The Data struct does not manage any of it's member variables and
* instead simply holds reference to some original source.
*/
virtual ~Data() { }
/*!
* \brief The human readable name for this data.
*/
const char* mDataName;
/*!
* \brief A reference to the actual data stored.
*/
T& mData;
/*!
* \brief Type for this data item
*/
typedef T value_type;
/*!
* \brief A constexpr (compile time) function that checks if a given aDataFlag
* matches any of the flags set set in DataFlagsDefinition.
* \param aDataFlag A Flag that may be some combination of the flags declared
* in the enumeration DataFlags.
* \return True if aTypeFlag was set in the data definition flags used to
* define this data structure.
*/
static constexpr bool hasDataFlag( const int aDataFlag ) {
return ( ( aDataFlag & ~DataFlagsDefinition ) == 0 );
}
/*!
* \pre All Data definitions must at the very least be tagged as SIMPLE,
* ARRAY, or CONTAINER.
*/
static_assert( hasDataFlag( SIMPLE ) || hasDataFlag( ARRAY ) || hasDataFlag( CONTAINER ),
"Invalid Data definition: failed to declare the kind of data." );
};
/*!
* \brief Macro to add to a class a method to accept the ExpandDataVector visitor
* \details The ExpandDataVector visitor works with this method to
* produce a vector of all of the data elements for an object
* (including those inherited from base classes). Each class
* needs to have such a method, and this macro produces it.
*/
#define ACCEPT_EXPAND_DATA_VECTOR_METHOD( aTypeDef ) \
friend class ExpandDataVector<aTypeDef>; \
virtual void doDataExpansion( ExpandDataVector<aTypeDef>& aVisitor ) { \
aVisitor.setSubClass( this ); \
}
/*!
* \brief This Macro is how GCAM member variables definitions that should be
* available for introspection should be made.
* \details Note that while this is how all Data definitions should be generated
* the result of this Macro will not make sense unless called from within
* DEFINE_DATA_INTERNAL (through it proxy Macro calls DEFINE_DATA or
* DEFINE_DATA_WITH_PARENT). The purpose of this Macro then is simply to
* collect all of the required pieces of a Data definition, reorganize them,
* and put them into a sequence of tokens so that then can be safely processed
* and stiched together in DEFINE_DATA_INTERNAL. Thus a call such as
* ```
* DEFINE_VARIABLE( CONTAINER, "period", mVintages, std::map<int, ITechnology*> )
* ```
* will expand to:
* ```
* ( "period", mVintages, (Data<std::map<int)(ITechnology*>)(CONTAINER>) )
* ```
* Note the special consideration given to ensure type definitions with
* commas in them get handled properly. This sequence will be used by
* DEFINE_DATA_INTERNAL to generate the declarations needed by the class declaration.
* \param aDataTypeFlags DataFlags used to determine properties about this data. Note this flag
* must at least contain one of SIMPLE, ARRAY, or CONTAINER.
* \param aDataName The human readable name.
* \param aVarName The variable the user of the class will use for direct access to this Data.
* \param aTypeDef (... / __VA_ARGS__) The type definition of the member variable.
*/
#define DEFINE_VARIABLE( aDataTypeFlags, aDataName, aVarName, ... ) \
( aDataName, aVarName, BOOST_PP_VARIADIC_TO_SEQ( Data<__VA_ARGS__, aDataTypeFlags> ) )
/*!
* \brief Identity transformation. To be used with FOR_EACH metafunction to Flatten the nesting of sequences one level.
* \details Example. Starting with a sequence like this
* ```
* (a) (b) (c)
* ```
* will become:
* ```
* a b c
* ```
* \param s The next available BOOST_PP_FOR repetition.
* \param data A base token to be always passed in (not used).
* \param elem The sequence of tokens represetning the current data definition.
*/
#define FLATTEN( r, data, elem ) \
elem
/*!
* \brief Creates the direct access variable definition.
* \details This Macro will be called by BOOST_PP_SEQ_FOR_EACH_I as it loops
* over all the requested Data definitions. Each time it is called
* it will create the acutal member variable definition although the
* type is pointing to the corresponding element in the Boost::Fusion
* vector such as:
* boost::mpl::at_c< DataVectorType, 0 >::type::value_type mName;
* \param r The next available BOOST_PP_FOR repetition.
* \param data A base token to be always passed in (not used).
* \param i The current iteration of the data definitions.
* \param elem The variable name to define for direct access to the current Data.
*/
#define MAKE_VAR_REF( r, data, i, elem ) \
boost::mpl::at_c< DataVectorType, i >::type::value_type elem;
/*!
* \brief Creates data vector initialization syntax.
* \details This Macro will be called by BOOST_PP_SEQ_FOR_EACH_I as it loops
* over all the requested Data definitions. Each time it is called
* it will create the call to the constructor to the corresponding
* element in the Boost::Fusion Data vector such as:
* Data<std::string, SIMPLE>( mName, "name" )
* To create this definition all elements of each DATA DEFINITION will
* need to be used.
* \param r The next available BOOST_PP_FOR repetition.
* \param data A base token to be always passed in (not used).
* \param i The current iteration of the data definitions.
* \param elem The full definition for a single data as generated by DEFINE_VARIABLE.
*/
#define MAKE_DATA_STRUCT_INIT( r, data, i, elem ) \
( ( BOOST_PP_SEQ_ENUM( BOOST_PP_TUPLE_ELEM( 2, elem ) )( BOOST_PP_TUPLE_ELEM( 1, elem ), BOOST_PP_TUPLE_ELEM( 0, elem ) ) ) )
/*!
* \brief Cut accross sequences of Data declarations to organize as
* sequences of variable names, Data type definitions, and data names.
* \details Implementation from: http://stackoverflow.com/questions/26475453/how-to-use-boostpreprocessor-to-unzip-a-sequence
* The "unzipped" sequences can be accessed by index. For data definitions
* given like:
* ```
* #define DECLS \
* ( NAME_1, VAR_1, TYPE_1 ), \
* ( NAME_2, VAR_2, TYPE_2 )
* ```
* The macro calls:
* ```
* UNZIP(0, DECLS)
* UNZIP(1, DECLS)
* UNZIP(2, DECLS)
* ```
* Would then be transformed to:
* ```
* (NAME_1) (NAME_2)
* (VAR_1) (VAR_2)
* (TYPE_1) (TYPE_2)
* ```
*/
#define UNZIP_MACRO(s, data, elem) BOOST_PP_TUPLE_ELEM(data, elem)
#define UNZIP(i, ...) \
BOOST_PP_SEQ_TRANSFORM( \
UNZIP_MACRO, \
i, \
BOOST_PP_VARIADIC_TO_SEQ(__VA_ARGS__) \
)
/*!
* \brief Collects each DEFINE_VARIABLE definition and generates the full set of Data definitions.
* Note that for perforamance reasons the data vector is only generated upon
* request through the function generateDataVector().
* \details The collected data generates the following definitions:
* 1) A boost::fusion::vector typedef that contains all of the Data definitions types in a
* vector.
* 2) A member function generateDataVector() which will generate a
boost::fusion::vector that contains all of the Data structs which
* contains reference to actual member variable data and data names, etc.
* 3) The actual member varible definitions such as mName, mYear so that
* users can continue to use the member variables as normal.
*
* For instance a call such as:
* ```
* DEFINE_DATA_INTERNAL( DEFINE_VARIABLE( SIMPLE, "name", mName, std::string ) )
* ```
* Would then be transformed to (although perhaps not so well formatted):
* ```
* typedef boost::fusion::vector<Data<std::string, SIMPLE> > DataVectorType;
* DataVectorType generateDataVector() {
* return DataVectorType>(Data<std::string, SIMPLE>( mName, "name" ) );
* }
* boost::mpl::at_c< DataVectorType, 0 >::type::value_type mName;
* ```
*/
#define DEFINE_DATA_INTERNAL( ... ) \
typedef boost::fusion::vector<BOOST_PP_SEQ_ENUM( BOOST_PP_SEQ_FOR_EACH( FLATTEN, BOOST_PP_EMPTY, UNZIP( 2, __VA_ARGS__ ) ) )> DataVectorType; \
DataVectorType generateDataVector() { \
return DataVectorType( BOOST_PP_SEQ_ENUM( BOOST_PP_SEQ_FOR_EACH_I( MAKE_DATA_STRUCT_INIT, BOOST_PP_EMPTY, BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ ) ) ) ); \
} \
BOOST_PP_SEQ_FOR_EACH_I( MAKE_VAR_REF, BOOST_PP_EMPTY, UNZIP( 1, __VA_ARGS__ ) )
/*!
* \brief A Macro to handle the special case where there are no Data definitions
* to be made. This will correctly make the data definitions in a way that
* won't result in compiler error.
*/
#define DEFINE_DATA_INTERNAL_EMPTY() \
typedef boost::fusion::vector<> DataVectorType; \
DataVectorType generateDataVector() { return DataVectorType(); }
/*!
* \brief A helper Macro to detect if we do or do not actually have any DEFINE_VARIABLE
* definitions. We need to check explicitly since DEFINE_DATA_INTERNAL would
* generate invalid syntax if it's argument was infact empty.
*/
#define DEFINE_DATA_INTERNAL_CHECK_ARGS( ... ) \
BOOST_PP_IIF( BOOST_PP_IS_BEGIN_PARENS( __VA_ARGS__ ), DEFINE_DATA_INTERNAL, DEFINE_DATA_INTERNAL_EMPTY ) ( __VA_ARGS__ )
/*!
* \brief Define data entry point. In this definition a user must give a sequence
* of all of the possible members of the inheritance heirarchy this class
* belongs to starting with itself. This is necessary in order to get the
* full data vector from sub-classes at runtime.
* \details The first argument is used to typedef the SubClassFamilyVector, and the
* rest is given to DEFINE_DATA_INTERNAL to process the actual data definitions.
* The DEFINE_SUBCLASS_FAMILY macro can be used to create the SubClassFamilySeq
* argument.
*/
#define DEFINE_DATA( aSubClassFamilySeq, ... ) \
public: typedef boost::mpl::vector<BOOST_PP_SEQ_ENUM( aSubClassFamilySeq )> SubClassFamilyVector; \
ACCEPT_EXPAND_DATA_VECTOR_METHOD( SubClassFamilyVector ) protected: \
DEFINE_DATA_INTERNAL_CHECK_ARGS( __VA_ARGS__ )
/*!
* \brief Define data entry point which adds a typdef to give reference to the direct
* parent class. This is necessary since each definition of generateDataVector() is
* independent from it's parent classes.
* \details The first argument is used to typeef the reference to the direct parent class,
* and the rest is given to DEFINE_DATA_INTERNAL to process the actual data definitions.
*/
#define DEFINE_DATA_WITH_PARENT( aParentClass, ... ) \
public: typedef aParentClass ParentClass; \
ACCEPT_EXPAND_DATA_VECTOR_METHOD( get_base_class<ParentClass>::type::SubClassFamilyVector ) protected: \
DEFINE_DATA_INTERNAL_CHECK_ARGS( __VA_ARGS__ )
/*!
* \brief A helper to organize the subclass family members into a sequence.
*/
#define DEFINE_SUBCLASS_FAMILY( ... ) \
BOOST_PP_VARIADIC_TO_SEQ( __VA_ARGS__ )
#endif // _DATA_DEFINITION_UTIL_H_
| [
"pralit.patel@pnnl.gov"
] | pralit.patel@pnnl.gov |
23c8ddc8bf56f1d0381e2669faa7cb8f50acf99a | da0513732e6f512975be831bc4ee820ba04b3c19 | /chap_2/include/Rifle.h | cce9076b836bf9c4ae64704fcb9e5d7241e08be2 | [] | no_license | yepeichu123/design_patterns | 6cea819fccc536b2da9a0a28dd8ec75bb96c976c | 32bdd014040f08202dee68152e2703ffd348a029 | refs/heads/master | 2022-12-18T13:32:15.538354 | 2020-07-30T06:54:13 | 2020-07-30T06:54:13 | 282,859,735 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 192 | h | #ifndef RIFLE_H
#define RIFLE_H
#include "AbstractGun.h"
class CRifle: public CAbstractGun {
public:
CRifle();
~CRifle();
void shoot();
};
#endif /* RIFLE_H */ | [
"peichu.ye@gmail.com"
] | peichu.ye@gmail.com |
36c23c73350218373751b7eacc1d3f11b46517e2 | 89ba283b2d655e569f945974c21e12440fb623df | /source/core/event_translators/axis/axis2btns.h | 4a781d8fc48bd0c2c9fd83c456c10e9a2ea8b54b | [
"MIT"
] | permissive | swipi-retro/MoltenGamepad | 20b35e8e50e2f9400708d278cf11c8bccf02a7fb | b5aebecd3112a65394841e45a27cda4dd9f4a1e8 | refs/heads/master | 2020-03-22T06:09:06.657599 | 2018-07-03T17:19:01 | 2018-07-03T17:19:01 | 139,614,620 | 0 | 0 | MIT | 2018-07-03T17:10:10 | 2018-07-03T17:10:09 | null | UTF-8 | C++ | false | false | 495 | h | #pragma once
#include "../event_change.h"
class axis2btns : public event_translator {
public:
int neg_btn;
int pos_btn;
int neg_cache = 0;
int pos_cache = 0;
axis2btns(int neg_btn, int pos_btn) : neg_btn(neg_btn), pos_btn(pos_btn) {
}
virtual void process(struct mg_ev ev, output_slot* out);
virtual axis2btns* clone() {
return new axis2btns(*this);
}
static const char* decl;
axis2btns(std::vector<MGField>& fields);
virtual void fill_def(MGTransDef& def);
};
| [
"josephgeumlek@gmail.com"
] | josephgeumlek@gmail.com |
462b4953ebc6cf88a2acd8e21f98c179dc95dae6 | fe5db3014317f062330a6c9fab3e9d941a84689c | /cube2.cpp | 30b4b9177e90163dc91cf8738f169c7ff694f381 | [] | no_license | mkutlu/ShaderBasedDraws | 932b410bbf0771725b9d268bc3c091f1f499d0e1 | 7898fb33974dee349bc3a25c723d292ee3029e8d | refs/heads/master | 2020-12-25T18:53:03.751103 | 2017-06-12T18:36:57 | 2017-06-12T18:36:57 | 94,010,272 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,382 | cpp | //
// Display a color cube
//
// Colors are assigned to each vertex and then the rasterizer interpolates
// those colors across the triangles. We us an orthographic projection
// as the default projetion.
#include "Angel.h"
typedef Angel::vec4 color4;
typedef Angel::vec4 point4;
const int NumVertices = 36; //(6 faces)(2 triangles/face)(3 vertices/triangle)
point4 points[NumVertices];
color4 colors[NumVertices];
// Vertices of a unit cube centered at origin, sides aligned with axes
point4 vertices[8] = {
point4(-0.07, 0.3, 0.5, 1.0),
point4( -0.07, -0.3, 0.5, 1.0 ),
point4(0.07, -0.3, 0.5, 1.0),
point4( 0.07, 0.3, 0.5, 1.0 ),
point4(0.07, -0.2, 0.5, 1.0),
point4(0.07, -0.3, 0.5, 1.0),
point4(0.3, -0.3, 0.5, 1.0),
point4(0.3, -0.2, 0.5, 1.0),
};
// RGBA olors
color4 vertex_colors[1] = {
color4( 0.75, 0.75, 0.75, 0.75 ),
};
// Array of rotation angles (in degrees) for each coordinate axis
enum { Xaxis = 0, Yaxis = 1, Zaxis = 2, NumAxes = 3 };
int Axis = Xaxis;
GLfloat Theta[NumAxes] = { 0.0, 0.0, 0.0 };
//----------------------------------------------------------------------------
// quad generates two triangles for each face and assigns colors
// to the vertices
int Index = 0;
void
quad( int a, int b, int c, int d )
{
colors[Index] = vertex_colors[0]; points[Index] = vertices[a]; Index++;
colors[Index] = vertex_colors[0]; points[Index] = vertices[b]; Index++;
colors[Index] = vertex_colors[0]; points[Index] = vertices[c]; Index++;
colors[Index] = vertex_colors[0]; points[Index] = vertices[a]; Index++;
colors[Index] = vertex_colors[0]; points[Index] = vertices[c]; Index++;
colors[Index] = vertex_colors[0]; points[Index] = vertices[d]; Index++;
}
//----------------------------------------------------------------------------
// generate 12 triangles: 36 vertices and 36 colors
void
colorcube()
{
quad(0,1,2,3 );
quad(4, 5, 6, 7);
}
//----------------------------------------------------------------------------
// OpenGL initialization
void
init()
{
colorcube();
// Create a vertex array object
GLuint vao;
glGenVertexArrays( 1, &vao );
glBindVertexArray( vao );
// Create and initialize a buffer object
GLuint buffer;
glGenBuffers( 1, &buffer );
glBindBuffer( GL_ARRAY_BUFFER, buffer );
glBufferData( GL_ARRAY_BUFFER, sizeof(points) + sizeof(colors),
NULL, GL_STATIC_DRAW );
glBufferSubData( GL_ARRAY_BUFFER, 0, sizeof(points), points );
glBufferSubData( GL_ARRAY_BUFFER, sizeof(points), sizeof(colors), colors );
// Load shaders and use the resulting shader program
GLuint program = InitShader( "vs.glsl", "fs.glsl" );
glUseProgram( program );
// set up vertex arrays
GLuint vPosition = glGetAttribLocation( program, "vPosition" );
glEnableVertexAttribArray( vPosition );
glVertexAttribPointer( vPosition, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(0) );
GLuint vColor = glGetAttribLocation( program, "vColor" );
glEnableVertexAttribArray( vColor );
glVertexAttribPointer( vColor, 4, GL_FLOAT, GL_FALSE, 0,
BUFFER_OFFSET(sizeof(points)) );
glEnable( GL_DEPTH_TEST );
glClearColor( 1.0, 1.0, 1.0, 1.0 );
}
//----------------------------------------------------------------------------
void drawL() {
mat4 transform = (RotateX(Theta[Xaxis]) *
RotateY(Theta[Yaxis]) *
RotateZ(Theta[Zaxis]));
point4 transformed_points[NumVertices];
for (int i = 0; i < NumVertices; ++i) {
transformed_points[i] = points[i];
}
glBufferSubData(GL_ARRAY_BUFFER, 0, sizeof(transformed_points),
transformed_points);
glDrawArrays(GL_TRIANGLES, 0, NumVertices);
}
void
display( void )
{
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
drawL();
glutSwapBuffers();
}
//----------------------------------------------------------------------------
void
keyboard( unsigned char key, int x, int y )
{
switch( key ) {
case 033: // Escape Key
case 'q': case 'Q':
exit( EXIT_SUCCESS );
break;
}
}
//----------------------------------------------------------------------------
void
mouse( int button, int state, int x, int y )
{
if ( state == GLUT_DOWN ) {
switch( button ) {
case GLUT_LEFT_BUTTON: Axis = Xaxis; break;
case GLUT_MIDDLE_BUTTON: Axis = Yaxis; break;
case GLUT_RIGHT_BUTTON: Axis = Zaxis; break;
}
}
}
//----------------------------------------------------------------------------
void
timer( int id )
{
Theta[Axis] += 0.5;
if ( Theta[Axis] > 360.0 ) {
Theta[Axis] -= 360.0;
}
glutTimerFunc(10, timer, 0);
glutPostRedisplay();
}
//----------------------------------------------------------------------------
int
main( int argc, char **argv )
{
glutInit( &argc, argv );
#ifdef __APPLE__
glutInitDisplayMode( GLUT_3_2_CORE_PROFILE | GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
#else
glutInitDisplayMode( GLUT_RGBA | GLUT_DOUBLE | GLUT_DEPTH );
#endif
glutInitWindowSize( 512, 512 );
// glutInitContextVersion( 3, 2 );
// glutInitContextProfile( GLUT_CORE_PROFILE );
glutCreateWindow( "Color Cube" );
glewExperimental = GL_TRUE;
glewInit();
init();
glutDisplayFunc( display );
glutKeyboardFunc( keyboard );
glutMouseFunc( mouse );
glutTimerFunc(10, timer, 0);
glutMainLoop();
return 0;
}
| [
"mkutlu13@gmail.com"
] | mkutlu13@gmail.com |
290b63702b731ec513028e85b9913ab623bd0a27 | 1810a26cd8db1da2263889067d93a48750dcb50a | /any.cpp | 6955aa688b94aa9b7e93fa39dd147df49964d093 | [] | no_license | spurnaye/cpp_algorithms | 4f63e559c94b1b3b30c32105a3cb17cac85f598f | 87fe47a24a7e80d31cb55a30dd0dcf0c91d3bc1a | refs/heads/master | 2020-03-08T02:04:49.650375 | 2018-10-22T04:22:03 | 2018-10-22T04:22:03 | 127,849,116 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 179 | cpp | #include <any>
#include <iostream>
#include <vector>
int main(){
std::any a = 1;
std::vector<std::any> v{1,2,3,4.5,6.7,"some string"};
auto x = std::any_cast<float>(v[0]);
} | [
"spurnaye@gmail.com"
] | spurnaye@gmail.com |
f6bd926660705a781e82078ade25abaa29e6e3e4 | f8b56b711317fcaeb0fb606fb716f6e1fe5e75df | /Internal/SDK/BP_FishingFish_AncientScale_05_Colour_02_Sapphire_classes.h | 0936daf43fc17391e41695cf0caa46b123fb6db3 | [] | no_license | zanzo420/SoT-SDK-CG | a5bba7c49a98fee71f35ce69a92b6966742106b4 | 2284b0680dcb86207d197e0fab6a76e9db573a48 | refs/heads/main | 2023-06-18T09:20:47.505777 | 2021-07-13T12:35:51 | 2021-07-13T12:35:51 | 385,600,112 | 0 | 0 | null | 2021-07-13T12:42:45 | 2021-07-13T12:42:44 | null | UTF-8 | C++ | false | false | 949 | h | #pragma once
// Name: Sea of Thieves, Version: 2.2.0.2
/*!!DEFINE!!*/
/*!!HELPER_DEF!!*/
/*!!HELPER_INC!!*/
#ifdef _MSC_VER
#pragma pack(push, 0x01)
#endif
namespace CG
{
//---------------------------------------------------------------------------
// Classes
//---------------------------------------------------------------------------
// BlueprintGeneratedClass BP_FishingFish_AncientScale_05_Colour_02_Sapphire.BP_FishingFish_AncientScale_05_Colour_02_Sapphire_C
// 0x0000 (FullSize[0x0910] - InheritedSize[0x0910])
class ABP_FishingFish_AncientScale_05_Colour_02_Sapphire_C : public ABP_FishingFish_AncientScale_05_C
{
public:
static UClass* StaticClass()
{
static auto ptr = UObject::FindClass("BlueprintGeneratedClass BP_FishingFish_AncientScale_05_Colour_02_Sapphire.BP_FishingFish_AncientScale_05_Colour_02_Sapphire_C");
return ptr;
}
void UserConstructionScript();
};
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"zp2kshield@gmail.com"
] | zp2kshield@gmail.com |
67c9d453adb00745905766ae9048094df455c4bc | 5db5ddf10fb0b71f1fd19cb93f874f7e539e33eb | /Tech/src/foundation/modules/event/peventmanager.cpp | ac97e0670c7582a5917c4e54de6751964da99777 | [] | no_license | softwarekid/FutureInterface | 13b290435c552a3feca0f97ecd930aa05fa2fb25 | 55583a58297a5e265953c36c72f41ccb8bac3015 | refs/heads/master | 2020-04-08T04:42:21.041081 | 2014-07-25T01:14:34 | 2014-07-25T01:14:34 | 22,280,531 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 2,741 | cpp | // peventmanager.cpp
// The event manager
//
// Copyright 2012 - 2014 by Future Interface.
// This software is licensed under the terms of the MIT license.
//
// Hongwei Li lihw81@gmail.com
//
//
#include "peventmanager.h"
#include <PFoundation/pevent.h>
#include <PFoundation/pcontext.h>
#include <PFoundation//pobject.h>
#include <PFoundation/pclock.h>
PEventManager::PEventManager(PContext *context)
: PModule("event-manager", context)
{
}
PEventManager::~PEventManager()
{
PList<PEvent *>::iterator it;
PList<PEvent *>::iterator ib = m_queue.begin();
PList<PEvent *>::iterator ie = m_queue.end();
for (it = ib; it != ie; ++it)
{
PDELETE(*it);
}
m_queue.clear();
}
void PEventManager::update()
{
puint32 deltaTime = (puint32)m_context->clock().systemDeltaTime();
// The deltaTime is the elapsed time from last frame, so each event should
// update its timer in this function so that it approaches the firing stage
// gradually. The correct logic should be
//
// Step 1. update times of all queued events
PList<PEvent *>::iterator it;
PList<PEvent *>::iterator ib = m_queue.begin();
PList<PEvent *>::iterator ie = m_queue.end();
for (it = ib; it != ie; ++it)
{
if ((*it)->m_fireTime < deltaTime)
{
(*it)->m_fireTime = 0;
}
else
{
(*it)->m_fireTime -= pMin((*it)->m_fireTime, deltaTime);
}
}
// Step 2. fire those events on due in the order of the fire time.
it = ib;
while (it != ie)
{
if ((*it)->canFire())
{
PEvent *event = *it;
fire(event);
m_queue.erase(it);
// FIXME: it can't be right to reset the iterator
// to the head of list. Those nodes already visited
// will be checked again. It seems to me we need to have a dedicated
// event queue data structure instead of using qlist.
it = m_queue.begin();
recycelEvent(event);
}
else
{
++it;
}
}
}
void PEventManager::queueEvent(PEvent *event)
{
m_queue.append(event);
}
void PEventManager::fire(PEvent *event)
{
event->m_handled = true;
if (event->m_receiver == P_NULL)
{
m_context->dispatch(event);
}
else
{
event->m_receiver->onEvent(event);
}
}
PEvent * PEventManager::createEvent(PEventTypeEnum type, PObject *sender)
{
// TODO: a memory pool.
PEvent *ret = PNEW(PEvent(type, sender, m_context->clock().timestamp(), this));
return ret;
}
void PEventManager::recycelEvent(PEvent *event)
{
// TODO: recycle the event memory.
PDELETE(event);
}
| [
"lihw81@gmail.com"
] | lihw81@gmail.com |
f26812631cd687e678cb07125d646b93724896a7 | 8a1d056a516831d99ccb4eb52053d1cffd97c9e9 | /src/gamed/gs/player/subsys/player_prop_reinforce.h | bf05a5ebb6126b9d9f03bdf36830d57707a4c113 | [] | no_license | 289/a | b964481d2552f11f300b1199062ca62b71edf76e | 43d28da99387ba225b476fe51bd7a13245f49d5e | refs/heads/master | 2020-04-17T04:22:23.226951 | 2018-03-21T14:17:08 | 2018-03-21T14:17:08 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,275 | h | #ifndef GAMED_GS_SUBSYS_PLAYER_PROP_REINFORCE_H_
#define GAMED_GS_SUBSYS_PLAYER_PROP_REINFORCE_H_
#include "gs/player/player_subsys.h"
namespace gamed {
/**
* @brief:player属性强化子系统(初阶属性强化等)
*/
class PlayerPropReinforce : public PlayerSubSystem
{
public:
PlayerPropReinforce(Player& player);
virtual ~PlayerPropReinforce();
virtual void RegisterCmdHandler();
bool SaveToDB(common::PlayerPropRFData* pdata);
bool LoadFromDB(const common::PlayerPropRFData& data);
void PlayerGetPropReinforce();
void ResetPrimaryPropRF();
void AddPrimaryPropRFCurEnergy();
public:
enum PrimaryPropRFIndex
{
PPRFI_HP = 0, // 生命值
PPRFI_P_ATK, // 物理攻击
PPRFI_M_ATK, // 魔法攻击
PPRFI_P_DEF, // 物理防御
PPRFI_M_DEF, // 魔法防御
PPRFI_P_PIE, // 物理穿透
PPRFI_M_PIE, // 魔法穿透
PPRFI_MAX
};
protected:
void CMDHandler_QueryPrimaryPropRF(const C2G::QueryPrimaryPropRF&);
void CMDHandler_BuyPrimaryPropRFEnergy(const C2G::BuyPrimaryPropRFEnergy&);
void CMDHandler_PrimaryPropReinforce(const C2G::PrimaryPropReinforce&);
private:
class PrimaryPropRF
{
public:
struct Detail
{
Detail()
: cur_add_energy(0),
cur_level(0)
{ }
void clear()
{
cur_add_energy = 0;
cur_level = 0;
}
int32_t cur_add_energy; // 当前已经充了多少能量
int32_t cur_level; // 当前等级
};
PrimaryPropRF()
: last_recover_time(0),
cur_energy(0)
{ }
void clear()
{
last_recover_time = 0;
cur_energy = 0;
for (size_t i = 0; i < detail.size(); ++i)
{
detail[i].clear();
}
}
int32_t last_recover_time; // 上次恢复能量的时间点,绝对时间,0表示上次恢复已经大于等于能量上限
int32_t cur_energy; // 当前能量值
FixedArray<Detail, PPRFI_MAX> detail; // 下标对应枚举PrimaryPropRFIndex
};
private:
void PlayerGetPrimaryPropRF();
void RecalculatePPRFEnergy(int32_t add_energy = 0, bool is_reset = false, bool sync_to_client = true); // 重新计算当前能量值
void AttachPrimaryPropRFPoints() const;
void DetachPrimaryPropRFPoints() const;
void CalcPrimaryPropRF(int32_t calc_energy, bool reset_cur_energy, bool sync_levelup);
void CalcPrimaryPropRFLevelUp(const int32_t* option, size_t size, bool sync_to_client);
void refresh_pprf_points(bool is_attach) const;
float get_pprf_average_level() const;
int32_t get_pprf_add_points(PrimaryPropRFIndex index) const; // 计算初阶属性强化最终加点
int32_t calc_pprf_weight(PrimaryPropRFIndex index, float average_level) const; // 计算初阶属性强化权重
bool check_pprf_levelup() const; // 检查是否还有可以升级的初阶属性
private:
PrimaryPropRF primary_prop_rf_;
};
} // namespace gamed
#endif // GAMED_GS_SUBSYS_PLAYER_PROP_REINFORCE_H_
| [
"18842636481@qq.com"
] | 18842636481@qq.com |
b0d49f17931cf066425441ef6e2b0fce63233454 | bdaa8f6fa3627232dd8129499b7603f1e30647e9 | /Login_ConnectDataBase/Login_ConnectDataBase/ChangeCode.h | f14687ca42b716af2839cbe1d7d8fb58dc9fb437 | [] | no_license | tianyunzqs/C_C_plus_plus_algorithm | 3e5b8258af86c8b8b95e3c6a1a879f70478f68e8 | d4e95e33129865f1baf4eefdbc996ac59882141e | refs/heads/master | 2020-12-02T05:24:43.977114 | 2017-07-11T13:41:46 | 2017-07-11T13:41:46 | 96,889,940 | 2 | 0 | null | null | null | null | GB18030 | C++ | false | false | 479 | h | #pragma once
// CChangeCode 对话框
class CChangeCode : public CDialog
{
DECLARE_DYNAMIC(CChangeCode)
public:
CChangeCode(CWnd* pParent = NULL); // 标准构造函数
virtual ~CChangeCode();
// 对话框数据
enum { IDD = IDD_CHANGECODE };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV 支持
DECLARE_MESSAGE_MAP()
public:
afx_msg void OnBnClickedFinishchange();
afx_msg HBRUSH OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor);
};
| [
"tianyunzqs@sina.com"
] | tianyunzqs@sina.com |
52f7f33ba90ecb9be6b17eb32350559ce7acfaeb | 50ada458f964ade9515b8405fc75ac0ed42ca3cd | /Level 1/Section 1.5/Exercise 1/Exercise 1/Exercise 1.cpp | 8e0a7e8741f7a20779c994dec9b384b8468a85de | [] | no_license | CPP-Muggle/C_Github | f7a224ee61cd98c5b3ae1142bc4956f44334622e | e860fe3c189c1821f93c7c6d6bea2d82ec60a089 | refs/heads/master | 2021-01-01T19:37:44.414099 | 2015-11-28T16:30:56 | 2015-11-28T16:30:56 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 276 | cpp | #include <stdio.h>
float minus(float a, float b){
return a - b;
}
void main(){
float a, b;
printf("Enter the first number ");
scanf_s("%f", &a);
printf("Enter the second number ");
scanf_s("%f", &b);
printf("The difference between two numbers is %.4f", minus(a, b));
}
| [
"jz2631@columbia.edu"
] | jz2631@columbia.edu |
1771468770fd2b916cc3faeda3c3fac137591d68 | 7add42e3fffa26c8aea222eca87791c89c7d84bd | /scenario/grid/GridSpectrum.cpp | bae10d12643975534f40a4f21df4935ebbcb804c | [] | no_license | mr-oroboto/Waveguide | 1f15417f43551dded241be66505a73900c075fd1 | d2921b065386a9f79830d6094b944f1b93b515ad | refs/heads/master | 2022-10-20T02:45:03.016262 | 2022-10-09T05:10:10 | 2022-10-09T05:10:10 | 235,275,433 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,188 | cpp | #include "GridSpectrum.h"
#include <iostream>
GridSpectrum::GridSpectrum(insight::WindowManager* window_manager, sdr::SpectrumSampler* sampler, uint32_t bin_coalesce_factor)
: SimpleSpectrum(window_manager, sampler, bin_coalesce_factor)
{
}
void GridSpectrum::run()
{
resetState();
display_manager_->resetCamera();
display_manager_->setCameraPointingVector(glm::vec3(1, 0, -1.0));
display_manager_->setCameraCoords(glm::vec3(-55, 20, 25));
display_manager_->setPerspective(0.1, 100.0, 90);
std::unique_ptr<insight::FrameQueue> frame_queue = std::make_unique<insight::FrameQueue>(display_manager_, true);
frame_queue->setFrameRate(1);
frame_ = frame_queue->newFrame();
uint64_t raw_bin_count = samples_->getBinCount();
uint64_t coalesced_bin_count = (raw_bin_count + bin_coalesce_factor_ - 1) / bin_coalesce_factor_; // integer ceiling
std::cout << "Coalescing " << raw_bin_count << " frequency bins into " << coalesced_bin_count << " visual bins" << std::endl;
uint32_t grid_width = 80;
glm::vec3 start_coords = glm::vec3(-1.0f * (grid_width / 2.0f), 0, 0);
for (uint64_t bin_id = 0; bin_id < coalesced_bin_count; bin_id++)
{
// Coalesce the frequency bins
std::vector<sdr::FrequencyBin const*> frequency_bins;
uint64_t start_frequency_bin = bin_id * bin_coalesce_factor_;
for (uint64_t j = start_frequency_bin; j < (start_frequency_bin + bin_coalesce_factor_) && j < raw_bin_count; j++)
{
frequency_bins.push_back(samples_->getFrequencyBin(j));
}
glm::vec3 world_coords = start_coords;
world_coords.x += (bin_id % grid_width);
SimpleSpectrumRange* bin = new SimpleSpectrumRange(display_manager_, insight::primitive::Primitive::Type::RECTANGLE, 0, bin_id, world_coords, glm::vec3(1, 1, 1), frequency_bins);
coalesced_bins_.push_back(bin);
frame_->addObject(bin);
if (bin_id != 0 && (bin_id % grid_width) == 0)
{
char msg[64];
snprintf(msg, sizeof(msg), "%.2fMHz", const_cast<sdr::FrequencyBin*>(frequency_bins[0])->getFrequency() / 1000000.0f);
frame_->addText(msg, world_coords.x - 5.0f, 0.0f, world_coords.z, false, 0.02, glm::vec3(1.0, 1.0, 1.0));
start_coords.z -= 1.0f;
}
}
char msg[128];
snprintf(msg, sizeof(msg), "Grid Perspective (%.3fMhz - %.3fMhz)", sampler_->getStartFrequency() / 1000000.0f, sampler_->getEndFrequency() / 1000000.0f);
frame_->addText(msg, 10, 10, 0, true, 1.0, glm::vec3(1.0, 1.0, 1.0));
frame_queue->enqueueFrame(frame_);
display_manager_->setUpdateSceneCallback(std::bind(&GridSpectrum::updateSceneCallback, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3, std::placeholders::_4));
frame_queue->setReady();
if (frame_queue->setActive())
{
display_manager_->setFrameQueue(std::move(frame_queue));
}
}
void GridSpectrum::updateSceneCallback(GLfloat secs_since_rendering_started, GLfloat secs_since_framequeue_started, GLfloat secs_since_last_renderloop, GLfloat secs_since_last_frame)
{
uint16_t current_slice = 0;
if (samples_->getSweepCount() && current_interest_markers_ < max_interest_markers_)
{
markLocalMaxima();
}
frame_->updateObjects(secs_since_rendering_started, secs_since_framequeue_started, secs_since_last_renderloop, secs_since_last_frame, static_cast<void*>(¤t_slice));
}
void GridSpectrum::addInterestMarkerToBin(SimpleSpectrumRange *bin)
{
char msg[64];
snprintf(msg, sizeof(msg), "%.3fMHz", bin->getFrequency() / 1000000.0f);
unsigned long text_id = frame_->addText(msg, bin->getPosition().x, bin->getAmplitude() + 0.2f, bin->getPosition().z, false, 0.02, glm::vec3(1.0, 1.0, 1.0));
marked_bin_text_ids_.push_back(text_id);
SimpleSpectrum::addInterestMarkerToBin(bin);
}
void GridSpectrum::clearInterestMarkers()
{
if (frame_ == nullptr)
{
return;
}
for (unsigned long i : marked_bin_text_ids_)
{
frame_->deleteText(i);
}
marked_bin_text_ids_.clear();
SimpleSpectrum::clearInterestMarkers();
}
| [
"jsmtp@protonmail.com"
] | jsmtp@protonmail.com |
19826386c9b011a4d9a57c3eea4b84e641f96f1a | 43acc519d1eb85c654776f28ef8ec06ca11fc7d0 | /robo/robo.ino | 243f4078262057914267f20f675c15208c9bc246 | [] | no_license | Rphmelo/robo-explorador | 2701888b85713235a6571563e3fe31649bc24c76 | 636d00f3876a70614d6e5e264a9379b0dc8975d8 | refs/heads/master | 2021-07-10T14:05:33.598034 | 2017-10-10T17:56:58 | 2017-10-10T17:56:58 | 105,097,405 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,349 | ino | #include <AFMotor.h>
#include <DHT.h>
#define DHTPIN 24
#define DHTTYPE DHT11
#define LED 22
DHT dht(DHTPIN, DHTTYPE);
float umidade;
float temperatura;
int ldrValue;
class Robo {
char comando;
int velocidade;
AF_DCMotor *rodaDD; //Dianteira Direita
AF_DCMotor *rodaDE; //Dianteira Esquerda
AF_DCMotor *rodaTD; //Traseira Direita
AF_DCMotor *rodaTE; //Traseira Esquerda
public:
Robo(char, int, int, int, int, int);
void setComando(char _comando){
this->comando = toupper(_comando);
};
char getComando(){
return comando;
};
void setVelocidade(int _velocidade){
this->velocidade = _velocidade;
};
int getVelocidade(){
return velocidade;
};
void definirVelocidade(){
//rodaDD->setSpeed(this->velocidade);
//rodaDE->setSpeed(this->velocidade > 50 ? this->velocidade - 50: this->velocidade);
//rodaTD->setSpeed(this->velocidade > 50 ? this->velocidade - 50: this->velocidade);
//rodaTE->setSpeed(this->velocidade > 50 ? this->velocidade - 50: this->velocidade);
rodaDD->setSpeed(this->velocidade);
rodaDE->setSpeed(this->velocidade );
rodaTD->setSpeed(this->velocidade );
rodaTE->setSpeed(this->velocidade );
};
void virarAEsquerda(){
definirVelocidade();
// rodas esquerdas param
rodaDD->run(FORWARD);
rodaDE->run(BACKWARD);
rodaTD->run(FORWARD);
rodaTE->run(BACKWARD);
Serial.write("Virando a esquerda");
}
void virarADireita(){
definirVelocidade();
// rodas direitas param
rodaDD->run(BACKWARD);
rodaDE->run(FORWARD);
rodaTD->run(BACKWARD);
rodaTE->run(FORWARD);
Serial.write("Virando a direita");
}
void pararRobo(){
// para todas as rodas
rodaDD->run(RELEASE);
rodaDE->run(RELEASE);
rodaTD->run(RELEASE);
rodaTE->run(RELEASE);
definirVelocidade();
Serial.write("Parando robo");
}
void moverParaFrente(){
// aciona todas as rodas
definirVelocidade();
rodaDD->run(FORWARD);
rodaDE->run(FORWARD);
rodaTD->run(FORWARD);
rodaTE->run(FORWARD);
Serial.write("Andando para frente");
}
void moverParaTras(){
// aciona todas as rodas
definirVelocidade();
rodaDD->run(BACKWARD);
rodaDE->run(BACKWARD);
rodaTD->run(BACKWARD);
rodaTE->run(BACKWARD);
Serial.write("Andando para tras");
}
};
Robo::Robo(char _comando, int _velocidade, int _rodaDD, int _rodaDE, int _rodaTD, int _rodaTE) {
comando = _comando;
velocidade = _velocidade;
rodaDD = new AF_DCMotor(_rodaDD);
rodaDE = new AF_DCMotor(_rodaDE);
rodaTD = new AF_DCMotor(_rodaTD);
rodaTE = new AF_DCMotor(_rodaTE);
}
Robo *curtoCircuito = new Robo('z', 255, 1, 2, 3, 4);
long previousMillis = 0;
long interval = 1000;
void setup()
{
//Inicia a serial do bluetooth
Serial1.begin(9600);
//Inicia a serial
Serial.begin(9600);
//Inicia o dht
dht.begin();
//Definindo pinMode do LED
pinMode(LED, OUTPUT);
}
void lerDht(){
// Reading temperature or humidity takes about 250 milliseconds!
// Sensor readings may also be up to 2 seconds 'old' (its a very slow sensor)
umidade = dht.readHumidity();
// Read temperature as Celsius (the default)
temperatura = dht.readTemperature();
// Read temperature as Fahrenheit (isFahrenheit = true)
// Check if any reads failed and exit early (to try again).
if (isnan(umidade) || isnan(temperatura)) {
Serial.println("Failed to read from DHT sensor!");
return;
}
Serial.print("Umidade: ");
Serial.print(umidade);
Serial.print(" %\t");
Serial.print("Temperatura: ");
Serial.print(temperatura);
Serial.print(" *C ");
}
void acionarLed(){
digitalWrite(LED, HIGH);
}
void lerLdr(){
// read the input on analog pin 0:
ldrValue = analogRead(A10);
// print out the value you read:
Serial.println("LDR:");
Serial.println(ldrValue);
}
void enviarDadosDhtLdr(){
}
String receberDadosBluetooth(){
char caractere = ' ';
String retornoCompleto = "";
while(Serial1.available()){
caractere = (char) Serial1.read();
retornoCompleto.concat(caractere);
}
return retornoCompleto;
}
int extrairVelocidade(String comando){
int velocidade = (comando.substring(1)).toInt();
return velocidade;
}
void iniciarControleRobo(){
unsigned long currentMillis = millis();
if(Serial1.available()){
String comando = receberDadosBluetooth();
int velocidade = extrairVelocidade(comando);
curtoCircuito->setComando(comando.charAt(0));
curtoCircuito->setVelocidade(velocidade);
switch(curtoCircuito->getComando()){
case 'A':
if(currentMillis - previousMillis > interval) {
curtoCircuito->virarAEsquerda();
previousMillis = currentMillis;
}
break;
case 'B':
if(currentMillis - previousMillis > interval) {
curtoCircuito->virarADireita();
previousMillis = currentMillis;
}
break;
case 'C':
if(currentMillis - previousMillis > interval) {
curtoCircuito->moverParaFrente();
previousMillis = currentMillis;
}
break;
case 'D':
if(currentMillis - previousMillis > interval) {
curtoCircuito->moverParaTras();
previousMillis = currentMillis;
}
break;
case 'E':
if(currentMillis - previousMillis > interval) {
curtoCircuito->pararRobo();
previousMillis = currentMillis;
}
break;
}
}
}
void loop() {
//Inicia o controle do robô
iniciarControleRobo();
//Lendo umidade, temperatura e luminosidade
lerDht();
//Acionando led
acionarLed();
//Lendo Ldr
lerLdr();
//Enviando dados ao aplicativo
Serial.println("Teste");
String dado = "";
dado.concat("T");
dado.concat(temperatura);
dado.concat("U");
dado.concat(umidade);
dado.concat("L");
dado.concat(ldrValue);
for(int indice = 0; dado.length() < indice; indice++){
if(Serial1.available()){
Serial1.write(dado.charAt(indice));
}
if(Serial.available()){
Serial.write(dado.charAt(indice));
}
}
}
| [
"r.de.melo.silva@accenture.com"
] | r.de.melo.silva@accenture.com |
7d0439776dfbc40b8079872a3030ee1ae91f9b0b | 55c81da8a1d0e98fe426b7b5c3ce7a9646ffdbe8 | /samples/Test/Classes/CDNewsViewController.cpp | 58cce061bc006658ab286accd2c85e63b901b5e3 | [] | no_license | babyliynfg/nano-CrossApp | e40c1b209e30b47bea588b981f4f15aedc638266 | e0c0e45c500d2647d330131b68474b67f0dfaae2 | refs/heads/master | 2021-01-18T03:04:08.540737 | 2017-03-14T03:47:06 | 2017-03-14T03:47:06 | 68,501,961 | 38 | 23 | null | null | null | null | UTF-8 | C++ | false | false | 18,542 | cpp | //
// CDNewsViewController.cpp
// Test
//
// Created by renhongguang on 15/4/16.
//
//
#include "CDNewsViewController.h"
#include "CDWebViewController.h"
extern int page_index;
float temp_time = 0;
CDNewsTableCell::CDNewsTableCell()
:theTitle(NULL),
theDesc(NULL),
theImage(NULL)
{
this->setAllowsSelected(false);
}
CDNewsTableCell::~CDNewsTableCell()
{
}
CDNewsTableCell* CDNewsTableCell::create(const std::string& identifier)
{
CCLog("CDNewsTableCell");
CDNewsTableCell* tableViewCell = new CDNewsTableCell();
if(tableViewCell&&tableViewCell->initWithReuseIdentifier(identifier))
{
tableViewCell->autorelease();
return tableViewCell;
}
CC_SAFE_DELETE(tableViewCell);
return NULL;
}
void CDNewsTableCell::highlightedTableViewCell()
{
this->setBackgroundView(CAView::createWithColor(ccc4(0, 0, 0, 64)));
}
void CDNewsTableCell::selectedTableViewCell()
{
this->setBackgroundView(CAView::createWithColor(ccc4(0, 0, 0, 64)));
}
bool CDNewsTableCell::initWithReuseIdentifier(const std::string& reuseIdentifier)
{
if (!CATableViewCell::initWithReuseIdentifier(reuseIdentifier))
{
return false;
}
theImage = CommonUrlImageView::createWithLayout(DLayout(DHorizontalLayout_L_W(20, 200), DVerticalLayout_T_B(20, 20)));
theImage->setTag(101);
theImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
theImage->setImage(CAImage::create("image/HelloWorld.png"));
this->getContentView()->addSubview(theImage);
theTitle = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(240, 150), DVerticalLayout_T_H(20, 40)));
theTitle->setColor(CAColor_black);
theTitle->setTextAlignment(CATextAlignmentLeft);
theTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
theTitle->setFontSize(32);
theTitle->setTag(100);
this->getContentView()->addSubview(theTitle);
theDesc = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(240, 150), DVerticalLayout_T_H(65, 40)));
theDesc->setColor(CAColor_black);
theDesc->setTextAlignment(CATextAlignmentLeft);
theDesc->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
theDesc->setFontSize(24);
theDesc->setTag(102);
theDesc->setColor(CAColor_gray);
theDesc->setLineSpacing(10);
this->getContentView()->addSubview(theDesc);
return true;
}
void CDNewsTableCell::setModel(const newsMsg &cellmodel)
{
theImage->setImage(CAImage::create("image/HelloWorld.png"));
theImage->setUrl(cellmodel.m_imageUrl);
theTitle->setText(cellmodel.m_title);
theDesc->setText(cellmodel.m_desc);
}
CDNewsViewController::CDNewsViewController(int index)
:p_PageView(NULL)
,p_TableView(NULL)
,p_pLoading(NULL)
,p_section(1)
{
urlID = index;
m_msg.clear();
}
CDNewsViewController::~CDNewsViewController()
{
}
string CDNewsViewController::getSign(std::map<std::string,std::string> key_value)
{
string appsecret = "c174cb1fda3491285be953998bb867a0";
string tempStr = "";
std::map<std::string,std::string>::iterator itr;
for (itr=key_value.begin(); itr!=key_value.end(); itr++) {
tempStr = tempStr+itr->first+itr->second;
}
tempStr = appsecret+tempStr+appsecret;
CCLog("tempStr===%s",tempStr.c_str());
string sign = MD5(tempStr).md5();
for(int i=0;i<sign.length();i++)
{
if(sign[i]>='a'&&sign[i]<='z')
sign[i]-=32;
else if
(sign[i]>='A'&&sign[i]<='Z')sign[i]+=32;
}
return sign;
}
void CDNewsViewController::viewDidLoad()
{
if (m_msg.empty())
{
std::map<std::string,
std::string> key_value;
key_value["tag"] = menuTag[urlID];
key_value["page"]= "1";
key_value["limit"]= "20";
key_value["appid"]="10000";
key_value["sign_method"]="md5";
string tempSign = getSign(key_value);
CCLog("sign===%s",tempSign.c_str());
key_value["sign"] = tempSign;
string tempUrl = "http://api.9miao.com/news/";
CommonHttpManager::getInstance()->send_post(tempUrl, key_value, this,
CommonHttpJson_selector(CDNewsViewController::onRequestFinished));
p_pLoading = CAActivityIndicatorView::createWithLayout(DLayoutFill);
this->getView()->insertSubview(p_pLoading, CAWindowZOrderTop);
p_pLoading->setLoadingMinTime(0.5f);
p_pLoading->setTargetOnCancel(this, callfunc_selector(CDNewsViewController::initNewsTableView));
}
else
{
this->initNewsTableView();
}
}
void CDNewsViewController::showAlert()
{
if (p_alertView) {
this->getView()->removeSubview(p_alertView);
p_alertView= NULL;
}
p_alertView = CAView::createWithFrame(this->getView()->getBounds());
this->getView()->addSubview(p_alertView);
CAImageView* bg = CAImageView::createWithLayout(DLayoutFill);
bg->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
bg->setImage(CAImage::create("image/HelloWorld.png"));
CAButton* btn5 = CAButton::create(CAButtonTypeSquareRect);
btn5->setTag(100);
btn5->setLayout(DLayoutFill);
btn5->setTitleColorForState(CAControlStateNormal,CAColor_white);
btn5->setBackgroundViewForState(CAControlStateNormal, bg);
btn5->setBackgroundViewForState(CAControlStateHighlighted, bg);
btn5->addTarget(this, CAControl_selector(CDNewsViewController::buttonCallBack), CAControlEventTouchUpInSide);
p_alertView->addSubview(btn5);
CALabel* test = CALabel::createWithLayout(DLayout(DHorizontalLayoutFill, DVerticalLayout_B_H(100, 40)));
test->setColor(CAColor_gray);
test->setTextAlignment(CATextAlignmentCenter);
test->setVerticalTextAlignmet(CAVerticalTextAlignmentTop);
test->setFontSize(24);
test->setText("网络不给力,请点击屏幕重新加载~");
p_alertView->addSubview(test);
}
void CDNewsViewController::buttonCallBack(CAControl* btn,DPoint point)
{
this->getView()->removeSubview(p_alertView);
p_alertView = NULL;
std::map<std::string,
std::string> key_value;
key_value["tag"] = menuTag[urlID];
key_value["page"]= "1";
key_value["limit"]= "20";
key_value["appid"]="10000";
key_value["sign_method"]="md5";
string tempSign = getSign(key_value);
CCLog("sign===%s",tempSign.c_str());
key_value["sign"] = tempSign;
string tempUrl = "http://api.9miao.com/news/";
CommonHttpManager::getInstance()->send_post(tempUrl, key_value, this,
CommonHttpJson_selector(CDNewsViewController::onRequestFinished));
{
p_pLoading = CAActivityIndicatorView::createWithLayout(DLayoutFill);
this->getView()->insertSubview(p_pLoading, CAWindowZOrderTop);
p_pLoading->setLoadingMinTime(0.5f);
p_pLoading->setTargetOnCancel(this, callfunc_selector(CDNewsViewController::initNewsTableView));
}
}
void CDNewsViewController::onRequestFinished(const HttpResponseStatus& status, const CSJson::Value& json)
{
if (status == HttpResponseSucceed)
{
const CSJson::Value& value = json["result"];
int length = value.size();
m_msg.clear();
m_page.clear();
for (int i=0; i<3; i++) {
newsPage temp_page;
temp_page.m_title = value[i]["title"].asString();
temp_page.m_pic = value[i]["image"].asString();
temp_page.m_url = value[i]["url"].asString();
m_page.push_back(temp_page);
}
for (int index = 3; index < length; index++)
{
newsMsg temp_msg;
temp_msg.m_title = value[index]["title"].asString();
temp_msg.m_desc = value[index]["desc"].asString();
temp_msg.m_url = value[index]["url"].asString();
temp_msg.m_imageUrl = value[index]["image"].asString();
m_msg.push_back(temp_msg);
}
}
CATabBarController* tabBarController = this->getTabBarController();
for (int i=0; i<5; i++)
{
CDNewsViewController* catalog = dynamic_cast<CDNewsViewController*>(tabBarController->getViewControllerAtIndex(i));
if (catalog && catalog->p_pLoading)
{
catalog->p_pLoading->stopAnimating();
}
}
if (p_TableView)
{
p_TableView->reloadData();
}
}
void CDNewsViewController::onRefreshRequestFinished(const HttpResponseStatus& status, const CSJson::Value& json)
{
if (status == HttpResponseSucceed)
{
const CSJson::Value& value = json["result"];
int length = value.size();
for (int index = 0; index < length; index++)
{
newsMsg temp_msg;
temp_msg.m_title = value[index]["title"].asString();
temp_msg.m_desc = value[index]["desc"].asString();
temp_msg.m_url = value[index]["url"].asString();
temp_msg.m_imageUrl = value[index]["image"].asString();
m_msg.push_back(temp_msg);
}
}
do
{
CC_BREAK_IF(p_pLoading == NULL);
if (p_pLoading->isAnimating())
{
p_pLoading->stopAnimating();
}
else
{
p_TableView->reloadData();
}
}
while (0);
}
void CDNewsViewController::initNewsTableView()
{
if (m_page.empty())
{
showAlert();
return;
}
if (p_TableView!=NULL)
{
this->getView()->removeSubview(p_TableView);
p_TableView = NULL;
}
p_TableView= CATableView::createWithLayout(DLayoutFill);
p_TableView->setTableViewDataSource(this);
p_TableView->setTableViewDelegate(this);
p_TableView->setScrollViewDelegate(this);
p_TableView->setAllowsSelection(true);
this->getView()->addSubview(p_TableView);
CAPullToRefreshView *refreshDiscount = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeFooter);
refreshDiscount->setLabelColor(CAColor_black);
CAPullToRefreshView *refreshDiscount1 = CAPullToRefreshView::create(CAPullToRefreshView::CAPullToRefreshTypeHeader);
refreshDiscount1->setLabelColor(CAColor_black);
p_TableView->setFooterRefreshView(refreshDiscount);
p_TableView->setHeaderRefreshView(refreshDiscount1);
initNewsPageView();
}
void CDNewsViewController::initNewsPageView()
{
//初始化pageView
CAView* tempview = CAView::create();
p_TableView->setTableHeaderView(tempview);
p_TableView->setTableHeaderHeight(360);
CAVector<CAView* > viewList;
CommonUrlImageView* temImage0 = CommonUrlImageView::createWithImage(CAImage::create("image/HelloWorld.png"));
temImage0->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage0->setUrl(m_page[m_page.size()-1].m_pic);
viewList.pushBack(temImage0);
for (int i=0; i<m_page.size(); i++)
{
//初始化viewList
CommonUrlImageView* temImage = CommonUrlImageView::createWithImage(CAImage::create("image/HelloWorld.png"));
temImage->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage->setUrl(m_page[i].m_pic);
viewList.pushBack(temImage);
}
CommonUrlImageView* temImage1 = CommonUrlImageView::createWithImage(CAImage::create("image/HelloWorld.png"));
temImage1->setImageViewScaleType(CAImageViewScaleTypeFitImageCrop);
temImage1->setUrl(m_page[0].m_pic);
viewList.pushBack(temImage1);
p_PageView = CAPageView::createWithLayout(DLayoutFill, CAPageViewDirectionHorizontal);
p_PageView->setViews(viewList);
p_PageView->setPageViewDelegate(this);
p_PageView->setTouchEnabled(true);
tempview->addSubview(p_PageView);
p_PageView->setCurrPage(1, false);
CAView* bg = CAView::createWithColor(ccc4(0, 0, 0, 128));
bg->setLayout(DLayout(DHorizontalLayoutFill, DVerticalLayout_B_H(0, 50)));
tempview->addSubview(bg);
pageControl = CAPageControl::createWithLayout(DLayout(DHorizontalLayout_R_W(40, 100), DVerticalLayoutFill));
pageControl->setNumberOfPages((int)m_page.size());
pageControl->setPageIndicatorImage(CAImage::create("image/pagecontrol_selected.png"));
pageControl->setCurrIndicatorImage(CAImage::create("image/pagecontrol_bg.png"));
pageControl->setPageIndicatorTintColor(CAColor_gray);
//pageControl->setCurrentPageIndicatorTintColor(CAColor_clear);
pageControl->addTarget(this, CAControl_selector(CDNewsViewController::pageControlCallBack));
bg->addSubview(pageControl);
if (m_page.size()>0)
{
pageViewTitle = CALabel::createWithLayout(DLayout(DHorizontalLayout_L_R(20, 160), DVerticalLayoutFill));
pageViewTitle->setVerticalTextAlignmet(CAVerticalTextAlignmentCenter);
pageViewTitle->setText(m_page[0].m_title);
pageViewTitle->setColor(CAColor_white);
pageViewTitle->setFontSize(28);
bg->addSubview(pageViewTitle);
}
}
void CDNewsViewController::viewDidUnload()
{
}
void CDNewsViewController::tableViewDidSelectRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row)
{
CDWebViewController* _webController = new CDWebViewController();
_webController->init();
_webController->setTitle(" ");
_webController->autorelease();
RootWindow::getInstance()->getDrawerController()->hideLeftViewController(true);
RootWindow::getInstance()->getRootNavigationController()->pushViewController(_webController, true);
_webController->initWebView(m_msg[row].m_url);
}
void CDNewsViewController::tableViewDidDeselectRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row)
{
}
CATableViewCell* CDNewsViewController::tableCellAtIndex(CATableView* table, const DSize& cellSize, unsigned int section, unsigned int row)
{
CDNewsTableCell* cell = dynamic_cast<CDNewsTableCell*>(table->dequeueReusableCellWithIdentifier("CrossApp"));
if (cell == NULL)
{
cell = CDNewsTableCell::create("CrossApp");
}
cell->setModel(m_msg[row]);
return cell;
}
void CDNewsViewController::tableViewWillDisplayCellAtIndex(CATableView* table, CATableViewCell* cell, unsigned int section, unsigned int row)
{
/*
if (cell != NULL)
{
temp_time+=0.02f;
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(temp_time);
CAViewAnimation::setAnimationDidStopSelector(this,CAViewAnimation0_selector(CDNewsViewController::tempCallBack));
CAViewAnimation::commitAnimations();
cell->getContentView()->setScale(0.8f);
cell->getContentView()->setRotationY(-180);
CAViewAnimation::beginAnimations("", NULL);
CAViewAnimation::setAnimationDuration(0.3f);
CAViewAnimation::setAnimationDelay(temp_time);
cell->getContentView()->setScale(1.0f);
cell->getContentView()->setRotationY(0);
//执行动画
CAViewAnimation::commitAnimations();
}
*/
}
void CDNewsViewController::tempCallBack()
{
temp_time-=0.02f;
}
unsigned int CDNewsViewController::numberOfSections(CATableView *table)
{
return 1;
}
unsigned int CDNewsViewController::numberOfRowsInSection(CATableView *table, unsigned int section)
{
return (unsigned int)m_msg.size();
}
unsigned int CDNewsViewController::tableViewHeightForRowAtIndexPath(CATableView* table, unsigned int section, unsigned int row)
{
return 170;
}
void CDNewsViewController::scrollViewHeaderBeginRefreshing(CrossApp::CAScrollView *view)
{
std::map<std::string,
std::string> key_value;
key_value["tag"] = menuTag[urlID];
key_value["page"]= "1";
key_value["limit"]= "20";
key_value["appid"]="10000";
key_value["sign_method"]="md5";
string tempSign = getSign(key_value);
CCLog("sign===%s",tempSign.c_str());
key_value["sign"] = tempSign;
string tempUrl = "http://api.9miao.com/news/";
CommonHttpManager::getInstance()->send_post(tempUrl, key_value, this,
CommonHttpJson_selector(CDNewsViewController::onRequestFinished));
CATabBarItem* item = this->getTabBarItem();
CCLog("BadgeValue====%s",item->getBadgeValue().c_str());
if (!item->getBadgeValue().empty()) {
item->setBadgeValue("");
this->setTabBarItem(item);
}
}
void CDNewsViewController::scrollViewFooterBeginRefreshing(CAScrollView* view)
{
p_section++;
std::map<std::string,
std::string> key_value;
key_value["tag"] = menuTag[urlID];
key_value["page"]= crossapp_format_string("%d",p_section);
key_value["limit"]= "20";
key_value["appid"]="10000";
key_value["sign_method"]="md5";
string tempSign = getSign(key_value);
CCLog("sign===%s",tempSign.c_str());
key_value["sign"] = tempSign;
string tempUrl = "http://api.9miao.com/news/";
CommonHttpManager::getInstance()->send_post(tempUrl, key_value, this,
CommonHttpJson_selector(CDNewsViewController::onRefreshRequestFinished));
}
void CDNewsViewController::pageViewDidSelectPageAtIndex(CAPageView* pageView, unsigned int index, const DPoint& point)
{
CDWebViewController* _webController = new CDWebViewController();
_webController->init();
_webController->setTitle(" ");
_webController->autorelease();
RootWindow::getInstance()->getDrawerController()->hideLeftViewController(true);
RootWindow::getInstance()->getRootNavigationController()->pushViewController(_webController, true);
_webController->initWebView(m_page[index-1].m_url);
}
void CDNewsViewController::pageViewDidBeginTurning(CAPageView* pageView)
{
}
void CDNewsViewController::pageViewDidEndTurning(CAPageView* pageView)
{
if (pageView->getCurrPage()==0)
{
pageView->setCurrPage((int)m_page.size(), false);
}
else if(pageView->getCurrPage()==m_page.size()+1)
{
pageView->setCurrPage(1, false);
}
pageControl->setCurrentPage(pageView->getCurrPage()-1);
pageControl->updateCurrentPageDisplay();
if (m_page.size()>0) {
pageViewTitle->setText(m_page[pageView->getCurrPage()-1].m_title);
}
}
void CDNewsViewController::pageControlCallBack(CrossApp::CAControl *btn, CrossApp::DPoint point){
CAPageControl* button = (CAPageControl*)btn;
p_PageView->setCurrPage(button->getCurrentPage()+1, true);
if (m_page.size()>0) {
pageViewTitle->setText(m_page[button->getCurrentPage()].m_title);
}
} | [
"278688386@qq.com"
] | 278688386@qq.com |
e30c170753170bbea3cd028247870192a6a10b79 | e393699b9e089fc864cab670c157145e625e118e | /dev/ScrollPresenter/ScrollingScrollCompletedEventArgs.h | 82e6bc90540dfee143e95488cb953592e77ea886 | [
"MIT"
] | permissive | yoshiask/microsoft-ui-xaml | dd01cded7ae15f2306247e422560a73cbf9be580 | 0f0a19654b833e1a50b9db172041d23e7c9aff38 | refs/heads/master | 2023-07-06T06:34:39.799972 | 2020-06-29T05:39:33 | 2020-06-29T05:39:33 | 275,098,738 | 1 | 0 | MIT | 2020-06-26T07:31:11 | 2020-06-26T07:31:11 | null | UTF-8 | C++ | false | false | 1,051 | h | // Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License. See LICENSE in the project root for license information.
#pragma once
#include "ScrollPresenter.h"
#include "ScrollingScrollCompletedEventArgs.g.h"
class ScrollingScrollCompletedEventArgs :
public winrt::implementation::ScrollingScrollCompletedEventArgsT<ScrollingScrollCompletedEventArgs>
{
public:
ScrollingScrollCompletedEventArgs()
{
SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
}
~ScrollingScrollCompletedEventArgs()
{
SCROLLPRESENTER_TRACE_VERBOSE(nullptr, TRACE_MSG_METH, METH_NAME, this);
}
// IScrollCompletedEventArgs overrides
winrt::ScrollInfo ScrollInfo();
ScrollPresenterViewChangeResult Result();
void OffsetsChangeId(int32_t offsetsChangeId);
void Result(ScrollPresenterViewChangeResult result);
private:
int32_t m_offsetsChangeId{ -1 };
ScrollPresenterViewChangeResult m_result{ ScrollPresenterViewChangeResult::Completed };
};
| [
"noreply@github.com"
] | yoshiask.noreply@github.com |
23dce32bae5ecd77a4eb93240c163b8759e6bbd0 | 992f1b4fef76853e256e7c54280139753c5a6192 | /leet/test/leet0013_test.cpp | ac08bc0f348f343bdc2ee208127fa34e5c39553e | [] | no_license | lcllkzdzq/leet | ce19526a5a4c2f94403a7e3c3dcdd4fffd912d2f | 7ea46a37e365c0d55435dfbb5a167a33c8c3e7a2 | refs/heads/master | 2021-04-06T13:32:08.580309 | 2018-07-19T15:31:11 | 2018-07-19T15:31:11 | 124,920,999 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 457 | cpp | #include <gtest/gtest.h>
#include "leet0013.hpp"
TEST(Leet0013, less_than_10)
{
Leet0013Solution s;
EXPECT_EQ(s.romanToInt("IV"), 4);
}
TEST(Leet0013, 10_to_100)
{
Leet0013Solution s;
EXPECT_EQ(s.romanToInt("XLIII"), 43);
}
TEST(Leet0013, 100_to_1000)
{
Leet0013Solution s;
EXPECT_EQ(s.romanToInt("DCCCXCIII"), 893);
}
TEST(Leet0013, 1000_than_3999)
{
Leet0013Solution s;
EXPECT_EQ(s.romanToInt("MMCLXXXV"), 2185);
}
| [
"lunarwaterfox@gmail.com"
] | lunarwaterfox@gmail.com |
a9dfd063e51f04e7c148083bad9f3b955ed54d65 | 09a8696421a8edc1fbb33aca63f42eb70a6b43b5 | /Class(III)/7-1-1.cpp | 52b67eca845c216f48b83122d3ca03f5880f3dd8 | [] | no_license | chris0765/CppPrograming | be35e6f7be37566d74ef3bafcbc01f8ef017772a | 726536c3c9cb18d281535b2a32256db1e8cf5f2b | refs/heads/main | 2023-05-13T23:26:55.650267 | 2021-06-03T14:43:54 | 2021-06-03T14:43:54 | 348,203,097 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 785 | cpp | #include <iostream>
using namespace std;
class Complex{
double re, im;
public:
Complex(double r = 0, double i = 0): re(r), im(i){}
~Complex(){}
double real() {return re;}
double imag() {return im;}
Complex add(const Complex& c) const;
friend Complex operator+(const Complex& c, const Complex& d);
void print() const{
cout << re << " + " << im << "i" << endl;
}
};
Complex operator+(const Complex& c, const Complex& d){
Complex result(c.re+d.re, c.im+d.im);
return result;
}
Complex Complex::add(const Complex& c) const{
Complex result(re + c.re, im + c.im);
return result;
}
int main()
{
Complex x(2, 3);
Complex y(-1, -3);
Complex z;
x.print();
y.print();
z = x+y;
z.print();
return 0;
} | [
"chris0765@kookmin.ac.kr"
] | chris0765@kookmin.ac.kr |
268d858714123c4d3d931b93c081e6ef17e5c5f1 | adb583595faf6167a4e12323ee1b6dccd306276c | /Micro_Servo.ino | 4f5c03df441f4cc3a70e5ad44a3a6ca3fec76e9e | [] | no_license | Martin-Mesias/Laboratorio-N-3-de-robotica | ef5febf0778b944117d1ab9f506a349e0c249676 | 0093770e52b104a2c54ef4df3be36a8ca7f30394 | refs/heads/master | 2020-08-07T13:53:11.200483 | 2019-11-29T19:16:58 | 2019-11-29T19:16:58 | 213,477,452 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 393 | ino | #include <Servo.h>
Servo servo1;
int PINSERVO = 2;
int PULSOMIN = 500; // equivale a 0 grados
int PULSOMAX = 2300; // equivale a 180 grados
int VALORPOT;
int ANGULO;
int POT = 0;
void setup (){
servo1.attach(PINSERVO, PULSOMIN,PULSOMAX);
}
void loop (){
VALORPOT = analogRead(POT);
ANGULO = map(VALORPOT, 0, 1023, 0, 180);
servo1.write(ANGULO);
delay(20);
}
| [
"noreply@github.com"
] | Martin-Mesias.noreply@github.com |
777c54650e914c05d972a3460235d8dabb3f4a79 | aea82ce20a77e329d84139e19f4f761b3af5df55 | /vulkan/vulkan_utilities.cc | 2ad904bdfe877a55d66df5688f1cb7a3936c3d76 | [
"BSD-3-Clause"
] | permissive | hanagm/engine | 3bda732ec48c1bd0fadf750641a34e33a105d546 | 36db6cfdd1b072ba6251e2ad87e56b698352a2a8 | refs/heads/master | 2022-11-29T06:29:14.361445 | 2020-08-06T08:41:02 | 2020-08-06T08:41:02 | 285,538,291 | 1 | 0 | BSD-3-Clause | 2020-08-06T10:11:03 | 2020-08-06T10:11:02 | null | UTF-8 | C++ | false | false | 3,461 | cc | // Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// FLUTTER_NOLINT
#include "vulkan_utilities.h"
#include "flutter/fml/build_config.h"
#include <algorithm>
#include <unordered_set>
namespace vulkan {
// Whether to show Vulkan validation layer info messages in addition
// to the error messages.
bool ValidationLayerInfoMessagesEnabled() {
return false;
}
bool ValidationErrorsFatal() {
#if OS_FUCHSIA
return false;
#endif
return true;
}
static std::vector<std::string> InstanceOrDeviceLayersToEnable(
const VulkanProcTable& vk,
VkPhysicalDevice physical_device,
bool enable_validation_layers) {
if (!enable_validation_layers) {
return {};
}
// NOTE: The loader is sensitive to the ordering here. Please do not rearrange
// this list.
#if OS_FUCHSIA
// The other layers in the Fuchsia SDK seem to have a bug right now causing
// crashes, so it is only recommended that we use VK_LAYER_KHRONOS_validation
// until we have a confirmation that they are fixed.
const std::vector<std::string> candidates = {"VK_LAYER_KHRONOS_validation"};
#else
const std::vector<std::string> candidates = {
"VK_LAYER_GOOGLE_threading", "VK_LAYER_LUNARG_parameter_validation",
"VK_LAYER_LUNARG_object_tracker", "VK_LAYER_LUNARG_core_validation",
"VK_LAYER_LUNARG_device_limits", "VK_LAYER_LUNARG_image",
"VK_LAYER_LUNARG_swapchain", "VK_LAYER_GOOGLE_unique_objects"};
#endif
uint32_t count = 0;
if (physical_device == VK_NULL_HANDLE) {
if (VK_CALL_LOG_ERROR(vk.EnumerateInstanceLayerProperties(
&count, nullptr)) != VK_SUCCESS) {
return {};
}
} else {
if (VK_CALL_LOG_ERROR(vk.EnumerateDeviceLayerProperties(
physical_device, &count, nullptr)) != VK_SUCCESS) {
return {};
}
}
std::vector<VkLayerProperties> properties;
properties.resize(count);
if (physical_device == VK_NULL_HANDLE) {
if (VK_CALL_LOG_ERROR(vk.EnumerateInstanceLayerProperties(
&count, properties.data())) != VK_SUCCESS) {
return {};
}
} else {
if (VK_CALL_LOG_ERROR(vk.EnumerateDeviceLayerProperties(
physical_device, &count, properties.data())) != VK_SUCCESS) {
return {};
}
}
std::unordered_set<std::string> available_extensions;
for (size_t i = 0; i < count; i++) {
available_extensions.emplace(properties[i].layerName);
}
std::vector<std::string> available_candidates;
for (const auto& candidate : candidates) {
auto found = available_extensions.find(candidate);
if (found != available_extensions.end()) {
available_candidates.emplace_back(candidate);
}
}
return available_candidates;
}
std::vector<std::string> InstanceLayersToEnable(const VulkanProcTable& vk,
bool enable_validation_layers) {
return InstanceOrDeviceLayersToEnable(vk, VK_NULL_HANDLE,
enable_validation_layers);
}
std::vector<std::string> DeviceLayersToEnable(
const VulkanProcTable& vk,
const VulkanHandle<VkPhysicalDevice>& physical_device,
bool enable_validation_layers) {
if (!physical_device) {
return {};
}
return InstanceOrDeviceLayersToEnable(vk, physical_device,
enable_validation_layers);
}
} // namespace vulkan
| [
"noreply@github.com"
] | hanagm.noreply@github.com |
3a794bc08ae9ccdb3cba751b38e514ad047a8f58 | bb9b83b2526d3ff8a932a1992885a3fac7ee064d | /src/modules/osg/generated_code/Projection.pypp.hpp | 1d2fcfebffa4444825eb24c23f299906cbee207f | [] | no_license | JaneliaSciComp/osgpyplusplus | 4ceb65237772fe6686ddc0805b8c77d7b4b61b40 | a5ae3f69c7e9101a32d8cc95fe680dab292f75ac | refs/heads/master | 2021-01-10T19:12:31.756663 | 2015-09-09T19:10:16 | 2015-09-09T19:10:16 | 23,578,052 | 20 | 7 | null | null | null | null | UTF-8 | C++ | false | false | 207 | hpp | // This file has been generated by Py++.
#ifndef Projection_hpp__pyplusplus_wrapper
#define Projection_hpp__pyplusplus_wrapper
void register_Projection_class();
#endif//Projection_hpp__pyplusplus_wrapper
| [
"brunsc@janelia.hhmi.org"
] | brunsc@janelia.hhmi.org |
6a59f0dd5bb54d2b26d30ed38650291eb59e3bec | d14b5d78b72711e4614808051c0364b7bd5d6d98 | /third_party/llvm-10.0/llvm/lib/Target/ARM/Thumb2InstrInfo.h | 7d8dff14e1e72de01db5f990b13d4ff6beb01ab6 | [
"Apache-2.0"
] | permissive | google/swiftshader | 76659addb1c12eb1477050fded1e7d067f2ed25b | 5be49d4aef266ae6dcc95085e1e3011dad0e7eb7 | refs/heads/master | 2023-07-21T23:19:29.415159 | 2023-07-21T19:58:29 | 2023-07-21T20:50:19 | 62,297,898 | 1,981 | 306 | Apache-2.0 | 2023-07-05T21:29:34 | 2016-06-30T09:25:24 | C++ | UTF-8 | C++ | false | false | 3,284 | h | //===-- Thumb2InstrInfo.h - Thumb-2 Instruction Information -----*- C++ -*-===//
//
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
// See https://llvm.org/LICENSE.txt for license information.
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
//
// This file contains the Thumb-2 implementation of the TargetInstrInfo class.
//
//===----------------------------------------------------------------------===//
#ifndef LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
#define LLVM_LIB_TARGET_ARM_THUMB2INSTRINFO_H
#include "ARMBaseInstrInfo.h"
#include "ThumbRegisterInfo.h"
namespace llvm {
class ARMSubtarget;
class ScheduleHazardRecognizer;
class Thumb2InstrInfo : public ARMBaseInstrInfo {
ThumbRegisterInfo RI;
public:
explicit Thumb2InstrInfo(const ARMSubtarget &STI);
/// Return the noop instruction to use for a noop.
void getNoop(MCInst &NopInst) const override;
// Return the non-pre/post incrementing version of 'Opc'. Return 0
// if there is not such an opcode.
unsigned getUnindexedOpcode(unsigned Opc) const override;
void ReplaceTailWithBranchTo(MachineBasicBlock::iterator Tail,
MachineBasicBlock *NewDest) const override;
bool isLegalToSplitMBBAt(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI) const override;
void copyPhysReg(MachineBasicBlock &MBB, MachineBasicBlock::iterator I,
const DebugLoc &DL, MCRegister DestReg, MCRegister SrcReg,
bool KillSrc) const override;
void storeRegToStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned SrcReg, bool isKill, int FrameIndex,
const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const override;
void loadRegFromStackSlot(MachineBasicBlock &MBB,
MachineBasicBlock::iterator MBBI,
unsigned DestReg, int FrameIndex,
const TargetRegisterClass *RC,
const TargetRegisterInfo *TRI) const override;
/// getRegisterInfo - TargetInstrInfo is a superset of MRegister info. As
/// such, whenever a client has an instance of instruction info, it should
/// always be able to get register info as well (through this method).
///
const ThumbRegisterInfo &getRegisterInfo() const override { return RI; }
private:
void expandLoadStackGuard(MachineBasicBlock::iterator MI) const override;
};
/// getITInstrPredicate - Valid only in Thumb2 mode. This function is identical
/// to llvm::getInstrPredicate except it returns AL for conditional branch
/// instructions which are "predicated", but are not in IT blocks.
ARMCC::CondCodes getITInstrPredicate(const MachineInstr &MI, unsigned &PredReg);
// getVPTInstrPredicate: VPT analogue of that, plus a helper function
// corresponding to MachineInstr::findFirstPredOperandIdx.
int findFirstVPTPredOperandIdx(const MachineInstr &MI);
ARMVCC::VPTCodes getVPTInstrPredicate(const MachineInstr &MI,
unsigned &PredReg);
}
#endif
| [
"bclayton@google.com"
] | bclayton@google.com |
76c7f0199fe875a62ecfc0d1f5263b5d5bfb92af | 2348000ede440b3513010c29a154ca70b22eb88e | /src/CPP/src/pratice/ReverseWordsInAString.cpp | ea103cf7c69443a4b5fc68e39dde58502fd01294 | [] | no_license | ZhenyingZhu/ClassicAlgorithms | 76438e02ecc813b75646df87f56d9588ffa256df | 86c90c23ea7ed91e8ce5278f334f0ce6e034a38c | refs/heads/master | 2023-08-27T20:34:18.427614 | 2023-08-25T06:08:00 | 2023-08-25T06:08:00 | 24,016,875 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,496 | cpp | #include <iostream>
using namespace std;
// [Source]: https://leetcode.com/problems/reverse-words-in-a-string/
// http://www.1point3acres.com/bbs/forum.php?mod=viewthread&tid=212481
class Solution {
public:
void reverseWords(string &s) {
if (s.empty())
return;
removeTrailingSpaces(s);
int st = 0;
for (int i = 0; i < (int)s.length(); ++i) {
if (s[i] == ' ') {
reverse(s, st, i - 1);
st = i + 1;
}
}
reverse(s, st, s.length() - 1);
reverse(s, 0, s.length() - 1);
}
void removeTrailingSpaces(string &s) {
int len = s.length();
// move pointer to first non space char
int run = 0;
while (run < len && s[run] == ' ')
++run;
// copy characters to previous slots
int cur = 0;
while (run < len) {
if (s[run] != ' ')
s[cur++] = s[run++];
else if (s[cur - 1] != ' ') // first char must not space
s[cur++] = s[run++];
else
++run;
}
// the last char might be a space
if (cur > 0 && s[cur - 1] == ' ')
--cur;
s.erase(cur);
}
void reverse(string &s, int st, int ed) {
while (st < ed) {
swap(s[st++], s[ed--]);
}
}
};
int main() {
Solution sol;
string s = " ";
sol.reverseWords(s);
cout << s << "|" << endl;
}
| [
"zz2283@columbia.edu"
] | zz2283@columbia.edu |
1fdbbbdb7b020f222da85fccd1e4da8b7a336e27 | 2485ffe62134cd39d4c5cf12f8e73ca9ef781dd1 | /contrib/boost/iterator/test/function_input_iterator_test.cpp | f64e9f59d6111b1aabc22365483b734d20daa66d | [
"MIT",
"BSL-1.0"
] | permissive | alesapin/XMorphy | 1aed0c8e0f8e74efac9523f4d6e585e5223105ee | aaf1d5561cc9227691331a515ca3bc94ed6cc0f1 | refs/heads/master | 2023-04-16T09:27:58.731844 | 2023-04-08T17:15:26 | 2023-04-08T17:15:26 | 97,373,549 | 37 | 5 | MIT | 2023-04-08T17:15:27 | 2017-07-16T09:35:41 | C++ | UTF-8 | C++ | false | false | 3,974 | cpp | // Copyright 2010 (c) Dean Michael Berris
// Distributed under the Boost Software License Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <cstddef>
#include <algorithm>
#include <iterator>
#include <vector>
#include <boost/config.hpp>
#if !defined(BOOST_NO_CXX11_DECLTYPE)
// Force boost::result_of use decltype, even on compilers that don't support N3276.
// This enables this test to also verify if the iterator works with lambdas
// on such compilers with this config macro. Note that without the macro result_of
// (and consequently the iterator) is guaranteed to _not_ work, so this case is not
// worth testing anyway.
#define BOOST_RESULT_OF_USE_DECLTYPE
#endif
#include <boost/core/lightweight_test.hpp>
#include <boost/iterator/function_input_iterator.hpp>
namespace {
struct ones {
typedef int result_type;
result_type operator() () {
return 1;
}
};
int ones_function () {
return 1;
}
struct counter {
typedef int result_type;
int n;
explicit counter(int n_) : n(n_) { }
result_type operator() () {
return n++;
}
};
} // namespace
using namespace std;
int main()
{
// test the iterator with function objects
ones ones_generator;
vector<int> values(10);
generate(values.begin(), values.end(), ones());
vector<int> generated;
copy(
boost::make_function_input_iterator(ones_generator, 0),
boost::make_function_input_iterator(ones_generator, 10),
back_inserter(generated)
);
BOOST_TEST_ALL_EQ(values.begin(), values.end(), generated.begin(), generated.end());
// test the iterator with normal functions
vector<int>().swap(generated);
copy(
boost::make_function_input_iterator(&ones_function, 0),
boost::make_function_input_iterator(&ones_function, 10),
back_inserter(generated)
);
BOOST_TEST_ALL_EQ(values.begin(), values.end(), generated.begin(), generated.end());
// test the iterator with a reference to a function
vector<int>().swap(generated);
copy(
boost::make_function_input_iterator(ones_function, 0),
boost::make_function_input_iterator(ones_function, 10),
back_inserter(generated)
);
BOOST_TEST_ALL_EQ(values.begin(), values.end(), generated.begin(), generated.end());
// test the iterator with a stateful function object
counter counter_generator(42);
vector<int>().swap(generated);
copy(
boost::make_function_input_iterator(counter_generator, 0),
boost::make_function_input_iterator(counter_generator, 10),
back_inserter(generated)
);
BOOST_TEST_EQ(generated.size(), 10u);
BOOST_TEST_EQ(counter_generator.n, 42 + 10);
for(std::size_t i = 0; i != 10; ++i)
BOOST_TEST_EQ(generated[i], static_cast<int>(42 + i));
// Test that incrementing the iterator returns a reference to the iterator type
{
typedef boost::iterators::function_input_iterator<counter, int> function_counter_iterator_t;
function_counter_iterator_t it1(counter_generator, 0);
function_counter_iterator_t it2(++it1);
function_counter_iterator_t it3(it2++);
BOOST_TEST_EQ(*it3, 54);
}
#if !defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) \
&& defined(BOOST_RESULT_OF_USE_DECLTYPE)
// test the iterator with lambda expressions
int num = 42;
auto lambda_generator = [&num] { return num++; };
vector<int>().swap(generated);
copy(
boost::make_function_input_iterator(lambda_generator, 0),
boost::make_function_input_iterator(lambda_generator, 10),
back_inserter(generated)
);
BOOST_TEST_EQ(generated.size(), 10u);
for(std::size_t i = 0; i != 10; ++i)
BOOST_TEST_EQ(generated[i], static_cast<int>(42 + i));
#endif // BOOST_NO_CXX11_LAMBDAS
return boost::report_errors();
}
| [
"alesapin@gmail.com"
] | alesapin@gmail.com |
338c31bdc9a9460a90248dc30619602322741e6d | 9214736766cce5399cf0d178b1398438fc40357d | /libs/tgp/src/temper.cc | b27343406597fe57db91773a300c681a916f1019 | [] | no_license | CustomComputingGroup/MLO | daaa391984a7b795354e518563733c98692b460c | 3af52321da6a5bfb3b3cc04df714eb04250e157c | refs/heads/master | 2021-01-01T19:34:15.891410 | 2013-05-21T16:23:26 | 2013-05-21T16:23:26 | 7,650,010 | 0 | 1 | null | 2019-01-21T19:53:47 | 2013-01-16T17:12:56 | Python | UTF-8 | C++ | false | false | 21,432 | cc |
/********************************************************************************
*
* Bayesian Regression and Adaptive Sampling with Gaussian Process Trees
* Copyright (C) 2005, University of California
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* Questions? Contact Robert B. Gramacy (rbgramacy@ams.ucsc.edu)
*
********************************************************************************/
extern "C" {
#include "rand_draws.h"
#include "matrix.h"
#include "rhelp.h"
}
#include "temper.h"
#include <stdlib.h>
#include <assert.h>
#include <math.h>
/*
* Temper: (constructor)
*
* create a new temperature structure from the temperature
* array provided, of length n (duplicating the array)
*/
Temper::Temper(double *itemps, double *tprobs, unsigned int numit,
double c0, double n0, IT_LAMBDA it_lambda)
{
/* copy the inv-temperature vector */
this->itemps = new_dup_vector(itemps, numit);
this->numit = numit;
/* stochastic approximation parameters */
this->c0 = c0;
this->n0 = n0;
this->doSA = false; /* must turn on in Model:: */
/* combination method */
this->it_lambda = it_lambda;
/* either assign uniform probs if tprobs is NULL */
if(tprobs == NULL) {
this->tprobs = ones(numit, 1.0/numit);
} else { /* or copy them and make sure they're positive and normalized */
this->tprobs = new_dup_vector(tprobs, numit);
Normalize();
}
/* init itemp-location pointer -- find closest to 1.0 */
this->k = 0;
double mindist = fabs(this->itemps[0] - 1.0);
for(unsigned int i=1; i<this->numit; i++) {
double dist = fabs(this->itemps[i] - 1.0);
if(dist < mindist) { mindist = dist; this->k = i; }
}
/* set new (proposed) temperature to "null" */
this->knew = -1;
/* set iteration number for stoch_approx to zero */
this->cnt = 1;
/* zero-out a new counter for each temperature */
this->tcounts = new_ones_uivector(this->numit, 0);
this->cum_tcounts = new_ones_uivector(this->numit, 0);
}
/*
* Temper: (constructor)
*
* create a new temperature structure from the temperature
* array provided, the first entry of the array is n. If n
* is not zero, then c0 and n0 follow, and then n inverse
* temperatures and n (possibly unnormalized) probabilities.
*/
Temper::Temper(double *ditemps)
{
/* read the number of inverse temperatures */
assert(ditemps[0] >= 0);
numit = (unsigned int) ditemps[0];
/* copy c0 and n0 */
c0 = ditemps[1];
n0 = ditemps[2];
assert(c0 >= 0 && n0 >= 0);
doSA = false; /* must turn on in Model:: */
/* copy the inv-temperature vector and probs */
itemps = new_dup_vector(&(ditemps[3]), numit);
tprobs = new_dup_vector(&(ditemps[3+numit]), numit);
/* normalize the probs and then check that they're positive */
Normalize();
/* combination method */
int dlambda = (unsigned int) ditemps[3+3*numit];
switch((unsigned int) dlambda) {
case 1: it_lambda = OPT; break;
case 2: it_lambda = NAIVE; break;
case 3: it_lambda = ST; break;
default: error("IT lambda = %d unknown\n", dlambda);
}
/* init itemp-location pointer -- find closest to 1.0 */
k = 0;
double mindist = fabs(itemps[0] - 1.0);
for(unsigned int i=1; i<numit; i++) {
double dist = fabs(itemps[i] - 1.0);
if(dist < mindist) { mindist = dist; k = i; }
}
/* set new (proposed) temperature to "null" */
knew = -1;
/* set iteration number for stoch_approx to zero */
cnt = 1;
/* initialize the cumulative counter for each temperature */
cum_tcounts = new_ones_uivector(numit, 0);
for(unsigned int i=0; i<numit; i++)
cum_tcounts[i] = (unsigned int) ditemps[3+2*numit+i];
/* initialize the frequencies in each temperature to a a constant
determined by the acerave cum_tcounts */
tcounts = new_ones_uivector(numit, meanuiv(cum_tcounts, numit));
}
/*
* Temper: (duplicator/constructor)
*
* create a new temperature structure from the temperature
* array provided, of length n (duplicating the array)
*/
Temper::Temper(Temper *temp)
{
assert(temp);
itemps = new_dup_vector(temp->itemps, temp->numit);
tprobs = new_dup_vector(temp->tprobs, temp->numit);
tcounts = new_dup_uivector(temp->tcounts, temp->numit);
cum_tcounts = new_dup_uivector(temp->cum_tcounts, temp->numit);
numit = temp->numit;
k = temp->k;
knew = temp->knew;
c0 = temp->c0;
n0 = temp->n0;
doSA = false;
cnt = temp->cnt;
}
/*
* Temper: (assignment operator)
*
* copy new temperature structure from the temperature
* array provided, of length n (duplicating the array)
*/
Temper& Temper::operator=(const Temper &t)
{
Temper *temp = (Temper*) &t;
assert(numit == temp->numit);
dupv(itemps, temp->itemps, numit);
dupv(tprobs, temp->tprobs, numit);
dupuiv(tcounts, temp->tcounts, numit);
dupuiv(cum_tcounts, temp->cum_tcounts, numit);
numit = temp->numit;
k = temp->k;
knew = temp->knew;
c0 = temp->c0;
n0 = temp->n0;
cnt = temp->cnt;
doSA = temp->doSA;
return *this;
}
/*
* ~Temper: (destructor)
*
* free the memory and contents of an itemp
* structure
*/
Temper::~Temper(void)
{
free(itemps);
free(tprobs);
free(tcounts);
free(cum_tcounts);
}
/*
* Itemp:
*
* return the actual inv-temperature currently
* being used
*/
double Temper::Itemp(void)
{
return itemps[k];
}
/*
* Prob:
*
* return the probability inv-temperature currently
* being used
*/
double Temper::Prob(void)
{
return tprobs[k];
}
/*
* ProposedProb:
*
* return the probability inv-temperature proposed
*/
double Temper::ProposedProb(void)
{
return tprobs[knew];
}
/*
* Propose:
*
* Uniform Random-walk proposal for annealed importance sampling
* temperature in the continuous interval (0,1) with bandwidth
* of 2*0.1. Returns proposal, and passes back forward and
* backward probs
*/
double Temper::Propose(double *q_fwd, double *q_bak, void *state)
{
/* sanity check */
if(knew != -1)
warning("did not accept or reject last proposed itemp");
if(k == 0) {
if(numit == 1) { /* only one temp avail */
knew = k;
*q_fwd = *q_bak = 1.0;
} else { /* knew should be k+1 */
knew = k + 1;
*q_fwd = 1.0;
if(knew == (int) (numit - 1)) *q_bak = 1.0;
else *q_bak = 0.5;
}
} else { /* k > 0 */
/* k == numit; means k_new = k-1 */
if(k == (int) (numit - 1)) {
assert(numit > 1);
knew = k - 1;
*q_fwd = 1.0;
if(knew == 0) *q_bak = 1.0;
else *q_bak = 0.5;
} else { /* most general case */
if(runi(state) < 0.5) {
knew = k - 1;
*q_fwd = 0.5;
if(knew == (int) (numit - 1)) *q_bak = 1.0;
else *q_bak = 0.5;
} else {
knew = k + 1;
*q_fwd = 0.5;
if(knew == 0) *q_bak = 1.0;
else *q_bak = 0.5;
}
}
}
return itemps[knew];
}
/*
* Keep:
*
* keep a proposed itemp, double-checking that the itemp_new
* argument actually was the last proposed inv-temperature
*/
void Temper::Keep(double itemp_new, bool burnin)
{
assert(knew >= 0);
assert(itemp_new == itemps[knew]);
k = knew;
knew = -1;
/* update the observation counts only whilest not
doing SA and not doing burn in rounds */
if(!(doSA || burnin)) {
(tcounts[k])++;
(cum_tcounts[k])++;
}
}
/*
* Reject:
*
* reject a proposed itemp, double-checking that the itemp_new
* argument actually was the last proposed inv-temperature --
* this actually amounts to simply updating the count of the
* kept (old) temperature
*/
void Temper::Reject(double itemp_new, bool burnin)
{
assert(itemp_new == itemps[knew]);
/* do not update itemps->k, but do update the counter for
the old (kept) temperature */
knew = -1;
/* update the observation counts only whilest not
doing SA and not doing burn in rounds */
if(!(doSA || burnin)) {
(tcounts[k])++;
(cum_tcounts[k])++;
}
}
/*
* UpdatePrior:
*
* re-create the prior distribution of the temperature
* ladder by dividing by the normalization constant, i.e.,
* adjust by the "observation counts" -- returns a pointer
* to the probabilities
*/
double* Temper::UpdatePrior(void)
{
/* do nothing if there is only one temperature */
if(numit == 1) return tprobs;
/* first find the min (non-zero) tcounts */
unsigned int min = tcounts[0];
for(unsigned int i=1; i<numit; i++) {
if(min == 0 || (tcounts[i] != 0 && tcounts[i] < min))
min = tcounts[i];
}
assert(min != 0);
/* now adjust the probabilities */
double sum = 0.0;
for(unsigned int i=0; i<numit; i++) {
if(tcounts[i] == 0) tcounts[i] = min;
tprobs[i] /= tcounts[i];
sum += tprobs[i];
}
/* now normalize the probabilities */
Normalize();
/* mean-out the tcounts (observation counts) vector */
uiones(tcounts, numit, meanuiv(cum_tcounts, numit));
/* return a pointer to the (new) prior probs */
return tprobs;
}
/*
* UpdateTprobs:
*
* copy the passed in tprobs vector, no questions asked.
*/
void Temper::UpdatePrior(double *tprobs, unsigned int numit)
{
assert(this->numit == numit);
dupv(this->tprobs, tprobs, numit);
}
/*
* CopyPrior:
*
* write the tprior into the double vector provided, in the
* same format as the double-input vector to the
* Temper::Temper(double*) constructor
*/
void Temper::CopyPrior(double *dparams)
{
assert(this->numit == (unsigned int) dparams[0]);
/* copy the pseudoprior */
dupv(&(dparams[3+numit]), tprobs, numit);
/* copy the integer counts in each temperature */
for(unsigned int i=0; i<numit; i++)
dparams[3+2*numit+i] = (double) cum_tcounts[i];
}
/*
* StochApprox:
*
* update the pseudo-prior via the stochastic approximation
* suggested by Geyer & Thompson
*/
void Temper::StochApprox(void)
{
/* check if stochastic approximation is currently turned on */
if(doSA == false) return;
/* adjust each of the probs in the pseudo-prior */
assert(cnt >= 1);
for(unsigned int i=0; i<numit; i++) {
if((int)i == k) {
tprobs[i] = exp(log(tprobs[i]) - c0 / ((double)(cnt) + n0));
} else {
tprobs[i] = exp(log(tprobs[i])+ c0 / (((double)numit)*((double)(cnt) + n0)));
}
}
/* update the count of the number of SA rounds */
cnt++;
}
/*
* LambdaOpt:
*
* adjust the weight distribution w[n] using richard's
* principled method of minimization by lagrange multipliers
* thus producing a lambda--adjusted weight distribution
*/
double Temper::LambdaOpt(double *w, double *itemp, unsigned int wlen,
double *essd, unsigned int verb)
{
unsigned int len;
unsigned int tlen = 0;
double tess = 0.0;
double eisum = 0.0;
/* allocate space for the lambdas, etc */
double *lambda = new_zero_vector(numit);
double *W = new_zero_vector(numit);
double *w2sum = new_zero_vector(numit);
/* for pretty printing */
if(verb >= 1)
myprintf(mystdout, "\neffective sample sizes:\n");
/* for each temperature */
for(unsigned int i=0; i<numit; i++) {
/* get the weights at the i-th temperature */
int *p = find(itemp, wlen, EQ, itemps[i], &len);
/* nothing to do if no samples were taken at this tempereature --
but this is bad! */
double ei = 0;
if(len == 0) {
essd[i] = essd[numit + i] = 0;
continue;
}
/* collect the weights at the i-th temperature */
double *wi = new_sub_vector(p, w, len);
/* calculate Wi=sum(wi) */
W[i] = sumv(wi, len);
w2sum[i] = sum_fv(wi, len, sq);
/* calculate the ess of the weights of the i-th temperature */
if(W[i] > 0 && w2sum[i] > 0) {
/* compute ess and max weight for this temp */
lambda[i] = sq(W[i]) / w2sum[i];
/* check for numerical problems and (if none) calculate the
within temperature ESS */
if(!R_FINITE(lambda[i])) {
lambda[i] = 0;
ei = 0;
} else ei = calc_ess(wi, len);
/* sum up the within temperature ESS's */
eisum += ei*len;
} else { W[i] = 1; } /* doesn't matter since ei=0 */
/* keep track of sum of lengths and ess so far */
tlen += len;
tess += len * ei;
/* save individual ess to the (double) output essd vector */
essd[i] = len;
essd[numit + i] = ei*len;
/* print individual ess */
if(verb >= 1)
myprintf(mystdout, "%d: itemp=%g, len=%d, ess=%g\n", //, sw=%g\n",
i, itemps[i], len, ei*len); //, sumv(wi, len));
/* clean up */
free(wi);
free(p);
}
/* normalize the lambdas */
double gamma_sum = sumv(lambda, numit);
scalev(lambda, numit, 1.0/gamma_sum);
/* for each temperature, calculate the adjusted weights */
for(unsigned int i=0; i<numit; i++) {
/* get the weights at the i-th temperature */
int *p = find(itemp, wlen, EQ, itemps[i], &len);
/* nothing to do if no samples were taken at this tempereature --
but this is bad! */
if(len == 0) continue;
/* collect the weights at the i-th temperature */
double *wi = new_sub_vector(p, w, len);
/* multiply by numerator of lambda-star */
scalev(wi, len, lambda[i]/W[i]);
/* copy the mofified weights into the big weight vector */
copy_p_vector(w, p, wi, len);
/* clean up */
free(p); free(wi);
}
/* print totals */
if(verb >= 1) {
myprintf(mystdout, "total: len=%d, ess.sum=%g, ess(w)=%g\n",
tlen, tess, ((double)wlen)*calc_ess(w,wlen));
double lce = wlen*(wlen-1.0)*gamma_sum/(sq(wlen)-gamma_sum);
if(ISNAN(lce)) lce = 1;
myprintf(mystdout, "lambda-combined ess=%g\n", lce);
}
/* clean up */
free(lambda);
free(W);
free(w2sum);
/* return the overall effective sample size */
return(((double)wlen)*calc_ess(w, wlen));
}
/*
* EachESS:
*
* calculate the effective sample size at each temperature
*/
void Temper::EachESS(double *w, double *itemp, unsigned int wlen, double *essd)
{
/* for each temperature */
for(unsigned int i=0; i<numit; i++) {
/* get the weights at the i-th temperature */
unsigned int len;
int *p = find(itemp, wlen, EQ, itemps[i], &len);
/* nothing to do if no samples were taken at this tempereature --
but this is bad! */
if(len == 0) {
essd[i] = essd[numit + i] = 0;
continue;
}
/* collect the weights at the i-th temperature */
double *wi = new_sub_vector(p, w, len);
/* calculate the ith ess */
double ei = calc_ess(wi, len);
/* save individual ess to the (double) output essd vector */
essd[i] = len;
essd[numit + i] = ei*len;
/* clean up */
free(wi);
free(p);
}
}
/*
* LambdaST:
*
* adjust the weight distribution w[n] to implement Simulated Tempering --
* that is, find the w corresponding to itemps == 1, and set the rest to
* zero, thus producing a lambda--adjusted weight distribution
*/
double Temper::LambdaST(double *w, double *itemp, unsigned int wlen, unsigned int verb)
{
/* ST not doable */
if(itemps[0] != 1.0) warning("itemps[0]=%d != 1.0", itemps[0]);
/* get the weights at the i-th temperature */
unsigned int len;
int *p = find(itemp, wlen, EQ, itemps[0], &len);
/* nothing to do if no samples were taken at this tempereature --
but this is bad! */
if(len == 0) {
zerov(w, wlen);
return 0.0;
}
/* collect the weights at the i-th temperature */
double *wi = new_sub_vector(p, w, len);
/* calculate Wi=sum(wi) */
double Wi = sumv(wi, len);
/* multiply by numerator of lambda-star */
scalev(wi, len, 1.0/Wi);
/* zero-out the weight vector */
zerov(w, wlen);
/* copy the mofified weights into the big weight vector */
copy_p_vector(w, p, wi, len);
/* print totals */
if(verb >= 1) myprintf(mystdout, "\nST sample size=%d\n", len);
/* return the overall effective sample size */
return((double) len);
}
/*
* LambdaNaive:
*
* adjust the weight distribution w[n] via Naive Importance Tempering;
* that is, disregard demperature, and just normalize the weight vector
*/
double Temper::LambdaNaive(double *w, unsigned int wlen, unsigned int verb)
{
/* calculate Wi=sum(wi) */
double W = sumv(w, wlen);
if(W == 0) return 0.0;
/* multiply by numerator of lambda-star */
scalev(w, wlen, 1.0/W);
/* calculate ESS */
double ess = ((double)wlen)*calc_ess(w, wlen);
/* print totals */
if(verb >= 1) myprintf(mystdout, "\nnaive IT ess=%g\n", ess);
/* return the overall effective sample size */
return(ess);
}
/*
* N:
*
* get number of temperatures n:
*/
unsigned int Temper::Numit(void)
{
return numit;
}
/*
* DoStochApprox:
*
* true if both c0 and n0 are non-zero, then we
* are doing StochApprox
*/
bool Temper::DoStochApprox(void)
{
if(c0 > 0 && n0 > 0 && numit > 1) return true;
else return false;
}
/*
* IS_ST_or_IS:
*
* return true importance tempering, simulated tempering,
* or importance sampling is supported by the current
* Tempering distribution
*/
bool Temper::IT_ST_or_IS(void)
{
if(numit > 1 || itemps[0] != 1.0) return true;
else return false;
}
/*
* IT_or_ST:
*
* return true importance tempering or simulated tempering,
* is supported by the current Tempering distribution
*/
bool Temper::IT_or_ST(void)
{
if(numit > 1) return true;
else return false;
}
/*
* IS:
*
* return true if importance sampling (only) is supported
* by the current Tempering distribution
*/
bool Temper::IS(void)
{
if(numit == 1 && itemps[0] != 1.0) return true;
else return false;
}
/*
* Itemps:
*
* return the temperature ladder
*/
double* Temper::Itemps(void)
{
return itemps;
}
/*
* C0:
*
* return the c0 (SA) paramete
*/
double Temper::C0(void)
{
return c0;
}
/*
* N0:
*
* return the n0 (SA) paramete
*/
double Temper::N0(void)
{
return n0;
}
/*
* ResetSA:
*
* reset the stochastic approximation by setting
* the counter to 1, and turn SA on
*/
void Temper::ResetSA(void)
{
doSA = true;
cnt = 1;
}
/*
* StopSA:
*
* turn off stochastic approximation
*/
void Temper::StopSA(void)
{
doSA = false;
}
/*
* ITLambda:
*
* choose a method for importance tempering based on the it_lambda
* variable, call that method, passing back the lambda-adjusted
* weights w, and returning a calculation of ESSw
*/
double Temper::LambdaIT(double *w, double *itemp, unsigned int R, double *essd,
unsigned int verb)
{
/* sanity check that it makes sense to adjust weights */
assert(IT_ST_or_IS());
double ess = 0;
switch(it_lambda) {
case OPT: ess = LambdaOpt(w, itemp, R, essd, verb); break;
case NAIVE: ess = LambdaNaive(w, R, verb); EachESS(w, itemp, R, essd); break;
case ST: ess = LambdaST(w, itemp, R, verb); EachESS(w, itemp, R, essd); break;
default: error("bad it_lambda\n");
}
return ess;
}
/*
* Print:
*
* write information about the IT configuration
* out to the supplied file
*/
void Temper::Print(FILE *outfile)
{
/* print the importance tempring information */
if(IS()) myprintf(outfile, "IS with inv-temp %g\n", itemps[0]);
else if(IT_or_ST()) {
switch(it_lambda) {
case OPT: myprintf(outfile, "IT: optimal"); break;
case NAIVE: myprintf(outfile, "IT: naive"); break;
case ST: myprintf(outfile, "IT: implementing ST"); break;
}
myprintf(outfile, " on %d-rung ladder\n", numit);
if(DoStochApprox()) myprintf(outfile, " with stoch approx\n");
else myprintf(outfile, "\n");
}
}
/*
* AppendLadder:
*
* append tprobs and tcounts to a file with the name
* provided
*/
void Temper::AppendLadder(const char* file_str)
{
FILE *LOUT = fopen(file_str, "a");
printVector(tprobs, numit, LOUT, MACHINE);
printUIVector(tcounts, numit, LOUT);
fclose(LOUT);
}
/*
* Normalize:
*
* normalize the pseudo-prior (tprobs) and
* check that all probs are positive
*/
void Temper::Normalize(void)
{
scalev(tprobs, numit, 1.0/sumv(tprobs, numit));
for(unsigned int i=0; i<numit; i++) assert(tprobs[i] > 0);
}
/*
* ess:
*
* effective sample size calculation for imporancnce
* sampling -- per unit sample. To get the full sample
* size, just multiply by n
*/
double calc_ess(double *w, unsigned int n)
{
if(n == 0) return 0;
else {
double cv2 = calc_cv2(w,n);
if(ISNAN(cv2) || !R_FINITE(cv2)) {
// warning("nan or inf found in cv2, probably due to zero weights");
return 0.0;
} else return(1.0/(1.0+cv2));
}
}
/*
* cv2:
*
* calculate the coefficient of variation, used here
* to find the variance of a sample of unnormalized
* importance sampling weights
*/
double calc_cv2(double *w, unsigned int n)
{
double mw;
wmean_of_rows(&mw, &w, 1, n, NULL);
double sum = 0;
if(n == 1) return 0.0;
for(unsigned int i=0; i<n; i++)
sum += sq(w[i] - mw);
return sum/((((double)n) - 1.0)*sq(mw));
}
| [
"liutianchi@yahoo.com"
] | liutianchi@yahoo.com |
e58bc7c45ef7ad0488f5d5a644e4d6710bfc9649 | fc7d9bbe049114ad5a94a6107321bdc09d3ccf53 | /.history/Maze_20210919224931.cpp | 573be8375c565b4a0b90910a5f0b7c42d540c2e3 | [] | no_license | xich4932/3010_maze | 2dbf7bb0f2be75d014a384cbefc4095779d525b5 | 72be8a7d9911efed5bc78be681486b2532c08ad8 | refs/heads/main | 2023-08-11T00:42:18.085853 | 2021-09-22T03:29:40 | 2021-09-22T03:29:40 | 408,272,071 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,434 | cpp | #include<iostream>
#include<vector>
#include<cstdlib>
#include<array>
#include"Maze.h"
#include<time.h>
//using namespace std;
//return true when the path is not in the vector
bool checkInPath(const int num, const std::vector<int> &vec){
for(int d =0; d < vec.size(); d++){
if(vec[d] == num) return true;
}
return false;
}
Board::Board(){
rows_ = 4;
cols_ = 4;
generate();
}
Board::Board(int r, int c){
rows_ = r;
cols_ = c;
generate();
}
void Board::displayUpdated(){
for(int i = 0; i < rows_; i++){
for(int d = 0; d < cols_; d++){
if(checkInPath(4*i +d, path)){
std::cout<< "*";
}else{
std::cout << "+" ;
}
}
std::cout << std::endl;
}
}
Maze::Maze(int r, int c){
//generate (board_);
Board *new_board = new Board(r, c);
}
std::vector<int> getDirection(int point, int r, int c, int max_r, int max_c){
//{col,row} up left down right
//int direction[4][2] ={{1,0},{0,1},{-1,0},{0,-1}};
std::vector< int > ret;
ret.push_back(point - max_r); //up
ret.push_back(point + 1); //right
ret.push_back(point + max_r); //down
ret.push_back(point - 1); //left
if(r == 0){
ret.erase(ret.begin()+3);
}else if(r == max_r - 1){
ret.erase(ret.begin()+1);
}
if(c == 0){
ret.erase(ret.begin());
}else if(c == max_c - 1){
ret.erase(ret.begin()+2);
}
return ret;
}
void printer(std::vector<int> pri){
for(int i =0 ; i< pri.size(); i++){
std::cout << pri[i] <<" ";
}
std::cout << std::endl;
}
void printer1(std::vector<std::array<int, 2>> pri){
for(int d =0; d < pri.size(); d++){
std::cout<<pri[d][0] <<" " << pri[d][1] <<std::endl;
}
}
bool Board::generate(){
int max_step = 1; //max step to reach exit is 8
int visited[cols_][rows_];
//vector<int> path;
path.push_back(0);
srand((unsigned ) time(NULL));
int max = rows_ * cols_;
visited[0][0] = 1;
int start_r = 0;
int start_c = 0;
int end_c = cols_ - 1;
int end_r = rows_ - 1;
while(start_r != end_r && start_c != end_c && path.size() < 13 && max_step < 16){
std::vector<int> direction = getDirection(path[path.size()-1], start_r, start_c, rows_, cols_);
//printer1(direction);
int curr = rand()%direction.size();
std::cout << curr << std::endl;
int temp_r = curr % rows_;
int temp_c = curr / rows_;
for(int t =0; t < cols_; t++){
for(int y =0; y < rows_; y++){
if(t == temp_c && y == temp_r){
std::cout << "2" << " ";
}else{
std::cout << visited[t][y] << " ";
}
}
std::cout << std::endl;
}
//std::cout << direction[curr][0] << " " << direction[curr][1] << std::endl;
if(visited[curr / rows_][ curr % cols_]) continue;
path.push_back(direction[curr]);
max_step ++;
//start_c += direction[curr][0];
//start_r += direction[curr][1];
visited[curr / rows_][curr % rows_] = 1;
max_step ++;
direction.clear();
displayUpdated();
}
printer(path);
if(start_r == end_r && start_c == end_c) return true;
return false;
}
| [
"xich4932@colorado.edu"
] | xich4932@colorado.edu |
7ee7312a0cdfcc6826d5a643418d9854eaed6c04 | 219bf71bde7b12219656ec333f2329109b3d0c73 | /Source/RHI/OpenRLRHI/RLVertexBufferLayout.cpp | d4e276fda4583b3ef9c6fcafc2b5cb32250fc16c | [] | no_license | blizmax/OpenRL_Baker | 958e96f88efe35e4c7c795f8a1706d1990b6c074 | 8ef3e2c60854088500aa00874447aff61650ee4b | refs/heads/master | 2022-01-13T02:05:14.378677 | 2019-03-11T08:28:24 | 2019-03-11T08:28:24 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 460 | cpp | #include "RLVertexBufferLayout.h"
namespace Core
{
RLVertexBufferLayout::RLVertexBufferLayout()
{
}
void RLVertexBufferLayout::SetSlotElement(uint32 index, int32 size, RLDataType dataType, Bool normalized, uint32 stride, uint32 offset) const
{
// rlGetAttribLocation(program, "positionAttribute")
rlVertexAttribBuffer(index, size, dataType, normalized, stride, offset);
rlCheckError();
}
RLVertexBufferLayout::~RLVertexBufferLayout()
{
}
} | [
"1989punk@gmail.com"
] | 1989punk@gmail.com |
bb06ab64b895169d467557df06c044aa519c0824 | fd8bb910d54c981157bfc2748ed5078760bd8be6 | /tensorflow_impl/applications/Garfield_legacy/native/so_threadpool/threadpool.cpp | e7a6c25049e594705e749d288b0b00ce38ee25dd | [
"MIT"
] | permissive | yanlili1995/Garfield | 7ac5941ebb78807e4ef53a24f0327f80599fb83c | f784cfd4cc2f34879abb287ef32c586243ee5b0c | refs/heads/master | 2023-08-05T18:20:04.547095 | 2021-09-24T08:27:55 | 2021-09-24T08:27:55 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,760 | cpp | /**
* @file threadpool.cpp
* @author Sébastien Rouault <sebastien.rouault@alumni.epfl.ch>
*
* @section LICENSE
*
* Copyright © 2018-2019 École Polytechnique Fédérale de Lausanne (EPFL).
* See LICENSE file.
*
* @section DESCRIPTION
*
* Another thread pool management class, with parallel for-loop helper.
**/
// Compiler version check
#if __cplusplus < 201103L
#error This translation unit requires at least a C++11 compiler
#endif
#ifndef __GNUC__
#error This translation unit requires a GNU C++ compiler
#endif
// External headers
#include <algorithm>
#include <condition_variable>
#include <cmath>
#include <cstddef>
#include <cstdio>
#include <future>
#include <iterator>
#include <limits>
#include <memory>
#include <mutex>
#include <queue>
#include <thread>
#include <tuple>
#include <type_traits>
#include <utility>
#include <vector>
extern "C" {
#include <unistd.h>
}
// Internal headers
#include <common.hpp>
#include <threadpool.hpp>
// -------------------------------------------------------------------------- //
/** Lock guard class.
**/
template<class Lock> using Guard = ::std::unique_lock<Lock>;
/** Lock "reverse" guard class.
**/
template<class Lock> class Forsake {
private:
Lock& lock; // Bound lock
public:
/** Deleted copy constructor/assignment.
**/
Forsake(Forsake const&) = delete;
Forsake& operator=(Forsake const&) = delete;
/** Lock release constructor.
* @param lock Lock to bind
**/
Forsake(Lock& lock): lock{lock} {
lock.unlock();
}
/** Lock acquire destructor.
**/
~Forsake() {
lock.lock();
}
};
/** Worker thread entry point.
* @param self Bound thread pool
**/
void ThreadPool::entry_point(ThreadPool& self) {
Guard<Mutex> guard{self.lock};
while (true) { // Main loop
if (self.status == Status::detached) // Must terminate
return;
if (!self.jobs.empty()) { // Pick and run job
auto& job = *self.jobs.front(); // Get job info
self.jobs.pop(); // Remove job
{ // Run job
Forsake<Mutex> forsake{self.lock};
job();
}
continue;
}
self.cv.wait(guard); // Wait for event
}
}
/** Get the default number of worker threads to use.
* @return Default number of worker threads
**/
size_t ThreadPool::get_default_nbworker() noexcept {
auto res = ::sysconf(_SC_NPROCESSORS_ONLN);
if (unlikely(res <= 0))
return 8; // Arbitrary default
return res;
}
// -------------------------------------------------------------------------- //
/** Thread pool begin constructor.
* @param nbworkers Number of worker threads to use (optional, 0 for auto)
**/
ThreadPool::ThreadPool(size_t nbworkers): size{nbworkers}, status{Status::running}, lock{}, cv{}, jobs{}, threads{} {
if (nbworkers == 0)
size = get_default_nbworker();
{ // Worker threads creation
threads.reserve(size);
for (decltype(size) i = 0; i < size; ++i)
threads.emplace_back(entry_point, ::std::ref(*this));
}
}
/** Notify then detach worker threads destructor.
**/
ThreadPool::~ThreadPool() {
{ // Mark ending
Guard<Mutex> guard{lock};
status = Status::detached;
}
cv.notify_all();
for (auto&& thread: threads) // Detach workers
thread.detach();
}
/** Submit a new job.
* @param job Job to submit
**/
void ThreadPool::submit(AbstractJob& job) {
{ // Submit one job
Guard<Mutex> guard{lock};
jobs.push(::std::addressof(job));
}
cv.notify_one(); // Notify one worker
}
// -------------------------------------------------------------------------- //
// Shared thread pool
ThreadPool pool;
| [
"sebastien.rouault@alumni.epfl.ch"
] | sebastien.rouault@alumni.epfl.ch |
5dcfc142474bcde5cf20a4cc9e99cdc523250bf3 | 6fbf5d53f59b8c9de18f91effb8d223eaf9dbc45 | /copy_elision/main.cpp | b2c03cb04462dcb6fbc91ad061179036566fe9db | [] | no_license | yajnas07/cppmunchies | 9f50da6ce751e32d43324e8de83eb4cbcd67478b | 6e2f532fc5f4fe6187c88320fa0ce823ae96b492 | refs/heads/master | 2021-12-23T21:09:51.146283 | 2021-08-05T19:31:36 | 2021-08-05T19:31:36 | 91,421,906 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 946 | cpp | #include<iostream>
using namespace std;
class copiable_class {
public:
copiable_class() {
cout << "Inside constructor" << endl;
}
copiable_class(const copiable_class & other){
cout << "Copying.." << endl;
}
};
//Invokes copy constructor, Named return value optimization
copiable_class creator_nrvo()
{
copiable_class instance;
return instance;
}
//Invokes copy constructor, return value optimization
copiable_class creator_rvo()
{
return copiable_class();
}
void pass_byvalue_func(copiable_class ob)
{
}
int main(int argc,char * argv[])
{
//Copying should have been printed two times
//But compiler optimizes out call to copy constructor for temporary objects
copiable_class instance1 = creator_rvo();
copiable_class instance2 = creator_nrvo();
cout << "Calling function" << endl;
pass_byvalue_func(copiable_class());
cout << "Returned from function" << endl;
}
| [
"email.yajnas@gmail.com"
] | email.yajnas@gmail.com |
3bfdde37d9a152ea31bcedb241d9976ee1b84030 | de70d532402c2c419a2057cd10df5405a81989d8 | /prac10/src/ofApp.cpp | cf9cca5ee7b481bd8757f8089e624fe0940f9a25 | [] | no_license | Lacty/of_practice | 083fdc0c6b5c776348e4b429f4fb69cb4584e122 | adcf0cbc89616e13eda7889c673318d155fbc2dd | refs/heads/master | 2021-01-12T16:16:14.045576 | 2016-11-19T10:09:41 | 2016-11-19T10:09:41 | 71,971,117 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,007 | cpp |
#include "ofApp.h"
//--------------------------------------------------------------
void ofApp::setup() {
ofSetCircleResolution(32);
}
//--------------------------------------------------------------
void ofApp::update() {
for (auto& part : particles) {
part.update(true, 0, 460, 0, 300);
}
}
//--------------------------------------------------------------
void ofApp::draw() {
for (auto& part : particles) {
part.draw();
}
}
//--------------------------------------------------------------
void ofApp::keyPressed(int key) {}
//--------------------------------------------------------------
void ofApp::keyReleased(int key) {}
//--------------------------------------------------------------
void ofApp::mouseMoved(int x, int y ) {}
//--------------------------------------------------------------
void ofApp::mouseDragged(int x, int y, int button) {
create(x, y);
}
//--------------------------------------------------------------
void ofApp::mousePressed(int x, int y, int button) {}
//--------------------------------------------------------------
void ofApp::mouseReleased(int x, int y, int button) {}
//--------------------------------------------------------------
void ofApp::mouseEntered(int x, int y) {}
//--------------------------------------------------------------
void ofApp::mouseExited(int x, int y) {}
//--------------------------------------------------------------
void ofApp::windowResized(int w, int h) {}
//--------------------------------------------------------------
void ofApp::gotMessage(ofMessage msg) {}
//--------------------------------------------------------------
void ofApp::dragEvent(ofDragInfo dragInfo) {}
void ofApp::create(int x, int y) {
Particle part;
part.setPosition(ofVec3f(x, y, 0))
->setSize(2 + ofRandom(5))
->setColor(ofColor(100 + ofRandom(155), 100 + ofRandom(155), 100 + ofRandom(155)))
->setGravity(true, 0.08f)
->setVelocity(ofVec3f(ofRandom(-5, 5), ofRandom(-5, 5), 0));
particles.push_back(part);
} | [
"akira206@gmail.com"
] | akira206@gmail.com |
5e345746d4d6bf90ea914d006cb8bb979c119a51 | e9d07cf8619f043ab051bd9a584f690fdb136b95 | /modules/fit_signal/fit_signal.h | 5234d2eb592741f7294745dadf8bc22b59f32464 | [] | no_license | slazav/pico_osc | 0465defae427c88bd33de2c659d60c8367aee08a | b98e13b8ea03d07b8d00d8836c74926c0b195593 | refs/heads/master | 2023-02-09T21:58:45.238122 | 2023-02-09T12:33:00 | 2023-02-09T12:33:00 | 29,144,427 | 1 | 1 | null | 2019-12-05T16:05:55 | 2015-01-12T16:22:45 | C++ | UTF-8 | C++ | false | false | 926 | h | #include <vector>
#include <stdint.h>
/*
Fit a signal by a model:
amp * exp(-t/tau) * sin(2*pi*fre*t + ph),
it also works for a non-decaying signals with 1/tau=0,
(TODO: fix boundary conditions!)
output: a vector with 4 double values:
fre, 1/tau, amp, ph
input:
buf -- signal data array
len -- array length
sc -- amplitude scale
dt -- time step
t0 -- time of the first point, returned amplitude and phase is converted to t=0
fmin, fmax -- where to look for a frequency
*/
std::vector<double> fit_signal(const int16_t *buf, int len, double sc, double dt, double t0=0,
double fmin=0, double fmax=+HUGE_VAL);
// fix problem with 'pure signals' where F = 1/tmax and only one fft component is
// large.
std::vector<double> fit_signal_fixfre(const int16_t *buf, int len, double sc, double dt, double t0=0,
double fmin=0, double fmax=+HUGE_VAL);
| [
"slazav@altlinux.org"
] | slazav@altlinux.org |
41cfc04ba182c6f4a1c9e2b53e274f234496422d | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /chrome/browser/ui/search/instant_theme_browsertest.cc | 9a6115bbe46b4d0a90a5e8fc84e48395d363689a | [
"BSD-3-Clause"
] | permissive | Samsung/Castanets | 240d9338e097b75b3f669604315b06f7cf129d64 | 4896f732fc747dfdcfcbac3d442f2d2d42df264a | refs/heads/castanets_76_dev | 2023-08-31T09:01:04.744346 | 2021-07-30T04:56:25 | 2021-08-11T05:45:21 | 125,484,161 | 58 | 49 | BSD-3-Clause | 2022-10-16T19:31:26 | 2018-03-16T08:07:37 | null | UTF-8 | C++ | false | false | 12,619 | cc | // Copyright 2017 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "base/macros.h"
#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/extensions/extension_browsertest.h"
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/search/instant_service.h"
#include "chrome/browser/search/instant_service_factory.h"
#include "chrome/browser/search/instant_service_observer.h"
#include "chrome/browser/themes/theme_service.h"
#include "chrome/browser/themes/theme_service_factory.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/search/instant_test_base.h"
#include "chrome/browser/ui/search/instant_test_utils.h"
#include "chrome/browser/ui/search/local_ntp_test_utils.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/webui/theme_source.h"
#include "chrome/common/search/instant_types.h"
#include "chrome/common/url_constants.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
#include "content/public/browser/url_data_source.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "net/test/embedded_test_server/embedded_test_server.h"
#include "testing/gtest/include/gtest/gtest.h"
class TestThemeInfoObserver : public InstantServiceObserver {
public:
explicit TestThemeInfoObserver(InstantService* service) : service_(service) {
service_->AddObserver(this);
}
~TestThemeInfoObserver() override { service_->RemoveObserver(this); }
void WaitForThemeApplied(bool theme_installed) {
DCHECK(!quit_closure_);
theme_installed_ = theme_installed;
if (!theme_info_.using_default_theme == theme_installed) {
return;
}
base::RunLoop run_loop;
quit_closure_ = run_loop.QuitClosure();
run_loop.Run();
}
bool IsUsingDefaultTheme() { return theme_info_.using_default_theme; }
private:
void ThemeInfoChanged(const ThemeBackgroundInfo& theme_info) override {
theme_info_ = theme_info;
if (quit_closure_ && !theme_info_.using_default_theme == theme_installed_) {
std::move(quit_closure_).Run();
quit_closure_.Reset();
}
}
void MostVisitedItemsChanged(const std::vector<InstantMostVisitedItem>&,
bool is_custom_links) override {}
InstantService* const service_;
ThemeBackgroundInfo theme_info_;
bool theme_installed_;
base::OnceClosure quit_closure_;
};
class InstantThemeTest : public extensions::ExtensionBrowserTest,
public InstantTestBase {
public:
InstantThemeTest() {}
protected:
void SetUpInProcessBrowserTestFixture() override {
ASSERT_TRUE(https_test_server().Start());
GURL base_url = https_test_server().GetURL("/instant_extended.html");
GURL ntp_url = https_test_server().GetURL("/instant_extended_ntp.html");
InstantTestBase::Init(base_url, ntp_url, false);
}
void SetUpOnMainThread() override {
extensions::ExtensionBrowserTest::SetUpOnMainThread();
content::URLDataSource::Add(profile(),
std::make_unique<ThemeSource>(profile()));
}
void InstallThemeAndVerify(const std::string& theme_dir,
const std::string& theme_name) {
bool had_previous_theme =
!!ThemeServiceFactory::GetThemeForProfile(profile());
const base::FilePath theme_path = test_data_dir_.AppendASCII(theme_dir);
// Themes install asynchronously so we must check the number of enabled
// extensions after theme install completes.
size_t num_before = extensions::ExtensionRegistry::Get(profile())
->enabled_extensions()
.size();
content::WindowedNotificationObserver theme_change_observer(
chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
content::Source<ThemeService>(
ThemeServiceFactory::GetForProfile(profile())));
ASSERT_TRUE(InstallExtensionWithUIAutoConfirm(
theme_path, 1, extensions::ExtensionBrowserTest::browser()));
theme_change_observer.Wait();
size_t num_after = extensions::ExtensionRegistry::Get(profile())
->enabled_extensions()
.size();
// If a theme was already installed, we're just swapping one for another, so
// no change in extension count.
int expected_change = had_previous_theme ? 0 : 1;
EXPECT_EQ(num_before + expected_change, num_after);
const extensions::Extension* new_theme =
ThemeServiceFactory::GetThemeForProfile(profile());
ASSERT_NE(nullptr, new_theme);
ASSERT_EQ(new_theme->name(), theme_name);
}
// Loads a named image from |image_url| in the given |tab|. |loaded|
// returns whether the image was able to load without error.
// The method returns true if the JavaScript executed cleanly.
bool LoadImage(content::WebContents* tab,
const GURL& image_url,
bool* loaded) {
std::string js_chrome =
"var img = document.createElement('img');"
"img.onerror = function() { domAutomationController.send(false); };"
"img.onload = function() { domAutomationController.send(true); };"
"img.src = '" +
image_url.spec() + "';";
return content::ExecuteScriptAndExtractBool(tab, js_chrome, loaded);
}
private:
DISALLOW_COPY_AND_ASSIGN(InstantThemeTest);
};
IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeBackgroundAccess) {
ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme"));
ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
ui_test_utils::NavigateToURLWithDisposition(
browser(), GURL(chrome::kChromeUINewTabURL),
WindowOpenDisposition::NEW_FOREGROUND_TAB,
ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB |
ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION);
// The "Instant" New Tab should have access to chrome-search: scheme but not
// chrome: scheme.
const GURL chrome_url("chrome://theme/IDR_THEME_NTP_BACKGROUND");
const GURL search_url("chrome-search://theme/IDR_THEME_NTP_BACKGROUND");
content::WebContents* tab =
browser()->tab_strip_model()->GetActiveWebContents();
bool loaded = false;
ASSERT_TRUE(LoadImage(tab, chrome_url, &loaded));
EXPECT_FALSE(loaded) << chrome_url;
ASSERT_TRUE(LoadImage(tab, search_url, &loaded));
EXPECT_TRUE(loaded) << search_url;
}
IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeAppliedToExistingTab) {
// On the existing tab.
ASSERT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
const std::string helper_js = "document.body.style.cssText";
TestThemeInfoObserver observer(
InstantServiceFactory::GetForProfile(browser()->profile()));
// Open new tab.
content::WebContents* active_tab =
local_ntp_test_utils::OpenNewTab(browser(), GURL("about:blank"));
local_ntp_test_utils::NavigateToNTPAndWaitUntilLoaded(browser());
ASSERT_EQ(2, browser()->tab_strip_model()->count());
ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
observer.WaitForThemeApplied(false);
// Get the default (no theme) css setting
std::string original_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&original_css_text));
// Open a new tab and install a theme on the new tab.
active_tab = local_ntp_test_utils::OpenNewTab(browser(), GURL("about:blank"));
local_ntp_test_utils::NavigateToNTPAndWaitUntilLoaded(browser());
ASSERT_EQ(3, browser()->tab_strip_model()->count());
ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme"));
observer.WaitForThemeApplied(true);
// Get the current tab's theme CSS setting.
std::string css_text = "";
EXPECT_TRUE(
instant_test_utils::GetStringFromJS(active_tab, helper_js, &css_text));
// Switch to the previous tab.
browser()->tab_strip_model()->ActivateTabAt(1);
ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
observer.WaitForThemeApplied(true);
// Get the previous tab's theme CSS setting.
std::string previous_tab_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&previous_tab_css_text));
// The previous tab should also apply the new theme.
EXPECT_NE(original_css_text, css_text);
EXPECT_EQ(previous_tab_css_text, css_text);
}
IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeAppliedToNewTab) {
// On the existing tab.
ASSERT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
const std::string helper_js = "document.body.style.cssText";
TestThemeInfoObserver observer(
InstantServiceFactory::GetForProfile(browser()->profile()));
// Open new tab.
content::WebContents* active_tab =
local_ntp_test_utils::OpenNewTab(browser(), GURL("about:blank"));
local_ntp_test_utils::NavigateToNTPAndWaitUntilLoaded(browser());
observer.WaitForThemeApplied(false);
ASSERT_EQ(2, browser()->tab_strip_model()->count());
ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
// Get the default (no theme) css setting
std::string original_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&original_css_text));
// Install a theme on this tab.
ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme"));
observer.WaitForThemeApplied(true);
// Get the current tab's theme CSS setting.
std::string css_text = "";
EXPECT_TRUE(
instant_test_utils::GetStringFromJS(active_tab, helper_js, &css_text));
// Open a new tab.
active_tab = local_ntp_test_utils::OpenNewTab(browser(), GURL("about:blank"));
local_ntp_test_utils::NavigateToNTPAndWaitUntilLoaded(browser());
observer.WaitForThemeApplied(true);
ASSERT_EQ(3, browser()->tab_strip_model()->count());
ASSERT_EQ(2, browser()->tab_strip_model()->active_index());
// Get the new tab's theme CSS setting.
std::string new_tab_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&new_tab_css_text));
// The new tab should change the original theme and also apply the new theme.
EXPECT_NE(original_css_text, new_tab_css_text);
EXPECT_EQ(css_text, new_tab_css_text);
}
IN_PROC_BROWSER_TEST_F(InstantThemeTest, ThemeChangedWhenApplyingNewTheme) {
// On the existing tab.
ASSERT_EQ(1, browser()->tab_strip_model()->count());
ASSERT_EQ(0, browser()->tab_strip_model()->active_index());
const std::string helper_js = "document.body.style.cssText";
TestThemeInfoObserver observer(
InstantServiceFactory::GetForProfile(browser()->profile()));
// Open new tab.
content::WebContents* active_tab =
local_ntp_test_utils::OpenNewTab(browser(), GURL("about:blank"));
local_ntp_test_utils::NavigateToNTPAndWaitUntilLoaded(browser());
observer.WaitForThemeApplied(false);
ASSERT_EQ(2, browser()->tab_strip_model()->count());
ASSERT_EQ(1, browser()->tab_strip_model()->active_index());
// Get the default (no theme) css setting
std::string original_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&original_css_text));
// install a theme on this tab.
ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme", "camo theme"));
observer.WaitForThemeApplied(true);
// Get the current tab's theme CSS setting.
std::string css_text = "";
EXPECT_TRUE(
instant_test_utils::GetStringFromJS(active_tab, helper_js, &css_text));
// Install a different theme.
ASSERT_NO_FATAL_FAILURE(InstallThemeAndVerify("theme2", "snowflake theme"));
observer.WaitForThemeApplied(true);
// Get the current tab's theme CSS setting.
std::string new_css_text = "";
EXPECT_TRUE(instant_test_utils::GetStringFromJS(active_tab, helper_js,
&new_css_text));
// Confirm that the theme will take effect on the current tab when installing
// a new theme.
EXPECT_NE(original_css_text, css_text);
EXPECT_NE(css_text, new_css_text);
EXPECT_NE(original_css_text, new_css_text);
}
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
4df8d2385ab5ea180d37426faed849bfea0bee9a | d8e7a11322f6d1b514c85b0c713bacca8f743ff5 | /7.6.00.32/V76_00_32/MaxDB_ORG/sys/src/SAPDB/SystemViews/SysView_OMSLocks.cpp | 817f46524a67b44085c06a57de6aad1db8889f95 | [] | no_license | zhaonaiy/MaxDB_GPL_Releases | a224f86c0edf76e935d8951d1dd32f5376c04153 | 15821507c20bd1cd251cf4e7c60610ac9cabc06d | refs/heads/master | 2022-11-08T21:14:22.774394 | 2020-07-07T00:52:44 | 2020-07-07T00:52:44 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,236 | cpp | /****************************************************************************/
/*!
@file SysView_OMSLocks.cpp
-------------------------------------------------------------------------
@author ElkeZ
@ingroup SystemViews
@brief This module implements the "OMSLocks" view class.
@see
*/
/*-------------------------------------------------------------------------
copyright: Copyright (c) 2002-2005 SAP AG
========== licence begin GPL
Copyright (c) 2002-2005 SAP AG
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
========== licence end
*****************************************************************************/
/*===========================================================================*
* INCLUDES *
*===========================================================================*/
#include "ggg00.h"
#include "gsp00.h"
#include "vak001.h"
#include "liveCache/LVC_LibOmsInterface.hpp"
#include "SystemViews/SysView_Defines.hpp"
#include "SystemViews/SysView_ITableObj.hpp"
#include "SystemViews/SysView_OMSLocks.hpp"
#include "SQLManager/SQLMan_Context.hpp"
/*===========================================================================*
* DEFINES *
*===========================================================================*/
/*===========================================================================*
* MACROS *
*===========================================================================*/
/*===========================================================================*
* LOCAL CLASSES, STRUCTURES, TYPES, UNIONS ... *
*===========================================================================*/
/*===========================================================================*
* STATIC/INLINE FUNCTIONS (PROTOTYPES) *
*===========================================================================*/
/*===========================================================================*
* METHODS *
*===========================================================================*/
void SysView_OMSLocks::Create()
{
m_Table->AppendCol (ITOCT_CHARBYTE, SV_ID, 8);
m_Table->AppendCol (ITOCT_FIXED, SV_TASKID, 10);
m_Table->AppendCol (ITOCT_FIXED, SV_LOCKREQUESTTIMEOUT, 10);
m_Table->AppendCol (ITOCT_CHAR, SV_LOCKMODE, 18);
m_Table->AppendCol (ITOCT_CHAR, SV_REQUESTMODE, 18);
}
/*---------------------------------------------------------------------------*/
SAPDB_Int SysView_OMSLocks::GetColCount()
{
return SV_CC_OMSLOCKS;
}
/*---------------------------------------------------------------------------*/
SAPDB_Int SysView_OMSLocks::EstimateRows()
{
return SV_ER_OMSLOCKS;
}
/*---------------------------------------------------------------------------*/
void SysView_OMSLocks::Execute()
{
//OMS_LibOmsInterface *pLibOmsInterface;
void *pHandle;
tgg01_OmsLockInfo LockInfo;
SAPDB_Bool bExit;
m_Table->GetCatalogTable();
if (m_Context.IsOk() && (m_Context.a_ex_kind != only_parsing))
{
pHandle = NULL;
bExit = false;
while ((!bExit) && (LVC_LibOmsInterface::Instance()->NextOmsLockObjInfo(&pHandle, LockInfo)))
{
m_Table->MoveToCol (ITOVT_CHARPTR, LockInfo.oli_handle.asCharp(), sizeof(LockInfo.oli_handle));
m_Table->MoveToCol (ITOVT_INT4, &LockInfo.oli_taskid, 0);
if (LockInfo.oli_timeout < 0)
{
m_Table->MoveToCol (ITOVT_NULL, NULL, 0);
}
else
{
m_Table->MoveToCol (ITOVT_INT4, &LockInfo.oli_timeout, 0);
}
m_Table->MoveToCol (ITOVT_CHARPTR, LockInfo.oli_lockmode.asCharp(), LockInfo.oli_lockmode.length());
m_Table->MoveToCol (ITOVT_CHARPTR, LockInfo.oli_requestmode.asCharp(), LockInfo.oli_requestmode.length());
if (!pHandle)
{
bExit = true;
}
}
}
}
/*===========================================================================*
* END OF CODE *
*===========================================================================*/
| [
"gunter.mueller@gmail.com"
] | gunter.mueller@gmail.com |
f1df8ce8fefa15ecf47a8c45b38a61bbf7c86415 | a0f8610bcb61463ef9982007dfb877408c3b1a78 | /Microwaving Lunch Boxes/Microwaving Lunch Boxes/main.cpp | 53c54e5610c068c9a3188ecfe75f13f32b1cac0b | [] | no_license | kiswiss777/Algorithm-SourceCode | 75669371f5e9a9a6895543c398bf4a9bfe76c99d | 08f01aa3bb1a524e687677a2c8723f1682516dd5 | refs/heads/master | 2020-04-30T20:50:29.569344 | 2019-06-14T07:11:15 | 2019-06-14T07:11:15 | 177,079,486 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 881 | cpp | #include<vector>
#include<iostream>
#include<algorithm>
#include<functional>
using namespace std;
const int MAX = 10000;
int boxNum;
vector<int> eat_t, micro_t;
int microwave(void)
{
vector<pair<int, int>> order;
for (int i = 0; i < boxNum; i++)
order.push_back(make_pair(-eat_t[i], i));
sort(order.begin(), order.end());
int answer = 0, start_e= 0;
for (int i = 0; i < boxNum; i++)
{
int box = order[i].second;
start_e += micro_t[box];
answer = max(answer, start_e + eat_t[box]);
}
return answer;
}
int main(void)
{
int test_case, input;
cin >> test_case;
while(test_case--)
{
cin >> boxNum;
for (int j = 0; j < boxNum; j++) {
cin >> input;
micro_t.push_back(input);
}
for (int j = 0; j < boxNum; j++) {
cin >> input;
eat_t.push_back(input);
}
cout << microwave() << endl;
micro_t.clear();
eat_t.clear();
}
return 0;
} | [
"kiswiss77477@naver.com"
] | kiswiss77477@naver.com |
de10269f4d283bacbeaf31487398b4504b54e0ae | f03cc2d3b830f6a616af40815815020ead38b992 | /FairyEngine/Source/F3DEngine/F3DTrack.h | 666fdc4efd8e605f073f7bf5e4a824cef51cedb3 | [] | no_license | yish0000/Fairy3D | 18d88d13e2a3a3e466d65db7aea06a8b111118ba | 6b84c6cb6c58a383e53a6a7f64676667c159c76b | refs/heads/master | 2021-07-01T16:37:14.887464 | 2020-11-08T14:52:01 | 2020-11-08T14:52:01 | 12,029,469 | 1 | 0 | null | null | null | null | GB18030 | C++ | false | false | 2,189 | h | /*
* ------------------------------------------------------------------------
* Name: F3DTrack.h
* Desc: 本文件定义了一个引擎所需的轨迹类。
* Author: Yish
* Date: 2010/11/12
* ----------------------------------------------------------------------
* CopyRight (C) YishSoft. 2010 All right Observed.
* ------------------------------------------------------------------------
*/
#ifndef __F3D_TRACK_H__
#define __F3D_TRACK_H__
//// HEADERS OF THIS FILE /////////////////////////////////////////////////
#include "F3DTypes.h"
///////////////////////////////////////////////////////////////////////////
enum EInterpolateType
{
ITT_LINEAR, // 线性插值(速度快)
ITT_SPLINE, // 曲线插值(速度慢,但会使方向的变化平滑)
};
/** 该类用来描述一个可移动物体的轨迹。
@remarks
@note
*/
class FAIRY_API F3DTrack : public FGeneralAlloc
{
protected:
std::vector<F3DVector3> m_Verts; // 关键顶点列表
float m_fWholeTime; // 轨迹所需的总时间
EInterpolateType m_InterType; // 插值类型
public:
F3DTrack();
F3DTrack( EInterpolateType type );
~F3DTrack();
// 加载/保存轨迹文件
bool LoadTrackFile( const char* filename );
void SaveTrackFile( const char* filename );
void AddVertex( const F3DVector3& vert );
void RemoveVertex( size_t nIndex );
void Clear(void);
size_t GetNumVerts(void) const { return m_Verts.size(); }
const F3DVector3& GetVertex( size_t nIndex ) const;
// 后去一个指定时间点的位置
F3DVector3 GetCurPos( float fTime );
// 设置轨迹所需的总时间
void SetWholeTime( float fWholeTime ) { m_fWholeTime = fWholeTime; }
float GetWholeTime(void) const { return m_fWholeTime; }
// 设置轨迹的插值类型
EInterpolateType GetInterpolateType(void) const { return m_InterType; }
void SetInterpolateType( EInterpolateType type ) { m_InterType = type; }
};
///////////////////////////////////////////////////////////////////////////
#endif //#ifndef __F3D_TRACK_H__ | [
"yish0000@foxmail.com"
] | yish0000@foxmail.com |
13528504887bf30d111bff07b3a9061c3f63bafc | 21b7f040298ba542d9cb8df906444120f27b3e84 | /PoissonSolver.h | 4165156c999c4aa9f5cccfc6b99aff0c87bf09d1 | [] | no_license | JoWayne94/High-Performance-Computing-Portfolio | 7606cc18862b59e101844b86069583b56ac6e076 | b977c55ec2adcc1f3d332f27518392112d24a082 | refs/heads/master | 2023-04-12T18:29:09.952656 | 2021-05-03T18:12:51 | 2021-05-03T18:12:51 | 295,102,156 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,116 | h | /**
* @file PoissonSolver.h
*
* High-performance Computing
*
* Header file for PoissonSolver.cpp
*
* Defines the Poisson solver object
*/
#ifndef POISSONSOLVER_H
#define POISSONSOLVER_H
#pragma once
#include <string>
using namespace std;
/* For the 2D solver, we assume a problem of [A]{x} = {b}. Since the boundary conditions
* are known, we reduce this to solving for the interior points only.
* A second order central difference scheme is used for the spatial derivatives.
* The reduced problem becomes [AInt]{xInt} = {bInt}, applying known boundary conditions on {bInt}
*/
class PoissonSolver {
public:
PoissonSolver();
~PoissonSolver();
void GenerateScaLaPackAIntMatrix();
void GenerateLaPackAIntMatrix();
double* GetScaLaPackAIntMatrix();
int GetScaLaPackAIntMatrixNx();
int GetScaLaPackAIntMatrixNy();
void SetScaLaPackAIntMatrix(double* aint, int aintnx, int aintny);
void SetVariables(int nx, int ny, double diagVar, double firstdiagVar, double seconddiagVar);
void SetVectors(double* xint, double* bVec);
void Updatex(double* xVec);
// Pre-factor and solve functions
void InitialiseScaLaPack(int px, int py);
void PrefactorAIntMatrixParallel();
void SolveParallel();
void PrefactorAIntMatrixSerial();
void SolveSerial();
private:
// [A]{x} = {b} matrices and vectors
double* AInt = nullptr;
double* xInt = nullptr;
double* bInt = nullptr;
// Main and super diagonals of A
double diag;
double firstdiag;
double seconddiag;
int Nx;
int Ny;
int bIntNx;
int bIntNy;
int AIntNx;
int AIntNy;
// MPI variables
int rank;
int nprocs;
int Px;
int Py;
int mype;
int npe;
int ctx;
int nrow;
int ncol;
int myrow;
int mycol;
int m;
int n;
int nb;
int bwl;
int bwu;
int ja;
int desca[7];
int lda;
double* prefactoredAInt = nullptr;
int* ipiv = nullptr;
double* af = nullptr;
int laf;
};
#endif
| [
"noreply@github.com"
] | JoWayne94.noreply@github.com |
66159bc3e47a4ff4502f507ed98fe086fb59c68f | ca978c8ad2a77677635df5042aa9139a727172dc | /src/backend/src/generated/follow_me/follow_me.pb.h | f7641d02ea4dfbf7381a190baf59b6514bc2443a | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | hrnbot/MAVSDK | e5541d60be3b32bf12bf0ea5afefc91a27b810a9 | 68ab0c5d50bb2e7e8f1e7ce565603f9e3f2c772f | refs/heads/master | 2023-01-05T17:58:22.994430 | 2020-10-12T10:59:14 | 2020-10-12T10:59:14 | 287,504,011 | 0 | 0 | BSD-3-Clause | 2020-10-07T10:06:05 | 2020-08-14T10:11:29 | C++ | UTF-8 | C++ | false | true | 131,215 | h | // Generated by the protocol buffer compiler. DO NOT EDIT!
// source: follow_me/follow_me.proto
#ifndef GOOGLE_PROTOBUF_INCLUDED_follow_5fme_2ffollow_5fme_2eproto
#define GOOGLE_PROTOBUF_INCLUDED_follow_5fme_2ffollow_5fme_2eproto
#include <limits>
#include <string>
#include <google/protobuf/port_def.inc>
#if PROTOBUF_VERSION < 3011000
#error This file was generated by a newer version of protoc which is
#error incompatible with your Protocol Buffer headers. Please update
#error your headers.
#endif
#if 3011002 < PROTOBUF_MIN_PROTOC_VERSION
#error This file was generated by an older version of protoc which is
#error incompatible with your Protocol Buffer headers. Please
#error regenerate this file with a newer version of protoc.
#endif
#include <google/protobuf/port_undef.inc>
#include <google/protobuf/io/coded_stream.h>
#include <google/protobuf/arena.h>
#include <google/protobuf/arenastring.h>
#include <google/protobuf/generated_message_table_driven.h>
#include <google/protobuf/generated_message_util.h>
#include <google/protobuf/inlined_string_field.h>
#include <google/protobuf/metadata.h>
#include <google/protobuf/generated_message_reflection.h>
#include <google/protobuf/message.h>
#include <google/protobuf/repeated_field.h> // IWYU pragma: export
#include <google/protobuf/extension_set.h> // IWYU pragma: export
#include <google/protobuf/generated_enum_reflection.h>
#include <google/protobuf/unknown_field_set.h>
#include "mavsdk_options.pb.h"
// @@protoc_insertion_point(includes)
#include <google/protobuf/port_def.inc>
#define PROTOBUF_INTERNAL_EXPORT_follow_5fme_2ffollow_5fme_2eproto
PROTOBUF_NAMESPACE_OPEN
namespace internal {
class AnyMetadata;
} // namespace internal
PROTOBUF_NAMESPACE_CLOSE
// Internal implementation detail -- do not use these members.
struct TableStruct_follow_5fme_2ffollow_5fme_2eproto {
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTableField entries[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::AuxillaryParseTableField aux[]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::ParseTable schema[17]
PROTOBUF_SECTION_VARIABLE(protodesc_cold);
static const ::PROTOBUF_NAMESPACE_ID::internal::FieldMetadata field_metadata[];
static const ::PROTOBUF_NAMESPACE_ID::internal::SerializationTable serialization_table[];
static const ::PROTOBUF_NAMESPACE_ID::uint32 offsets[];
};
extern const ::PROTOBUF_NAMESPACE_ID::internal::DescriptorTable descriptor_table_follow_5fme_2ffollow_5fme_2eproto;
namespace mavsdk {
namespace rpc {
namespace follow_me {
class Config;
class ConfigDefaultTypeInternal;
extern ConfigDefaultTypeInternal _Config_default_instance_;
class FollowMeResult;
class FollowMeResultDefaultTypeInternal;
extern FollowMeResultDefaultTypeInternal _FollowMeResult_default_instance_;
class GetConfigRequest;
class GetConfigRequestDefaultTypeInternal;
extern GetConfigRequestDefaultTypeInternal _GetConfigRequest_default_instance_;
class GetConfigResponse;
class GetConfigResponseDefaultTypeInternal;
extern GetConfigResponseDefaultTypeInternal _GetConfigResponse_default_instance_;
class GetLastLocationRequest;
class GetLastLocationRequestDefaultTypeInternal;
extern GetLastLocationRequestDefaultTypeInternal _GetLastLocationRequest_default_instance_;
class GetLastLocationResponse;
class GetLastLocationResponseDefaultTypeInternal;
extern GetLastLocationResponseDefaultTypeInternal _GetLastLocationResponse_default_instance_;
class IsActiveRequest;
class IsActiveRequestDefaultTypeInternal;
extern IsActiveRequestDefaultTypeInternal _IsActiveRequest_default_instance_;
class IsActiveResponse;
class IsActiveResponseDefaultTypeInternal;
extern IsActiveResponseDefaultTypeInternal _IsActiveResponse_default_instance_;
class SetConfigRequest;
class SetConfigRequestDefaultTypeInternal;
extern SetConfigRequestDefaultTypeInternal _SetConfigRequest_default_instance_;
class SetConfigResponse;
class SetConfigResponseDefaultTypeInternal;
extern SetConfigResponseDefaultTypeInternal _SetConfigResponse_default_instance_;
class SetTargetLocationRequest;
class SetTargetLocationRequestDefaultTypeInternal;
extern SetTargetLocationRequestDefaultTypeInternal _SetTargetLocationRequest_default_instance_;
class SetTargetLocationResponse;
class SetTargetLocationResponseDefaultTypeInternal;
extern SetTargetLocationResponseDefaultTypeInternal _SetTargetLocationResponse_default_instance_;
class StartRequest;
class StartRequestDefaultTypeInternal;
extern StartRequestDefaultTypeInternal _StartRequest_default_instance_;
class StartResponse;
class StartResponseDefaultTypeInternal;
extern StartResponseDefaultTypeInternal _StartResponse_default_instance_;
class StopRequest;
class StopRequestDefaultTypeInternal;
extern StopRequestDefaultTypeInternal _StopRequest_default_instance_;
class StopResponse;
class StopResponseDefaultTypeInternal;
extern StopResponseDefaultTypeInternal _StopResponse_default_instance_;
class TargetLocation;
class TargetLocationDefaultTypeInternal;
extern TargetLocationDefaultTypeInternal _TargetLocation_default_instance_;
} // namespace follow_me
} // namespace rpc
} // namespace mavsdk
PROTOBUF_NAMESPACE_OPEN
template<> ::mavsdk::rpc::follow_me::Config* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::Config>(Arena*);
template<> ::mavsdk::rpc::follow_me::FollowMeResult* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::FollowMeResult>(Arena*);
template<> ::mavsdk::rpc::follow_me::GetConfigRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::GetConfigRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::GetConfigResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::GetConfigResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::GetLastLocationRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::GetLastLocationRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::GetLastLocationResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::GetLastLocationResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::IsActiveRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::IsActiveRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::IsActiveResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::IsActiveResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::SetConfigRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::SetConfigRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::SetConfigResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::SetConfigResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::SetTargetLocationRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::SetTargetLocationRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::SetTargetLocationResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::SetTargetLocationResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::StartRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::StartRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::StartResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::StartResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::StopRequest* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::StopRequest>(Arena*);
template<> ::mavsdk::rpc::follow_me::StopResponse* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::StopResponse>(Arena*);
template<> ::mavsdk::rpc::follow_me::TargetLocation* Arena::CreateMaybeMessage<::mavsdk::rpc::follow_me::TargetLocation>(Arena*);
PROTOBUF_NAMESPACE_CLOSE
namespace mavsdk {
namespace rpc {
namespace follow_me {
enum Config_FollowDirection : int {
Config_FollowDirection_FOLLOW_DIRECTION_NONE = 0,
Config_FollowDirection_FOLLOW_DIRECTION_BEHIND = 1,
Config_FollowDirection_FOLLOW_DIRECTION_FRONT = 2,
Config_FollowDirection_FOLLOW_DIRECTION_FRONT_RIGHT = 3,
Config_FollowDirection_FOLLOW_DIRECTION_FRONT_LEFT = 4,
Config_FollowDirection_Config_FollowDirection_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
Config_FollowDirection_Config_FollowDirection_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
};
bool Config_FollowDirection_IsValid(int value);
constexpr Config_FollowDirection Config_FollowDirection_FollowDirection_MIN = Config_FollowDirection_FOLLOW_DIRECTION_NONE;
constexpr Config_FollowDirection Config_FollowDirection_FollowDirection_MAX = Config_FollowDirection_FOLLOW_DIRECTION_FRONT_LEFT;
constexpr int Config_FollowDirection_FollowDirection_ARRAYSIZE = Config_FollowDirection_FollowDirection_MAX + 1;
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* Config_FollowDirection_descriptor();
template<typename T>
inline const std::string& Config_FollowDirection_Name(T enum_t_value) {
static_assert(::std::is_same<T, Config_FollowDirection>::value ||
::std::is_integral<T>::value,
"Incorrect type passed to function Config_FollowDirection_Name.");
return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum(
Config_FollowDirection_descriptor(), enum_t_value);
}
inline bool Config_FollowDirection_Parse(
const std::string& name, Config_FollowDirection* value) {
return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum<Config_FollowDirection>(
Config_FollowDirection_descriptor(), name, value);
}
enum FollowMeResult_Result : int {
FollowMeResult_Result_RESULT_UNKNOWN = 0,
FollowMeResult_Result_RESULT_SUCCESS = 1,
FollowMeResult_Result_RESULT_NO_SYSTEM = 2,
FollowMeResult_Result_RESULT_CONNECTION_ERROR = 3,
FollowMeResult_Result_RESULT_BUSY = 4,
FollowMeResult_Result_RESULT_COMMAND_DENIED = 5,
FollowMeResult_Result_RESULT_TIMEOUT = 6,
FollowMeResult_Result_RESULT_NOT_ACTIVE = 7,
FollowMeResult_Result_RESULT_SET_CONFIG_FAILED = 8,
FollowMeResult_Result_FollowMeResult_Result_INT_MIN_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::min(),
FollowMeResult_Result_FollowMeResult_Result_INT_MAX_SENTINEL_DO_NOT_USE_ = std::numeric_limits<::PROTOBUF_NAMESPACE_ID::int32>::max()
};
bool FollowMeResult_Result_IsValid(int value);
constexpr FollowMeResult_Result FollowMeResult_Result_Result_MIN = FollowMeResult_Result_RESULT_UNKNOWN;
constexpr FollowMeResult_Result FollowMeResult_Result_Result_MAX = FollowMeResult_Result_RESULT_SET_CONFIG_FAILED;
constexpr int FollowMeResult_Result_Result_ARRAYSIZE = FollowMeResult_Result_Result_MAX + 1;
const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor* FollowMeResult_Result_descriptor();
template<typename T>
inline const std::string& FollowMeResult_Result_Name(T enum_t_value) {
static_assert(::std::is_same<T, FollowMeResult_Result>::value ||
::std::is_integral<T>::value,
"Incorrect type passed to function FollowMeResult_Result_Name.");
return ::PROTOBUF_NAMESPACE_ID::internal::NameOfEnum(
FollowMeResult_Result_descriptor(), enum_t_value);
}
inline bool FollowMeResult_Result_Parse(
const std::string& name, FollowMeResult_Result* value) {
return ::PROTOBUF_NAMESPACE_ID::internal::ParseNamedEnum<FollowMeResult_Result>(
FollowMeResult_Result_descriptor(), name, value);
}
// ===================================================================
class Config :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.Config) */ {
public:
Config();
virtual ~Config();
Config(const Config& from);
Config(Config&& from) noexcept
: Config() {
*this = ::std::move(from);
}
inline Config& operator=(const Config& from) {
CopyFrom(from);
return *this;
}
inline Config& operator=(Config&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const Config& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const Config* internal_default_instance() {
return reinterpret_cast<const Config*>(
&_Config_default_instance_);
}
static constexpr int kIndexInFileMessages =
0;
friend void swap(Config& a, Config& b) {
a.Swap(&b);
}
inline void Swap(Config* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline Config* New() const final {
return CreateMaybeMessage<Config>(nullptr);
}
Config* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<Config>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const Config& from);
void MergeFrom(const Config& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(Config* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.Config";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
typedef Config_FollowDirection FollowDirection;
static constexpr FollowDirection FOLLOW_DIRECTION_NONE =
Config_FollowDirection_FOLLOW_DIRECTION_NONE;
static constexpr FollowDirection FOLLOW_DIRECTION_BEHIND =
Config_FollowDirection_FOLLOW_DIRECTION_BEHIND;
static constexpr FollowDirection FOLLOW_DIRECTION_FRONT =
Config_FollowDirection_FOLLOW_DIRECTION_FRONT;
static constexpr FollowDirection FOLLOW_DIRECTION_FRONT_RIGHT =
Config_FollowDirection_FOLLOW_DIRECTION_FRONT_RIGHT;
static constexpr FollowDirection FOLLOW_DIRECTION_FRONT_LEFT =
Config_FollowDirection_FOLLOW_DIRECTION_FRONT_LEFT;
static inline bool FollowDirection_IsValid(int value) {
return Config_FollowDirection_IsValid(value);
}
static constexpr FollowDirection FollowDirection_MIN =
Config_FollowDirection_FollowDirection_MIN;
static constexpr FollowDirection FollowDirection_MAX =
Config_FollowDirection_FollowDirection_MAX;
static constexpr int FollowDirection_ARRAYSIZE =
Config_FollowDirection_FollowDirection_ARRAYSIZE;
static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor*
FollowDirection_descriptor() {
return Config_FollowDirection_descriptor();
}
template<typename T>
static inline const std::string& FollowDirection_Name(T enum_t_value) {
static_assert(::std::is_same<T, FollowDirection>::value ||
::std::is_integral<T>::value,
"Incorrect type passed to function FollowDirection_Name.");
return Config_FollowDirection_Name(enum_t_value);
}
static inline bool FollowDirection_Parse(const std::string& name,
FollowDirection* value) {
return Config_FollowDirection_Parse(name, value);
}
// accessors -------------------------------------------------------
enum : int {
kMinHeightMFieldNumber = 1,
kFollowDistanceMFieldNumber = 2,
kFollowDirectionFieldNumber = 3,
kResponsivenessFieldNumber = 4,
};
// float min_height_m = 1 [(.mavsdk.options.default_value) = "8.0"];
void clear_min_height_m();
float min_height_m() const;
void set_min_height_m(float value);
private:
float _internal_min_height_m() const;
void _internal_set_min_height_m(float value);
public:
// float follow_distance_m = 2 [(.mavsdk.options.default_value) = "8.0"];
void clear_follow_distance_m();
float follow_distance_m() const;
void set_follow_distance_m(float value);
private:
float _internal_follow_distance_m() const;
void _internal_set_follow_distance_m(float value);
public:
// .mavsdk.rpc.follow_me.Config.FollowDirection follow_direction = 3;
void clear_follow_direction();
::mavsdk::rpc::follow_me::Config_FollowDirection follow_direction() const;
void set_follow_direction(::mavsdk::rpc::follow_me::Config_FollowDirection value);
private:
::mavsdk::rpc::follow_me::Config_FollowDirection _internal_follow_direction() const;
void _internal_set_follow_direction(::mavsdk::rpc::follow_me::Config_FollowDirection value);
public:
// float responsiveness = 4 [(.mavsdk.options.default_value) = "0.5"];
void clear_responsiveness();
float responsiveness() const;
void set_responsiveness(float value);
private:
float _internal_responsiveness() const;
void _internal_set_responsiveness(float value);
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.Config)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
float min_height_m_;
float follow_distance_m_;
int follow_direction_;
float responsiveness_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class TargetLocation :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.TargetLocation) */ {
public:
TargetLocation();
virtual ~TargetLocation();
TargetLocation(const TargetLocation& from);
TargetLocation(TargetLocation&& from) noexcept
: TargetLocation() {
*this = ::std::move(from);
}
inline TargetLocation& operator=(const TargetLocation& from) {
CopyFrom(from);
return *this;
}
inline TargetLocation& operator=(TargetLocation&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const TargetLocation& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const TargetLocation* internal_default_instance() {
return reinterpret_cast<const TargetLocation*>(
&_TargetLocation_default_instance_);
}
static constexpr int kIndexInFileMessages =
1;
friend void swap(TargetLocation& a, TargetLocation& b) {
a.Swap(&b);
}
inline void Swap(TargetLocation* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline TargetLocation* New() const final {
return CreateMaybeMessage<TargetLocation>(nullptr);
}
TargetLocation* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<TargetLocation>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const TargetLocation& from);
void MergeFrom(const TargetLocation& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(TargetLocation* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.TargetLocation";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kLatitudeDegFieldNumber = 1,
kLongitudeDegFieldNumber = 2,
kAbsoluteAltitudeMFieldNumber = 3,
kVelocityXMSFieldNumber = 4,
kVelocityYMSFieldNumber = 5,
kVelocityZMSFieldNumber = 6,
};
// double latitude_deg = 1 [(.mavsdk.options.default_value) = "NaN"];
void clear_latitude_deg();
double latitude_deg() const;
void set_latitude_deg(double value);
private:
double _internal_latitude_deg() const;
void _internal_set_latitude_deg(double value);
public:
// double longitude_deg = 2 [(.mavsdk.options.default_value) = "NaN"];
void clear_longitude_deg();
double longitude_deg() const;
void set_longitude_deg(double value);
private:
double _internal_longitude_deg() const;
void _internal_set_longitude_deg(double value);
public:
// float absolute_altitude_m = 3 [(.mavsdk.options.default_value) = "NaN"];
void clear_absolute_altitude_m();
float absolute_altitude_m() const;
void set_absolute_altitude_m(float value);
private:
float _internal_absolute_altitude_m() const;
void _internal_set_absolute_altitude_m(float value);
public:
// float velocity_x_m_s = 4 [(.mavsdk.options.default_value) = "NaN"];
void clear_velocity_x_m_s();
float velocity_x_m_s() const;
void set_velocity_x_m_s(float value);
private:
float _internal_velocity_x_m_s() const;
void _internal_set_velocity_x_m_s(float value);
public:
// float velocity_y_m_s = 5 [(.mavsdk.options.default_value) = "NaN"];
void clear_velocity_y_m_s();
float velocity_y_m_s() const;
void set_velocity_y_m_s(float value);
private:
float _internal_velocity_y_m_s() const;
void _internal_set_velocity_y_m_s(float value);
public:
// float velocity_z_m_s = 6 [(.mavsdk.options.default_value) = "NaN"];
void clear_velocity_z_m_s();
float velocity_z_m_s() const;
void set_velocity_z_m_s(float value);
private:
float _internal_velocity_z_m_s() const;
void _internal_set_velocity_z_m_s(float value);
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.TargetLocation)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
double latitude_deg_;
double longitude_deg_;
float absolute_altitude_m_;
float velocity_x_m_s_;
float velocity_y_m_s_;
float velocity_z_m_s_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class GetConfigRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.GetConfigRequest) */ {
public:
GetConfigRequest();
virtual ~GetConfigRequest();
GetConfigRequest(const GetConfigRequest& from);
GetConfigRequest(GetConfigRequest&& from) noexcept
: GetConfigRequest() {
*this = ::std::move(from);
}
inline GetConfigRequest& operator=(const GetConfigRequest& from) {
CopyFrom(from);
return *this;
}
inline GetConfigRequest& operator=(GetConfigRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const GetConfigRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GetConfigRequest* internal_default_instance() {
return reinterpret_cast<const GetConfigRequest*>(
&_GetConfigRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
2;
friend void swap(GetConfigRequest& a, GetConfigRequest& b) {
a.Swap(&b);
}
inline void Swap(GetConfigRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GetConfigRequest* New() const final {
return CreateMaybeMessage<GetConfigRequest>(nullptr);
}
GetConfigRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<GetConfigRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const GetConfigRequest& from);
void MergeFrom(const GetConfigRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GetConfigRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.GetConfigRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.GetConfigRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class GetConfigResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.GetConfigResponse) */ {
public:
GetConfigResponse();
virtual ~GetConfigResponse();
GetConfigResponse(const GetConfigResponse& from);
GetConfigResponse(GetConfigResponse&& from) noexcept
: GetConfigResponse() {
*this = ::std::move(from);
}
inline GetConfigResponse& operator=(const GetConfigResponse& from) {
CopyFrom(from);
return *this;
}
inline GetConfigResponse& operator=(GetConfigResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const GetConfigResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GetConfigResponse* internal_default_instance() {
return reinterpret_cast<const GetConfigResponse*>(
&_GetConfigResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
3;
friend void swap(GetConfigResponse& a, GetConfigResponse& b) {
a.Swap(&b);
}
inline void Swap(GetConfigResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GetConfigResponse* New() const final {
return CreateMaybeMessage<GetConfigResponse>(nullptr);
}
GetConfigResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<GetConfigResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const GetConfigResponse& from);
void MergeFrom(const GetConfigResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GetConfigResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.GetConfigResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kConfigFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.Config config = 1;
bool has_config() const;
private:
bool _internal_has_config() const;
public:
void clear_config();
const ::mavsdk::rpc::follow_me::Config& config() const;
::mavsdk::rpc::follow_me::Config* release_config();
::mavsdk::rpc::follow_me::Config* mutable_config();
void set_allocated_config(::mavsdk::rpc::follow_me::Config* config);
private:
const ::mavsdk::rpc::follow_me::Config& _internal_config() const;
::mavsdk::rpc::follow_me::Config* _internal_mutable_config();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.GetConfigResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::Config* config_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class SetConfigRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.SetConfigRequest) */ {
public:
SetConfigRequest();
virtual ~SetConfigRequest();
SetConfigRequest(const SetConfigRequest& from);
SetConfigRequest(SetConfigRequest&& from) noexcept
: SetConfigRequest() {
*this = ::std::move(from);
}
inline SetConfigRequest& operator=(const SetConfigRequest& from) {
CopyFrom(from);
return *this;
}
inline SetConfigRequest& operator=(SetConfigRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const SetConfigRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SetConfigRequest* internal_default_instance() {
return reinterpret_cast<const SetConfigRequest*>(
&_SetConfigRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
4;
friend void swap(SetConfigRequest& a, SetConfigRequest& b) {
a.Swap(&b);
}
inline void Swap(SetConfigRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SetConfigRequest* New() const final {
return CreateMaybeMessage<SetConfigRequest>(nullptr);
}
SetConfigRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<SetConfigRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const SetConfigRequest& from);
void MergeFrom(const SetConfigRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SetConfigRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.SetConfigRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kConfigFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.Config config = 1;
bool has_config() const;
private:
bool _internal_has_config() const;
public:
void clear_config();
const ::mavsdk::rpc::follow_me::Config& config() const;
::mavsdk::rpc::follow_me::Config* release_config();
::mavsdk::rpc::follow_me::Config* mutable_config();
void set_allocated_config(::mavsdk::rpc::follow_me::Config* config);
private:
const ::mavsdk::rpc::follow_me::Config& _internal_config() const;
::mavsdk::rpc::follow_me::Config* _internal_mutable_config();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.SetConfigRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::Config* config_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class SetConfigResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.SetConfigResponse) */ {
public:
SetConfigResponse();
virtual ~SetConfigResponse();
SetConfigResponse(const SetConfigResponse& from);
SetConfigResponse(SetConfigResponse&& from) noexcept
: SetConfigResponse() {
*this = ::std::move(from);
}
inline SetConfigResponse& operator=(const SetConfigResponse& from) {
CopyFrom(from);
return *this;
}
inline SetConfigResponse& operator=(SetConfigResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const SetConfigResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SetConfigResponse* internal_default_instance() {
return reinterpret_cast<const SetConfigResponse*>(
&_SetConfigResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
5;
friend void swap(SetConfigResponse& a, SetConfigResponse& b) {
a.Swap(&b);
}
inline void Swap(SetConfigResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SetConfigResponse* New() const final {
return CreateMaybeMessage<SetConfigResponse>(nullptr);
}
SetConfigResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<SetConfigResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const SetConfigResponse& from);
void MergeFrom(const SetConfigResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SetConfigResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.SetConfigResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kFollowMeResultFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
bool has_follow_me_result() const;
private:
bool _internal_has_follow_me_result() const;
public:
void clear_follow_me_result();
const ::mavsdk::rpc::follow_me::FollowMeResult& follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* release_follow_me_result();
::mavsdk::rpc::follow_me::FollowMeResult* mutable_follow_me_result();
void set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result);
private:
const ::mavsdk::rpc::follow_me::FollowMeResult& _internal_follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* _internal_mutable_follow_me_result();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.SetConfigResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class IsActiveRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.IsActiveRequest) */ {
public:
IsActiveRequest();
virtual ~IsActiveRequest();
IsActiveRequest(const IsActiveRequest& from);
IsActiveRequest(IsActiveRequest&& from) noexcept
: IsActiveRequest() {
*this = ::std::move(from);
}
inline IsActiveRequest& operator=(const IsActiveRequest& from) {
CopyFrom(from);
return *this;
}
inline IsActiveRequest& operator=(IsActiveRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const IsActiveRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const IsActiveRequest* internal_default_instance() {
return reinterpret_cast<const IsActiveRequest*>(
&_IsActiveRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
6;
friend void swap(IsActiveRequest& a, IsActiveRequest& b) {
a.Swap(&b);
}
inline void Swap(IsActiveRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline IsActiveRequest* New() const final {
return CreateMaybeMessage<IsActiveRequest>(nullptr);
}
IsActiveRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<IsActiveRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const IsActiveRequest& from);
void MergeFrom(const IsActiveRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(IsActiveRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.IsActiveRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.IsActiveRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class IsActiveResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.IsActiveResponse) */ {
public:
IsActiveResponse();
virtual ~IsActiveResponse();
IsActiveResponse(const IsActiveResponse& from);
IsActiveResponse(IsActiveResponse&& from) noexcept
: IsActiveResponse() {
*this = ::std::move(from);
}
inline IsActiveResponse& operator=(const IsActiveResponse& from) {
CopyFrom(from);
return *this;
}
inline IsActiveResponse& operator=(IsActiveResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const IsActiveResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const IsActiveResponse* internal_default_instance() {
return reinterpret_cast<const IsActiveResponse*>(
&_IsActiveResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
7;
friend void swap(IsActiveResponse& a, IsActiveResponse& b) {
a.Swap(&b);
}
inline void Swap(IsActiveResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline IsActiveResponse* New() const final {
return CreateMaybeMessage<IsActiveResponse>(nullptr);
}
IsActiveResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<IsActiveResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const IsActiveResponse& from);
void MergeFrom(const IsActiveResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(IsActiveResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.IsActiveResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kIsActiveFieldNumber = 1,
};
// bool is_active = 1;
void clear_is_active();
bool is_active() const;
void set_is_active(bool value);
private:
bool _internal_is_active() const;
void _internal_set_is_active(bool value);
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.IsActiveResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
bool is_active_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class SetTargetLocationRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.SetTargetLocationRequest) */ {
public:
SetTargetLocationRequest();
virtual ~SetTargetLocationRequest();
SetTargetLocationRequest(const SetTargetLocationRequest& from);
SetTargetLocationRequest(SetTargetLocationRequest&& from) noexcept
: SetTargetLocationRequest() {
*this = ::std::move(from);
}
inline SetTargetLocationRequest& operator=(const SetTargetLocationRequest& from) {
CopyFrom(from);
return *this;
}
inline SetTargetLocationRequest& operator=(SetTargetLocationRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const SetTargetLocationRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SetTargetLocationRequest* internal_default_instance() {
return reinterpret_cast<const SetTargetLocationRequest*>(
&_SetTargetLocationRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
8;
friend void swap(SetTargetLocationRequest& a, SetTargetLocationRequest& b) {
a.Swap(&b);
}
inline void Swap(SetTargetLocationRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SetTargetLocationRequest* New() const final {
return CreateMaybeMessage<SetTargetLocationRequest>(nullptr);
}
SetTargetLocationRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<SetTargetLocationRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const SetTargetLocationRequest& from);
void MergeFrom(const SetTargetLocationRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SetTargetLocationRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.SetTargetLocationRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kLocationFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.TargetLocation location = 1;
bool has_location() const;
private:
bool _internal_has_location() const;
public:
void clear_location();
const ::mavsdk::rpc::follow_me::TargetLocation& location() const;
::mavsdk::rpc::follow_me::TargetLocation* release_location();
::mavsdk::rpc::follow_me::TargetLocation* mutable_location();
void set_allocated_location(::mavsdk::rpc::follow_me::TargetLocation* location);
private:
const ::mavsdk::rpc::follow_me::TargetLocation& _internal_location() const;
::mavsdk::rpc::follow_me::TargetLocation* _internal_mutable_location();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.SetTargetLocationRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::TargetLocation* location_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class SetTargetLocationResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.SetTargetLocationResponse) */ {
public:
SetTargetLocationResponse();
virtual ~SetTargetLocationResponse();
SetTargetLocationResponse(const SetTargetLocationResponse& from);
SetTargetLocationResponse(SetTargetLocationResponse&& from) noexcept
: SetTargetLocationResponse() {
*this = ::std::move(from);
}
inline SetTargetLocationResponse& operator=(const SetTargetLocationResponse& from) {
CopyFrom(from);
return *this;
}
inline SetTargetLocationResponse& operator=(SetTargetLocationResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const SetTargetLocationResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const SetTargetLocationResponse* internal_default_instance() {
return reinterpret_cast<const SetTargetLocationResponse*>(
&_SetTargetLocationResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
9;
friend void swap(SetTargetLocationResponse& a, SetTargetLocationResponse& b) {
a.Swap(&b);
}
inline void Swap(SetTargetLocationResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline SetTargetLocationResponse* New() const final {
return CreateMaybeMessage<SetTargetLocationResponse>(nullptr);
}
SetTargetLocationResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<SetTargetLocationResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const SetTargetLocationResponse& from);
void MergeFrom(const SetTargetLocationResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(SetTargetLocationResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.SetTargetLocationResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kFollowMeResultFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
bool has_follow_me_result() const;
private:
bool _internal_has_follow_me_result() const;
public:
void clear_follow_me_result();
const ::mavsdk::rpc::follow_me::FollowMeResult& follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* release_follow_me_result();
::mavsdk::rpc::follow_me::FollowMeResult* mutable_follow_me_result();
void set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result);
private:
const ::mavsdk::rpc::follow_me::FollowMeResult& _internal_follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* _internal_mutable_follow_me_result();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.SetTargetLocationResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class GetLastLocationRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.GetLastLocationRequest) */ {
public:
GetLastLocationRequest();
virtual ~GetLastLocationRequest();
GetLastLocationRequest(const GetLastLocationRequest& from);
GetLastLocationRequest(GetLastLocationRequest&& from) noexcept
: GetLastLocationRequest() {
*this = ::std::move(from);
}
inline GetLastLocationRequest& operator=(const GetLastLocationRequest& from) {
CopyFrom(from);
return *this;
}
inline GetLastLocationRequest& operator=(GetLastLocationRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const GetLastLocationRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GetLastLocationRequest* internal_default_instance() {
return reinterpret_cast<const GetLastLocationRequest*>(
&_GetLastLocationRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
10;
friend void swap(GetLastLocationRequest& a, GetLastLocationRequest& b) {
a.Swap(&b);
}
inline void Swap(GetLastLocationRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GetLastLocationRequest* New() const final {
return CreateMaybeMessage<GetLastLocationRequest>(nullptr);
}
GetLastLocationRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<GetLastLocationRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const GetLastLocationRequest& from);
void MergeFrom(const GetLastLocationRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GetLastLocationRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.GetLastLocationRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.GetLastLocationRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class GetLastLocationResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.GetLastLocationResponse) */ {
public:
GetLastLocationResponse();
virtual ~GetLastLocationResponse();
GetLastLocationResponse(const GetLastLocationResponse& from);
GetLastLocationResponse(GetLastLocationResponse&& from) noexcept
: GetLastLocationResponse() {
*this = ::std::move(from);
}
inline GetLastLocationResponse& operator=(const GetLastLocationResponse& from) {
CopyFrom(from);
return *this;
}
inline GetLastLocationResponse& operator=(GetLastLocationResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const GetLastLocationResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const GetLastLocationResponse* internal_default_instance() {
return reinterpret_cast<const GetLastLocationResponse*>(
&_GetLastLocationResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
11;
friend void swap(GetLastLocationResponse& a, GetLastLocationResponse& b) {
a.Swap(&b);
}
inline void Swap(GetLastLocationResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline GetLastLocationResponse* New() const final {
return CreateMaybeMessage<GetLastLocationResponse>(nullptr);
}
GetLastLocationResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<GetLastLocationResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const GetLastLocationResponse& from);
void MergeFrom(const GetLastLocationResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(GetLastLocationResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.GetLastLocationResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kLocationFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.TargetLocation location = 1;
bool has_location() const;
private:
bool _internal_has_location() const;
public:
void clear_location();
const ::mavsdk::rpc::follow_me::TargetLocation& location() const;
::mavsdk::rpc::follow_me::TargetLocation* release_location();
::mavsdk::rpc::follow_me::TargetLocation* mutable_location();
void set_allocated_location(::mavsdk::rpc::follow_me::TargetLocation* location);
private:
const ::mavsdk::rpc::follow_me::TargetLocation& _internal_location() const;
::mavsdk::rpc::follow_me::TargetLocation* _internal_mutable_location();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.GetLastLocationResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::TargetLocation* location_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class StartRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.StartRequest) */ {
public:
StartRequest();
virtual ~StartRequest();
StartRequest(const StartRequest& from);
StartRequest(StartRequest&& from) noexcept
: StartRequest() {
*this = ::std::move(from);
}
inline StartRequest& operator=(const StartRequest& from) {
CopyFrom(from);
return *this;
}
inline StartRequest& operator=(StartRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const StartRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StartRequest* internal_default_instance() {
return reinterpret_cast<const StartRequest*>(
&_StartRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
12;
friend void swap(StartRequest& a, StartRequest& b) {
a.Swap(&b);
}
inline void Swap(StartRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline StartRequest* New() const final {
return CreateMaybeMessage<StartRequest>(nullptr);
}
StartRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<StartRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const StartRequest& from);
void MergeFrom(const StartRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StartRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.StartRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.StartRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class StartResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.StartResponse) */ {
public:
StartResponse();
virtual ~StartResponse();
StartResponse(const StartResponse& from);
StartResponse(StartResponse&& from) noexcept
: StartResponse() {
*this = ::std::move(from);
}
inline StartResponse& operator=(const StartResponse& from) {
CopyFrom(from);
return *this;
}
inline StartResponse& operator=(StartResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const StartResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StartResponse* internal_default_instance() {
return reinterpret_cast<const StartResponse*>(
&_StartResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
13;
friend void swap(StartResponse& a, StartResponse& b) {
a.Swap(&b);
}
inline void Swap(StartResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline StartResponse* New() const final {
return CreateMaybeMessage<StartResponse>(nullptr);
}
StartResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<StartResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const StartResponse& from);
void MergeFrom(const StartResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StartResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.StartResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kFollowMeResultFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
bool has_follow_me_result() const;
private:
bool _internal_has_follow_me_result() const;
public:
void clear_follow_me_result();
const ::mavsdk::rpc::follow_me::FollowMeResult& follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* release_follow_me_result();
::mavsdk::rpc::follow_me::FollowMeResult* mutable_follow_me_result();
void set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result);
private:
const ::mavsdk::rpc::follow_me::FollowMeResult& _internal_follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* _internal_mutable_follow_me_result();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.StartResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class StopRequest :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.StopRequest) */ {
public:
StopRequest();
virtual ~StopRequest();
StopRequest(const StopRequest& from);
StopRequest(StopRequest&& from) noexcept
: StopRequest() {
*this = ::std::move(from);
}
inline StopRequest& operator=(const StopRequest& from) {
CopyFrom(from);
return *this;
}
inline StopRequest& operator=(StopRequest&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const StopRequest& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StopRequest* internal_default_instance() {
return reinterpret_cast<const StopRequest*>(
&_StopRequest_default_instance_);
}
static constexpr int kIndexInFileMessages =
14;
friend void swap(StopRequest& a, StopRequest& b) {
a.Swap(&b);
}
inline void Swap(StopRequest* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline StopRequest* New() const final {
return CreateMaybeMessage<StopRequest>(nullptr);
}
StopRequest* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<StopRequest>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const StopRequest& from);
void MergeFrom(const StopRequest& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StopRequest* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.StopRequest";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.StopRequest)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class StopResponse :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.StopResponse) */ {
public:
StopResponse();
virtual ~StopResponse();
StopResponse(const StopResponse& from);
StopResponse(StopResponse&& from) noexcept
: StopResponse() {
*this = ::std::move(from);
}
inline StopResponse& operator=(const StopResponse& from) {
CopyFrom(from);
return *this;
}
inline StopResponse& operator=(StopResponse&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const StopResponse& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const StopResponse* internal_default_instance() {
return reinterpret_cast<const StopResponse*>(
&_StopResponse_default_instance_);
}
static constexpr int kIndexInFileMessages =
15;
friend void swap(StopResponse& a, StopResponse& b) {
a.Swap(&b);
}
inline void Swap(StopResponse* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline StopResponse* New() const final {
return CreateMaybeMessage<StopResponse>(nullptr);
}
StopResponse* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<StopResponse>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const StopResponse& from);
void MergeFrom(const StopResponse& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(StopResponse* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.StopResponse";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
// accessors -------------------------------------------------------
enum : int {
kFollowMeResultFieldNumber = 1,
};
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
bool has_follow_me_result() const;
private:
bool _internal_has_follow_me_result() const;
public:
void clear_follow_me_result();
const ::mavsdk::rpc::follow_me::FollowMeResult& follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* release_follow_me_result();
::mavsdk::rpc::follow_me::FollowMeResult* mutable_follow_me_result();
void set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result);
private:
const ::mavsdk::rpc::follow_me::FollowMeResult& _internal_follow_me_result() const;
::mavsdk::rpc::follow_me::FollowMeResult* _internal_mutable_follow_me_result();
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.StopResponse)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// -------------------------------------------------------------------
class FollowMeResult :
public ::PROTOBUF_NAMESPACE_ID::Message /* @@protoc_insertion_point(class_definition:mavsdk.rpc.follow_me.FollowMeResult) */ {
public:
FollowMeResult();
virtual ~FollowMeResult();
FollowMeResult(const FollowMeResult& from);
FollowMeResult(FollowMeResult&& from) noexcept
: FollowMeResult() {
*this = ::std::move(from);
}
inline FollowMeResult& operator=(const FollowMeResult& from) {
CopyFrom(from);
return *this;
}
inline FollowMeResult& operator=(FollowMeResult&& from) noexcept {
if (GetArenaNoVirtual() == from.GetArenaNoVirtual()) {
if (this != &from) InternalSwap(&from);
} else {
CopyFrom(from);
}
return *this;
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* descriptor() {
return GetDescriptor();
}
static const ::PROTOBUF_NAMESPACE_ID::Descriptor* GetDescriptor() {
return GetMetadataStatic().descriptor;
}
static const ::PROTOBUF_NAMESPACE_ID::Reflection* GetReflection() {
return GetMetadataStatic().reflection;
}
static const FollowMeResult& default_instance();
static void InitAsDefaultInstance(); // FOR INTERNAL USE ONLY
static inline const FollowMeResult* internal_default_instance() {
return reinterpret_cast<const FollowMeResult*>(
&_FollowMeResult_default_instance_);
}
static constexpr int kIndexInFileMessages =
16;
friend void swap(FollowMeResult& a, FollowMeResult& b) {
a.Swap(&b);
}
inline void Swap(FollowMeResult* other) {
if (other == this) return;
InternalSwap(other);
}
// implements Message ----------------------------------------------
inline FollowMeResult* New() const final {
return CreateMaybeMessage<FollowMeResult>(nullptr);
}
FollowMeResult* New(::PROTOBUF_NAMESPACE_ID::Arena* arena) const final {
return CreateMaybeMessage<FollowMeResult>(arena);
}
void CopyFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void MergeFrom(const ::PROTOBUF_NAMESPACE_ID::Message& from) final;
void CopyFrom(const FollowMeResult& from);
void MergeFrom(const FollowMeResult& from);
PROTOBUF_ATTRIBUTE_REINITIALIZES void Clear() final;
bool IsInitialized() const final;
size_t ByteSizeLong() const final;
const char* _InternalParse(const char* ptr, ::PROTOBUF_NAMESPACE_ID::internal::ParseContext* ctx) final;
::PROTOBUF_NAMESPACE_ID::uint8* _InternalSerialize(
::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const final;
int GetCachedSize() const final { return _cached_size_.Get(); }
private:
inline void SharedCtor();
inline void SharedDtor();
void SetCachedSize(int size) const final;
void InternalSwap(FollowMeResult* other);
friend class ::PROTOBUF_NAMESPACE_ID::internal::AnyMetadata;
static ::PROTOBUF_NAMESPACE_ID::StringPiece FullMessageName() {
return "mavsdk.rpc.follow_me.FollowMeResult";
}
private:
inline ::PROTOBUF_NAMESPACE_ID::Arena* GetArenaNoVirtual() const {
return nullptr;
}
inline void* MaybeArenaPtr() const {
return nullptr;
}
public:
::PROTOBUF_NAMESPACE_ID::Metadata GetMetadata() const final;
private:
static ::PROTOBUF_NAMESPACE_ID::Metadata GetMetadataStatic() {
::PROTOBUF_NAMESPACE_ID::internal::AssignDescriptors(&::descriptor_table_follow_5fme_2ffollow_5fme_2eproto);
return ::descriptor_table_follow_5fme_2ffollow_5fme_2eproto.file_level_metadata[kIndexInFileMessages];
}
public:
// nested types ----------------------------------------------------
typedef FollowMeResult_Result Result;
static constexpr Result RESULT_UNKNOWN =
FollowMeResult_Result_RESULT_UNKNOWN;
static constexpr Result RESULT_SUCCESS =
FollowMeResult_Result_RESULT_SUCCESS;
static constexpr Result RESULT_NO_SYSTEM =
FollowMeResult_Result_RESULT_NO_SYSTEM;
static constexpr Result RESULT_CONNECTION_ERROR =
FollowMeResult_Result_RESULT_CONNECTION_ERROR;
static constexpr Result RESULT_BUSY =
FollowMeResult_Result_RESULT_BUSY;
static constexpr Result RESULT_COMMAND_DENIED =
FollowMeResult_Result_RESULT_COMMAND_DENIED;
static constexpr Result RESULT_TIMEOUT =
FollowMeResult_Result_RESULT_TIMEOUT;
static constexpr Result RESULT_NOT_ACTIVE =
FollowMeResult_Result_RESULT_NOT_ACTIVE;
static constexpr Result RESULT_SET_CONFIG_FAILED =
FollowMeResult_Result_RESULT_SET_CONFIG_FAILED;
static inline bool Result_IsValid(int value) {
return FollowMeResult_Result_IsValid(value);
}
static constexpr Result Result_MIN =
FollowMeResult_Result_Result_MIN;
static constexpr Result Result_MAX =
FollowMeResult_Result_Result_MAX;
static constexpr int Result_ARRAYSIZE =
FollowMeResult_Result_Result_ARRAYSIZE;
static inline const ::PROTOBUF_NAMESPACE_ID::EnumDescriptor*
Result_descriptor() {
return FollowMeResult_Result_descriptor();
}
template<typename T>
static inline const std::string& Result_Name(T enum_t_value) {
static_assert(::std::is_same<T, Result>::value ||
::std::is_integral<T>::value,
"Incorrect type passed to function Result_Name.");
return FollowMeResult_Result_Name(enum_t_value);
}
static inline bool Result_Parse(const std::string& name,
Result* value) {
return FollowMeResult_Result_Parse(name, value);
}
// accessors -------------------------------------------------------
enum : int {
kResultStrFieldNumber = 2,
kResultFieldNumber = 1,
};
// string result_str = 2;
void clear_result_str();
const std::string& result_str() const;
void set_result_str(const std::string& value);
void set_result_str(std::string&& value);
void set_result_str(const char* value);
void set_result_str(const char* value, size_t size);
std::string* mutable_result_str();
std::string* release_result_str();
void set_allocated_result_str(std::string* result_str);
private:
const std::string& _internal_result_str() const;
void _internal_set_result_str(const std::string& value);
std::string* _internal_mutable_result_str();
public:
// .mavsdk.rpc.follow_me.FollowMeResult.Result result = 1;
void clear_result();
::mavsdk::rpc::follow_me::FollowMeResult_Result result() const;
void set_result(::mavsdk::rpc::follow_me::FollowMeResult_Result value);
private:
::mavsdk::rpc::follow_me::FollowMeResult_Result _internal_result() const;
void _internal_set_result(::mavsdk::rpc::follow_me::FollowMeResult_Result value);
public:
// @@protoc_insertion_point(class_scope:mavsdk.rpc.follow_me.FollowMeResult)
private:
class _Internal;
::PROTOBUF_NAMESPACE_ID::internal::InternalMetadataWithArena _internal_metadata_;
::PROTOBUF_NAMESPACE_ID::internal::ArenaStringPtr result_str_;
int result_;
mutable ::PROTOBUF_NAMESPACE_ID::internal::CachedSize _cached_size_;
friend struct ::TableStruct_follow_5fme_2ffollow_5fme_2eproto;
};
// ===================================================================
// ===================================================================
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wstrict-aliasing"
#endif // __GNUC__
// Config
// float min_height_m = 1 [(.mavsdk.options.default_value) = "8.0"];
inline void Config::clear_min_height_m() {
min_height_m_ = 0;
}
inline float Config::_internal_min_height_m() const {
return min_height_m_;
}
inline float Config::min_height_m() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.Config.min_height_m)
return _internal_min_height_m();
}
inline void Config::_internal_set_min_height_m(float value) {
min_height_m_ = value;
}
inline void Config::set_min_height_m(float value) {
_internal_set_min_height_m(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.Config.min_height_m)
}
// float follow_distance_m = 2 [(.mavsdk.options.default_value) = "8.0"];
inline void Config::clear_follow_distance_m() {
follow_distance_m_ = 0;
}
inline float Config::_internal_follow_distance_m() const {
return follow_distance_m_;
}
inline float Config::follow_distance_m() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.Config.follow_distance_m)
return _internal_follow_distance_m();
}
inline void Config::_internal_set_follow_distance_m(float value) {
follow_distance_m_ = value;
}
inline void Config::set_follow_distance_m(float value) {
_internal_set_follow_distance_m(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.Config.follow_distance_m)
}
// .mavsdk.rpc.follow_me.Config.FollowDirection follow_direction = 3;
inline void Config::clear_follow_direction() {
follow_direction_ = 0;
}
inline ::mavsdk::rpc::follow_me::Config_FollowDirection Config::_internal_follow_direction() const {
return static_cast< ::mavsdk::rpc::follow_me::Config_FollowDirection >(follow_direction_);
}
inline ::mavsdk::rpc::follow_me::Config_FollowDirection Config::follow_direction() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.Config.follow_direction)
return _internal_follow_direction();
}
inline void Config::_internal_set_follow_direction(::mavsdk::rpc::follow_me::Config_FollowDirection value) {
follow_direction_ = value;
}
inline void Config::set_follow_direction(::mavsdk::rpc::follow_me::Config_FollowDirection value) {
_internal_set_follow_direction(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.Config.follow_direction)
}
// float responsiveness = 4 [(.mavsdk.options.default_value) = "0.5"];
inline void Config::clear_responsiveness() {
responsiveness_ = 0;
}
inline float Config::_internal_responsiveness() const {
return responsiveness_;
}
inline float Config::responsiveness() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.Config.responsiveness)
return _internal_responsiveness();
}
inline void Config::_internal_set_responsiveness(float value) {
responsiveness_ = value;
}
inline void Config::set_responsiveness(float value) {
_internal_set_responsiveness(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.Config.responsiveness)
}
// -------------------------------------------------------------------
// TargetLocation
// double latitude_deg = 1 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_latitude_deg() {
latitude_deg_ = 0;
}
inline double TargetLocation::_internal_latitude_deg() const {
return latitude_deg_;
}
inline double TargetLocation::latitude_deg() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.latitude_deg)
return _internal_latitude_deg();
}
inline void TargetLocation::_internal_set_latitude_deg(double value) {
latitude_deg_ = value;
}
inline void TargetLocation::set_latitude_deg(double value) {
_internal_set_latitude_deg(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.latitude_deg)
}
// double longitude_deg = 2 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_longitude_deg() {
longitude_deg_ = 0;
}
inline double TargetLocation::_internal_longitude_deg() const {
return longitude_deg_;
}
inline double TargetLocation::longitude_deg() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.longitude_deg)
return _internal_longitude_deg();
}
inline void TargetLocation::_internal_set_longitude_deg(double value) {
longitude_deg_ = value;
}
inline void TargetLocation::set_longitude_deg(double value) {
_internal_set_longitude_deg(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.longitude_deg)
}
// float absolute_altitude_m = 3 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_absolute_altitude_m() {
absolute_altitude_m_ = 0;
}
inline float TargetLocation::_internal_absolute_altitude_m() const {
return absolute_altitude_m_;
}
inline float TargetLocation::absolute_altitude_m() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.absolute_altitude_m)
return _internal_absolute_altitude_m();
}
inline void TargetLocation::_internal_set_absolute_altitude_m(float value) {
absolute_altitude_m_ = value;
}
inline void TargetLocation::set_absolute_altitude_m(float value) {
_internal_set_absolute_altitude_m(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.absolute_altitude_m)
}
// float velocity_x_m_s = 4 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_velocity_x_m_s() {
velocity_x_m_s_ = 0;
}
inline float TargetLocation::_internal_velocity_x_m_s() const {
return velocity_x_m_s_;
}
inline float TargetLocation::velocity_x_m_s() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.velocity_x_m_s)
return _internal_velocity_x_m_s();
}
inline void TargetLocation::_internal_set_velocity_x_m_s(float value) {
velocity_x_m_s_ = value;
}
inline void TargetLocation::set_velocity_x_m_s(float value) {
_internal_set_velocity_x_m_s(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.velocity_x_m_s)
}
// float velocity_y_m_s = 5 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_velocity_y_m_s() {
velocity_y_m_s_ = 0;
}
inline float TargetLocation::_internal_velocity_y_m_s() const {
return velocity_y_m_s_;
}
inline float TargetLocation::velocity_y_m_s() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.velocity_y_m_s)
return _internal_velocity_y_m_s();
}
inline void TargetLocation::_internal_set_velocity_y_m_s(float value) {
velocity_y_m_s_ = value;
}
inline void TargetLocation::set_velocity_y_m_s(float value) {
_internal_set_velocity_y_m_s(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.velocity_y_m_s)
}
// float velocity_z_m_s = 6 [(.mavsdk.options.default_value) = "NaN"];
inline void TargetLocation::clear_velocity_z_m_s() {
velocity_z_m_s_ = 0;
}
inline float TargetLocation::_internal_velocity_z_m_s() const {
return velocity_z_m_s_;
}
inline float TargetLocation::velocity_z_m_s() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.TargetLocation.velocity_z_m_s)
return _internal_velocity_z_m_s();
}
inline void TargetLocation::_internal_set_velocity_z_m_s(float value) {
velocity_z_m_s_ = value;
}
inline void TargetLocation::set_velocity_z_m_s(float value) {
_internal_set_velocity_z_m_s(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.TargetLocation.velocity_z_m_s)
}
// -------------------------------------------------------------------
// GetConfigRequest
// -------------------------------------------------------------------
// GetConfigResponse
// .mavsdk.rpc.follow_me.Config config = 1;
inline bool GetConfigResponse::_internal_has_config() const {
return this != internal_default_instance() && config_ != nullptr;
}
inline bool GetConfigResponse::has_config() const {
return _internal_has_config();
}
inline void GetConfigResponse::clear_config() {
if (GetArenaNoVirtual() == nullptr && config_ != nullptr) {
delete config_;
}
config_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::Config& GetConfigResponse::_internal_config() const {
const ::mavsdk::rpc::follow_me::Config* p = config_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::Config*>(
&::mavsdk::rpc::follow_me::_Config_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::Config& GetConfigResponse::config() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.GetConfigResponse.config)
return _internal_config();
}
inline ::mavsdk::rpc::follow_me::Config* GetConfigResponse::release_config() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.GetConfigResponse.config)
::mavsdk::rpc::follow_me::Config* temp = config_;
config_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::Config* GetConfigResponse::_internal_mutable_config() {
if (config_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::Config>(GetArenaNoVirtual());
config_ = p;
}
return config_;
}
inline ::mavsdk::rpc::follow_me::Config* GetConfigResponse::mutable_config() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.GetConfigResponse.config)
return _internal_mutable_config();
}
inline void GetConfigResponse::set_allocated_config(::mavsdk::rpc::follow_me::Config* config) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete config_;
}
if (config) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
config = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, config, submessage_arena);
}
} else {
}
config_ = config;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.GetConfigResponse.config)
}
// -------------------------------------------------------------------
// SetConfigRequest
// .mavsdk.rpc.follow_me.Config config = 1;
inline bool SetConfigRequest::_internal_has_config() const {
return this != internal_default_instance() && config_ != nullptr;
}
inline bool SetConfigRequest::has_config() const {
return _internal_has_config();
}
inline void SetConfigRequest::clear_config() {
if (GetArenaNoVirtual() == nullptr && config_ != nullptr) {
delete config_;
}
config_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::Config& SetConfigRequest::_internal_config() const {
const ::mavsdk::rpc::follow_me::Config* p = config_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::Config*>(
&::mavsdk::rpc::follow_me::_Config_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::Config& SetConfigRequest::config() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.SetConfigRequest.config)
return _internal_config();
}
inline ::mavsdk::rpc::follow_me::Config* SetConfigRequest::release_config() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.SetConfigRequest.config)
::mavsdk::rpc::follow_me::Config* temp = config_;
config_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::Config* SetConfigRequest::_internal_mutable_config() {
if (config_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::Config>(GetArenaNoVirtual());
config_ = p;
}
return config_;
}
inline ::mavsdk::rpc::follow_me::Config* SetConfigRequest::mutable_config() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.SetConfigRequest.config)
return _internal_mutable_config();
}
inline void SetConfigRequest::set_allocated_config(::mavsdk::rpc::follow_me::Config* config) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete config_;
}
if (config) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
config = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, config, submessage_arena);
}
} else {
}
config_ = config;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.SetConfigRequest.config)
}
// -------------------------------------------------------------------
// SetConfigResponse
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
inline bool SetConfigResponse::_internal_has_follow_me_result() const {
return this != internal_default_instance() && follow_me_result_ != nullptr;
}
inline bool SetConfigResponse::has_follow_me_result() const {
return _internal_has_follow_me_result();
}
inline void SetConfigResponse::clear_follow_me_result() {
if (GetArenaNoVirtual() == nullptr && follow_me_result_ != nullptr) {
delete follow_me_result_;
}
follow_me_result_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& SetConfigResponse::_internal_follow_me_result() const {
const ::mavsdk::rpc::follow_me::FollowMeResult* p = follow_me_result_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::FollowMeResult*>(
&::mavsdk::rpc::follow_me::_FollowMeResult_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& SetConfigResponse::follow_me_result() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.SetConfigResponse.follow_me_result)
return _internal_follow_me_result();
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetConfigResponse::release_follow_me_result() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.SetConfigResponse.follow_me_result)
::mavsdk::rpc::follow_me::FollowMeResult* temp = follow_me_result_;
follow_me_result_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetConfigResponse::_internal_mutable_follow_me_result() {
if (follow_me_result_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::FollowMeResult>(GetArenaNoVirtual());
follow_me_result_ = p;
}
return follow_me_result_;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetConfigResponse::mutable_follow_me_result() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.SetConfigResponse.follow_me_result)
return _internal_mutable_follow_me_result();
}
inline void SetConfigResponse::set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete follow_me_result_;
}
if (follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
follow_me_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, follow_me_result, submessage_arena);
}
} else {
}
follow_me_result_ = follow_me_result;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.SetConfigResponse.follow_me_result)
}
// -------------------------------------------------------------------
// IsActiveRequest
// -------------------------------------------------------------------
// IsActiveResponse
// bool is_active = 1;
inline void IsActiveResponse::clear_is_active() {
is_active_ = false;
}
inline bool IsActiveResponse::_internal_is_active() const {
return is_active_;
}
inline bool IsActiveResponse::is_active() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.IsActiveResponse.is_active)
return _internal_is_active();
}
inline void IsActiveResponse::_internal_set_is_active(bool value) {
is_active_ = value;
}
inline void IsActiveResponse::set_is_active(bool value) {
_internal_set_is_active(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.IsActiveResponse.is_active)
}
// -------------------------------------------------------------------
// SetTargetLocationRequest
// .mavsdk.rpc.follow_me.TargetLocation location = 1;
inline bool SetTargetLocationRequest::_internal_has_location() const {
return this != internal_default_instance() && location_ != nullptr;
}
inline bool SetTargetLocationRequest::has_location() const {
return _internal_has_location();
}
inline void SetTargetLocationRequest::clear_location() {
if (GetArenaNoVirtual() == nullptr && location_ != nullptr) {
delete location_;
}
location_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::TargetLocation& SetTargetLocationRequest::_internal_location() const {
const ::mavsdk::rpc::follow_me::TargetLocation* p = location_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::TargetLocation*>(
&::mavsdk::rpc::follow_me::_TargetLocation_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::TargetLocation& SetTargetLocationRequest::location() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.SetTargetLocationRequest.location)
return _internal_location();
}
inline ::mavsdk::rpc::follow_me::TargetLocation* SetTargetLocationRequest::release_location() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.SetTargetLocationRequest.location)
::mavsdk::rpc::follow_me::TargetLocation* temp = location_;
location_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::TargetLocation* SetTargetLocationRequest::_internal_mutable_location() {
if (location_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::TargetLocation>(GetArenaNoVirtual());
location_ = p;
}
return location_;
}
inline ::mavsdk::rpc::follow_me::TargetLocation* SetTargetLocationRequest::mutable_location() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.SetTargetLocationRequest.location)
return _internal_mutable_location();
}
inline void SetTargetLocationRequest::set_allocated_location(::mavsdk::rpc::follow_me::TargetLocation* location) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete location_;
}
if (location) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
location = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, location, submessage_arena);
}
} else {
}
location_ = location;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.SetTargetLocationRequest.location)
}
// -------------------------------------------------------------------
// SetTargetLocationResponse
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
inline bool SetTargetLocationResponse::_internal_has_follow_me_result() const {
return this != internal_default_instance() && follow_me_result_ != nullptr;
}
inline bool SetTargetLocationResponse::has_follow_me_result() const {
return _internal_has_follow_me_result();
}
inline void SetTargetLocationResponse::clear_follow_me_result() {
if (GetArenaNoVirtual() == nullptr && follow_me_result_ != nullptr) {
delete follow_me_result_;
}
follow_me_result_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& SetTargetLocationResponse::_internal_follow_me_result() const {
const ::mavsdk::rpc::follow_me::FollowMeResult* p = follow_me_result_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::FollowMeResult*>(
&::mavsdk::rpc::follow_me::_FollowMeResult_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& SetTargetLocationResponse::follow_me_result() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.SetTargetLocationResponse.follow_me_result)
return _internal_follow_me_result();
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetTargetLocationResponse::release_follow_me_result() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.SetTargetLocationResponse.follow_me_result)
::mavsdk::rpc::follow_me::FollowMeResult* temp = follow_me_result_;
follow_me_result_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetTargetLocationResponse::_internal_mutable_follow_me_result() {
if (follow_me_result_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::FollowMeResult>(GetArenaNoVirtual());
follow_me_result_ = p;
}
return follow_me_result_;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* SetTargetLocationResponse::mutable_follow_me_result() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.SetTargetLocationResponse.follow_me_result)
return _internal_mutable_follow_me_result();
}
inline void SetTargetLocationResponse::set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete follow_me_result_;
}
if (follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
follow_me_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, follow_me_result, submessage_arena);
}
} else {
}
follow_me_result_ = follow_me_result;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.SetTargetLocationResponse.follow_me_result)
}
// -------------------------------------------------------------------
// GetLastLocationRequest
// -------------------------------------------------------------------
// GetLastLocationResponse
// .mavsdk.rpc.follow_me.TargetLocation location = 1;
inline bool GetLastLocationResponse::_internal_has_location() const {
return this != internal_default_instance() && location_ != nullptr;
}
inline bool GetLastLocationResponse::has_location() const {
return _internal_has_location();
}
inline void GetLastLocationResponse::clear_location() {
if (GetArenaNoVirtual() == nullptr && location_ != nullptr) {
delete location_;
}
location_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::TargetLocation& GetLastLocationResponse::_internal_location() const {
const ::mavsdk::rpc::follow_me::TargetLocation* p = location_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::TargetLocation*>(
&::mavsdk::rpc::follow_me::_TargetLocation_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::TargetLocation& GetLastLocationResponse::location() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.GetLastLocationResponse.location)
return _internal_location();
}
inline ::mavsdk::rpc::follow_me::TargetLocation* GetLastLocationResponse::release_location() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.GetLastLocationResponse.location)
::mavsdk::rpc::follow_me::TargetLocation* temp = location_;
location_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::TargetLocation* GetLastLocationResponse::_internal_mutable_location() {
if (location_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::TargetLocation>(GetArenaNoVirtual());
location_ = p;
}
return location_;
}
inline ::mavsdk::rpc::follow_me::TargetLocation* GetLastLocationResponse::mutable_location() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.GetLastLocationResponse.location)
return _internal_mutable_location();
}
inline void GetLastLocationResponse::set_allocated_location(::mavsdk::rpc::follow_me::TargetLocation* location) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete location_;
}
if (location) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
location = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, location, submessage_arena);
}
} else {
}
location_ = location;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.GetLastLocationResponse.location)
}
// -------------------------------------------------------------------
// StartRequest
// -------------------------------------------------------------------
// StartResponse
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
inline bool StartResponse::_internal_has_follow_me_result() const {
return this != internal_default_instance() && follow_me_result_ != nullptr;
}
inline bool StartResponse::has_follow_me_result() const {
return _internal_has_follow_me_result();
}
inline void StartResponse::clear_follow_me_result() {
if (GetArenaNoVirtual() == nullptr && follow_me_result_ != nullptr) {
delete follow_me_result_;
}
follow_me_result_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& StartResponse::_internal_follow_me_result() const {
const ::mavsdk::rpc::follow_me::FollowMeResult* p = follow_me_result_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::FollowMeResult*>(
&::mavsdk::rpc::follow_me::_FollowMeResult_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& StartResponse::follow_me_result() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.StartResponse.follow_me_result)
return _internal_follow_me_result();
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StartResponse::release_follow_me_result() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.StartResponse.follow_me_result)
::mavsdk::rpc::follow_me::FollowMeResult* temp = follow_me_result_;
follow_me_result_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StartResponse::_internal_mutable_follow_me_result() {
if (follow_me_result_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::FollowMeResult>(GetArenaNoVirtual());
follow_me_result_ = p;
}
return follow_me_result_;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StartResponse::mutable_follow_me_result() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.StartResponse.follow_me_result)
return _internal_mutable_follow_me_result();
}
inline void StartResponse::set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete follow_me_result_;
}
if (follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
follow_me_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, follow_me_result, submessage_arena);
}
} else {
}
follow_me_result_ = follow_me_result;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.StartResponse.follow_me_result)
}
// -------------------------------------------------------------------
// StopRequest
// -------------------------------------------------------------------
// StopResponse
// .mavsdk.rpc.follow_me.FollowMeResult follow_me_result = 1;
inline bool StopResponse::_internal_has_follow_me_result() const {
return this != internal_default_instance() && follow_me_result_ != nullptr;
}
inline bool StopResponse::has_follow_me_result() const {
return _internal_has_follow_me_result();
}
inline void StopResponse::clear_follow_me_result() {
if (GetArenaNoVirtual() == nullptr && follow_me_result_ != nullptr) {
delete follow_me_result_;
}
follow_me_result_ = nullptr;
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& StopResponse::_internal_follow_me_result() const {
const ::mavsdk::rpc::follow_me::FollowMeResult* p = follow_me_result_;
return p != nullptr ? *p : *reinterpret_cast<const ::mavsdk::rpc::follow_me::FollowMeResult*>(
&::mavsdk::rpc::follow_me::_FollowMeResult_default_instance_);
}
inline const ::mavsdk::rpc::follow_me::FollowMeResult& StopResponse::follow_me_result() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.StopResponse.follow_me_result)
return _internal_follow_me_result();
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StopResponse::release_follow_me_result() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.StopResponse.follow_me_result)
::mavsdk::rpc::follow_me::FollowMeResult* temp = follow_me_result_;
follow_me_result_ = nullptr;
return temp;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StopResponse::_internal_mutable_follow_me_result() {
if (follow_me_result_ == nullptr) {
auto* p = CreateMaybeMessage<::mavsdk::rpc::follow_me::FollowMeResult>(GetArenaNoVirtual());
follow_me_result_ = p;
}
return follow_me_result_;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult* StopResponse::mutable_follow_me_result() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.StopResponse.follow_me_result)
return _internal_mutable_follow_me_result();
}
inline void StopResponse::set_allocated_follow_me_result(::mavsdk::rpc::follow_me::FollowMeResult* follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* message_arena = GetArenaNoVirtual();
if (message_arena == nullptr) {
delete follow_me_result_;
}
if (follow_me_result) {
::PROTOBUF_NAMESPACE_ID::Arena* submessage_arena = nullptr;
if (message_arena != submessage_arena) {
follow_me_result = ::PROTOBUF_NAMESPACE_ID::internal::GetOwnedMessage(
message_arena, follow_me_result, submessage_arena);
}
} else {
}
follow_me_result_ = follow_me_result;
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.StopResponse.follow_me_result)
}
// -------------------------------------------------------------------
// FollowMeResult
// .mavsdk.rpc.follow_me.FollowMeResult.Result result = 1;
inline void FollowMeResult::clear_result() {
result_ = 0;
}
inline ::mavsdk::rpc::follow_me::FollowMeResult_Result FollowMeResult::_internal_result() const {
return static_cast< ::mavsdk::rpc::follow_me::FollowMeResult_Result >(result_);
}
inline ::mavsdk::rpc::follow_me::FollowMeResult_Result FollowMeResult::result() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.FollowMeResult.result)
return _internal_result();
}
inline void FollowMeResult::_internal_set_result(::mavsdk::rpc::follow_me::FollowMeResult_Result value) {
result_ = value;
}
inline void FollowMeResult::set_result(::mavsdk::rpc::follow_me::FollowMeResult_Result value) {
_internal_set_result(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.FollowMeResult.result)
}
// string result_str = 2;
inline void FollowMeResult::clear_result_str() {
result_str_.ClearToEmptyNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline const std::string& FollowMeResult::result_str() const {
// @@protoc_insertion_point(field_get:mavsdk.rpc.follow_me.FollowMeResult.result_str)
return _internal_result_str();
}
inline void FollowMeResult::set_result_str(const std::string& value) {
_internal_set_result_str(value);
// @@protoc_insertion_point(field_set:mavsdk.rpc.follow_me.FollowMeResult.result_str)
}
inline std::string* FollowMeResult::mutable_result_str() {
// @@protoc_insertion_point(field_mutable:mavsdk.rpc.follow_me.FollowMeResult.result_str)
return _internal_mutable_result_str();
}
inline const std::string& FollowMeResult::_internal_result_str() const {
return result_str_.GetNoArena();
}
inline void FollowMeResult::_internal_set_result_str(const std::string& value) {
result_str_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), value);
}
inline void FollowMeResult::set_result_str(std::string&& value) {
result_str_.SetNoArena(
&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::move(value));
// @@protoc_insertion_point(field_set_rvalue:mavsdk.rpc.follow_me.FollowMeResult.result_str)
}
inline void FollowMeResult::set_result_str(const char* value) {
GOOGLE_DCHECK(value != nullptr);
result_str_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), ::std::string(value));
// @@protoc_insertion_point(field_set_char:mavsdk.rpc.follow_me.FollowMeResult.result_str)
}
inline void FollowMeResult::set_result_str(const char* value, size_t size) {
result_str_.SetNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(),
::std::string(reinterpret_cast<const char*>(value), size));
// @@protoc_insertion_point(field_set_pointer:mavsdk.rpc.follow_me.FollowMeResult.result_str)
}
inline std::string* FollowMeResult::_internal_mutable_result_str() {
return result_str_.MutableNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline std::string* FollowMeResult::release_result_str() {
// @@protoc_insertion_point(field_release:mavsdk.rpc.follow_me.FollowMeResult.result_str)
return result_str_.ReleaseNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
}
inline void FollowMeResult::set_allocated_result_str(std::string* result_str) {
if (result_str != nullptr) {
} else {
}
result_str_.SetAllocatedNoArena(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), result_str);
// @@protoc_insertion_point(field_set_allocated:mavsdk.rpc.follow_me.FollowMeResult.result_str)
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif // __GNUC__
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// -------------------------------------------------------------------
// @@protoc_insertion_point(namespace_scope)
} // namespace follow_me
} // namespace rpc
} // namespace mavsdk
PROTOBUF_NAMESPACE_OPEN
template <> struct is_proto_enum< ::mavsdk::rpc::follow_me::Config_FollowDirection> : ::std::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::mavsdk::rpc::follow_me::Config_FollowDirection>() {
return ::mavsdk::rpc::follow_me::Config_FollowDirection_descriptor();
}
template <> struct is_proto_enum< ::mavsdk::rpc::follow_me::FollowMeResult_Result> : ::std::true_type {};
template <>
inline const EnumDescriptor* GetEnumDescriptor< ::mavsdk::rpc::follow_me::FollowMeResult_Result>() {
return ::mavsdk::rpc::follow_me::FollowMeResult_Result_descriptor();
}
PROTOBUF_NAMESPACE_CLOSE
// @@protoc_insertion_point(global_scope)
#include <google/protobuf/port_undef.inc>
#endif // GOOGLE_PROTOBUF_INCLUDED_GOOGLE_PROTOBUF_INCLUDED_follow_5fme_2ffollow_5fme_2eproto
| [
"julian@oes.ch"
] | julian@oes.ch |
1fc956a27599f55ef7a4fe04ebadda48d5feb075 | 523a1f9f9628cd1f374f2abf75c78fd7d3f2af33 | /include/queue.h | 4c4cf74864a65e73145f85ea04bf8d9b95005f1a | [
"MIT"
] | permissive | wari/sandbox | c2271fea319df56744c802f620c70ffc4d770ed8 | 13f37d2eb45571d6b34fab65cfc965b443621697 | refs/heads/master | 2020-05-09T09:26:25.613873 | 2014-02-05T05:20:12 | 2014-02-05T05:20:12 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 171 | h | class Queue {
struct Node {
int* data;
Node *next;
};
Node *front;
Node *back;
public:
Queue();
void put(int);
int* get();
};
| [
"wahabmw@i2r.a-star.edu.sg"
] | wahabmw@i2r.a-star.edu.sg |
1b421321dc11fda00a3fb36db20be76cfb6ba651 | 8ba3820b70bf3808dc96ac393f96e859c17e69e7 | /codeforces/1341/A.cpp | 07527de9e42f8af5b1a23bea2d47eb44df21e8b0 | [] | no_license | anikxt/Competitive_Programming | d92767247c358a093d8de04933c8fda4abeb42c0 | e464bd2b480ccc4f469bdbe1609af921ef93c723 | refs/heads/master | 2023-03-24T13:56:38.442334 | 2021-02-14T18:14:00 | 2021-03-19T19:19:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 710 | cpp | //#pragma GCC optimize "trapv"
#include<bits/stdc++.h>
#define ll long long
#define fab(a,b,i) for(int i=a;i<b;i++)
#define pb push_back
#define db double
#define mp make_pair
#define endl "\n"
#define f first
#define se second
#define all(x) x.begin(),x.end()
#define MOD 1000000007
#define quick ios_base::sync_with_stdio(false);cin.tie(NULL)
using namespace std;
int main()
{ quick;
#ifndef ONLINE_JUDGE
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
#endif
int t;
cin>>t;
while(t--)
{
ll int n,a,b,c,d;
cin>>n>>a>>b>>c>>d;
ll int k=a+b,j=a-b,l=c+d,p=c-d;
string ans="YES";
if(k*n<p)
ans="NO";
if(j*n>l)
ans="NO";
cout<<ans<<endl;
}
return 0;
} | [
"nishitsharma0@gmail.com"
] | nishitsharma0@gmail.com |
226f6e49e7ded97fbaaddaaee35d17131215c53c | b0e233b9b173a866cf78f6e74a9b95c1e64eeb51 | /Code/Server/AutoLuaBind/cpp/LuaBind_GameLogic_SkillBase.cpp | 70019f9b1f787463cb4f0d73868e242abe31a6e5 | [] | no_license | xiaol-luo/Utopia | 47a6e987ebd6aaebb7759b736a4590859a6c4eb3 | 798741067114467680c6bcf9d22301f12f127f02 | refs/heads/master | 2021-07-10T13:21:24.547069 | 2019-01-14T14:03:31 | 2019-01-14T14:03:31 | 100,261,666 | 6 | 3 | null | null | null | null | UTF-8 | C++ | false | false | 2,179 | cpp | #include "SolLuaBindUtils.h"
#include <sol.hpp>
#include "Logic/LogicModules/GameLogic/Scene/SceneUnitModules/SceneUnitSkills/SceneUnitSkills.h"
#include "Logic/LogicModules/GameLogic/Scene/Defines/EffectDefine.h"
#include "Logic/LogicModules/GameLogic/Scene/Defines/SceneDefine.h"
#include "Logic/LogicModules/GameLogic/Scene/Skills/SkillConfigBase.h"
#include "Logic/LogicModules/GameLogic/Scene/SceneUnit/SceneUnit.h"
#include "Logic/LogicModules/GameLogic/Scene/Config/SceneAllConfig.h"
#include "Logic/LogicModules/GameLogic/Scene/Skills/SkillBase.h"
namespace SolLuaBind
{
void LuaBind_GameLogic_SkillBase(lua_State *L)
{
struct LuaBindImpl
{
struct ForOverloadFns
{
};
struct ForPropertyField
{
};
static void DoLuaBind(lua_State *L)
{
std::string name = "SkillBase";
std::string name_space = "GameLogic";
{
sol::usertype<GameLogic::SkillBase> meta_table(
sol::constructors<
GameLogic::SkillBase(const GameLogic::SkillConfigBase *)
>(),
"__StructName__", sol::property([]() {return "SkillBase"; })
,"GetSkillId", &GameLogic::SkillBase::GetSkillId
,"SetSkillKey", &GameLogic::SkillBase::SetSkillKey
,"GetSkillKey", &GameLogic::SkillBase::GetSkillKey
,"SetSceneUnitSkills", &GameLogic::SkillBase::SetSceneUnitSkills
,"GetSceneUnitSkills", &GameLogic::SkillBase::GetSceneUnitSkills
,"GetCaster", &GameLogic::SkillBase::GetCaster
,"GetLogicMs", &GameLogic::SkillBase::GetLogicMs
,"SetLevel", &GameLogic::SkillBase::SetLevel
,"ReloadCfg", &GameLogic::SkillBase::ReloadCfg
,"SyncClient", &GameLogic::SkillBase::SyncClient
,"GetPbMsg", &GameLogic::SkillBase::GetPbMsg
, sol::base_classes, sol::bases<
std::enable_shared_from_this<GameLogic::SkillBase>
>()
);
SolLuaBindUtils::BindLuaUserType(sol::state_view(L), meta_table, name, name_space);
}
{
sol::table ns_table = SolLuaBindUtils::GetOrNewLuaNameSpaceTable(sol::state_view(L), name_space)[name];
}
}
};
LuaBindImpl::DoLuaBind(L);
}
} | [
"xiaol.luo@163.com"
] | xiaol.luo@163.com |
a69c194e832d0e67183b7d72487be01c9ec5a830 | 3f5179150584730cc0ee2ddc8f232b5e372d84aa | /Source/ProjectR/Private/UI/RacePlayerUI.cpp | 6a5a2d52c1c5da7aefe0a8ef63178e03449ccdd7 | [] | no_license | poettlr/ProjectR | 4e8963c006bc0e5a2f7ffe72b89e5f65355d5dde | 1b92b4c034c36f0cbb0ef8c2e02972dd86a3e1e1 | refs/heads/master | 2023-06-16T02:37:39.782708 | 2021-06-29T00:07:41 | 2021-06-29T00:07:41 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,546 | cpp | // Fill out your copyright notice in the Description page of Project Settings.
#include "UI/RacePlayerUI.h"
#include "Components/TextBlock.h"
int URacePlayerUI::currentLap()
{
return FCString::Atoi(*currentLapText->GetText().ToString());
}
int URacePlayerUI::totalLaps()
{
return FCString::Atoi(*totalLapsText->GetText().ToString());
}
int URacePlayerUI::currentPosition()
{
return FCString::Atoi(*currentPositionText->GetText().ToString());
}
void URacePlayerUI::setTotalLapsTo(int aDesiredValue)
{
if(totalLapsText->GetText().ToString().Contains("(Total Laps)"))
{
changeIntegerTextOf(totalLapsText, aDesiredValue);
}
}
void URacePlayerUI::changeIntegerTextOf(UTextBlock* aTextBlock, int aNewValue)
{
aTextBlock->SetText(FText::FromString(FString::FromInt(aNewValue)));
}
bool URacePlayerUI::Initialize()
{
bool initializeResult = Super::Initialize();
if(currentLapText)
{
currentLapText->SetText(FText::FromString(FString("(Current Lap)")));
}
if(totalLapsText)
{
totalLapsText->SetText(FText::FromString(FString("(Total Laps)")));
}
if(currentPositionText)
{
currentPositionText->SetText(FText::FromString(FString("(Current Position)")));
}
return initializeResult;
}
void URacePlayerUI::updateLapTo(int aNewLap)
{
changeIntegerTextOf(currentLapText, aNewLap);
}
void URacePlayerUI::updatePositionTo(int aNewPosition)
{
changeIntegerTextOf(currentPositionText, aNewPosition);
}
void URacePlayerUI::modifyTotalLapsTo(int aNewTotalLapsValue)
{
changeIntegerTextOf(totalLapsText, aNewTotalLapsValue);
}
| [
"betomiku@gmail.com"
] | betomiku@gmail.com |
ab051ff4bec4499901de3b8cbb3e1fab6bac12e3 | 9e99984a3e8a5582ce2f32beb8e7bbcaf6f71fb3 | /src/points.h | 1bfabf8bcfded8e024c6c109377217c65246c1cb | [] | no_license | alirezagoli/dots-game | 1176985b0cc7ff88478a1b5b3218c25177006fc0 | 5899c7dc7a3b0d208e17210f51a9cac4528ed3e8 | refs/heads/main | 2023-02-09T09:17:21.247788 | 2021-01-02T09:57:48 | 2021-01-02T09:57:48 | 326,098,931 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,096 | h | #ifndef POINTS_H
#define POINTS_H
#include <QGraphicsScene>
#include<QGraphicsEllipseItem>
#include<QList>
#include<QMessageBox>
#include<QBrush>
#include"show_winner.h"
enum playerTurn{player1,player2};
struct PointStatus
{
PointStatus *up;
PointStatus *down;
PointStatus *right;
PointStatus *left;
};
class points : public QGraphicsScene
{
Q_OBJECT
public:
points(QObject *parent = 0, int Row_size=11, int Col_size=11);
private:
PointStatus **PS;
playerTurn PT;
QList<QGraphicsItem *>items;
int RowSize;
int ColSize;
int RectCounter;
int Player1Score;
int Player2Score;
PointStatus temp;
private:
void drawline();
void ChangePointStatus();
bool CheckRect();
void Updating_Score_RectCount();
void ChangePlayerTurn();
protected:
void mouseReleaseEvent(QGraphicsSceneMouseEvent *event);
signals:
void UpdatingScoreBoard1(int);
void UpdatingScoreBoard2(int);
void Winner(QString);
void exitmainwindows();
void PlayerTurn(QString);
public slots:
};
#endif // POINTS_H
| [
"alirezagoli.mail@gmail.com"
] | alirezagoli.mail@gmail.com |
b0e2f650cd34efb34c1377db7926cc86a6941c42 | 6e60698f107a9a6da687a8f4fa639f3bb12467c7 | /thirdparty/IntervalTree/test/countouterintervals.cpp | ead7e045c5b69781420eab899d1602ff5319f962 | [
"MIT"
] | permissive | nikitaresh/rectangles_intersections | 710769a7512bfc47639bd2db96f68ab16e7d0841 | 3108e12ccd89e2d0d538e83689c96c1d2543fee2 | refs/heads/master | 2020-03-20T20:24:23.059300 | 2018-12-05T16:43:28 | 2018-12-05T16:43:28 | 137,685,968 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,387 | cpp | #include "catch.hpp"
#include "intervals.h"
TEST_CASE("Count outer intervals")
{
SECTION("Empty tree")
{
const IntervalTree tree;
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(tree.isEmpty());
REQUIRE(0 == count);
}
SECTION("Boundary interval")
{
const auto tree = IntervalTree(Test::boundaryIntervals());
auto count = tree.countOuterIntervals(Test::interval(), true);
REQUIRE(count == Test::boundaryIntervals().size());
count = tree.countOuterIntervals(Test::interval(), false);
REQUIRE(0 == count);
}
SECTION("Outer intervals")
{
const auto tree = IntervalTree(Test::outerIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
SECTION("Outer and boundary intervals")
{
const auto intervals = Test::compositeIntervals(Test::outerIntervals(), Test::boundaryIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == intervals.size());
}
SECTION("Inner intervals")
{
const auto tree = IntervalTree(Test::innerIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(0 == count);
}
SECTION("Inner and boundary intervals")
{
const auto intervals = Test::compositeIntervals(Test::innerIntervals(), Test::boundaryIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::boundaryIntervals().size());
}
SECTION("Outer and inner intervals")
{
const auto intervals = Test::compositeIntervals(Test::outerIntervals(), Test::innerIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
SECTION("Left intervals")
{
const auto tree = IntervalTree(Test::leftIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(0 == count);
}
SECTION("Left and outer intervals")
{
const auto intervals = Test::compositeIntervals(Test::leftIntervals(), Test::outerIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
SECTION("Right intervals")
{
const auto tree = IntervalTree(Test::rightIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(0 == count);
}
SECTION("Right and outer intervals")
{
const auto intervals = Test::compositeIntervals(Test::rightIntervals(), Test::outerIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
SECTION("Left overlapping intervals")
{
const auto tree = IntervalTree(Test::leftOverlappingIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(0 == count);
}
SECTION("Left overlapping and outer intervals")
{
const auto intervals = Test::compositeIntervals(Test::leftOverlappingIntervals(), Test::outerIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
SECTION("Right overlapping intervals")
{
const auto tree = IntervalTree(Test::rightOverlappingIntervals());
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(0 == count);
}
SECTION("Right overlapping and outer intervals")
{
const auto intervals = Test::compositeIntervals(Test::rightOverlappingIntervals(), Test::outerIntervals());
const auto tree = IntervalTree(intervals);
const auto count = tree.countOuterIntervals(Test::interval());
REQUIRE(count == Test::outerIntervals().size());
}
}
| [
"nikitaresh@mail.ru"
] | nikitaresh@mail.ru |
ff13b6eec7e704e653491ac29d62ee37b71c27ef | d38c0e1b1fa45e3dd9ed101db047831ac740f085 | /src/BinaryHelper.cpp | d4f91bb8bdefea3e9611535f7a3d12b6c0c19751 | [] | no_license | igornfaustino/Huffman_algoritmo | b39df1cf078794df45eee949e1c77aa32c6e8ab1 | 5c3d8eb5e4e22387019eda8209e319daf648709e | refs/heads/master | 2021-11-08T16:46:52.761091 | 2021-10-26T16:29:40 | 2021-10-26T16:29:40 | 92,450,075 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 836 | cpp | #include "BinaryHelper.h"
unsigned int BinaryHelper::setBitToOne(unsigned int num)
{
return ((num & mask) | mask_one);
}
unsigned int BinaryHelper::setBitToZero(unsigned int num)
{
return ((num & mask) | mask_zero);
}
unsigned int BinaryHelper::getCurrentBit(unsigned int num)
{
return (num & mask_one);
}
unsigned int BinaryHelper::parse_int(string str)
{
unsigned int num = 0x00000000;
for (int i = 0; i < str.size(); i++)
{
if (str[i] == '1')
{
num = setBitToOne(num);
}
else
{
num = setBitToZero(num);
}
if (i < str.size() - 1)
num = num << 1;
}
return num;
}
string BinaryHelper::parse_str(unsigned int num)
{
string str;
unsigned int aux;
for (int i = 0; i < 32; i++)
{
aux = getCurrentBit(num);
stringstream ss;
ss << aux;
str = ss.str() + str;
num = num >> 1;
}
return str;
}
| [
"igor@nfaustino.com"
] | igor@nfaustino.com |
b85412dd32248222bc252ad00d9625e126bedd46 | 65cdc3ced737400cef283915d70d87fe42b70632 | /src/cGame.cpp | 19c8f9c20e3ba242d1afef1a8bc4b25e4a570a35 | [] | no_license | alexgg-developer/sdlbaseforgame | 1f2f5cc70557412ab30d58b5ea9d0994e2b0e0df | 1e16c9d7aa464d95d07d5483adabe949331f64f0 | refs/heads/master | 2020-03-30T04:35:32.781620 | 2014-05-08T21:25:10 | 2014-05-08T21:25:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,343 | cpp | #include "cGame.hpp"
#include "cTexture.hpp"
#include "vec3.hpp"
#include "cAnimation2D.hpp"
#include "cText.hpp"
#include "TypesDefined.hpp"
#include "SDL_ttf.h"
#include "SDL_mixer.h"
#include "cMusic.hpp"
#include "cSound.hpp"
#include <sstream>
Game::Game()
{}
int Game::init()
{
int error = initSDL();
if(error == 0) error = initGLEW();
if(error == 0) error = initGL();
return error;
}
int Game::initSDL()
{
int error = 0;
if( SDL_Init( SDL_INIT_VIDEO | SDL_INIT_AUDIO ) < 0 )
{
std::cout << "SDL could not initialize! SDL_Error: " << SDL_GetError() << std::endl;
error = 1;
}
error = mWindow.init();
if(error == 0) {
if( TTF_Init() == -1 ) {
std::cout << "SDL_ttf could not initialize! SDL_ttf Error: " << TTF_GetError() << std::endl;
error = 4;
}
if( Mix_OpenAudio( 44100, MIX_DEFAULT_FORMAT, 2, 2048 ) < 0 ) {
std::cout << "SDL_mixer could not initialize! SDL_mixer Error: " << Mix_GetError();
error = 6;
}
}
return error;
}
int Game::initGLEW()
{
int error = 0;
glewExperimental = GL_TRUE;
GLenum glewError = glewInit();
if( glewError != GLEW_OK ) {
std::cout << "Error initializing GLEW! " << glewGetErrorString( glewError ) << std::endl;
error = 10;
}
return error;
}
int Game::initGL()
{
int error = 0;
if(!mRenderer.initGL() || !mRenderer.initApp()) {
error = 20;
}
return error;
}
int Game::quit()
{
mWindow.free();
mRenderer.free();
Mix_Quit();
TTF_Quit();
IMG_Quit();
SDL_Quit();
return 0;
}
int Game::main()
{
int error = init();
if(!error) {
uint frame = 0;
//mWindow.switchFullScreen();
mTimer.start();
while(!mInput.check(Input::KESC)) {
SDL_Event event;
while (SDL_PollEvent(&event)) {
if(event.type == SDL_WINDOWEVENT) {
mWindow.handleEvent(event);
if(mWindow.mMinimized) {
mTimer.pause();
}
else {
mTimer.resume();
}
}
else {
mInput.readWithScanCode(event);
}
}
if(!mWindow.mMinimized) {
glClearColor( 0.f, 0.f, 0.f, 1.f );
glClear( GL_COLOR_BUFFER_BIT );
mRenderer.render();
SDL_GL_SwapWindow( mWindow.mWindow );
}
}
error = quit();
}
else quit();
return error;
}
| [
"alexgg.developer@gmail.com"
] | alexgg.developer@gmail.com |
09d641424b38b5fa5cce4b791a6541e92f9d58c6 | 84a96dbd96e926ebb5c658e3cb897db276c32d6c | /tensorflow/core/common_runtime/process_state.cc | 19f7a985f3e3bcc3647c6d0358738527840cc818 | [
"Apache-2.0"
] | permissive | MothCreations/gavlanWheels | bc9189092847369ad291d1c7d3f4144dd2239359 | 01d8a43b45a26afec27b971f686f79c108fe08f9 | refs/heads/master | 2022-12-06T09:27:49.458800 | 2020-10-13T21:56:40 | 2020-10-13T21:56:40 | 249,206,716 | 6 | 5 | Apache-2.0 | 2022-11-21T22:39:47 | 2020-03-22T14:57:45 | C++ | UTF-8 | C++ | false | false | 6,027 | cc | /* Copyright 2015 The TensorFlow Authors. All Rights Reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
==============================================================================*/
#include "tensorflow/core/common_runtime/process_state.h"
#include <cstring>
#include <vector>
#include "absl/base/call_once.h"
#include "tensorflow/core/common_runtime/bfc_allocator.h"
#include "tensorflow/core/common_runtime/pool_allocator.h"
#include "tensorflow/core/framework/allocator.h"
#include "tensorflow/core/framework/log_memory.h"
#include "tensorflow/core/framework/tracking_allocator.h"
#include "tensorflow/core/lib/strings/strcat.h"
#include "tensorflow/core/platform/logging.h"
#include "tensorflow/core/platform/mutex.h"
#include "tensorflow/core/platform/types.h"
#include "tensorflow/core/util/env_var.h"
namespace tensorflow {
/*static*/ ProcessState* ProcessState::singleton() {
static ProcessState* instance = new ProcessState;
static absl::once_flag f;
absl::call_once(f, []() {
AllocatorFactoryRegistry::singleton()->process_state_ = instance;
});
return instance;
}
ProcessState::ProcessState() : numa_enabled_(false) {}
string ProcessState::MemDesc::DebugString() {
return strings::StrCat((loc == CPU ? "CPU " : "GPU "), dev_index,
", dma: ", gpu_registered, ", nic: ", nic_registered);
}
ProcessState::MemDesc ProcessState::PtrType(const void* ptr) {
if (FLAGS_brain_gpu_record_mem_types) {
auto iter = mem_desc_map_.find(ptr);
if (iter != mem_desc_map_.end()) {
return iter->second;
}
}
return MemDesc();
}
Allocator* ProcessState::GetCPUAllocator(int numa_node) {
if (!numa_enabled_ || numa_node == port::kNUMANoAffinity) numa_node = 0;
mutex_lock lock(mu_);
while (cpu_allocators_.size() <= static_cast<size_t>(numa_node)) {
// If visitors have been defined we need an Allocator built from
// a SubAllocator. Prefer BFCAllocator, but fall back to PoolAllocator
// depending on env var setting.
const bool alloc_visitors_defined =
(!cpu_alloc_visitors_.empty() || !cpu_free_visitors_.empty());
bool use_bfc_allocator = false;
Status status = ReadBoolFromEnvVar(
"TF_CPU_ALLOCATOR_USE_BFC", alloc_visitors_defined, &use_bfc_allocator);
if (!status.ok()) {
LOG(ERROR) << "GetCPUAllocator: " << status.error_message();
}
Allocator* allocator = nullptr;
SubAllocator* sub_allocator =
(numa_enabled_ || alloc_visitors_defined || use_bfc_allocator)
? new BasicCPUAllocator(
numa_enabled_ ? numa_node : port::kNUMANoAffinity,
cpu_alloc_visitors_, cpu_free_visitors_)
: nullptr;
if (use_bfc_allocator) {
// TODO(reedwm): evaluate whether 64GB by default is the best choice.
int64 cpu_mem_limit_in_mb = -1;
Status status = ReadInt64FromEnvVar("TF_CPU_BFC_MEM_LIMIT_IN_MB",
1LL << 16 /*64GB max by default*/,
&cpu_mem_limit_in_mb);
if (!status.ok()) {
LOG(ERROR) << "GetCPUAllocator: " << status.error_message();
}
int64 cpu_mem_limit = cpu_mem_limit_in_mb * (1LL << 20);
DCHECK(sub_allocator);
allocator =
new BFCAllocator(sub_allocator, cpu_mem_limit, true /*allow_growth*/,
"bfc_cpu_allocator_for_gpu" /*name*/);
VLOG(2) << "Using BFCAllocator with memory limit of "
<< cpu_mem_limit_in_mb << " MB for ProcessState CPU allocator";
} else if (sub_allocator) {
DCHECK(sub_allocator);
allocator =
new PoolAllocator(100 /*pool_size_limit*/, true /*auto_resize*/,
sub_allocator, new NoopRounder, "cpu_pool");
VLOG(2) << "Using PoolAllocator for ProcessState CPU allocator "
<< "numa_enabled_=" << numa_enabled_
<< " numa_node=" << numa_node;
} else {
DCHECK(!sub_allocator);
allocator = cpu_allocator_base();
}
if (LogMemory::IsEnabled() && !allocator->TracksAllocationSizes()) {
// Wrap the allocator to track allocation ids for better logging
// at the cost of performance.
allocator = new TrackingAllocator(allocator, true);
}
cpu_allocators_.push_back(allocator);
if (!sub_allocator) {
DCHECK(cpu_alloc_visitors_.empty() && cpu_free_visitors_.empty());
}
}
return cpu_allocators_[numa_node];
}
void ProcessState::AddCPUAllocVisitor(SubAllocator::Visitor visitor) {
VLOG(1) << "AddCPUAllocVisitor";
mutex_lock lock(mu_);
CHECK_EQ(0, cpu_allocators_.size()) // Crash OK
<< "AddCPUAllocVisitor must be called prior to first call to "
"ProcessState::GetCPUAllocator";
cpu_alloc_visitors_.push_back(std::move(visitor));
}
void ProcessState::AddCPUFreeVisitor(SubAllocator::Visitor visitor) {
mutex_lock lock(mu_);
CHECK_EQ(0, cpu_allocators_.size()) // Crash OK
<< "AddCPUFreeVisitor must be called prior to first call to "
"ProcessState::GetCPUAllocator";
cpu_free_visitors_.push_back(std::move(visitor));
}
void ProcessState::TestOnlyReset() {
mutex_lock lock(mu_);
// Don't delete this value because it's static.
Allocator* default_cpu_allocator = cpu_allocator_base();
mem_desc_map_.clear();
for (Allocator* a : cpu_allocators_) {
if (a != default_cpu_allocator) delete a;
}
cpu_allocators_.clear();
for (Allocator* a : cpu_al_) {
delete a;
}
cpu_al_.clear();
}
} // namespace tensorflow
| [
"gardener@tensorflow.org"
] | gardener@tensorflow.org |
9799de56b81b66934c75c38e50c76d34ea7e6379 | 3ff1fe3888e34cd3576d91319bf0f08ca955940f | /gse/include/tencentcloud/gse/v20191112/model/DeleteScalingPolicyResponse.h | 141bb3c22118c26292bf39a6888c795e3ca9be06 | [
"Apache-2.0"
] | permissive | TencentCloud/tencentcloud-sdk-cpp | 9f5df8220eaaf72f7eaee07b2ede94f89313651f | 42a76b812b81d1b52ec6a217fafc8faa135e06ca | refs/heads/master | 2023-08-30T03:22:45.269556 | 2023-08-30T00:45:39 | 2023-08-30T00:45:39 | 188,991,963 | 55 | 37 | Apache-2.0 | 2023-08-17T03:13:20 | 2019-05-28T08:56:08 | C++ | UTF-8 | C++ | false | false | 1,637 | h | /*
* Copyright (c) 2017-2019 THL A29 Limited, a Tencent company. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#ifndef TENCENTCLOUD_GSE_V20191112_MODEL_DELETESCALINGPOLICYRESPONSE_H_
#define TENCENTCLOUD_GSE_V20191112_MODEL_DELETESCALINGPOLICYRESPONSE_H_
#include <string>
#include <vector>
#include <map>
#include <tencentcloud/core/AbstractModel.h>
namespace TencentCloud
{
namespace Gse
{
namespace V20191112
{
namespace Model
{
/**
* DeleteScalingPolicy返回参数结构体
*/
class DeleteScalingPolicyResponse : public AbstractModel
{
public:
DeleteScalingPolicyResponse();
~DeleteScalingPolicyResponse() = default;
CoreInternalOutcome Deserialize(const std::string &payload);
std::string ToJsonString() const;
private:
};
}
}
}
}
#endif // !TENCENTCLOUD_GSE_V20191112_MODEL_DELETESCALINGPOLICYRESPONSE_H_
| [
"tencentcloudapi@tenent.com"
] | tencentcloudapi@tenent.com |
b4c9883e2dfe8c12262f42960cd4e05748b90d15 | 6391f2ba00ee3273518af0a02be01c1141ad667c | /include/GameState.hpp | 8ae628ed79040938c6fd286e19fcd844ae004305 | [] | no_license | linorabolini/Dungeon | d1847f8fc368b0f09e5a79866a00aab60f85cbae | d23bec2a94b84636d4daec91f826b8fd11bd318c | refs/heads/master | 2020-01-23T21:34:01.506515 | 2017-02-02T23:26:40 | 2017-02-02T23:26:40 | 74,698,718 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 116 | hpp | #pragma once
struct GameState
{
int floorsCleared = 0;
int enemiesKilled = 0;
int chestsOpened = 0;
};
| [
"linorabolini@gmail.com"
] | linorabolini@gmail.com |
4355740daf6a988512d75ae7975e7b7af538f1ff | 632b94beca62f7c8af5ae1d1e8e095a352600429 | /devel/include/control_msgs/FollowJointTrajectoryAction.h | fb65b86db7ea7b7e96f1ccbdd14fd0b549592ff7 | [] | no_license | Haoran-Zhao/US_UR3 | d9eb17a7eceed75bc623be4f4db417a38f5a9f8d | a0c25e1daf613bb45dbd08075e3185cb9cd03657 | refs/heads/master | 2020-08-31T07:02:45.403001 | 2020-05-27T16:58:52 | 2020-05-27T16:58:52 | 218,629,020 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,549 | h | // Generated by gencpp from file control_msgs/FollowJointTrajectoryAction.msg
// DO NOT EDIT!
#ifndef CONTROL_MSGS_MESSAGE_FOLLOWJOINTTRAJECTORYACTION_H
#define CONTROL_MSGS_MESSAGE_FOLLOWJOINTTRAJECTORYACTION_H
#include <string>
#include <vector>
#include <map>
#include <ros/types.h>
#include <ros/serialization.h>
#include <ros/builtin_message_traits.h>
#include <ros/message_operations.h>
#include <control_msgs/FollowJointTrajectoryActionGoal.h>
#include <control_msgs/FollowJointTrajectoryActionResult.h>
#include <control_msgs/FollowJointTrajectoryActionFeedback.h>
namespace control_msgs
{
template <class ContainerAllocator>
struct FollowJointTrajectoryAction_
{
typedef FollowJointTrajectoryAction_<ContainerAllocator> Type;
FollowJointTrajectoryAction_()
: action_goal()
, action_result()
, action_feedback() {
}
FollowJointTrajectoryAction_(const ContainerAllocator& _alloc)
: action_goal(_alloc)
, action_result(_alloc)
, action_feedback(_alloc) {
(void)_alloc;
}
typedef ::control_msgs::FollowJointTrajectoryActionGoal_<ContainerAllocator> _action_goal_type;
_action_goal_type action_goal;
typedef ::control_msgs::FollowJointTrajectoryActionResult_<ContainerAllocator> _action_result_type;
_action_result_type action_result;
typedef ::control_msgs::FollowJointTrajectoryActionFeedback_<ContainerAllocator> _action_feedback_type;
_action_feedback_type action_feedback;
typedef boost::shared_ptr< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> > Ptr;
typedef boost::shared_ptr< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> const> ConstPtr;
}; // struct FollowJointTrajectoryAction_
typedef ::control_msgs::FollowJointTrajectoryAction_<std::allocator<void> > FollowJointTrajectoryAction;
typedef boost::shared_ptr< ::control_msgs::FollowJointTrajectoryAction > FollowJointTrajectoryActionPtr;
typedef boost::shared_ptr< ::control_msgs::FollowJointTrajectoryAction const> FollowJointTrajectoryActionConstPtr;
// constants requiring out of line definition
template<typename ContainerAllocator>
std::ostream& operator<<(std::ostream& s, const ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> & v)
{
ros::message_operations::Printer< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >::stream(s, "", v);
return s;
}
} // namespace control_msgs
namespace ros
{
namespace message_traits
{
// BOOLTRAITS {'IsFixedSize': False, 'IsMessage': True, 'HasHeader': False}
// {'std_msgs': ['/opt/ros/kinetic/share/std_msgs/cmake/../msg'], 'geometry_msgs': ['/opt/ros/kinetic/share/geometry_msgs/cmake/../msg'], 'actionlib_msgs': ['/opt/ros/kinetic/share/actionlib_msgs/cmake/../msg'], 'trajectory_msgs': ['/opt/ros/kinetic/share/trajectory_msgs/cmake/../msg'], 'control_msgs': ['/home/haoran/US_UR3/devel/share/control_msgs/msg', '/home/haoran/US_UR3/src/ros_controllers/control_msgs/control_msgs/msg']}
// !!!!!!!!!!! ['__class__', '__delattr__', '__dict__', '__doc__', '__eq__', '__format__', '__getattribute__', '__hash__', '__init__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', '_parsed_fields', 'constants', 'fields', 'full_name', 'has_header', 'header_present', 'names', 'package', 'parsed_fields', 'short_name', 'text', 'types']
template <class ContainerAllocator>
struct IsFixedSize< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct IsFixedSize< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> const>
: FalseType
{ };
template <class ContainerAllocator>
struct IsMessage< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
: TrueType
{ };
template <class ContainerAllocator>
struct IsMessage< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> const>
: TrueType
{ };
template <class ContainerAllocator>
struct HasHeader< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
: FalseType
{ };
template <class ContainerAllocator>
struct HasHeader< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> const>
: FalseType
{ };
template<class ContainerAllocator>
struct MD5Sum< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
{
static const char* value()
{
return "bc4f9b743838566551c0390c65f1a248";
}
static const char* value(const ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator>&) { return value(); }
static const uint64_t static_value1 = 0xbc4f9b7438385665ULL;
static const uint64_t static_value2 = 0x51c0390c65f1a248ULL;
};
template<class ContainerAllocator>
struct DataType< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
{
static const char* value()
{
return "control_msgs/FollowJointTrajectoryAction";
}
static const char* value(const ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator>&) { return value(); }
};
template<class ContainerAllocator>
struct Definition< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
{
static const char* value()
{
return "# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
\n\
FollowJointTrajectoryActionGoal action_goal\n\
FollowJointTrajectoryActionResult action_result\n\
FollowJointTrajectoryActionFeedback action_feedback\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryActionGoal\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
\n\
Header header\n\
actionlib_msgs/GoalID goal_id\n\
FollowJointTrajectoryGoal goal\n\
\n\
================================================================================\n\
MSG: std_msgs/Header\n\
# Standard metadata for higher-level stamped data types.\n\
# This is generally used to communicate timestamped data \n\
# in a particular coordinate frame.\n\
# \n\
# sequence ID: consecutively increasing ID \n\
uint32 seq\n\
#Two-integer timestamp that is expressed as:\n\
# * stamp.sec: seconds (stamp_secs) since epoch (in Python the variable is called 'secs')\n\
# * stamp.nsec: nanoseconds since stamp_secs (in Python the variable is called 'nsecs')\n\
# time-handling sugar is provided by the client library\n\
time stamp\n\
#Frame this data is associated with\n\
# 0: no frame\n\
# 1: global frame\n\
string frame_id\n\
\n\
================================================================================\n\
MSG: actionlib_msgs/GoalID\n\
# The stamp should store the time at which this goal was requested.\n\
# It is used by an action server when it tries to preempt all\n\
# goals that were requested before a certain time\n\
time stamp\n\
\n\
# The id provides a way to associate feedback and\n\
# result message with specific goal requests. The id\n\
# specified must be unique.\n\
string id\n\
\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryGoal\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
# The joint trajectory to follow\n\
trajectory_msgs/JointTrajectory trajectory\n\
\n\
# Tolerances for the trajectory. If the measured joint values fall\n\
# outside the tolerances the trajectory goal is aborted. Any\n\
# tolerances that are not specified (by being omitted or set to 0) are\n\
# set to the defaults for the action server (often taken from the\n\
# parameter server).\n\
\n\
# Tolerances applied to the joints as the trajectory is executed. If\n\
# violated, the goal aborts with error_code set to\n\
# PATH_TOLERANCE_VIOLATED.\n\
JointTolerance[] path_tolerance\n\
\n\
# To report success, the joints must be within goal_tolerance of the\n\
# final trajectory value. The goal must be achieved by time the\n\
# trajectory ends plus goal_time_tolerance. (goal_time_tolerance\n\
# allows some leeway in time, so that the trajectory goal can still\n\
# succeed even if the joints reach the goal some time after the\n\
# precise end time of the trajectory).\n\
#\n\
# If the joints are not within goal_tolerance after \"trajectory finish\n\
# time\" + goal_time_tolerance, the goal aborts with error_code set to\n\
# GOAL_TOLERANCE_VIOLATED\n\
JointTolerance[] goal_tolerance\n\
duration goal_time_tolerance\n\
\n\
\n\
================================================================================\n\
MSG: trajectory_msgs/JointTrajectory\n\
Header header\n\
string[] joint_names\n\
JointTrajectoryPoint[] points\n\
================================================================================\n\
MSG: trajectory_msgs/JointTrajectoryPoint\n\
# Each trajectory point specifies either positions[, velocities[, accelerations]]\n\
# or positions[, effort] for the trajectory to be executed.\n\
# All specified values are in the same order as the joint names in JointTrajectory.msg\n\
\n\
float64[] positions\n\
float64[] velocities\n\
float64[] accelerations\n\
float64[] effort\n\
duration time_from_start\n\
\n\
================================================================================\n\
MSG: control_msgs/JointTolerance\n\
# The tolerances specify the amount the position, velocity, and\n\
# accelerations can vary from the setpoints. For example, in the case\n\
# of trajectory control, when the actual position varies beyond\n\
# (desired position + position tolerance), the trajectory goal may\n\
# abort.\n\
# \n\
# There are two special values for tolerances:\n\
# * 0 - The tolerance is unspecified and will remain at whatever the default is\n\
# * -1 - The tolerance is \"erased\". If there was a default, the joint will be\n\
# allowed to move without restriction.\n\
\n\
string name\n\
float64 position # in radians or meters (for a revolute or prismatic joint, respectively)\n\
float64 velocity # in rad/sec or m/sec\n\
float64 acceleration # in rad/sec^2 or m/sec^2\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryActionResult\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
\n\
Header header\n\
actionlib_msgs/GoalStatus status\n\
FollowJointTrajectoryResult result\n\
\n\
================================================================================\n\
MSG: actionlib_msgs/GoalStatus\n\
GoalID goal_id\n\
uint8 status\n\
uint8 PENDING = 0 # The goal has yet to be processed by the action server\n\
uint8 ACTIVE = 1 # The goal is currently being processed by the action server\n\
uint8 PREEMPTED = 2 # The goal received a cancel request after it started executing\n\
# and has since completed its execution (Terminal State)\n\
uint8 SUCCEEDED = 3 # The goal was achieved successfully by the action server (Terminal State)\n\
uint8 ABORTED = 4 # The goal was aborted during execution by the action server due\n\
# to some failure (Terminal State)\n\
uint8 REJECTED = 5 # The goal was rejected by the action server without being processed,\n\
# because the goal was unattainable or invalid (Terminal State)\n\
uint8 PREEMPTING = 6 # The goal received a cancel request after it started executing\n\
# and has not yet completed execution\n\
uint8 RECALLING = 7 # The goal received a cancel request before it started executing,\n\
# but the action server has not yet confirmed that the goal is canceled\n\
uint8 RECALLED = 8 # The goal received a cancel request before it started executing\n\
# and was successfully cancelled (Terminal State)\n\
uint8 LOST = 9 # An action client can determine that a goal is LOST. This should not be\n\
# sent over the wire by an action server\n\
\n\
#Allow for the user to associate a string with GoalStatus for debugging\n\
string text\n\
\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryResult\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
int32 error_code\n\
int32 SUCCESSFUL = 0\n\
int32 INVALID_GOAL = -1\n\
int32 INVALID_JOINTS = -2\n\
int32 OLD_HEADER_TIMESTAMP = -3\n\
int32 PATH_TOLERANCE_VIOLATED = -4\n\
int32 GOAL_TOLERANCE_VIOLATED = -5\n\
\n\
# Human readable description of the error code. Contains complementary\n\
# information that is especially useful when execution fails, for instance:\n\
# - INVALID_GOAL: The reason for the invalid goal (e.g., the requested\n\
# trajectory is in the past).\n\
# - INVALID_JOINTS: The mismatch between the expected controller joints\n\
# and those provided in the goal.\n\
# - PATH_TOLERANCE_VIOLATED and GOAL_TOLERANCE_VIOLATED: Which joint\n\
# violated which tolerance, and by how much.\n\
string error_string\n\
\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryActionFeedback\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
\n\
Header header\n\
actionlib_msgs/GoalStatus status\n\
FollowJointTrajectoryFeedback feedback\n\
\n\
================================================================================\n\
MSG: control_msgs/FollowJointTrajectoryFeedback\n\
# ====== DO NOT MODIFY! AUTOGENERATED FROM AN ACTION DEFINITION ======\n\
Header header\n\
string[] joint_names\n\
trajectory_msgs/JointTrajectoryPoint desired\n\
trajectory_msgs/JointTrajectoryPoint actual\n\
trajectory_msgs/JointTrajectoryPoint error\n\
\n\
";
}
static const char* value(const ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator>&) { return value(); }
};
} // namespace message_traits
} // namespace ros
namespace ros
{
namespace serialization
{
template<class ContainerAllocator> struct Serializer< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
{
template<typename Stream, typename T> inline static void allInOne(Stream& stream, T m)
{
stream.next(m.action_goal);
stream.next(m.action_result);
stream.next(m.action_feedback);
}
ROS_DECLARE_ALLINONE_SERIALIZER
}; // struct FollowJointTrajectoryAction_
} // namespace serialization
} // namespace ros
namespace ros
{
namespace message_operations
{
template<class ContainerAllocator>
struct Printer< ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator> >
{
template<typename Stream> static void stream(Stream& s, const std::string& indent, const ::control_msgs::FollowJointTrajectoryAction_<ContainerAllocator>& v)
{
s << indent << "action_goal: ";
s << std::endl;
Printer< ::control_msgs::FollowJointTrajectoryActionGoal_<ContainerAllocator> >::stream(s, indent + " ", v.action_goal);
s << indent << "action_result: ";
s << std::endl;
Printer< ::control_msgs::FollowJointTrajectoryActionResult_<ContainerAllocator> >::stream(s, indent + " ", v.action_result);
s << indent << "action_feedback: ";
s << std::endl;
Printer< ::control_msgs::FollowJointTrajectoryActionFeedback_<ContainerAllocator> >::stream(s, indent + " ", v.action_feedback);
}
};
} // namespace message_operations
} // namespace ros
#endif // CONTROL_MSGS_MESSAGE_FOLLOWJOINTTRAJECTORYACTION_H
| [
"zhaohaorandl@gmail.com"
] | zhaohaorandl@gmail.com |
1508f3e698bacd4793a59f3acaa5091a638d2429 | 08234a09fbb5efc56ac886c1dcb0d6e68f680735 | /benchmarks/benchmark-tsv.cpp | 56ae150021d6849de55867bcb99429513995449b | [] | no_license | sramas15/snapr | d861f3a7d3329aaa296c6a73ec2498a5d1eaa004 | b873101d87d1081cbfec28ceffdaf33411da5773 | refs/heads/master | 2021-01-14T12:47:14.937481 | 2015-03-11T21:46:41 | 2015-03-11T21:46:41 | 25,495,610 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 466 | cpp | #include <stdio.h>
#include "Snap.h"
int main(int argc, char* argv[]) {
TFIn LoadF("attr/save-vec.bin");
double start = omp_get_wtime();
PNSparseNet Net = TNSparseNet::Load(LoadF);
double end = omp_get_wtime();
printf("Time to read from binary: %f\n", (end-start));
start = omp_get_wtime();
FILE *fp = fopen("attr/output-vec.tsv", "w");
Net->ConvertToTSV(fp, 1000);
end = omp_get_wtime();
printf("Time to convert to TSV: %f\n", (end-start));
}
| [
"ramasshe@cs.stanford.edu"
] | ramasshe@cs.stanford.edu |
d46339589bbf7fa89b60df847d29bf8e862e06ad | c80bd757f18735452eef1f0f7cd7bd305d4313c7 | /src/Dataflow/Serialization/Network/ModuleDescriptionSerialization.cc | bbf1c5a3aab7428d015fcf682a749aa9b73d22f5 | [
"MIT"
] | permissive | kenlouie/SCIRunGUIPrototype | 956449f4b4ce3ed76ccc1fa23a6656f084c3a9b1 | 062ff605839b076177c4e50f08cf36d83a6a9220 | refs/heads/master | 2020-12-25T03:11:44.510875 | 2013-10-01T05:51:39 | 2013-10-01T05:51:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,990 | cc | /*
For more information, please see: http://software.sci.utah.edu
The MIT License
Copyright (c) 2012 Scientific Computing and Imaging Institute,
University of Utah.
License for the specific language governing rights and limitations under
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
*/
#include <Dataflow/Serialization/Network/ModuleDescriptionSerialization.h>
using namespace SCIRun::Dataflow::Networks;
ModuleLookupInfoXML::ModuleLookupInfoXML() {}
ModuleLookupInfoXML::ModuleLookupInfoXML(const ModuleLookupInfoXML& rhs) : ModuleLookupInfo(rhs) {}
ModuleLookupInfoXML::ModuleLookupInfoXML(const ModuleLookupInfo& rhs) : ModuleLookupInfo(rhs) {}
ConnectionDescriptionXML::ConnectionDescriptionXML() {}
ConnectionDescriptionXML::ConnectionDescriptionXML(const ConnectionDescriptionXML& rhs) : ConnectionDescription(rhs) {}
ConnectionDescriptionXML::ConnectionDescriptionXML(const ConnectionDescription& rhs) : ConnectionDescription(rhs) {}
| [
"dwhite@sci.utah.edu"
] | dwhite@sci.utah.edu |
c9b6194f6e1b936a48ed37cc85d6fa16de7d8fb7 | 3cc1092ed190a1c8a8ad51db38cf21324a29265d | /bin/cpp/include/haxe/IMap.h | 31d4a3948c3f3585ffc3a4ea9b4e036c1406591a | [] | no_license | civo/client-haxe | cab0e890103b4b27a0cbdad65a81aa36746a5d27 | 6542bef8d0ae635e7d7d82aa281efa87fdd04053 | refs/heads/master | 2023-01-08T21:10:00.029740 | 2019-11-27T21:48:54 | 2019-11-27T21:48:54 | 223,903,648 | 1 | 0 | null | 2023-01-05T01:38:54 | 2019-11-25T08:55:54 | C++ | UTF-8 | C++ | false | true | 337 | h | // Generated by Haxe 4.0.2
#ifndef INCLUDED_haxe_IMap
#define INCLUDED_haxe_IMap
#ifndef HXCPP_H
#include <hxcpp.h>
#endif
HX_DECLARE_CLASS1(haxe,IMap)
namespace haxe{
class HXCPP_CLASS_ATTRIBUTES IMap_obj {
public:
typedef hx::Object super;
HX_DO_INTERFACE_RTTI;
};
} // end namespace haxe
#endif /* INCLUDED_haxe_IMap */
| [
"lee.sylvester@gmail.com"
] | lee.sylvester@gmail.com |
d99d743af97c21e8fee84e101560d3543ceefa62 | 7e96610cc01da9082e6c00c2f8304da78fee5af0 | /src/server/game/Handlers/CollectionsHandler.cpp | 0679ef9b90396dd4c6e0b048e0fdc5f75c02b548 | [] | no_license | ralphhorizon/bfacore-1 | f945d24bafcb84f12d875c17aa8e948bddcb46ed | 8085d551669a164aa7fbade55081058451cb8024 | refs/heads/master | 2023-01-06T23:21:35.959674 | 2020-10-24T20:17:16 | 2020-10-24T20:17:16 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,707 | cpp | /*
* Copyright (C) 2020 BfaCore
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "WorldSession.h"
#include "CollectionMgr.h"
#include "CollectionPackets.h"
void WorldSession::HandleCollectionItemSetFavorite(WorldPackets::Collections::CollectionItemSetFavorite& collectionItemSetFavorite)
{
switch (collectionItemSetFavorite.Type)
{
case WorldPackets::Collections::TOYBOX:
GetCollectionMgr()->ToySetFavorite(collectionItemSetFavorite.ID, collectionItemSetFavorite.IsFavorite);
break;
case WorldPackets::Collections::APPEARANCE:
{
bool hasAppearance, isTemporary;
std::tie(hasAppearance, isTemporary) = GetCollectionMgr()->HasItemAppearance(collectionItemSetFavorite.ID);
if (!hasAppearance || isTemporary)
return;
GetCollectionMgr()->SetAppearanceIsFavorite(collectionItemSetFavorite.ID, collectionItemSetFavorite.IsFavorite);
break;
}
case WorldPackets::Collections::TRANSMOG_SET:
break;
default:
break;
}
}
| [
"zemetskia@gmail.com"
] | zemetskia@gmail.com |
23be59e8658cc959eace12dbcd456402344c6c0f | 7ea45377de05a91d447687c53e1a836cfaec4b11 | /forces_code/con221/d.cpp | f1280decfc9b415ae84c440244ba9a03b04779e9 | [] | no_license | saikrishna17394/Code | d2b71efe5e3e932824339149008c3ea33dff6acb | 1213f951233a502ae6ecf2df337f340d8d65d498 | refs/heads/master | 2020-05-19T14:16:49.037709 | 2017-01-26T17:17:13 | 2017-01-26T17:17:13 | 24,478,656 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 770 | cpp | #include <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
#include <cstring>
#include <map>
using namespace std;
#define inf 99999999
typedef long long int lli;
typedef pair<int,int> ii;
char s[5010][5010];
int dp[5000][5000],n,m,ans,A[5000];
int main() {
// cin>>n>>m;
scanf("%d %d",&n,&m);
for(int i=0;i<n;i++)
scanf("%s",s[i]);
for(int i=0;i<n;i++)
dp[i][m-1]=s[i][m-1]-'0';
for(int i=0;i<n;i++) {
for(int j=m-2;j>=0;j--) {
if(s[i][j]=='0')
dp[i][j]=0;
else
dp[i][j]=1+dp[i][j+1];
}
}
ans=0;
for(int j=0;j<m;j++) {
for(int i=0;i<n;i++) {
A[i]=dp[i][j];
}
sort(A,A+n);
for(int i=n-1;i>=0;i--) {
ans=max(ans,A[i]*(n-i));
}
}
// cout<<ans<<endl;
printf("%d\n", ans);
return 0;
} | [
"saikrishna17394@gmail.com"
] | saikrishna17394@gmail.com |
44d5470f9a69c2352894cc5fcee5d324a1f88358 | eb580526d1c04da0a1f3ed4146b9b68609cef3ea | /D/630.cpp | 9452914d5b118ab04d1f7a282befd7240a82324f | [] | no_license | bhaveshgawri/codeforces | bc34e7b688ee1e7ddc7efbdd758839454ba40524 | 22b8b7e0f3432051ddc1132b6bb84e0b25781347 | refs/heads/master | 2021-01-12T03:32:58.452769 | 2018-01-13T09:01:14 | 2018-01-13T09:01:14 | 78,229,124 | 0 | 1 | null | 2017-10-28T17:06:10 | 2017-01-06T18:31:40 | C++ | UTF-8 | C++ | false | false | 113 | cpp | #include <iostream>
int main(){
unsigned long long int n;
std::cin>>n;
std::cout<<3*n*n+3*n+1;
} | [
"4bhaveshgawri@gmail.com"
] | 4bhaveshgawri@gmail.com |
fb4b9cce15a058d278f4c1621d358aba606810cc | 2f0fa24dac268978f9fb24c9369d5127b898dfe8 | /Classes/SlitherMap.cpp | 95273dfe3dda40c9927ee69982ab5aa9da4e8c6e | [] | no_license | tomcat2088/slitherApp | fc2f7dea3a2719514afc20f50f884ab283eaf136 | b501e32505d265bfc6c26f5163124128e4a1cfb7 | refs/heads/master | 2016-09-13T09:33:34.559016 | 2016-05-31T15:58:35 | 2016-05-31T15:58:35 | 56,503,688 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 109 | cpp | //
// SlitherMap.cpp
// slitherApp
//
// Created by wangyang on 16/4/21.
//
//
#include "SlitherMap.hpp"
| [
"tomcat1991@126.com"
] | tomcat1991@126.com |
306fa7907dcf8dad4a707e085706d9f3ada99843 | b5c338541fb8102293d4f93d1ba18d86e0a6dec9 | /main/src/Math/Matrix.h | 0b7ff6dd78b87b84a17aac16d9c8df26b1bba602 | [] | no_license | robinvierich/engine | e894870e2559b9b862cdfc92975cc022681b3816 | e5cccdbac1e4d824b4047251286533f67950163d | refs/heads/master | 2021-01-10T04:23:57.133209 | 2017-11-06T00:58:05 | 2017-11-06T00:58:05 | 49,519,003 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 604 | h | #pragma once
#include "Math/Vector.h"
class Matrix4
{
private:
Vector4 m_columns[4];
const static Matrix4 s_identity;
public:
static const Matrix4& Identity() { return s_identity; }
static Matrix4 Matrix4::CreateProjectionMatrix(const float fov, const float farPlane, const float nearPlane);
Matrix4()
: m_columns{}
{
}
Matrix4(Vector4& col0, Vector4& col1, Vector4& col2, Vector4& col3)
: m_columns{ col0, col1, col2, col3 }
{
}
const inline float& operator[](uint32 i) const
{
return m_columns[i / 4][i % 4];
}
};
| [
"robinvierich@gmail.com"
] | robinvierich@gmail.com |
1443fcde15aabbacf587f07365df5ea6cbd1e7f1 | 833b0ad8f71cd1a2cd0a0f761edb059a86a79e55 | /BOJ/1000~/2455.cpp | 322b919221e0731815fac060b7aa4aed831bfe76 | [] | no_license | kin16742/Problem-Solving | 339c0be925eeaab82c2715bbcb571d32ffd00b8c | f549bdf05f16d3179fcc7a177378241b405db56e | refs/heads/master | 2022-12-28T14:29:58.613114 | 2020-10-07T12:24:47 | 2020-10-07T12:24:47 | 185,807,578 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 330 | cpp | #include <iostream>
#include <algorithm>
#include <string.h>
using namespace std;
int main() {
std::ios::sync_with_stdio(false);
cin.tie(NULL);
int a, b, result = 0, people = 0;
for (int i = 0; i < 4; i++) {
cin >> a >> b;
people = people - a + b;
result = max(result, people);
}
cout << result << '\n';
return 0;
}
| [
"kin16742@naver.com"
] | kin16742@naver.com |
1393776d3103dda6b4caeef8ab410746ee831133 | dbfb77666a87e0d9dc89f2f50db89e7173f1f0d8 | /source/cpp_utils/data/ArrayView.hpp | 714ae5194ef47b502b5c8995d539f2f16ab00f78 | [] | no_license | VladasZ/cpp_utils | b7b248933e1711c6586be2a836d56c9383c5d96c | 76e7246f6b31e8a189e5fbbb943c733792815f9e | refs/heads/master | 2021-06-10T11:14:16.895833 | 2021-03-31T19:50:32 | 2021-03-31T19:50:32 | 157,543,516 | 3 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,057 | hpp | //
// ArrayView.hpp
// cpp_utils
//
// Created by Vladas Zakrevskis on 03/05/20.
// Copyright © 2020 VladasZ. All rights reserved.
//
#pragma once
#include <stdlib.h>
namespace cu {
template<class T>
class ArrayView {
private:
const T* const _data;
const size_t _size;
public:
ArrayView() : _data(nullptr), _size(0) { }
explicit ArrayView(const T* data, size_t size) : _data(data), _size(size) { }
template<class Container, class Value = typename Container::value_type>
constexpr ArrayView(const Container& container)
: _data(reinterpret_cast<const T*>(container.data())),
_size(container.size() * (sizeof(Value) / sizeof(T))) { }
bool empty() const { return _size == 0; }
size_t size() const { return _size; }
const T* data() const { return _data; }
const T* begin() const { return _data; }
const T* end() const { return _data + _size; }
const T& operator[](int i) const { return _data[i]; }
};
}
| [
"146100@gmail.com"
] | 146100@gmail.com |
b608a829a99668b69478286f3cd72aa6fce9343f | aac5c40093e690689091844dd0bfe497a343a3cb | /EscalonadorEstruct.cpp | 910ce457bc3f02bb3c3199b6e9e9ce1e0c55d704 | [] | no_license | jlopezsa/escalonadorJulianTesteEscaClassMaq | 4d69d6a15b3ef6684a0dc8826d633ae488612d63 | e8df6770c128e91d2bf3469e7c13908946641f9e | refs/heads/master | 2020-09-21T05:54:18.320412 | 2019-11-28T17:32:29 | 2019-11-28T17:32:29 | 224,701,124 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,573 | cpp | #include <iostream>
#include <stdio.h>
#include <iomanip>
using namespace std;
#include "EscalonadorEstruct.h"
#include "Lista.cpp"
#include "Timer.cpp"
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
EscalonadorEstruct::EscalonadorEstruct()
{
schedulerStates = 0;
};
//
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
EscalonadorEstruct::~EscalonadorEstruct(){};
//
// Inicializa as entradas de todas as tarefas com 0
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
void EscalonadorEstruct::init_Task_TimersStruct()
{
taskToSchedule.priorityID = 0;
taskToSchedule.ptrObject = NULL;
taskToSchedule.task = NULL;
taskToSchedule.ready = 0;
taskToSchedule.delay = 0;
taskToSchedule.period = 0;
taskToSchedule.enabled = 0;
taskToSchedule.io_status = 0;
//
runningTask.priorityID = 0;
runningTask.ptrObject = NULL;
runningTask.task = NULL;
runningTask.ready = 0;
runningTask.delay = 0;
runningTask.period = 0;
runningTask.enabled = 0;
runningTask.io_status = 0;
};
//
//
//
int EscalonadorEstruct::addTaskReadyEstruct(void (MaquinaRefri::*task)(void), MaquinaRefri *newObject, int time, int priority)
{
/* Verifica se a prioridade é válida */
/* Verifica se sobre-escreve uma tarefa escalonada */
/* Escalona a tarefa */
taskToSchedule.priorityID = priority;
taskToSchedule.ptrObject = newObject;
taskToSchedule.task = task;
taskToSchedule.ready = 0;
taskToSchedule.delay = time;
taskToSchedule.period = time;
taskToSchedule.enabled = 1;
readyEstruct.insertionSort(taskToSchedule);
return 1;
}
//
//
//
int EscalonadorEstruct::removeTask(void (MaquinaRefri::*task)(void), MaquinaRefri *newObject)
{
readyEstruct.removeFirst();
return 1;
}
//
//
//
void EscalonadorEstruct::Run_RTC_SchedulerEstruct()
{ // Sempre executando
int i;
//GBL_run_scheduler = 1;
while (1)
{ // Laço infinito; verifica cada tarefa
if ((runningTask.task != NULL) &&
// Verifica se habilitada
(runningTask.enabled == 1) &&
// Verifica se está pronta para executar
(runningTask.ready == 1))
{ // se (task!=NULL & enable==1 & ready==1)
cout << "\n\n\t\tFLAG TEST: into RUN Scheduler <" << setfill('-') << setw(50) << "Execut function" << endl;
//(pT->*GBL_task_table[i].task)(); // Executa a tarefa
(runningTask.ptrObject->*runningTask.task)(); // <<<<<<<< Executa a tarefa
runningTask.ready = 0;
break;
} // if
tick_timer_intrStruct();
objTimer.start(1);
} // while 1
}
//
//
//
#pragma INTERRUPT tick_timer_intr
void EscalonadorEstruct::tick_timer_intrStruct(void)
{
//cout << "FLAG TEST: into tick_timer_intr 0000000" << endl;
//static char i;
int i;
//cout << "\t\tDelay task 0: " << setfill(' ') << setw(2) << runningTask.delay << endl;
//cout << "FLAG TEST: into tick_timer_intr for " << i << endl;
if ((runningTask.task != NULL) && //Se for escalonada
(runningTask.enabled == 1) &&
(runningTask.delay != 0))
{ // se (task!=NULL & enable==1 & delay!=0)
//cout << "FLAG TEST: into tick_timer_intr if 1 delay: " << GBL_task_table[i].delay << endl;
runningTask.delay--; // delay Decrementa
if (runningTask.delay == 0)
{
//cout << "FLAG TEST: into tick_timer_intr 2" << endl;
runningTask.ready = 1; // ready = 1
runningTask.delay = runningTask.period;
} // if delay == 0
} // if
}
//
//
//
void EscalonadorEstruct::schedulerStatesLogic()
{
int toStart;
switch (schedulerStates)
{
case 0: // created
//cout << "CREATED: Aperte tecla para iniciar: ";
//cin >> toStart;
schedulerStates = 2;
break;
case 1: // ready
//cout << "READY: aperte tecla para continuar: ";
//if (readyEstruct.readFirst().priorityID >= runningTask.priorityID) // if priReady > priRunning
schedulerStates = 2;
//cin >> toStart;
break;
case 2: // running
//cout << "RUNNING 1: state\n";
runningTask = readyEstruct.readFirst();
readyEstruct.removeFirst();
printf("\e[H\e[2J");
Run_RTC_SchedulerEstruct();
if (runningTask.ready == 0)// && runningTask.io_status == 0)
schedulerStates = 4;
// executing task
// while priRunning > priReady || delay > 0
// delay --
// if priRunning < pryReady && delay > 0
// schedulerStates = 1
// if delay == 0
// schedulerStates = 4
// if ???? para ir no waiting
break;
case 3: // waiting
break;
case 4: // terminated
cout << "TERMINATED: \n";
terminatedTask = runningTask;
schedulerStates = 2;
break;
default:
break;
}
}
/*
void EscalonadorEstruct::Run_RTC_Scheduler()
{ // Sempre executando
int i;
//GBL_run_scheduler = 1;
while (1)
{ // Laço infinito; verifica cada tarefa
for (i = 0; i < MAX_TASKS; i++)
{ // Se essa for uma tarefa escalonada valida
if ((GBL_task_table[i].task != NULL) &&
// Verifica se habilitada
(GBL_task_table[i].enabled == 1) &&
// Verifica se está pronta para executar
(GBL_task_table[i].ready == 1))
{ // se (task!=NULL & enable==1 & ready==1)
cout << "\n\n\t\tFLAG TEST: into RUN Scheduler <" << setfill('-') << setw(50) << "Execut function" << endl;
//(pT->*GBL_task_table[i].task)(); // Executa a tarefa
(GBL_task_table[i].ptrObject->*GBL_task_table[i].task)(); // Executa a tarefa
GBL_task_table[i].ready = 0;
break;
} // if
} // for i
tick_timer_intr();
objTimer.start(1);
} // while 1
}
*/
//
/*
void Escalonador::addTask(void (*task)(void), int time, int priority)
int EscalonadorEstruct::addTask(void (MaquinaRefri::*task)(void), MaquinaRefri *newObject, int time, int priority)
{
}
*/
//
//
//
//
//
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
/*
void EscalonadorEstruct::Enable_Task(int task_number)
{
GBL_task_table[task_number].enabled = 1;
}
*/
//
//
//
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
/*
void EscalonadorEstruct::Disable_Task(int task_number)
{
GBL_task_table[task_number].enabled = 0;
}
*/
//
//
/*declara uma função que será uma rotina de serviço
de interrupção (ISR - Interrupt Service Routine) de prioridade alta*/
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
/*
#pragma INTERRUPT tick_timer_intr
void EscalonadorEstruct::tick_timer_intr(void)
{
//cout << "FLAG TEST: into tick_timer_intr 0000000" << endl;
//static char i;
int i;
cout << "\t\tDelay task 0: " << setfill(' ') << setw(2) << GBL_task_table[0].delay;
cout << "\tDelay task 1: " << setfill(' ') << setw(2) << GBL_task_table[1].delay;
cout << "\tDelay task 2: " << GBL_task_table[2].delay << endl;
//cout << endl;
for (i = 0; i < MAX_TASKS; i++)
{
//cout << "FLAG TEST: into tick_timer_intr for " << i << endl;
if ((GBL_task_table[i].task != NULL) && //Se for escalonada
(GBL_task_table[i].enabled == 1) &&
(GBL_task_table[i].delay != 0))
{ // se (task!=NULL & enable==1 & delay!=0)
//cout << "FLAG TEST: into tick_timer_intr if 1 delay: " << GBL_task_table[i].delay << endl;
GBL_task_table[i].delay--; // delay Decrementa
if (GBL_task_table[i].delay == 0)
{
//cout << "FLAG TEST: into tick_timer_intr 2" << endl;
GBL_task_table[i].ready = 1; // ready = 1
GBL_task_table[i].delay = GBL_task_table[i].period;
} // if delay == 0
} // if
} // for
}
*/
//
//
//
//template<typename TYPEFUNC,typename TASKTYPE,typename OBJECTTYPE>
void EscalonadorEstruct::Request_Task_Run()
{
taskToSchedule.ready = 1;
}
//
//
//
// | [
"jlopezsa@gmail.com"
] | jlopezsa@gmail.com |
6e95a1d5585eabb74ab3aaca63f00d47e4a2c815 | b9b17fcfac43774e730ecf221bc26164598010b6 | /src/ncmdline.h | 85cf03f86fa4e7414fb082793ac98677692bc5f9 | [
"BSD-3-Clause"
] | permissive | taviso/mpgravity | e2334e77e9d5e9769e05d24609e4bbed00f23b5c | f6a2a7a02014b19047e44db76ae551bd689c16ac | refs/heads/master | 2023-07-26T00:49:37.297106 | 2020-04-24T06:15:10 | 2020-04-24T06:15:10 | 251,759,803 | 13 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,521 | h | /*****************************************************************************/
/* SOURCE CONTROL VERSIONS */
/*---------------------------------------------------------------------------*/
/* */
/* Version Date Time Author / Comment (optional) */
/* */
/* $Log: ncmdline.h,v $
/* Revision 1.1 2010/07/21 17:14:57 richard_wood
/* Initial checkin of V3.0.0 source code and other resources.
/* Initial code builds V3.0.0 RC1
/*
/* Revision 1.2 2009/07/26 15:54:59 richard_wood
/* Added import / export of news server.
/* Refactored import / export of database / settings.
/* Added command line import of news server.
/* Fixed crash on trace file use.
/* Tidied up source code in a few files.
/*
/* Revision 1.1 2009/06/09 13:21:29 richard_wood
/* *** empty log message ***
/*
/* Revision 1.2 2008/09/19 14:51:33 richard_wood
/* Updated for VS 2005
/*
/* */
/*****************************************************************************/
/**********************************************************************************
Copyright (c) 2003, Albert M. Choy
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of Microplanet, Inc. nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
POSSIBILITY OF SUCH DAMAGE.
**********************************************************************************/
#pragma once
class TNewsCommandLineInfo : public CCommandLineInfo
{
public:
TNewsCommandLineInfo();
~TNewsCommandLineInfo() {}
void ParseParam (LPCTSTR lpszParam, BOOL fFlag, BOOL bLast);
BOOL m_bLogStartup;
BOOL m_bSafeStart;
bool m_bNewsURL; // true if a Usenet (news: or nntp:) URL is here
CString m_strNewsURL;
bool m_bVCRFile; // true if VCR file is specified
CString m_strVCRFile;
bool m_bGSXFile;
CString m_strGSXFile;
};
| [
"taviso@gmail.com"
] | taviso@gmail.com |
db6c8e41dfb571b9a639583604b5a6d126af5a10 | e47f3bc67c0dbfa194e7ec57044a8e16f2410200 | /ReservasHotel/sources/habitacion.hpp | 8d915ef2264ed7755ae14d339db7988abf17d420 | [
"MIT"
] | permissive | rocammo/object-oriented-programming-i | 5afee2b05b7c6495562512b7dd0f53e43a71e69b | e1c7b4c060e843d9358b501ab64a4d83d8bf2f89 | refs/heads/master | 2020-04-28T01:44:58.695737 | 2019-03-10T21:04:29 | 2019-03-10T21:04:29 | 174,869,936 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 552 | hpp | /**
* habitacion.hpp
*
* @author: Rodrigo Casamayor <alu.89657@usj.es>
* @date: 14 ene. 2019
*/
#pragma once
class Habitacion {
private:
int plazas;
bool ocupada;
private:
long idHabitacion;
int numHabitacion;
public:
Habitacion();
int getPlazas() const;
void setPlazas(int plazas);
bool isOcupada() const;
void setOcupada(bool ocupada);
long getIdHabitacion() const;
void setIdHabitacion(int idHabitacion);
int getNumHabitacion() const;
void setNumHabitacion(int numHabitacion);
};
| [
"rodrigo.casamayor@gmail.com"
] | rodrigo.casamayor@gmail.com |
97289ac790d13a19f7ab578edcd3386a255569c8 | 48da32f6a426262cc2c8107f7e31c9d62ffb619b | /main.cpp | 24f64717060034bc945a928102953587ae3c8316 | [] | no_license | Garcia6l20/qtsignalgraph | afbeddcaa2a1dab3d0188aabf82e2c14601c3fcd | 3cd065a1bde9255f6a0dce733d69e858cf049557 | refs/heads/master | 2020-09-30T00:36:45.914262 | 2019-12-17T18:38:38 | 2019-12-17T18:38:38 | 227,157,779 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 276 | cpp | // Copyright (c) 2019 Schneider-Electric. All rights reserved.
// Licensed under the MIT license.
// See LICENSE file in the project root for full license information.
#include <iostream>
using namespace std;
int main()
{
cout << "Hello World!" << endl;
return 0;
}
| [
"garcia.6l20@gmail.com"
] | garcia.6l20@gmail.com |
890333a478a749b189477819261d9655c22a50dc | e5645099723739972ac8965819a6eb15e3d6d6b0 | /URI_Online_Judge/1136uri.cpp | cf199c1545eeac1f0c2bd6e953c1d3086f2a19bb | [] | no_license | arleyribeiro/Maratona | a3ab602bf025e4565a53af8c724f266fd7d0c989 | f60ae7f07d74e33683ea1b48e72770e3707e1874 | refs/heads/master | 2016-08-12T03:43:59.984403 | 2016-04-23T18:09:42 | 2016-04-23T18:09:42 | 55,017,237 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 495 | cpp | #include <bits/stdc++.h>
#define TAM 92
int main() {
int n=0,b=0,d;
while(scanf("%d %d",&n,&b)==2, n+b) {
int v[TAM]={0};
int bo[TAM]={0};
for(int i=0;i<b;i++) {
scanf("%d",&bo[i]); }
for(int i=0;i<b;i++){
for(int j=0;j<b;j++) {
d=abs(bo[i]-bo[j]);
if(!v[d]) {
v[d]=1;
}
}
}
int f=1;
for(int i=0;i<=n;i++){
if(!v[i]) {
f=0;
printf("N\n");
break;
}
}
if(f)
printf("Y\n");
}
return 0;
}
| [
"arley.sribeiro@gmail.com"
] | arley.sribeiro@gmail.com |
266d94774bcb32a0b78bb999ebfffa8fe0ea2b6b | baa9fffc817a2a993d4ecc774d3f277783308c20 | /test/gtest/common/googletest/gtest-matchers.h | f28d10eafabad8fc44fa11875d0ff72d9e24aed6 | [
"BSD-3-Clause"
] | permissive | openucx/ucx | 9a0f2205295afbdf3cff14b5d24af781b123f5ea | 73a48700badb7cbace64d94b82f408e2a26fca32 | refs/heads/master | 2023-09-01T16:51:26.913950 | 2023-09-01T13:02:25 | 2023-09-01T13:02:25 | 25,379,390 | 966 | 420 | NOASSERTION | 2023-09-14T12:29:35 | 2014-10-17T22:17:24 | C | UTF-8 | C++ | false | false | 27,021 | h | // Copyright 2007, Google Inc.
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
// * Redistributions in binary form must reproduce the above
// copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the
// distribution.
// * Neither the name of Google Inc. nor the names of its
// contributors may be used to endorse or promote products derived from
// this software without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// The Google C++ Testing and Mocking Framework (Google Test)
//
// This file implements just enough of the matcher interface to allow
// EXPECT_DEATH and friends to accept a matcher argument.
// IWYU pragma: private, include "testing/base/public/gunit.h"
// IWYU pragma: friend third_party/googletest/googlemock/.*
// IWYU pragma: friend third_party/googletest/googletest/.*
#ifndef GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
#define GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
#include <memory>
#include <ostream>
#include <string>
#include <type_traits>
#include "gtest-printers.h"
#include "internal/gtest-internal.h"
#include "internal/gtest-port.h"
// MSVC warning C5046 is new as of VS2017 version 15.8.
#if defined(_MSC_VER) && _MSC_VER >= 1915
#define GTEST_MAYBE_5046_ 5046
#else
#define GTEST_MAYBE_5046_
#endif
GTEST_DISABLE_MSC_WARNINGS_PUSH_(
4251 GTEST_MAYBE_5046_ /* class A needs to have dll-interface to be used by
clients of class B */
/* Symbol involving type with internal linkage not defined */)
namespace testing {
// To implement a matcher Foo for type T, define:
// 1. a class FooMatcherImpl that implements the
// MatcherInterface<T> interface, and
// 2. a factory function that creates a Matcher<T> object from a
// FooMatcherImpl*.
//
// The two-level delegation design makes it possible to allow a user
// to write "v" instead of "Eq(v)" where a Matcher is expected, which
// is impossible if we pass matchers by pointers. It also eases
// ownership management as Matcher objects can now be copied like
// plain values.
// MatchResultListener is an abstract class. Its << operator can be
// used by a matcher to explain why a value matches or doesn't match.
//
class MatchResultListener {
public:
// Creates a listener object with the given underlying ostream. The
// listener does not own the ostream, and does not dereference it
// in the constructor or destructor.
explicit MatchResultListener(::std::ostream* os) : stream_(os) {}
virtual ~MatchResultListener() = 0; // Makes this class abstract.
// Streams x to the underlying ostream; does nothing if the ostream
// is NULL.
template <typename T>
MatchResultListener& operator<<(const T& x) {
if (stream_ != nullptr) *stream_ << x;
return *this;
}
// Returns the underlying ostream.
::std::ostream* stream() { return stream_; }
// Returns true if and only if the listener is interested in an explanation
// of the match result. A matcher's MatchAndExplain() method can use
// this information to avoid generating the explanation when no one
// intends to hear it.
bool IsInterested() const { return stream_ != nullptr; }
private:
::std::ostream* const stream_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatchResultListener);
};
inline MatchResultListener::~MatchResultListener() {
}
// An instance of a subclass of this knows how to describe itself as a
// matcher.
class MatcherDescriberInterface {
public:
virtual ~MatcherDescriberInterface() {}
// Describes this matcher to an ostream. The function should print
// a verb phrase that describes the property a value matching this
// matcher should have. The subject of the verb phrase is the value
// being matched. For example, the DescribeTo() method of the Gt(7)
// matcher prints "is greater than 7".
virtual void DescribeTo(::std::ostream* os) const = 0;
// Describes the negation of this matcher to an ostream. For
// example, if the description of this matcher is "is greater than
// 7", the negated description could be "is not greater than 7".
// You are not required to override this when implementing
// MatcherInterface, but it is highly advised so that your matcher
// can produce good error messages.
virtual void DescribeNegationTo(::std::ostream* os) const {
*os << "not (";
DescribeTo(os);
*os << ")";
}
};
// The implementation of a matcher.
template <typename T>
class MatcherInterface : public MatcherDescriberInterface {
public:
// Returns true if and only if the matcher matches x; also explains the
// match result to 'listener' if necessary (see the next paragraph), in
// the form of a non-restrictive relative clause ("which ...",
// "whose ...", etc) that describes x. For example, the
// MatchAndExplain() method of the Pointee(...) matcher should
// generate an explanation like "which points to ...".
//
// Implementations of MatchAndExplain() should add an explanation of
// the match result *if and only if* they can provide additional
// information that's not already present (or not obvious) in the
// print-out of x and the matcher's description. Whether the match
// succeeds is not a factor in deciding whether an explanation is
// needed, as sometimes the caller needs to print a failure message
// when the match succeeds (e.g. when the matcher is used inside
// Not()).
//
// For example, a "has at least 10 elements" matcher should explain
// what the actual element count is, regardless of the match result,
// as it is useful information to the reader; on the other hand, an
// "is empty" matcher probably only needs to explain what the actual
// size is when the match fails, as it's redundant to say that the
// size is 0 when the value is already known to be empty.
//
// You should override this method when defining a new matcher.
//
// It's the responsibility of the caller (Google Test) to guarantee
// that 'listener' is not NULL. This helps to simplify a matcher's
// implementation when it doesn't care about the performance, as it
// can talk to 'listener' without checking its validity first.
// However, in order to implement dummy listeners efficiently,
// listener->stream() may be NULL.
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const = 0;
// Inherits these methods from MatcherDescriberInterface:
// virtual void DescribeTo(::std::ostream* os) const = 0;
// virtual void DescribeNegationTo(::std::ostream* os) const;
};
namespace internal {
// Converts a MatcherInterface<T> to a MatcherInterface<const T&>.
template <typename T>
class MatcherInterfaceAdapter : public MatcherInterface<const T&> {
public:
explicit MatcherInterfaceAdapter(const MatcherInterface<T>* impl)
: impl_(impl) {}
~MatcherInterfaceAdapter() override { delete impl_; }
void DescribeTo(::std::ostream* os) const override { impl_->DescribeTo(os); }
void DescribeNegationTo(::std::ostream* os) const override {
impl_->DescribeNegationTo(os);
}
bool MatchAndExplain(const T& x,
MatchResultListener* listener) const override {
return impl_->MatchAndExplain(x, listener);
}
private:
const MatcherInterface<T>* const impl_;
GTEST_DISALLOW_COPY_AND_ASSIGN_(MatcherInterfaceAdapter);
};
struct AnyEq {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a == b; }
};
struct AnyNe {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a != b; }
};
struct AnyLt {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a < b; }
};
struct AnyGt {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a > b; }
};
struct AnyLe {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a <= b; }
};
struct AnyGe {
template <typename A, typename B>
bool operator()(const A& a, const B& b) const { return a >= b; }
};
// A match result listener that ignores the explanation.
class DummyMatchResultListener : public MatchResultListener {
public:
DummyMatchResultListener() : MatchResultListener(nullptr) {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(DummyMatchResultListener);
};
// A match result listener that forwards the explanation to a given
// ostream. The difference between this and MatchResultListener is
// that the former is concrete.
class StreamMatchResultListener : public MatchResultListener {
public:
explicit StreamMatchResultListener(::std::ostream* os)
: MatchResultListener(os) {}
private:
GTEST_DISALLOW_COPY_AND_ASSIGN_(StreamMatchResultListener);
};
// An internal class for implementing Matcher<T>, which will derive
// from it. We put functionalities common to all Matcher<T>
// specializations here to avoid code duplication.
template <typename T>
class MatcherBase {
public:
// Returns true if and only if the matcher matches x; also explains the
// match result to 'listener'.
bool MatchAndExplain(const T& x, MatchResultListener* listener) const {
return impl_->MatchAndExplain(x, listener);
}
// Returns true if and only if this matcher matches x.
bool Matches(const T& x) const {
DummyMatchResultListener dummy;
return MatchAndExplain(x, &dummy);
}
// Describes this matcher to an ostream.
void DescribeTo(::std::ostream* os) const { impl_->DescribeTo(os); }
// Describes the negation of this matcher to an ostream.
void DescribeNegationTo(::std::ostream* os) const {
impl_->DescribeNegationTo(os);
}
// Explains why x matches, or doesn't match, the matcher.
void ExplainMatchResultTo(const T& x, ::std::ostream* os) const {
StreamMatchResultListener listener(os);
MatchAndExplain(x, &listener);
}
// Returns the describer for this matcher object; retains ownership
// of the describer, which is only guaranteed to be alive when
// this matcher object is alive.
const MatcherDescriberInterface* GetDescriber() const {
return impl_.get();
}
protected:
MatcherBase() {}
// Constructs a matcher from its implementation.
explicit MatcherBase(const MatcherInterface<const T&>* impl) : impl_(impl) {}
template <typename U>
explicit MatcherBase(
const MatcherInterface<U>* impl,
typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
nullptr)
: impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {}
MatcherBase(const MatcherBase&) = default;
MatcherBase& operator=(const MatcherBase&) = default;
MatcherBase(MatcherBase&&) = default;
MatcherBase& operator=(MatcherBase&&) = default;
virtual ~MatcherBase() {}
private:
std::shared_ptr<const MatcherInterface<const T&>> impl_;
};
} // namespace internal
// A Matcher<T> is a copyable and IMMUTABLE (except by assignment)
// object that can check whether a value of type T matches. The
// implementation of Matcher<T> is just a std::shared_ptr to const
// MatcherInterface<T>. Don't inherit from Matcher!
template <typename T>
class Matcher : public internal::MatcherBase<T> {
public:
// Constructs a null matcher. Needed for storing Matcher objects in STL
// containers. A default-constructed matcher is not yet initialized. You
// cannot use it until a valid value has been assigned to it.
explicit Matcher() {} // NOLINT
// Constructs a matcher from its implementation.
explicit Matcher(const MatcherInterface<const T&>* impl)
: internal::MatcherBase<T>(impl) {}
template <typename U>
explicit Matcher(
const MatcherInterface<U>* impl,
typename std::enable_if<!std::is_same<U, const U&>::value>::type* =
nullptr)
: internal::MatcherBase<T>(impl) {}
// Implicit constructor here allows people to write
// EXPECT_CALL(foo, Bar(5)) instead of EXPECT_CALL(foo, Bar(Eq(5))) sometimes
Matcher(T value); // NOLINT
};
// The following two specializations allow the user to write str
// instead of Eq(str) and "foo" instead of Eq("foo") when a std::string
// matcher is expected.
template <>
class GTEST_API_ Matcher<const std::string&>
: public internal::MatcherBase<const std::string&> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<const std::string&>* impl)
: internal::MatcherBase<const std::string&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a std::string object.
Matcher(const std::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
};
template <>
class GTEST_API_ Matcher<std::string>
: public internal::MatcherBase<std::string> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<const std::string&>* impl)
: internal::MatcherBase<std::string>(impl) {}
explicit Matcher(const MatcherInterface<std::string>* impl)
: internal::MatcherBase<std::string>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a string object.
Matcher(const std::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
};
#if GTEST_HAS_ABSL
// The following two specializations allow the user to write str
// instead of Eq(str) and "foo" instead of Eq("foo") when a absl::string_view
// matcher is expected.
template <>
class GTEST_API_ Matcher<const absl::string_view&>
: public internal::MatcherBase<const absl::string_view&> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
: internal::MatcherBase<const absl::string_view&>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a std::string object.
Matcher(const std::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
// Allows the user to pass absl::string_views directly.
Matcher(absl::string_view s); // NOLINT
};
template <>
class GTEST_API_ Matcher<absl::string_view>
: public internal::MatcherBase<absl::string_view> {
public:
Matcher() {}
explicit Matcher(const MatcherInterface<const absl::string_view&>* impl)
: internal::MatcherBase<absl::string_view>(impl) {}
explicit Matcher(const MatcherInterface<absl::string_view>* impl)
: internal::MatcherBase<absl::string_view>(impl) {}
// Allows the user to write str instead of Eq(str) sometimes, where
// str is a std::string object.
Matcher(const std::string& s); // NOLINT
// Allows the user to write "foo" instead of Eq("foo") sometimes.
Matcher(const char* s); // NOLINT
// Allows the user to pass absl::string_views directly.
Matcher(absl::string_view s); // NOLINT
};
#endif // GTEST_HAS_ABSL
// Prints a matcher in a human-readable format.
template <typename T>
std::ostream& operator<<(std::ostream& os, const Matcher<T>& matcher) {
matcher.DescribeTo(&os);
return os;
}
// The PolymorphicMatcher class template makes it easy to implement a
// polymorphic matcher (i.e. a matcher that can match values of more
// than one type, e.g. Eq(n) and NotNull()).
//
// To define a polymorphic matcher, a user should provide an Impl
// class that has a DescribeTo() method and a DescribeNegationTo()
// method, and define a member function (or member function template)
//
// bool MatchAndExplain(const Value& value,
// MatchResultListener* listener) const;
//
// See the definition of NotNull() for a complete example.
template <class Impl>
class PolymorphicMatcher {
public:
explicit PolymorphicMatcher(const Impl& an_impl) : impl_(an_impl) {}
// Returns a mutable reference to the underlying matcher
// implementation object.
Impl& mutable_impl() { return impl_; }
// Returns an immutable reference to the underlying matcher
// implementation object.
const Impl& impl() const { return impl_; }
template <typename T>
operator Matcher<T>() const {
return Matcher<T>(new MonomorphicImpl<const T&>(impl_));
}
private:
template <typename T>
class MonomorphicImpl : public MatcherInterface<T> {
public:
explicit MonomorphicImpl(const Impl& impl) : impl_(impl) {}
virtual void DescribeTo(::std::ostream* os) const { impl_.DescribeTo(os); }
virtual void DescribeNegationTo(::std::ostream* os) const {
impl_.DescribeNegationTo(os);
}
virtual bool MatchAndExplain(T x, MatchResultListener* listener) const {
return impl_.MatchAndExplain(x, listener);
}
private:
const Impl impl_;
};
Impl impl_;
};
// Creates a matcher from its implementation.
// DEPRECATED: Especially in the generic code, prefer:
// Matcher<T>(new MyMatcherImpl<const T&>(...));
//
// MakeMatcher may create a Matcher that accepts its argument by value, which
// leads to unnecessary copies & lack of support for non-copyable types.
template <typename T>
inline Matcher<T> MakeMatcher(const MatcherInterface<T>* impl) {
return Matcher<T>(impl);
}
// Creates a polymorphic matcher from its implementation. This is
// easier to use than the PolymorphicMatcher<Impl> constructor as it
// doesn't require you to explicitly write the template argument, e.g.
//
// MakePolymorphicMatcher(foo);
// vs
// PolymorphicMatcher<TypeOfFoo>(foo);
template <class Impl>
inline PolymorphicMatcher<Impl> MakePolymorphicMatcher(const Impl& impl) {
return PolymorphicMatcher<Impl>(impl);
}
namespace internal {
// Implements a matcher that compares a given value with a
// pre-supplied value using one of the ==, <=, <, etc, operators. The
// two values being compared don't have to have the same type.
//
// The matcher defined here is polymorphic (for example, Eq(5) can be
// used to match an int, a short, a double, etc). Therefore we use
// a template type conversion operator in the implementation.
//
// The following template definition assumes that the Rhs parameter is
// a "bare" type (i.e. neither 'const T' nor 'T&').
template <typename D, typename Rhs, typename Op>
class ComparisonBase {
public:
explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
template <typename Lhs>
operator Matcher<Lhs>() const {
return Matcher<Lhs>(new Impl<const Lhs&>(rhs_));
}
private:
template <typename T>
static const T& Unwrap(const T& v) { return v; }
template <typename T>
static const T& Unwrap(std::reference_wrapper<T> v) { return v; }
template <typename Lhs, typename = Rhs>
class Impl : public MatcherInterface<Lhs> {
public:
explicit Impl(const Rhs& rhs) : rhs_(rhs) {}
bool MatchAndExplain(Lhs lhs,
MatchResultListener* /* listener */) const override {
return Op()(lhs, Unwrap(rhs_));
}
void DescribeTo(::std::ostream* os) const override {
*os << D::Desc() << " ";
UniversalPrint(Unwrap(rhs_), os);
}
void DescribeNegationTo(::std::ostream* os) const override {
*os << D::NegatedDesc() << " ";
UniversalPrint(Unwrap(rhs_), os);
}
private:
Rhs rhs_;
};
Rhs rhs_;
};
template <typename Rhs>
class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {
public:
explicit EqMatcher(const Rhs& rhs)
: ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq>(rhs) { }
static const char* Desc() { return "is equal to"; }
static const char* NegatedDesc() { return "isn't equal to"; }
};
template <typename Rhs>
class NeMatcher : public ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe> {
public:
explicit NeMatcher(const Rhs& rhs)
: ComparisonBase<NeMatcher<Rhs>, Rhs, AnyNe>(rhs) { }
static const char* Desc() { return "isn't equal to"; }
static const char* NegatedDesc() { return "is equal to"; }
};
template <typename Rhs>
class LtMatcher : public ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt> {
public:
explicit LtMatcher(const Rhs& rhs)
: ComparisonBase<LtMatcher<Rhs>, Rhs, AnyLt>(rhs) { }
static const char* Desc() { return "is <"; }
static const char* NegatedDesc() { return "isn't <"; }
};
template <typename Rhs>
class GtMatcher : public ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt> {
public:
explicit GtMatcher(const Rhs& rhs)
: ComparisonBase<GtMatcher<Rhs>, Rhs, AnyGt>(rhs) { }
static const char* Desc() { return "is >"; }
static const char* NegatedDesc() { return "isn't >"; }
};
template <typename Rhs>
class LeMatcher : public ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe> {
public:
explicit LeMatcher(const Rhs& rhs)
: ComparisonBase<LeMatcher<Rhs>, Rhs, AnyLe>(rhs) { }
static const char* Desc() { return "is <="; }
static const char* NegatedDesc() { return "isn't <="; }
};
template <typename Rhs>
class GeMatcher : public ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe> {
public:
explicit GeMatcher(const Rhs& rhs)
: ComparisonBase<GeMatcher<Rhs>, Rhs, AnyGe>(rhs) { }
static const char* Desc() { return "is >="; }
static const char* NegatedDesc() { return "isn't >="; }
};
// Implements polymorphic matchers MatchesRegex(regex) and
// ContainsRegex(regex), which can be used as a Matcher<T> as long as
// T can be converted to a string.
class MatchesRegexMatcher {
public:
MatchesRegexMatcher(const RE* regex, bool full_match)
: regex_(regex), full_match_(full_match) {}
#if GTEST_HAS_ABSL
bool MatchAndExplain(const absl::string_view& s,
MatchResultListener* listener) const {
return MatchAndExplain(std::string(s), listener);
}
#endif // GTEST_HAS_ABSL
// Accepts pointer types, particularly:
// const char*
// char*
// const wchar_t*
// wchar_t*
template <typename CharType>
bool MatchAndExplain(CharType* s, MatchResultListener* listener) const {
return s != nullptr && MatchAndExplain(std::string(s), listener);
}
// Matches anything that can convert to std::string.
//
// This is a template, not just a plain function with const std::string&,
// because absl::string_view has some interfering non-explicit constructors.
template <class MatcheeStringType>
bool MatchAndExplain(const MatcheeStringType& s,
MatchResultListener* /* listener */) const {
const std::string& s2(s);
return full_match_ ? RE::FullMatch(s2, *regex_)
: RE::PartialMatch(s2, *regex_);
}
void DescribeTo(::std::ostream* os) const {
*os << (full_match_ ? "matches" : "contains") << " regular expression ";
UniversalPrinter<std::string>::Print(regex_->pattern(), os);
}
void DescribeNegationTo(::std::ostream* os) const {
*os << "doesn't " << (full_match_ ? "match" : "contain")
<< " regular expression ";
UniversalPrinter<std::string>::Print(regex_->pattern(), os);
}
private:
const std::shared_ptr<const RE> regex_;
const bool full_match_;
};
} // namespace internal
// Matches a string that fully matches regular expression 'regex'.
// The matcher takes ownership of 'regex'.
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
const internal::RE* regex) {
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, true));
}
inline PolymorphicMatcher<internal::MatchesRegexMatcher> MatchesRegex(
const std::string& regex) {
return MatchesRegex(new internal::RE(regex));
}
// Matches a string that contains regular expression 'regex'.
// The matcher takes ownership of 'regex'.
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
const internal::RE* regex) {
return MakePolymorphicMatcher(internal::MatchesRegexMatcher(regex, false));
}
inline PolymorphicMatcher<internal::MatchesRegexMatcher> ContainsRegex(
const std::string& regex) {
return ContainsRegex(new internal::RE(regex));
}
// Creates a polymorphic matcher that matches anything equal to x.
// Note: if the parameter of Eq() were declared as const T&, Eq("foo")
// wouldn't compile.
template <typename T>
inline internal::EqMatcher<T> Eq(T x) { return internal::EqMatcher<T>(x); }
// Constructs a Matcher<T> from a 'value' of type T. The constructed
// matcher matches any value that's equal to 'value'.
template <typename T>
Matcher<T>::Matcher(T value) { *this = Eq(value); }
// Creates a monomorphic matcher that matches anything with type Lhs
// and equal to rhs. A user may need to use this instead of Eq(...)
// in order to resolve an overloading ambiguity.
//
// TypedEq<T>(x) is just a convenient short-hand for Matcher<T>(Eq(x))
// or Matcher<T>(x), but more readable than the latter.
//
// We could define similar monomorphic matchers for other comparison
// operations (e.g. TypedLt, TypedGe, and etc), but decided not to do
// it yet as those are used much less than Eq() in practice. A user
// can always write Matcher<T>(Lt(5)) to be explicit about the type,
// for example.
template <typename Lhs, typename Rhs>
inline Matcher<Lhs> TypedEq(const Rhs& rhs) { return Eq(rhs); }
// Creates a polymorphic matcher that matches anything >= x.
template <typename Rhs>
inline internal::GeMatcher<Rhs> Ge(Rhs x) {
return internal::GeMatcher<Rhs>(x);
}
// Creates a polymorphic matcher that matches anything > x.
template <typename Rhs>
inline internal::GtMatcher<Rhs> Gt(Rhs x) {
return internal::GtMatcher<Rhs>(x);
}
// Creates a polymorphic matcher that matches anything <= x.
template <typename Rhs>
inline internal::LeMatcher<Rhs> Le(Rhs x) {
return internal::LeMatcher<Rhs>(x);
}
// Creates a polymorphic matcher that matches anything < x.
template <typename Rhs>
inline internal::LtMatcher<Rhs> Lt(Rhs x) {
return internal::LtMatcher<Rhs>(x);
}
// Creates a polymorphic matcher that matches anything != x.
template <typename Rhs>
inline internal::NeMatcher<Rhs> Ne(Rhs x) {
return internal::NeMatcher<Rhs>(x);
}
} // namespace testing
GTEST_DISABLE_MSC_WARNINGS_POP_() // 4251 5046
#endif // GTEST_INCLUDE_GTEST_GTEST_MATCHERS_H_
| [
"lgenkin@nvidia.com"
] | lgenkin@nvidia.com |
18bfb159b1f6190a516119da4d34b3468af048d6 | b54847ee4898fb3272a38daabf60d1a02646dd05 | /exams/exam_part2/Button.h | b87b74fd22cde26e886581b871293249c483d61c | [] | no_license | IvanFilipov/FMI-OOP | 4d7b97e92b14949d6edf269bedef95d0b86ed97d | 92a8c5a8cf1e73f3da640928c46965affba7e57e | refs/heads/master | 2023-04-21T10:13:18.911124 | 2018-06-05T10:57:08 | 2018-06-05T10:57:08 | 52,727,858 | 19 | 9 | null | 2023-04-06T23:14:31 | 2016-02-28T15:27:39 | C++ | UTF-8 | C++ | false | false | 231 | h | #pragma once
#include "Element.h"
class Button : public Element{
public:
Button(const char*);
Button(const Button&);
Button& operator= (const Button&);
virtual const char* convertToHtml();
virtual Element* clone();
};
| [
"vanaka1189@gmail.com"
] | vanaka1189@gmail.com |
3b23f675a82d35706ba8b2400b39b40fee517ab6 | 2112057af069a78e75adfd244a3f5b224fbab321 | /branches/ref1/src-root/src/common/world/client_zone.cpp | 0f6076b8fb3308af47100ffb40c7b2d1bfa35067 | [] | no_license | blockspacer/ireon | 120bde79e39fb107c961697985a1fe4cb309bd81 | a89fa30b369a0b21661c992da2c4ec1087aac312 | refs/heads/master | 2023-04-15T00:22:02.905112 | 2010-01-07T20:31:07 | 2010-01-07T20:31:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,274 | cpp | /**
* @file client_zone.cpp
* Client-side zone class
*/
/* Copyright (C) 2005 ireon.org developers council
* $Id$
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
* 02110-1301, USA.
*/
#include "stdafx.h"
#include "world/client_zone.h"
#include "world/client_static.h"
#include "resource/resource_manager.h"
CClientZone::CClientZone()
{
};
CClientZone::~CClientZone()
{
};
bool CClientZone::load(const String& resourceName)
{
CLog::instance()->log(CLog::msgFlagResources,CLog::msgLvlInfo,"Loading zone from '%s'.\n",resourceName.c_str());
DataPtr dPtr = CResourceManager::instance()->load(resourceName);
if( !dPtr )
{
CLog::instance()->log(CLog::msgLvlError,"Error loading zone: resource not found.\n",resourceName.c_str());
return false;
}
TiXmlDocument doc;
std::stringstream buf;
buf.write(dPtr->data(),dPtr->size());
buf >> doc;
if (doc.Error())
{
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlError, _("Error loading zone: XML parser returned an error: %s\n"), doc.ErrorDesc());
return false;
}
TiXmlNode* root = doc.FirstChild();
while( root && root->Type() == TiXmlNode::DECLARATION )
root = root->NextSibling();
if( !root || root->Type() != TiXmlNode::ELEMENT || strcmp(root->ToElement()->Value(),"Zone") )
{
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlError, _("Error loading zone: resource isn't zone. %s\n"),root->Value());
return false;
};
TiXmlNode* option;
for( option = root->FirstChild(); option; option = option->NextSibling() )
if( !processOption(option) )
{
CLog::instance()->log(CLog::msgFlagResources, CLog::msgLvlError, _("Error loading zone: error in file near '%s'.\n"),option->Value());
return false;
};
return true;
};
bool CClientZone::processOption(TiXmlNode* option)
{
if( !option )
return false;
if( !option->Type() == TiXmlNode::ELEMENT )
return true;
const char* name = option->Value();
if( !strcmp(name,"Static") )
{
if( !processStatic(option) )
return false;
}
else
{
return false;
}
return true;
};
bool CClientZone::processStatic(TiXmlNode *node)
{
TiXmlAttribute* attr = node->ToElement()->FirstAttribute();
StaticPtr st;
while( attr )
{
if( !attr || !attr->Name() || !attr->Value() )
return false;
if( !st )
{
if( !strcmp(attr->Name(),"Name") )
{
StaticPrototypePtr prot = I_WORLD->getStaticPrototype(attr->Value());
if( prot )
st.reset( new CClientStaticObject(prot) );
} else if( !strcmp(attr->Name(),"Id") )
{
StaticPrototypePtr prot = I_WORLD->getStaticPrototype(StringConverter::parseLong(attr->Value()));
if( prot )
st.reset( new CClientStaticObject(prot) );
}
} else
{
if( !strcmp(attr->Name(),"Position") )
{
StringVector vec = StringConverter::parseStringVector(attr->Value());
if( vec.size() < 3 )
return false;
Vector3 pos;
pos.x = StringConverter::parseReal(vec[0]);
pos.y = StringConverter::parseReal(vec[1]);
pos.z = StringConverter::parseReal(vec[2]);
st->setPosition(pos);
} else if( !strcmp(attr->Name(),"Rotation") )
{
Radian rot;
rot = Radian(StringConverter::parseReal(attr->Value()));
st->setRotation(rot);
}
}
attr = attr->Next();
}
if( st)
{
m_statics.push_back(st);
I_WORLD->addStatic(st);
}
return true;
};
void CClientZone::unload()
{
for( std::vector<StaticPtr>::iterator it = m_statics.begin(); it != m_statics.end(); ++it )
I_WORLD->removeStatic(*it);
}; | [
"psavichev@gmail.com"
] | psavichev@gmail.com |
25ed7c4738159902023acc11edec4cb66ebad103 | db04ecf258aef8a187823b8e47f4a1ae908e5897 | /Cplus/LastMomentBeforeAllAntsFallOutofaPlank.cpp | 03a60ce5fb3324f2e9ee69a7d4c4f3bf5e1c5e94 | [
"MIT"
] | permissive | JumHorn/leetcode | 9612a26e531ceae7f25e2a749600632da6882075 | abf145686dcfac860b0f6b26a04e3edd133b238c | refs/heads/master | 2023-08-03T21:12:13.945602 | 2023-07-30T07:00:50 | 2023-07-30T07:00:50 | 74,735,489 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 405 | cpp | #include <algorithm>
#include <vector>
using namespace std;
class Solution
{
public:
int getLastMoment(int n, vector<int> &left, vector<int> &right)
{
int res = 0, l = 0, r = 0;
if (!left.empty())
{
l = *max_element(left.begin(), left.end());
res = max(res, l);
}
if (!right.empty())
{
r = *min_element(right.begin(), right.end());
res = max(res, n - r);
}
return res;
}
}; | [
"JumHorn@gmail.com"
] | JumHorn@gmail.com |
32aba7c26130efcbfb2358267d8900a725353ffb | 4bc40d60c146300030512b11e375cb8abbf2f5b3 | /LiteX/software/Doom/mc1-doom/src/i_video_mc1.c | 2a236239853956be6fd01e54612d3112cdc7efe5 | [
"BSD-3-Clause",
"GPL-1.0-or-later",
"LicenseRef-scancode-proprietary-license"
] | permissive | BrunoLevy/learn-fpga | fd18ea8a67cfc46d29fac9ad417ae7990b135118 | fd954b06f6dc57ee042d0c82e9418e83c4b261b4 | refs/heads/master | 2023-08-23T06:15:43.195975 | 2023-08-04T06:41:22 | 2023-08-04T06:41:22 | 267,350,664 | 2,036 | 191 | BSD-3-Clause | 2023-06-23T13:41:44 | 2020-05-27T15:04:05 | C++ | UTF-8 | C++ | false | false | 11,164 | c | // Emacs style mode select -*- C++ -*-
//-----------------------------------------------------------------------------
//
// Copyright (C) 1993-1996 by id Software, Inc.
// Copyright (C) 2020 by Marcus Geelnard
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// DESCRIPTION:
// Dummy system interface for video.
//
//-----------------------------------------------------------------------------
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <mr32intrin.h>
#include "doomdef.h"
#include "d_event.h"
#include "d_main.h"
#include "i_system.h"
#include "i_video.h"
#include "v_video.h"
#include "mc1.h"
// Video buffers.
static byte* s_vcp;
static byte* s_palette;
static byte* s_framebuffer;
// Pointers for the custom VRAM allocator.
static byte* s_vram_alloc_ptr;
static byte* s_vram_alloc_end;
static void MC1_AllocInit (void)
{
// We assume that the Doom binary is loaded into XRAM (0x80000000...), or
// into the "ROM" (0x00000000...) for the simulator, and that it has
// complete ownership of VRAM (0x40000000...).
s_vram_alloc_ptr = (byte*)0x40000100;
s_vram_alloc_end = (byte*)(0x40000000 + GET_MMIO (VRAMSIZE));
}
static byte* MC1_VRAM_Alloc (const size_t bytes)
{
// Check if there is enough room.
byte* ptr = s_vram_alloc_ptr;
byte* new_ptr = ptr + bytes;
if (new_ptr > s_vram_alloc_end)
return NULL;
// Align the next allocation slot to a 32 byte boundary.
if ((((size_t)new_ptr) & 31) != 0)
new_ptr += 32U - (((size_t)new_ptr) & 31);
s_vram_alloc_ptr = new_ptr;
return ptr;
}
static byte* MC1_Alloc (const size_t bytes)
{
// Prefer VRAM (for speed).
byte* ptr = MC1_VRAM_Alloc (bytes);
if (ptr == NULL)
ptr = (byte*)malloc (bytes);
return ptr;
}
static int MC1_IsVRAMPtr (const byte* ptr)
{
return ptr >= (byte*)0x40000000 && ptr < (byte*)0x80000000;
}
static void MC1_Free (byte* ptr)
{
// We can't free VRAM pointers.
if (!MC1_IsVRAMPtr (ptr))
free (ptr);
}
static void I_MC1_CreateVCP (void)
{
// Get the native video signal resolution and calculate the scaling factors.
unsigned native_width = GET_MMIO (VIDWIDTH);
unsigned native_height = GET_MMIO (VIDHEIGHT);
unsigned xincr = ((native_width - 1) << 16) / (SCREENWIDTH - 1);
unsigned yincr = ((native_height - 1) << 16) / (SCREENHEIGHT - 1);
// Frame configuraiton.
unsigned* vcp = (unsigned*)s_vcp;
*vcp++ = VCP_SETREG (VCR_XINCR, xincr);
*vcp++ = VCP_SETREG (VCR_CMODE, CMODE_PAL8);
*vcp++ = VCP_JSR (s_palette);
// Generate lines.
unsigned y = 0;
unsigned addr = (unsigned)s_framebuffer;
for (int i = 0; i < SCREENHEIGHT; ++i)
{
if (i == 0)
*vcp++ = VCP_SETREG (VCR_HSTOP, native_width);
*vcp++ = VCP_WAITY (y >> 16);
*vcp++ = VCP_SETREG (VCR_ADDR, VCP_TOVCPADDR (addr));
addr += SCREENWIDTH;
y += yincr;
}
// End of frame (wait forever).
*vcp = VCP_WAITY (32767);
// Palette.
unsigned* palette = (unsigned*)s_palette;
*palette++ = VCP_SETPAL (0, 256);
palette += 256;
*palette = VCP_RTS;
// Configure the main layer 1 VCP to call our VCP.
*((unsigned*)0x40000008) = VCP_JMP (s_vcp);
// The layer 2 VCP should do nothing.
*((unsigned*)0x40000010) = VCP_WAITY (32767);
}
static int I_MC1_TranslateKey (unsigned keycode)
{
// clang-format off
switch (keycode)
{
case KB_SPACE: return ' ';
case KB_LEFT: return KEY_LEFTARROW;
case KB_RIGHT: return KEY_RIGHTARROW;
case KB_DOWN: return KEY_DOWNARROW;
case KB_UP: return KEY_UPARROW;
case KB_ESC: return KEY_ESCAPE;
case KB_ENTER: return KEY_ENTER;
case KB_TAB: return KEY_TAB;
case KB_F1: return KEY_F1;
case KB_F2: return KEY_F2;
case KB_F3: return KEY_F3;
case KB_F4: return KEY_F4;
case KB_F5: return KEY_F5;
case KB_F6: return KEY_F6;
case KB_F7: return KEY_F7;
case KB_F8: return KEY_F8;
case KB_F9: return KEY_F9;
case KB_F10: return KEY_F10;
case KB_F11: return KEY_F11;
case KB_F12: return KEY_F12;
case KB_DEL:
case KB_BACKSPACE: return KEY_BACKSPACE;
case KB_MM_PLAY_PAUSE: return KEY_PAUSE;
case KB_KP_PLUS: return KEY_EQUALS;
case KB_KP_MINUS: return KEY_MINUS;
case KB_LSHIFT:
case KB_RSHIFT: return KEY_RSHIFT;
case KB_LCTRL:
case KB_RCTRL: return KEY_RCTRL;
case KB_LALT:
case KB_LMETA:
case KB_RALT:
case KB_RMETA: return KEY_RALT;
case KB_A: return 'a';
case KB_B: return 'b';
case KB_C: return 'c';
case KB_D: return 'd';
case KB_E: return 'e';
case KB_F: return 'f';
case KB_G: return 'g';
case KB_H: return 'h';
case KB_I: return 'i';
case KB_J: return 'j';
case KB_K: return 'k';
case KB_L: return 'l';
case KB_M: return 'm';
case KB_N: return 'n';
case KB_O: return 'o';
case KB_P: return 'p';
case KB_Q: return 'q';
case KB_R: return 'r';
case KB_S: return 's';
case KB_T: return 't';
case KB_U: return 'u';
case KB_V: return 'v';
case KB_W: return 'w';
case KB_X: return 'x';
case KB_Y: return 'y';
case KB_Z: return 'z';
case KB_0: return '0';
case KB_1: return '1';
case KB_2: return '2';
case KB_3: return '3';
case KB_4: return '4';
case KB_5: return '5';
case KB_6: return '6';
case KB_7: return '7';
case KB_8: return '8';
case KB_9: return '9';
default:
return 0;
}
// clang-format on
}
static unsigned s_keyptr;
static boolean I_MC1_PollKeyEvent (event_t* event)
{
unsigned keyptr, keycode;
int doom_key;
// Check if we have any new keycode from the keyboard.
keyptr = GET_MMIO (KEYPTR);
if (s_keyptr == keyptr)
return false;
// Get the next keycode.
++s_keyptr;
keycode = GET_KEYBUF (s_keyptr % KEYBUF_SIZE);
// Translate the MC1 keycode to a Doom keycode.
doom_key = I_MC1_TranslateKey (keycode & 0x1ff);
if (doom_key != 0)
{
// Create a Doom keyboard event.
event->type = (keycode & 0x80000000) ? ev_keydown : ev_keyup;
event->data1 = doom_key;
}
return true;
}
static boolean I_MC1_PollMouseEvent (event_t* event)
{
static unsigned s_old_mousepos;
static unsigned s_old_mousebtns;
// Do we have a new mouse movement event?
unsigned mousepos = GET_MMIO (MOUSEPOS);
unsigned mousebtns = GET_MMIO (MOUSEBTNS);
if (mousepos == s_old_mousepos && mousebtns == s_old_mousebtns)
return false;
// Get the x & y mouse delta.
int mousex = ((int)(short)mousepos) - ((int)(short)s_old_mousepos);
int mousey = (((int)mousepos) >> 16) - (((int)s_old_mousepos) >> 16);
// Create a Doom mouse event.
event->type = ev_mouse;
event->data1 = mousebtns;
event->data2 = mousex;
event->data3 = mousey;
s_old_mousepos = mousepos;
s_old_mousebtns = mousebtns;
return true;
}
void I_InitGraphics (void)
{
MC1_AllocInit ();
// Video buffers that need to be in VRAM.
const size_t vcp_size = (5 + SCREENHEIGHT * 2) * sizeof (unsigned);
const size_t palette_size = (2 + 256) * sizeof (unsigned);
const size_t framebuffer_size = SCREENWIDTH * SCREENHEIGHT * sizeof (byte);
s_vcp = MC1_VRAM_Alloc (vcp_size);
s_palette = MC1_VRAM_Alloc (palette_size);
s_framebuffer = MC1_VRAM_Alloc (framebuffer_size);
if (s_framebuffer == NULL)
I_Error ("Error: Not enough VRAM!");
// Allocate regular memory for the Doom screen.
const size_t screen_size = SCREENWIDTH * SCREENHEIGHT * sizeof (byte);
screens[0] = MC1_Alloc (screen_size);
if (MC1_IsVRAMPtr (screens[0]))
printf ("I_InitGraphics: Using VRAM for the pixel buffer\n");
I_MC1_CreateVCP ();
s_keyptr = GET_MMIO (KEYPTR);
printf (
"I_InitGraphics: Resolution = %d x %d\n"
" Framebuffer @ 0x%08x (%d)\n"
" Palette @ 0x%08x (%d)\n",
SCREENWIDTH,
SCREENHEIGHT,
(unsigned)s_framebuffer,
(unsigned)s_framebuffer,
(unsigned)(s_palette + 4),
(unsigned)(s_palette + 4));
}
void I_ShutdownGraphics (void)
{
MC1_Free (screens[0]);
}
void I_StartFrame (void)
{
// Er? This is declared in i_system.h.
}
void I_StartTic (void)
{
event_t event;
// Read mouse and keyboard events.
if (I_MC1_PollKeyEvent (&event))
D_PostEvent (&event);
if (I_MC1_PollMouseEvent (&event))
D_PostEvent (&event);
}
void I_SetPalette (byte* palette)
{
unsigned* dst = &((unsigned*)s_palette)[1];
const unsigned a = 255;
for (int i = 0; i < 256; ++i)
{
unsigned r = (unsigned)palette[i * 3];
unsigned g = (unsigned)palette[i * 3 + 1];
unsigned b = (unsigned)palette[i * 3 + 2];
#ifdef __MRISC32_PACKED_OPS__
dst[i] = _mr32_pack_h (_mr32_pack (a, g), _mr32_pack (b, r));
#else
dst[i] = (a << 24) | (b << 16) | (g << 8) | r;
#endif
}
}
void I_UpdateNoBlit (void)
{
}
void I_FinishUpdate (void)
{
memcpy (s_framebuffer, screens[0], SCREENWIDTH * SCREENHEIGHT);
}
void I_WaitVBL (int count)
{
#if 0
// TODO(m): Replace this with MC1 MMIO-based timing.
struct timeval t0, t;
long dt, waitt;
// Busy-wait for COUNT*1/60 s.
gettimeofday (&t0, NULL);
waitt = count * (1000000L / 60L);
do
{
gettimeofday (&t, NULL);
dt = (t.tv_sec - t0.tv_sec) * 1000000L + (t.tv_usec - t0.tv_usec);
} while (dt < waitt);
#else
// Run at max FPS - no wait.
(void)count;
#endif
}
void I_ReadScreen (byte* scr)
{
memcpy (scr, screens[0], SCREENWIDTH * SCREENHEIGHT);
}
| [
"Bruno.Levy@inria.fr"
] | Bruno.Levy@inria.fr |
a696952ddc3578d4c85a555ef1a6a9074aa120f5 | 8c910789637e15021cc169fe3c6ab8f29487daf1 | /Linux_ex_box/build-Linux_ex_box-Desktop_Qt_5_1_0_GCC_64bit-Debug/ui_mymainwindow.h | 841a5896cabe8a5e61f3d06cb8fd46f9ea49d5cc | [] | no_license | Dufferent/Qt-Work | 498c6b9251cbb43fdcaeec273ce0878722a0d40b | 245481420d7a511511fc8906a4955f4727806446 | refs/heads/master | 2023-01-11T00:54:01.533118 | 2020-10-29T08:53:22 | 2020-10-29T08:53:22 | 287,864,157 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,535 | h | /********************************************************************************
** Form generated from reading UI file 'mymainwindow.ui'
**
** Created by: Qt User Interface Compiler version 5.1.0
**
** WARNING! All changes made in this file will be lost when recompiling UI file!
********************************************************************************/
#ifndef UI_MYMAINWINDOW_H
#define UI_MYMAINWINDOW_H
#include <QtCore/QVariant>
#include <QtWidgets/QAction>
#include <QtWidgets/QApplication>
#include <QtWidgets/QButtonGroup>
#include <QtWidgets/QHeaderView>
#include <QtWidgets/QMainWindow>
#include <QtWidgets/QWidget>
QT_BEGIN_NAMESPACE
class Ui_MyMainWindow
{
public:
QWidget *centralWidget;
void setupUi(QMainWindow *MyMainWindow)
{
if (MyMainWindow->objectName().isEmpty())
MyMainWindow->setObjectName(QStringLiteral("MyMainWindow"));
MyMainWindow->resize(1024, 600);
centralWidget = new QWidget(MyMainWindow);
centralWidget->setObjectName(QStringLiteral("centralWidget"));
MyMainWindow->setCentralWidget(centralWidget);
retranslateUi(MyMainWindow);
QMetaObject::connectSlotsByName(MyMainWindow);
} // setupUi
void retranslateUi(QMainWindow *MyMainWindow)
{
MyMainWindow->setWindowTitle(QApplication::translate("MyMainWindow", "MyMainWindow", 0));
} // retranslateUi
};
namespace Ui {
class MyMainWindow: public Ui_MyMainWindow {};
} // namespace Ui
QT_END_NAMESPACE
#endif // UI_MYMAINWINDOW_H
| [
"2269969490@qq.com"
] | 2269969490@qq.com |
43b7fcaad12c788e099ed7b44642527ad17e47b1 | fd05fd318468dfddb80a3af1b413fca06e9fae90 | /SMJS_GameRulesProps.h | 8285328acf0ac0297a08a182fec89f38d837c97b | [] | no_license | Sarzhevsky/SourceMod.js | 6a6c7df9ae0d3ef7f1beffc40efb36186d8b90f9 | 639c0cb3dd60c6034f8fccea4be8ac6127f74f44 | refs/heads/master | 2021-01-22T03:23:26.301192 | 2013-11-17T21:30:52 | 2013-11-17T21:30:52 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,107 | h | #ifndef _INCLUDE_SMJS_GAMERULESPROPS_H_
#define _INCLUDE_SMJS_GAMERULESPROPS_H_
#include "SMJS.h"
#include "SMJS_BaseWrapped.h"
#include "SMJS_Netprops.h"
class SMJS_GameRulesProps : public SMJS_BaseWrapped, public SMJS_NPValueCacher {
public:
void *gamerules;
void *proxy;
SMJS_GameRulesProps();
WRAPPED_CLS(SMJS_GameRulesProps, SMJS_BaseWrapped){
temp->InstanceTemplate()->SetNamedPropertyHandler(GetRulesProp, SetRulesProp);
}
v8::Persistent<v8::Value> GenerateThenFindCachedValue(PLUGIN_ID plId, std::string key, SendProp *p, size_t offset){
bool isCacheable;
auto res = v8::Persistent<v8::Value>::New(SMJS_Netprops::SGetNetProp(gamerules, NULL, p, offset, &isCacheable));
if(isCacheable){
InsertCachedValue(plId, key, res);
}
return res;
}
void OnWrapperAttached(SMJS_Plugin *plugin, v8::Persistent<v8::Value> wrapper);
static void GetRulesProp(v8::Local<v8::String> property, const v8::PropertyCallbackInfo<v8::Value>& args);
static void SetRulesProp(v8::Local<v8::String> property, v8::Local<v8::Value> value, const v8::PropertyCallbackInfo<Value>& args);
};
#endif | [
"matheusavs3@gmail.com"
] | matheusavs3@gmail.com |
fd8e8d9f0a038c6bbbf3f6209580f9a5b1431a84 | 7e791eccdc4d41ba225a90b3918ba48e356fdd78 | /chromium/src/mojo/edk/test/multiprocess_test_helper.cc | 0490119abbc227a32bdedcccd05c685379e7b834 | [
"BSD-3-Clause"
] | permissive | WiViClass/cef-3.2623 | 4e22b763a75e90d10ebf9aa3ea9a48a3d9ccd885 | 17fe881e9e481ef368d9f26e903e00a6b7bdc018 | refs/heads/master | 2021-01-25T04:38:14.941623 | 2017-06-09T07:37:43 | 2017-06-09T07:37:43 | 93,824,379 | 2 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 4,037 | cc | // Copyright 2013 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "mojo/edk/test/multiprocess_test_helper.h"
#include <utility>
#include "base/command_line.h"
#include "base/logging.h"
#include "base/process/kill.h"
#include "base/process/process_handle.h"
#include "build/build_config.h"
#include "mojo/edk/embedder/embedder.h"
#include "mojo/edk/embedder/platform_channel_pair.h"
#if defined(OS_WIN)
#include "base/win/windows_version.h"
#endif
namespace mojo {
namespace edk {
namespace test {
const char kBrokerHandleSwitch[] = "broker-handle";
MultiprocessTestHelper::MultiprocessTestHelper() {
platform_channel_pair_.reset(new PlatformChannelPair());
server_platform_handle = platform_channel_pair_->PassServerHandle();
broker_platform_channel_pair_.reset(new PlatformChannelPair());
}
MultiprocessTestHelper::~MultiprocessTestHelper() {
CHECK(!test_child_.IsValid());
server_platform_handle.reset();
platform_channel_pair_.reset();
}
void MultiprocessTestHelper::StartChild(const std::string& test_child_name) {
StartChildWithExtraSwitch(test_child_name, std::string(), std::string());
}
void MultiprocessTestHelper::StartChildWithExtraSwitch(
const std::string& test_child_name,
const std::string& switch_string,
const std::string& switch_value) {
CHECK(platform_channel_pair_);
CHECK(!test_child_name.empty());
CHECK(!test_child_.IsValid());
std::string test_child_main = test_child_name + "TestChildMain";
base::CommandLine command_line(
base::GetMultiProcessTestChildBaseCommandLine());
HandlePassingInformation handle_passing_info;
platform_channel_pair_->PrepareToPassClientHandleToChildProcess(
&command_line, &handle_passing_info);
std::string broker_handle = broker_platform_channel_pair_->
PrepareToPassClientHandleToChildProcessAsString(&handle_passing_info);
command_line.AppendSwitchASCII(kBrokerHandleSwitch, broker_handle);
if (!switch_string.empty()) {
CHECK(!command_line.HasSwitch(switch_string));
if (!switch_value.empty())
command_line.AppendSwitchASCII(switch_string, switch_value);
else
command_line.AppendSwitch(switch_string);
}
base::LaunchOptions options;
#if defined(OS_POSIX)
options.fds_to_remap = &handle_passing_info;
#elif defined(OS_WIN)
options.start_hidden = true;
if (base::win::GetVersion() >= base::win::VERSION_VISTA)
options.handles_to_inherit = &handle_passing_info;
else
options.inherit_handles = true;
#else
#error "Not supported yet."
#endif
test_child_ =
base::SpawnMultiProcessTestChild(test_child_main, command_line, options);
platform_channel_pair_->ChildProcessLaunched();
broker_platform_channel_pair_->ChildProcessLaunched();
ChildProcessLaunched(test_child_.Handle(),
broker_platform_channel_pair_->PassServerHandle());
CHECK(test_child_.IsValid());
}
int MultiprocessTestHelper::WaitForChildShutdown() {
CHECK(test_child_.IsValid());
int rv = -1;
CHECK(
test_child_.WaitForExitWithTimeout(TestTimeouts::action_timeout(), &rv));
test_child_.Close();
return rv;
}
bool MultiprocessTestHelper::WaitForChildTestShutdown() {
return WaitForChildShutdown() == 0;
}
// static
void MultiprocessTestHelper::ChildSetup() {
CHECK(base::CommandLine::InitializedForCurrentProcess());
client_platform_handle =
PlatformChannelPair::PassClientHandleFromParentProcess(
*base::CommandLine::ForCurrentProcess());
std::string broker_handle_str =
base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
kBrokerHandleSwitch);
ScopedPlatformHandle broker_handle =
PlatformChannelPair::PassClientHandleFromParentProcessFromString(
broker_handle_str);
SetParentPipeHandle(std::move(broker_handle));
}
// static
ScopedPlatformHandle MultiprocessTestHelper::client_platform_handle;
} // namespace test
} // namespace edk
} // namespace mojo
| [
"1480868058@qq.com"
] | 1480868058@qq.com |
9c01007ded74b8ef3e8088874d50ece6fde219d6 | b9048652f15be10232888d2af78ef7e6eb363893 | /include/qxt/qxtletterboxwidget_p.h | dcd81e9b2a0f47d45568dabeae9c59ee268f724d | [] | no_license | vghost2008/wlib | 0457b1e191f2d461caf100486521c89f2abbf9f1 | ab7ae25eef6427df21d7022f3376ec601beec28f | refs/heads/master | 2022-05-09T11:49:07.802162 | 2019-05-07T11:39:39 | 2019-05-07T11:39:39 | 185,389,328 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,524 | h | /********************************************************************************
* License :
* Author : WangJie bluetornado@zju.edu.cn
* Description :
********************************************************************************/
#ifndef QXTLETTERBOXWIDGET_P_H
/****************************************************************************
** Copyright (c) 2006 - 2011, the LibQxt project.
** See the Qxt AUTHORS file for a list of authors and copyright holders.
** All rights reserved.
**
** Redistribution and use in source and binary forms, with or without
** modification, are permitted provided that the following conditions are met:
** * Redistributions of source code must retain the above copyright
** notice, this list of conditions and the following disclaimer.
** * Redistributions in binary form must reproduce the above copyright
** notice, this list of conditions and the following disclaimer in the
** documentation and/or other materials provided with the distribution.
** * Neither the name of the LibQxt project nor the
** names of its contributors may be used to endorse or promote products
** derived from this software without specific prior written permission.
**
** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
** ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
** WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
** DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY
** DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
** (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
** LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
** ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
** SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
**
** <http://libqxt.org> <foundation@libqxt.org>
*****************************************************************************/
#define QXTLETTERBOXWIDGET_P_H
#include "qxtletterboxwidget.h"
#include <QTimer>
class QxtLetterBoxWidgetPrivate : public QObject, public QxtPrivate<QxtLetterBoxWidget>
{
Q_OBJECT
public:
QXT_DECLARE_PUBLIC(QxtLetterBoxWidget)
QxtLetterBoxWidgetPrivate();
public:
QWidget* center;
QTimer timer;
int margin;
};
#endif // QXTLETTERBOXWIDGET_P_H
| [
"bluetornado@zju.edu.cn"
] | bluetornado@zju.edu.cn |
ac01dbb0756b955213bc4131cb000ff1ffde511f | e773d41ff293c1c0b7f1968a26cc5764e00667bb | /cefclient/browser/main_context_impl_win.cc | d59788a8b7a73af33767949f5a20e3de85da8ec1 | [] | no_license | yufanghu/fec | 43794ac187d3c1aa84bd4e660f5272c8addf830a | 87be1c1238ff638ed4c5488cf5f0701b78e4b82f | refs/heads/master | 2021-03-27T12:33:52.573027 | 2017-12-01T10:18:38 | 2017-12-01T10:18:38 | 108,273,897 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,073 | cc | // Copyright (c) 2015 The Chromium Embedded Framework Authors. All rights
// reserved. Use of this source code is governed by a BSD-style license that
// can be found in the LICENSE file.
#include "cefclient/browser/main_context_impl.h"
#include <direct.h>
#include <shlobj.h>
namespace client {
std::string MainContextImpl::GetDownloadPath(const std::string& file_name) {
TCHAR szFolderPath[MAX_PATH];
std::string path;
// Save the file in the user's "My Documents" folder.
if (SUCCEEDED(SHGetFolderPath(NULL, CSIDL_PERSONAL | CSIDL_FLAG_CREATE, NULL,
0, szFolderPath))) {
path = CefString(szFolderPath);
path += "\\" + file_name;
}
return path;
}
std::string MainContextImpl::GetAppWorkingDirectory() {
char szWorkingDir[MAX_PATH + 1];
if (_getcwd(szWorkingDir, MAX_PATH) == NULL) {
szWorkingDir[0] = 0;
} else {
// Add trailing path separator.
size_t len = strlen(szWorkingDir);
szWorkingDir[len] = '\\';
szWorkingDir[len + 1] = 0;
}
return szWorkingDir;
}
} // namespace client
| [
"fibonacci2016@126.com"
] | fibonacci2016@126.com |
891e146acf8e21249e293693c0daac6d5c9dab8f | e3d917181ee947fe596df4b66e1bdc066e9f9e02 | /windowsbuild/MSVC2022/Qt/6.4.2/include/QtCore/qstandardpaths.h | ca1e37d92c406087ddb68649ba30539d992efa6d | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-3-Clause"
] | permissive | visit-dav/visit-deps | d1be0023fa4c91c02589e5d87ab4e48c99145bb5 | d779eb48a12e667c3b759cedd3732053d7676abf | refs/heads/master | 2023-08-08T15:30:28.412508 | 2023-07-31T22:34:52 | 2023-07-31T22:34:52 | 174,021,407 | 2 | 3 | NOASSERTION | 2023-07-06T16:07:22 | 2019-03-05T21:12:14 | C++ | UTF-8 | C++ | false | false | 2,009 | h | // Copyright (C) 2020 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
#ifndef QSTANDARDPATHS_H
#define QSTANDARDPATHS_H
#include <QtCore/qstringlist.h>
#include <QtCore/qobjectdefs.h>
QT_BEGIN_NAMESPACE
#ifndef QT_NO_STANDARDPATHS
class Q_CORE_EXPORT QStandardPaths
{
Q_GADGET
public:
enum StandardLocation {
DesktopLocation,
DocumentsLocation,
FontsLocation,
ApplicationsLocation,
MusicLocation,
MoviesLocation,
PicturesLocation,
TempLocation,
HomeLocation,
AppLocalDataLocation,
CacheLocation,
GenericDataLocation,
RuntimeLocation,
ConfigLocation,
DownloadLocation,
GenericCacheLocation,
GenericConfigLocation,
AppDataLocation,
AppConfigLocation,
PublicShareLocation,
TemplatesLocation
};
Q_ENUM(StandardLocation)
static QString writableLocation(StandardLocation type);
static QStringList standardLocations(StandardLocation type);
enum LocateOption {
LocateFile = 0x0,
LocateDirectory = 0x1
};
Q_DECLARE_FLAGS(LocateOptions, LocateOption)
Q_FLAG(LocateOptions)
static QString locate(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
static QStringList locateAll(StandardLocation type, const QString &fileName, LocateOptions options = LocateFile);
#ifndef QT_BOOTSTRAPPED
static QString displayName(StandardLocation type);
#endif
static QString findExecutable(const QString &executableName, const QStringList &paths = QStringList());
static void setTestModeEnabled(bool testMode);
static bool isTestModeEnabled();
private:
// prevent construction
QStandardPaths();
~QStandardPaths();
};
Q_DECLARE_OPERATORS_FOR_FLAGS(QStandardPaths::LocateOptions)
#endif // QT_NO_STANDARDPATHS
QT_END_NAMESPACE
#endif // QSTANDARDPATHS_H
| [
"noreply@github.com"
] | visit-dav.noreply@github.com |
b532c0d8db525bccbc32a4a011db755b9eccce11 | 1095cfe2e29ddf4e4c5e12d713bd12f45c9b6f7d | /ext/systemc/src/sysc/datatypes/fx/scfx_pow10.h | c9b278561f747424d113f608bdbcec18f19550fe | [
"BSD-3-Clause",
"LicenseRef-scancode-proprietary-license",
"LGPL-2.0-or-later",
"MIT",
"Apache-2.0"
] | permissive | gem5/gem5 | 9ec715ae036c2e08807b5919f114e1d38d189bce | 48a40cf2f5182a82de360b7efa497d82e06b1631 | refs/heads/stable | 2023-09-03T15:56:25.819189 | 2023-08-31T05:53:03 | 2023-08-31T05:53:03 | 27,425,638 | 1,185 | 1,177 | BSD-3-Clause | 2023-09-14T08:29:31 | 2014-12-02T09:46:00 | C++ | UTF-8 | C++ | false | false | 2,543 | h | /*****************************************************************************
Licensed to Accellera Systems Initiative Inc. (Accellera) under one or
more contributor license agreements. See the NOTICE file distributed
with this work for additional information regarding copyright ownership.
Accellera licenses this file to you under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with the
License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied. See the License for the specific language governing
permissions and limitations under the License.
*****************************************************************************/
/*****************************************************************************
scfx_pow10.h -
Original Author: Robert Graulich, Synopsys, Inc.
Martin Janssen, Synopsys, Inc.
*****************************************************************************/
/*****************************************************************************
MODIFICATION LOG - modifiers, enter your name, affiliation, date and
changes you are making here.
Name, Affiliation, Date:
Description of Modification:
*****************************************************************************/
// $Log: scfx_pow10.h,v $
// Revision 1.1.1.1 2006/12/15 20:20:04 acg
// SystemC 2.3
//
// Revision 1.3 2006/01/13 18:53:58 acg
// Andy Goodrich: added $Log command so that CVS comments are reproduced in
// the source.
//
#ifndef SCFX_POW10_H
#define SCFX_POW10_H
#include "sysc/datatypes/fx/scfx_rep.h"
namespace sc_dt
{
// classes defined in this module
class scfx_pow10;
// ----------------------------------------------------------------------------
// CLASS : scfx_pow10
//
// Class to compute (and cache) powers of 10 in arbitrary precision.
// ----------------------------------------------------------------------------
const int SCFX_POW10_TABLE_SIZE = 32;
class scfx_pow10
{
public:
scfx_pow10();
~scfx_pow10();
const scfx_rep operator() ( int );
private:
scfx_rep* pos( int );
scfx_rep* neg( int );
scfx_rep m_pos[SCFX_POW10_TABLE_SIZE];
scfx_rep m_neg[SCFX_POW10_TABLE_SIZE];
};
} // namespace sc_dt
#endif
// Taf!
| [
"jungma@eit.uni-kl.de"
] | jungma@eit.uni-kl.de |
70126879b03599750b7c5c708cfc0def2003f2dd | 04b886bcb4eae8b4cd656b2917a82a13067ca2b7 | /src/cpp/oclint/oclint-rules/test/custom2/CommaMissingInIntArrayInitRuleTest.cpp | 374b3dd1ebf54f51e850a54bcb5bcd208e3e3eaa | [
"BSD-3-Clause"
] | permissive | terryhu08/MachingLearning | 4d01ba9c72e931a82db0992ea58ad1bd425f1544 | 45ccc79ee906e072bb40552c211579e2c677f459 | refs/heads/master | 2021-09-16T01:38:10.364942 | 2018-06-14T13:45:39 | 2018-06-14T13:45:39 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 773 | cpp | #include "TestRuleOnCode.h"
#include "rules/custom2/CommaMissingInIntArrayInitRule.cpp"
TEST(CommaMissingInIntArrayInitRuleTest, PropertyTest)
{
CommaMissingInIntArrayInitRule rule;
EXPECT_EQ(3, rule.priority());
EXPECT_EQ("comma missing in int array init", rule.name());
EXPECT_EQ("custom2", rule.category());
}
TEST(CommaMissingInIntArrayInitRuleTest, NoViolationInstance)
{
testRuleOnCXXCode(new CommaMissingInIntArrayInitRule(),
"void m(){int a[3]={1,2,3};}");
}
TEST(CommaMissingInIntArrayInitRuleTest, Test1)
{
testRuleOnCXXCode(new CommaMissingInIntArrayInitRule(),
"void m(){\n"
"int a[3]={1,2 -3};}",0, 2, 1, 2, 17, "It is possible that ',' comma is missing at the end of the string.");
}
| [
"dhfang812@163.com"
] | dhfang812@163.com |
2789ade5b65463402ebfc694f29169ffcf47b495 | 2e3d9d4b286b7b3d0b367181f5d1c2c154fb9b28 | /Math/BottomUpResultOut/solver.cpp | c4106aea156899b69147dbaedf2d0ab426625cd9 | [] | no_license | squirrelClare/algorithm_cplusplus | 8237baf5cea6f79889eaad6360b2dadd7a1b3624 | 312a63851182962d014b6b5fba28bdd51decb033 | refs/heads/master | 2021-01-10T03:38:40.434217 | 2015-10-22T17:36:57 | 2015-10-22T17:36:57 | 44,685,760 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,680 | cpp | #include "solver.h"
#include<QDebug>
/**
与SteelBarCut中的不同之处在于,
该算法将每次局部最优解存储起来,
以便再次需要求解该局部最优解的
时候直接从记录中调取。以牺牲内存
为代价获得运行时间上的提升*/
Solver::Solver()
{
}
Solver::Solver(const QList<int> lengthList, const QList<int> valueList, const int totalLength)
{
/*lengthList为可以切割的长度选项
valueList为每个长度对应的价格
totalLength为原始钢条长度*/
this->totalLength=totalLength;
barList=new QMap<int,BarPart>();
//将价格表的样例存入一个QMap中
for(int i=0;i<lengthList.length();++i){
BarPart *part=new BarPart(lengthList.at(i),valueList.at(i));
barList->insert(i,*part);
}
}
void Solver::ShowResult()
{
//输出最佳结果
RodAns ans=BottomUpCutRod(totalLength);
qDebug()<<QString("长度为%1的钢条最多可卖%2")
.arg(totalLength).arg(ans.bestValue);
qDebug()<<QString("最好方案为:");
int tlength=totalLength;
QList<int>outPut;
while(tlength>=3){
outPut<<ans.proAns.at(tlength);
tlength=tlength-ans.proAns.at(tlength);
}
qDebug()<<outPut;
}
RodAns Solver::BottomUpCutRod(const int totalLength)
{
/*
原来的算法在第二次for循环的时候会调用record中的值,但是barvalue的值
并不是连续的,对于其中的间断点会被record的中初始值所代替,因此将record
的值全部初始化为0(最终的局部最优化结果肯定是非负的)*/
//record数组初始化
QList<int>proans;
for(int i=0;i<=totalLength;++i){
record<<-100;
proans<<0;
}
//算法主体部分
for(int j=0;j<=totalLength;++j){
int currentBest=0;
for(int i=0;i<barList->size();++i){
if(((j-barList->value(i).barLength)>=0)&¤tBest<barList->value(i).barValue+
record.at(j-barList->value(i).barLength)){
currentBest=barList->value(i).barValue+
record.at(j-barList->value(i).barLength);
proans.replace(j,barList->value(i).barLength);//保存局部最佳结果的第一段切割长度
}
}
record.replace(j,currentBest);
}
RodAns ans;
ans.bestValue=record.at(totalLength);
ans.proAns=proans;
return ans;
}
//将价格表的样例封装成一个类
BarPart::BarPart()
{
}
BarPart::BarPart(const int barLength,const int barValue)
{
//barValue为对应barValue的价格
this->barLength=barLength;
this->barValue=barValue;
}
| [
"zcc136314853@hotmail.com"
] | zcc136314853@hotmail.com |
3a46c72c714cdae9bc1f2bee34dbe79b73cebe9e | e540d777e71d94f34cbac8fcfdc99d5ffd174b3e | /SpaceShooter/view.cpp | 522410772cf588f14fe94a76fe401770d2ed4407 | [] | no_license | N4G1/SpaceShooter | 3c4f0cb3d5cf98e4aff690ca3da256cb066a094f | e173b9628cd6572efed8791e4d8af662da57752f | refs/heads/master | 2020-04-02T04:48:55.904322 | 2018-10-21T19:09:31 | 2018-10-21T19:09:31 | 154,036,417 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 743 | cpp | #include "view.h"
view::view()
{
//window.create(sf::VideoMode(800, 1000), "Space Shooter"); //creating window
//window.setPosition(sf::Vector2i((1920 / 2) - (800 / 2), 0));
//window.setFramerateLimit(60);
}
view::~view()
{
}
void view::setFramerate(int fps)
{
window.setFramerateLimit(fps);
}
void view::draw(sf::Sprite s)
{
window.draw(s);
}
void view::clear()
{
window.clear();
}
void view::display()
{
if (window.isOpen())
{
if (window.pollEvent(event))
{
//std::cout << "a";
if (event.type == sf::Event::Closed)
window.close();
if (event.type == sf::Event::KeyPressed && event.key.code == sf::Keyboard::Escape)
window.close();
}
//window.display();
}
}
| [
"noreply@github.com"
] | N4G1.noreply@github.com |
f11299f4f177bb08528eafc5a291f89e623efd6d | bf53c9dc6851b501b13fa89c6e2bd2cf775b0d67 | /src/WaterSurface.cpp | 698ebd16de31516b1b6fa25c35163267e77800c8 | [] | no_license | xchuki00/PGP | 2ca971dc9af7858b57407502c777c2819d56d689 | 3f4990f84260734b5758e3731bd088e099d00575 | refs/heads/master | 2023-01-28T09:57:57.710541 | 2020-11-23T14:05:08 | 2020-11-23T14:05:08 | 315,334,034 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,746 | cpp | #pragma once
#include <iostream>
#include <cstdlib>
#include <fstream>
#include <GPUEngine/geGL/StaticCalls.h>
#include <GPUEngine/geGL/geGL.h>
#include <GPUEngine/geAd/SDLWindow/SDLWindow.h>
#include <GPUEngine/geAd/SDLWindow/SDLMainLoop.h>
#include<glm/glm.hpp>
#include<glm/gtc/matrix_transform.hpp>
#include<glm/gtc/type_ptr.hpp>
#include<glm/gtc/matrix_access.hpp>
#include "controler.h"
#include "Model.h"
#include "BaseShaders.h"
#include "LightSource.h"
#include "Models.h"
#include "sphere.h"
#include "water.h"
controler* c;
Model* sp;
Water* w;
bool HittedSphere(SDL_Event const& e) {
return false;
}
bool keyDown(SDL_Event const& e) {
if (e.key.keysym.sym == SDLK_1) {
w->pushToPoint(0);
}
if (e.key.keysym.sym == SDLK_2) {
w->pushToPoint(w->getCountofSurfacePoints()*0.85);
}
if (e.key.keysym.sym == SDLK_3) {
w->pushToPoint(w->getCountofSurfacePoints()*0.6);
}
if (e.key.keysym.sym == SDLK_4) {
w->pushToPoint(w->getCountofSurfacePoints()*0.55);
}
if (e.key.keysym.sym == SDLK_5) {
w->pushToPoint(w->getCountofSurfacePoints()/4);
}
if (e.key.keysym.sym == SDLK_6) {
w->pushToPoint(w->getCountofSurfacePoints()/8);
}
return c->keyDown(e);
}
bool mouseDown(SDL_Event const& e) {
if (HittedSphere(e)) {
//sp->setDraging();
}
return c->mouseDown(e);
}
bool mouseUp(SDL_Event const& e) {
return c->mouseUp(e);
}
bool mouseMotion(SDL_Event const& e) {
return c->MouseMotion(e);
}
bool windowResize(SDL_Event const& e) {
std::cout << "DWADWA";
w->resizeTexture();
ge::gl::glViewport(0,0,c->getWindowWidth(),c->getWindowHeight());
return true;
}
using namespace ge::gl;
int main(int, char*[]) {
//create window
auto mainLoop = std::make_shared<ge::ad::SDLMainLoop>();
SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8);
auto window = std::make_shared<ge::ad::SDLWindow>();
window->createContext("rendering");
mainLoop->addWindow("mainWindow", window);
//init OpenGL
ge::gl::init(SDL_GL_GetProcAddress);
ge::gl::setHighDebugMessage();
//sphere = new Model();
c= new controler(window,mainLoop);
window->setEventCallback(SDL_KEYDOWN, keyDown);
window->setEventCallback(SDL_MOUSEBUTTONDOWN, mouseDown);
window->setEventCallback(SDL_MOUSEBUTTONUP, mouseUp);
window->setEventCallback(SDL_MOUSEMOTION, mouseMotion);
window->setWindowEventCallback(SDL_WINDOWEVENT_SIZE_CHANGED, windowResize);
LightSource* ls = new LightSource(glm::vec3(-5,-10,-5),glm::vec3(1,1,1),1,1);
c->setLightSource(ls);
Model* aq = new Model();
aq->setControler(c);
sp = new Model();
sp->setControler(c);
glm::vec3 v[4] = {
glm::vec3(-14.999f,0.0f,4.999f),
glm::vec3(-14.999f,0.0f,-4.999f),
glm::vec3(14.999f,0.0f,4.999f)
};
w = new Water(v,3,glm::vec3(0,1,0),300,100,4.999);
w->setControler(c);
w->setLightSource(ls);
w->compileShaders();
w->buffer();
auto vs = std::make_shared<ge::gl::Shader>(GL_VERTEX_SHADER, BaseVSSrc);
auto fs = std::make_shared<ge::gl::Shader>(GL_FRAGMENT_SHADER, BaseFSSrc);
auto prgm = std::make_shared<ge::gl::Program>(vs, fs);
auto upOrDown = prgm->getUniformLocation("upOrDown");
//buffer data
aq->buffer(prgm,AquariumVer,NULL,AquariumEl,AquariumCountOfVer,AquariumCountOfEl);
aq->setTexture("../imgs/text.bmp", GL_BGR);
sp->buffer(prgm,NULL, sphereVer,sphereEl, sphereCountOfVer,sphereCountOfEl);
sp->setPosition(glm::translate(glm::mat4(1.0f), glm::vec3(10, 3, -1.5)));
ls->glGetUniformLocationLight(prgm);
w->addModel(sp);
w->addModel(aq);
Model* sp2 = new Model();
sp2->setControler(c);
sp2->setPosition(glm::translate(glm::mat4(1.0f), glm::vec3(-8, 3, 1)));
sp2->buffer(prgm, NULL, sphereVer, sphereEl, sphereCountOfVer, sphereCountOfEl);
Model* sp3 = new Model();
sp3->setControler(c);
sp3->setPosition(glm::translate(glm::mat4(1.0f), glm::vec3(0, -3, 2.697)));
sp3->buffer(prgm, NULL, sphereVer, sphereEl, sphereCountOfVer, sphereCountOfEl);
Model* pl = new Model();
pl->setControler(c);
//pl->setPosition(glm::translate(glm::mat4(1.0f), glm::vec3(0, -3, 2.697)));
pl->buffer(prgm, plane, NULL, planeEL, planeCountOfVer, planeCountOfEl);
pl->setTexture("../imgs/text.bmp", GL_RGB);
w->addModel(sp2);
w->addModel(sp3);
//draw loop
ge::util::Timer<float>timer;
mainLoop->setIdleCallback([&]() {
auto const frameTime = timer.elapsedFromLast();
w->updateSurface(frameTime);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT|GL_STENCIL_BUFFER_BIT);
glDisable(GL_DEPTH_TEST);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_ALWAYS, 1, 0);
glStencilOp(GL_KEEP, GL_KEEP, GL_REPLACE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
w->Draw(false);
glDisable(GL_STENCIL_TEST);
glEnable(GL_DEPTH_TEST);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glDisable(GL_CULL_FACE);
w->drawReflectRefract(true);
glEnable(GL_STENCIL_TEST);
glStencilFunc(GL_EQUAL, 1, 0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
glEnable(GL_CULL_FACE);
glCullFace(GL_BACK);
prgm->use();
ls->glUniformLight(c->getPosition());
aq->draw(1.3333);
sp->draw(1.3333);
sp2->draw(1.3333);
sp3->draw(1.3333);
glStencilFunc(GL_EQUAL, 0, 0xff);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
prgm->use();
ls->glUniformLight(c->getPosition());
aq->draw(1);
sp->draw(1);
sp2->draw(1);
sp3->draw(1);
glDisable(GL_STENCIL_TEST);
w->Draw(false);
glDisable(GL_BLEND);
window->swap();
});
(*mainLoop)();
return EXIT_SUCCESS;
}
| [
"p.chukir@gmail.com"
] | p.chukir@gmail.com |
34b32e0ebddb7e497561bfa6cfd433687b80057a | 4bc21b62a346c48cbe29b898b7fe331d6dedc023 | /src/rpcserver.h | 914de9fc73b3017f1d06ef8829a1926a1a79d169 | [
"MIT"
] | permissive | dachcoin/dach | 0bc1f57a2be087c81a847b8114d8d38cb211d39b | 57c2b4af4005e8deba7932e81bd6ccdfbfe7f6bf | refs/heads/master | 2020-04-12T22:36:32.451311 | 2019-01-30T05:54:04 | 2019-01-30T05:54:04 | 162,793,444 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 15,802 | h | // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2015-2018 The PIVX developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#ifndef BITCOIN_RPCSERVER_H
#define BITCOIN_RPCSERVER_H
#include "amount.h"
#include "rpcprotocol.h"
#include "uint256.h"
#include <list>
#include <map>
#include <stdint.h>
#include <string>
#include <boost/function.hpp>
#include <univalue.h>
class CRPCCommand;
namespace RPCServer
{
void OnStarted(boost::function<void ()> slot);
void OnStopped(boost::function<void ()> slot);
void OnPreCommand(boost::function<void (const CRPCCommand&)> slot);
void OnPostCommand(boost::function<void (const CRPCCommand&)> slot);
}
class CBlockIndex;
class CNetAddr;
class JSONRequest
{
public:
UniValue id;
std::string strMethod;
UniValue params;
JSONRequest() { id = NullUniValue; }
void parse(const UniValue& valRequest);
};
/** Query whether RPC is running */
bool IsRPCRunning();
/**
* Set the RPC warmup status. When this is done, all RPC calls will error out
* immediately with RPC_IN_WARMUP.
*/
void SetRPCWarmupStatus(const std::string& newStatus);
/* Mark warmup as done. RPC calls will be processed from now on. */
void SetRPCWarmupFinished();
/* returns the current warmup state. */
bool RPCIsInWarmup(std::string* statusOut);
/**
* Type-check arguments; throws JSONRPCError if wrong type given. Does not check that
* the right number of arguments are passed, just that any passed are the correct type.
* Use like: RPCTypeCheck(params, boost::assign::list_of(str_type)(int_type)(obj_type));
*/
void RPCTypeCheck(const UniValue& params,
const std::list<UniValue::VType>& typesExpected, bool fAllowNull=false);
/**
* Check for expected keys/value types in an Object.
* Use like: RPCTypeCheckObj(object, boost::assign::map_list_of("name", str_type)("value", int_type));
*/
void RPCTypeCheckObj(const UniValue& o,
const std::map<std::string, UniValue::VType>& typesExpected, bool fAllowNull=false);
/** Opaque base class for timers returned by NewTimerFunc.
* This provides no methods at the moment, but makes sure that delete
* cleans up the whole state.
*/
class RPCTimerBase
{
public:
virtual ~RPCTimerBase() {}
};
/**
* RPC timer "driver".
*/
class RPCTimerInterface
{
public:
virtual ~RPCTimerInterface() {}
/** Implementation name */
virtual const char *Name() = 0;
/** Factory function for timers.
* RPC will call the function to create a timer that will call func in *millis* milliseconds.
* @note As the RPC mechanism is backend-neutral, it can use different implementations of timers.
* This is needed to cope with the case in which there is no HTTP server, but
* only GUI RPC console, and to break the dependency of pcserver on httprpc.
*/
virtual RPCTimerBase* NewTimer(boost::function<void(void)>& func, int64_t millis) = 0;
};
/** Register factory function for timers */
void RPCRegisterTimerInterface(RPCTimerInterface *iface);
/** Unregister factory function for timers */
void RPCUnregisterTimerInterface(RPCTimerInterface *iface);
/**
* Run func nSeconds from now.
* Overrides previous timer <name> (if any).
*/
void RPCRunLater(const std::string& name, boost::function<void(void)> func, int64_t nSeconds);
typedef UniValue(*rpcfn_type)(const UniValue& params, bool fHelp);
class CRPCCommand
{
public:
std::string category;
std::string name;
rpcfn_type actor;
bool okSafeMode;
bool threadSafe;
bool reqWallet;
};
/**
* Dach RPC command dispatcher.
*/
class CRPCTable
{
private:
std::map<std::string, const CRPCCommand*> mapCommands;
public:
CRPCTable();
const CRPCCommand* operator[](const std::string& name) const;
std::string help(std::string name) const;
/**
* Execute a method.
* @param method Method to execute
* @param params UniValue Array of arguments (JSON objects)
* @returns Result of the call.
* @throws an exception (UniValue) when an error happens.
*/
UniValue execute(const std::string &method, const UniValue ¶ms) const;
/**
* Returns a list of registered commands
* @returns List of registered commands.
*/
std::vector<std::string> listCommands() const;
};
extern const CRPCTable tableRPC;
/**
* Utilities: convert hex-encoded Values
* (throws error if not hex).
*/
extern uint256 ParseHashV(const UniValue& v, std::string strName);
extern uint256 ParseHashO(const UniValue& o, std::string strKey);
extern std::vector<unsigned char> ParseHexV(const UniValue& v, std::string strName);
extern std::vector<unsigned char> ParseHexO(const UniValue& o, std::string strKey);
extern int ParseInt(const UniValue& o, std::string strKey);
extern bool ParseBool(const UniValue& o, std::string strKey);
extern int64_t nWalletUnlockTime;
extern CAmount AmountFromValue(const UniValue& value);
extern UniValue ValueFromAmount(const CAmount& amount);
extern double GetDifficulty(const CBlockIndex* blockindex = NULL);
extern std::string HelpRequiringPassphrase();
extern std::string HelpExampleCli(std::string methodname, std::string args);
extern std::string HelpExampleRpc(std::string methodname, std::string args);
extern void EnsureWalletIsUnlocked(bool fAllowAnonOnly = false);
extern UniValue getconnectioncount(const UniValue& params, bool fHelp); // in rpcnet.cpp
extern UniValue getpeerinfo(const UniValue& params, bool fHelp);
extern UniValue ping(const UniValue& params, bool fHelp);
extern UniValue addnode(const UniValue& params, bool fHelp);
extern UniValue disconnectnode(const UniValue& params, bool fHelp);
extern UniValue getaddednodeinfo(const UniValue& params, bool fHelp);
extern UniValue getnettotals(const UniValue& params, bool fHelp);
extern UniValue setban(const UniValue& params, bool fHelp);
extern UniValue listbanned(const UniValue& params, bool fHelp);
extern UniValue clearbanned(const UniValue& params, bool fHelp);
extern UniValue dumpprivkey(const UniValue& params, bool fHelp); // in rpcdump.cpp
extern UniValue importprivkey(const UniValue& params, bool fHelp);
extern UniValue importaddress(const UniValue& params, bool fHelp);
extern UniValue dumpwallet(const UniValue& params, bool fHelp);
extern UniValue importwallet(const UniValue& params, bool fHelp);
extern UniValue bip38encrypt(const UniValue& params, bool fHelp);
extern UniValue bip38decrypt(const UniValue& params, bool fHelp);
extern UniValue getgenerate(const UniValue& params, bool fHelp); // in rpcmining.cpp
extern UniValue setgenerate(const UniValue& params, bool fHelp);
extern UniValue getnetworkhashps(const UniValue& params, bool fHelp);
extern UniValue gethashespersec(const UniValue& params, bool fHelp);
extern UniValue getmininginfo(const UniValue& params, bool fHelp);
extern UniValue prioritisetransaction(const UniValue& params, bool fHelp);
extern UniValue getblocktemplate(const UniValue& params, bool fHelp);
extern UniValue submitblock(const UniValue& params, bool fHelp);
extern UniValue estimatefee(const UniValue& params, bool fHelp);
extern UniValue estimatepriority(const UniValue& params, bool fHelp);
extern UniValue getnewaddress(const UniValue& params, bool fHelp); // in rpcwallet.cpp
extern UniValue getaccountaddress(const UniValue& params, bool fHelp);
extern UniValue getrawchangeaddress(const UniValue& params, bool fHelp);
extern UniValue setaccount(const UniValue& params, bool fHelp);
extern UniValue getaccount(const UniValue& params, bool fHelp);
extern UniValue getaddressesbyaccount(const UniValue& params, bool fHelp);
extern UniValue sendtoaddress(const UniValue& params, bool fHelp);
extern UniValue sendtoaddressix(const UniValue& params, bool fHelp);
extern UniValue signmessage(const UniValue& params, bool fHelp);
extern UniValue getreceivedbyaddress(const UniValue& params, bool fHelp);
extern UniValue getreceivedbyaccount(const UniValue& params, bool fHelp);
extern UniValue getbalance(const UniValue& params, bool fHelp);
extern UniValue getunconfirmedbalance(const UniValue& params, bool fHelp);
extern UniValue movecmd(const UniValue& params, bool fHelp);
extern UniValue sendfrom(const UniValue& params, bool fHelp);
extern UniValue sendmany(const UniValue& params, bool fHelp);
extern UniValue addmultisigaddress(const UniValue& params, bool fHelp);
extern UniValue listreceivedbyaddress(const UniValue& params, bool fHelp);
extern UniValue listreceivedbyaccount(const UniValue& params, bool fHelp);
extern UniValue listtransactions(const UniValue& params, bool fHelp);
extern UniValue listaddressgroupings(const UniValue& params, bool fHelp);
extern UniValue listaccounts(const UniValue& params, bool fHelp);
extern UniValue listsinceblock(const UniValue& params, bool fHelp);
extern UniValue gettransaction(const UniValue& params, bool fHelp);
extern UniValue backupwallet(const UniValue& params, bool fHelp);
extern UniValue keypoolrefill(const UniValue& params, bool fHelp);
extern UniValue walletpassphrase(const UniValue& params, bool fHelp);
extern UniValue walletpassphrasechange(const UniValue& params, bool fHelp);
extern UniValue walletlock(const UniValue& params, bool fHelp);
extern UniValue encryptwallet(const UniValue& params, bool fHelp);
extern UniValue getwalletinfo(const UniValue& params, bool fHelp);
extern UniValue getblockchaininfo(const UniValue& params, bool fHelp);
extern UniValue getnetworkinfo(const UniValue& params, bool fHelp);
extern UniValue reservebalance(const UniValue& params, bool fHelp);
extern UniValue setstakesplitthreshold(const UniValue& params, bool fHelp);
extern UniValue getstakesplitthreshold(const UniValue& params, bool fHelp);
extern UniValue multisend(const UniValue& params, bool fHelp);
extern UniValue autocombinerewards(const UniValue& params, bool fHelp);
// dachx extern UniValue getzerocoinbalance(const UniValue& params, bool fHelp);
extern UniValue listmintedzerocoins(const UniValue& params, bool fHelp);
extern UniValue listspentzerocoins(const UniValue& params, bool fHelp);
extern UniValue listzerocoinamounts(const UniValue& params, bool fHelp);
extern UniValue mintzerocoin(const UniValue& params, bool fHelp);
extern UniValue spendzerocoin(const UniValue& params, bool fHelp);
extern UniValue resetmintzerocoin(const UniValue& params, bool fHelp);
extern UniValue resetspentzerocoin(const UniValue& params, bool fHelp);
extern UniValue getarchivedzerocoin(const UniValue& params, bool fHelp);
extern UniValue importzerocoins(const UniValue& params, bool fHelp);
extern UniValue exportzerocoins(const UniValue& params, bool fHelp);
extern UniValue reconsiderzerocoins(const UniValue& params, bool fHelp);
extern UniValue getspentzerocoinamount(const UniValue& params, bool fHelp);
extern UniValue setzdachxseed(const UniValue& params, bool fHelp);
extern UniValue getzdachxseed(const UniValue& params, bool fHelp);
extern UniValue generatemintlist(const UniValue& params, bool fHelp);
extern UniValue searchdzdachx(const UniValue& params, bool fHelp);
extern UniValue dzdachxstate(const UniValue& params, bool fHelp);
extern UniValue getrawtransaction(const UniValue& params, bool fHelp); // in rcprawtransaction.cpp
extern UniValue listunspent(const UniValue& params, bool fHelp);
extern UniValue lockunspent(const UniValue& params, bool fHelp);
extern UniValue listlockunspent(const UniValue& params, bool fHelp);
extern UniValue createrawtransaction(const UniValue& params, bool fHelp);
extern UniValue decoderawtransaction(const UniValue& params, bool fHelp);
extern UniValue decodescript(const UniValue& params, bool fHelp);
extern UniValue signrawtransaction(const UniValue& params, bool fHelp);
extern UniValue sendrawtransaction(const UniValue& params, bool fHelp);
extern UniValue findserial(const UniValue& params, bool fHelp); // in rpcblockchain.cpp
extern UniValue getblockcount(const UniValue& params, bool fHelp);
extern UniValue getbestblockhash(const UniValue& params, bool fHelp);
extern UniValue getdifficulty(const UniValue& params, bool fHelp);
extern UniValue settxfee(const UniValue& params, bool fHelp);
extern UniValue getmempoolinfo(const UniValue& params, bool fHelp);
extern UniValue getrawmempool(const UniValue& params, bool fHelp);
extern UniValue getblockhash(const UniValue& params, bool fHelp);
extern UniValue getblock(const UniValue& params, bool fHelp);
extern UniValue getblockheader(const UniValue& params, bool fHelp);
extern UniValue getfeeinfo(const UniValue& params, bool fHelp);
extern UniValue gettxoutsetinfo(const UniValue& params, bool fHelp);
extern UniValue gettxout(const UniValue& params, bool fHelp);
extern UniValue verifychain(const UniValue& params, bool fHelp);
extern UniValue getchaintips(const UniValue& params, bool fHelp);
extern UniValue invalidateblock(const UniValue& params, bool fHelp);
extern UniValue reconsiderblock(const UniValue& params, bool fHelp);
extern UniValue getaccumulatorvalues(const UniValue& params, bool fHelp);
extern UniValue getpoolinfo(const UniValue& params, bool fHelp); // in rpcmasternode.cpp
extern UniValue masternode(const UniValue& params, bool fHelp);
extern UniValue listmasternodes(const UniValue& params, bool fHelp);
extern UniValue getmasternodecount(const UniValue& params, bool fHelp);
extern UniValue createmasternodebroadcast(const UniValue& params, bool fHelp);
extern UniValue decodemasternodebroadcast(const UniValue& params, bool fHelp);
extern UniValue relaymasternodebroadcast(const UniValue& params, bool fHelp);
extern UniValue masternodeconnect(const UniValue& params, bool fHelp);
extern UniValue masternodecurrent(const UniValue& params, bool fHelp);
extern UniValue masternodedebug(const UniValue& params, bool fHelp);
extern UniValue startmasternode(const UniValue& params, bool fHelp);
extern UniValue createmasternodekey(const UniValue& params, bool fHelp);
extern UniValue getmasternodeoutputs(const UniValue& params, bool fHelp);
extern UniValue listmasternodeconf(const UniValue& params, bool fHelp);
extern UniValue getmasternodestatus(const UniValue& params, bool fHelp);
extern UniValue getmasternodewinners(const UniValue& params, bool fHelp);
extern UniValue getmasternodescores(const UniValue& params, bool fHelp);
extern UniValue mnbudget(const UniValue& params, bool fHelp); // in rpcmasternode-budget.cpp
extern UniValue preparebudget(const UniValue& params, bool fHelp);
extern UniValue submitbudget(const UniValue& params, bool fHelp);
extern UniValue mnbudgetvote(const UniValue& params, bool fHelp);
extern UniValue getbudgetvotes(const UniValue& params, bool fHelp);
extern UniValue getnextsuperblock(const UniValue& params, bool fHelp);
extern UniValue getbudgetprojection(const UniValue& params, bool fHelp);
extern UniValue getbudgetinfo(const UniValue& params, bool fHelp);
extern UniValue mnbudgetrawvote(const UniValue& params, bool fHelp);
extern UniValue mnfinalbudget(const UniValue& params, bool fHelp);
extern UniValue checkbudgets(const UniValue& params, bool fHelp);
extern UniValue getinfo(const UniValue& params, bool fHelp); // in rpcmisc.cpp
extern UniValue mnsync(const UniValue& params, bool fHelp);
extern UniValue spork(const UniValue& params, bool fHelp);
extern UniValue validateaddress(const UniValue& params, bool fHelp);
extern UniValue createmultisig(const UniValue& params, bool fHelp);
extern UniValue verifymessage(const UniValue& params, bool fHelp);
extern UniValue setmocktime(const UniValue& params, bool fHelp);
extern UniValue getstakingstatus(const UniValue& params, bool fHelp);
bool StartRPC();
void InterruptRPC();
void StopRPC();
std::string JSONRPCExecBatch(const UniValue& vReq);
#endif // BITCOIN_RPCSERVER_H
| [
"media@dachcoin.live"
] | media@dachcoin.live |
a1a2ea4f364cf96de37277b7b564c5f2d5da6fad | fb2337d616b5e121d66b0b59b4222d2eec9d7290 | /src/cpp/206. Reverse Linked List.cpp | caa3f84ef6dc520dd0a296f68c36af248f0f1356 | [
"MIT"
] | permissive | asdlei99/D.S.A-Leet | 02348b33bf4a7a8a4f673de9a087d8557471af59 | be19c3ccc1f704e75590786fdfd4cd3ab4818d4f | refs/heads/master | 2020-09-24T15:47:03.756271 | 2019-03-29T01:34:37 | 2019-03-29T01:34:37 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 681 | cpp | /*
Reverse a singly linked list.
*/
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <common.hpp>
class Solution
{
public:
ListNode *reverseList(ListNode *head)
{
if (head == NULL)
{
return NULL;
}
ListNode *pre = head;
ListNode *node = head->next;
ListNode *next = NULL;
pre->next = NULL;
while (node != NULL)
{
next = node->next;
node->next = pre;
pre = node;
node = next;
}
return pre;
}
};
//O(N) | [
"x-jj@foxmail.com"
] | x-jj@foxmail.com |
4742cc34346ab3cb9c825d5380f5e6641c45b72f | ecc8548a48d60469f5bf3d433dbe3128bf860348 | /src/lib/drishti/face/FaceTracker.h | bd2abcd053e5b058deaf9bdf70e9801eca9d345b | [
"BSD-3-Clause"
] | permissive | kumaakh/drishti | 58b4ca5da590d7fa1efaae335e767fdf9f4fe04c | 2f38fc0228437f77e04e09fee3528a800085d930 | refs/heads/master | 2021-05-15T15:43:07.919235 | 2017-11-06T10:06:48 | 2017-11-06T10:06:48 | 107,410,936 | 0 | 0 | null | 2017-10-18T13:19:57 | 2017-10-18T13:19:57 | null | UTF-8 | C++ | false | false | 1,667 | h | /*! -*-c++-*-
@file FaceTracker.h
@author David Hirvonen
@brief Declaration of a face landmark tracker.
\copyright Copyright 2017 Elucideye, Inc. All rights reserved.
\license{This project is released under the 3 Clause BSD License.}
*/
#ifndef __drishti_face_FaceTracker_h__
#define __drishti_face_FaceTracker_h__
#include "drishti/face/drishti_face.h"
#include "drishti/face/Face.h" // FaceModel.h
#include <memory>
DRISHTI_FACE_NAMESPACE_BEGIN
class FaceTracker
{
public:
struct TrackInfo
{
TrackInfo() = default;
TrackInfo(std::size_t identifier)
: identifier(identifier)
, age(1)
, hits(1)
, misses(0)
{}
void hit()
{
age++;
hits++;
misses = 0;
}
void miss()
{
age++;
hits = 0;
misses++;
}
std::size_t identifier = 0;
std::size_t age = 0;
std::size_t hits = 0; // consecutive hits
std::size_t misses = 0; // consecutive misses
};
using FaceTrack = std::pair<drishti::face::FaceModel, TrackInfo>;
using FaceTrackVec = std::vector<FaceTrack>;
using FaceModelVec = std::vector<drishti::face::FaceModel>;
struct Impl;
FaceTracker(float costThreshold = 0.15f, std::size_t minTrackHits = 3, std::size_t maxTrackMisses = 3);
~FaceTracker();
void operator()(const FaceModelVec &facesIn, FaceTrackVec &facesOut);
protected:
std::unique_ptr<Impl> m_impl;
};
DRISHTI_FACE_NAMESPACE_END
#endif // __drishti_face_FaceDetectorAndTracker_h__
| [
"noreply@github.com"
] | kumaakh.noreply@github.com |
2c5a747a79e80d3fbf7e81763656c376af17dc7b | 212d4a1c13f8ccbce673982df770258c03f9abcc | /libnmm/sml/sml-tools/Helper.cc | 067e36e2142577748d5aa6e7a04719cea41209f3 | [] | no_license | ShravanTata/Mouse_Webots_BenchMarking | 0c3d62cd1d15c82134b8bdb8605f4e83d783875d | 90d838f42675752d68190e62c47693e45b6038e0 | refs/heads/master | 2020-12-30T15:07:40.042027 | 2017-05-29T15:47:37 | 2017-05-29T15:47:37 | 91,102,564 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,372 | cc | #include "Helper.hh"
#include <boost/random/normal_distribution.hpp>
#include <boost/random.hpp>
//constructor
typedef boost::mt19937 RandomGenerator;
static RandomGenerator rng(static_cast<unsigned> (time(0)));
// Gaussian
typedef boost::normal_distribution<double> NormalDistribution;
typedef boost::variate_generator<RandomGenerator&, \
NormalDistribution> GaussianGenerator;
static NormalDistribution nd_amplitude(0.0, 1.0);
static GaussianGenerator gauss(rng, nd_amplitude);
extern EventManager* eventManager;
extern SmlParameters parameters;
using namespace std;
double getSignalDependentNoise(double s){
// rescaling normal random variable
// N(0,1)*A --> N(0,A*A). We want N(0,K*A*A) --> N(0,1)*sqrt(K*A*A)
static double k = Settings::get<double>("noise_variationCoefficient");
static string noise_level = "noise_level";
static string noise_class = Settings::get<string>("noise_class");
static string noise_type = Settings::get<string>("noise_type");
k=k+parameters[1][noise_level];
if(eventManager->get<int>(STATES::CYCLE_COUNT) < 1)
return 0.0;;
if(noise_class=="revert")
s = 1.0-s;
else if(noise_class=="constant")
s = 1.0;
//return gauss()*k*s*s;
if(noise_type=="sqrt")
return gauss()*sqrt(k*s*s);
else
return gauss()*k*sqrt(s*s);
} | [
"tatarama@biorobpc4.epfl.ch"
] | tatarama@biorobpc4.epfl.ch |
f1bf06e81bbe9e48552823d8f040ccc6bff88791 | 763269f66f7e34a21b4cf1eee065984d9ab43406 | /RC_S620S_Test/RC_S620S_Test.ino | 04d9ee7dc3380ce9235fd37ae5ba6f0070133a6e | [] | no_license | yukusakabe/HomeSensorNetwork | 44ad57f8fadc8f12d8ed36b9d340fc8eb786ff97 | 098f751b0315fbf9fdbff1ab09d9019a15de40fa | refs/heads/master | 2020-05-20T00:23:33.841505 | 2013-06-10T19:59:07 | 2013-06-10T19:59:07 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,488 | ino | #include <SoftwareSerial.h>
#include <TypeDefinition.h>
#include <LiquidCrystal.h>
#include <libRCS620S.h>
#define COMMAND_TIMEOUT 400
#define POLLING_INTERVAL 1000
#define LED_PIN 13
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
RCS620S rcs620s(NULL);
void setup() {
int ret;
pinMode(LED_PIN, OUTPUT); // for Polling Status
digitalWrite(LED_PIN, LOW);
Serial.begin(115200); // for RC-S620/S
lcd.begin(16, 2); // for LCD
// initialize RC-S620/S
ret = rcs620s.initDevice();
while (!ret) {} // blocking
}
void loop() {
int ret, i;
uint8_t response[RCS620S_MAX_CARD_RESPONSE_LEN], responselen;
// Polling
digitalWrite(LED_PIN, HIGH);
rcs620s.timeout = COMMAND_TIMEOUT;
ret = rcs620s.pollingTypeA();
lcd.clear();
/*
if(ret) {
lcd.print("NFCID:");
lcd.setCursor(0, 1);
for(i = 0; i < rcs620s.nfcidlen; i++)
{
if(rcs620s.idm[i] / 0x10 == 0) lcd.print(0);
lcd.print(rcs620s.nfcid[i], HEX);
}
} else {
lcd.print("Polling...");
}*/
//ret = rcs620s.cardDataExchange((const uint8_t*)"\xa2\x06\x01\x02\x03\x04", 6, response, &responselen);
ret = rcs620s.cardDataExchange((const uint8_t*)"\x30\x06", 2, response);
if(ret) {
lcd.print("Response:");
lcd.setCursor(0, 1);
for(i = 0; i < 4; i++)
{
lcd.print(response[i], HEX);
}
} else {
lcd.print("Miss...");
}
rcs620s.rfOff();
digitalWrite(LED_PIN, LOW);
delay(POLLING_INTERVAL);
}
| [
"yu@kskb.jp"
] | yu@kskb.jp |
a5978e3ee825e8c0a636da529925b087fb92e632 | dfc05885f375d723c767e85c303b706890e9bba9 | /hashmap/main.cpp | ffb749d5a8d9f2a19fd5cb476064d9abbbe91b2c | [] | no_license | z847299324/demo | 417f3f11118e38f93a4263485361ca4334bb8616 | 0f7649f5834682c4f5d32885621f4033a34e0604 | refs/heads/master | 2018-10-19T22:31:48.323534 | 2018-09-20T01:27:17 | 2018-09-20T01:27:17 | 99,782,273 | 0 | 0 | null | null | null | null | GB18030 | C++ | false | false | 1,947 | cpp | #define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char *argv[])
{
char ch;
int flag = 0;//设置标志位
char *infilename ="in", *outfilename = "out"; // 初始化的输入输出文件名
FILE *infile, *outfile;//文件指针
if (argc == 2)
strcpy(infilename, argv[1]);
else if (argc == 3) // 指定输入输出文件名
{
if (!strcmp(argv[1], argv[2]))//检测来两个传入的参数
{
printf("error:file is same\n");
exit(0);
}
strcpy(infilename, argv[1]);
strcpy(outfilename, argv[2]);
}
else if (argc > 3)
{
printf("error:传入参数过多\n");
exit(0);
}
if ((infile = fopen(infilename, "r")) == NULL)//打开文件的错误检测
{
printf("can't open input file!\n");
exit(0);
}
if ((outfile = fopen(outfilename, "w")) == NULL)//打开输出文件的检测
{
printf("can't open output file!\n");
exit(0);
}
while ((ch = fgetc(infile)) != EOF) // 读输入文件中的字符
{
if (flag == 0)
{
if (ch == '/') // 遇到"/", flag = 1;
{
flag = 1;
}
}
else if (flag == 1)
{
if (ch == '/') // 遇到"//", flag = 2;
{
flag = 2;
continue;
}
else if (ch == '*') // 遇到"/*", flag = 3;
{
flag = 3;
continue;
}
else // 遇到的"/"非注释符
{
flag = 0;
fputc('/', outfile);
}
}
else if (flag == 2)//遇到双//注释
{
if (ch == '\n') // 遇到"//"注释结尾的换行符
flag = 0;
else // 遇到"//"的注释部分
continue;
}
else if (flag == 3)
{
if (ch == '*') // 遇到"/*"注释中的"*", flag = 4;
flag = 4;
continue;
}
else if (flag == 4)
{
if (ch == '/') // 遇到"/*"注释结尾的"*/"
flag = 0;
else if (ch != '*') // 遇到"/*"的注释部分
flag = 3;
continue;
}
else
{
if (ch == ' ')
{
continue;
}
fputc(ch, outfile);
}
}
fclose(infile);
fclose(outfile);
} | [
"123456@qq.com"
] | 123456@qq.com |
3665d4f7b455df893765c1e38391e9757ade0639 | f65ce9e212064d6c27c7f9bd13684b83fef58d83 | /Softrast/src/App.h | 8d3a8653f6b115cf7b6858a00f8fd674953d9749 | [
"MIT"
] | permissive | RickvanMiltenburg/SoftRast | 9722d2bda7b9fcfe2bf5494b09de6bbf99e27237 | e14b74804c052bb448058808cbb6dd06616ba585 | refs/heads/master | 2020-05-18T18:00:55.752279 | 2015-05-18T14:05:28 | 2015-05-18T14:05:28 | 35,819,422 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 956 | h | #pragma once
#include <stdint.h>
#include <d3d11.h>
#include "RenderTarget.h"
class App
{
public:
App ( ID3D11Device* device, ID3D11DeviceContext* deviceContext, ID3D11RenderTargetView** backBuffer, ID3D11Texture2D** backBufferTexture );
~App ( );
bool LoadModel ( const char* path );
void OnResize ( uint32_t width, uint32_t height );
void GUITick ( float cpuDeltaTimeSeconds, float gpuDeltaTimeSeconds );
void Tick ( float cpuDeltaTimeSeconds, float gpuDeltaTimeSeconds );
private:
ID3D11Device* m_Device;
ID3D11DeviceContext* m_DeviceContext;
ID3D11RenderTargetView** m_BackBuffer;
ID3D11Texture2D** m_BackBufferTexture;
ID3D11VertexShader* m_FinalOutputVertexShader;
ID3D11PixelShader* m_FinalOutputPixelShader;
ID3D11SamplerState* m_Sampler;
ID3D11Buffer* m_IndexBuffer;
RenderTarget* m_IntermediateRenderTarget = nullptr;
DepthRenderTarget* m_DepthRenderTarget;
uint32_t m_ScreenWidth, m_ScreenHeight;
}; | [
"rick@milty.nl"
] | rick@milty.nl |
9e57ed1f90551bf84fd2f2fa7e480b440b16e419 | 6b5d6690678f05a71837b85016db3da52359a2f6 | /src/net/ftp/ftp_network_transaction.h | ec0c1f8de2b39a52ee073dc70106b6d65422b117 | [
"BSD-3-Clause",
"MIT"
] | permissive | bopopescu/MQUIC | eda5477bacc68f30656488e3cef243af6f7460e6 | 703e944ec981366cfd2528943b1def2c72b7e49d | refs/heads/master | 2022-11-22T07:41:11.374401 | 2016-04-08T22:27:32 | 2016-04-08T22:27:32 | 282,352,335 | 0 | 0 | MIT | 2020-07-25T02:05:49 | 2020-07-25T02:05:49 | null | UTF-8 | C++ | false | false | 7,990 | h | // Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef NET_FTP_FTP_NETWORK_TRANSACTION_H_
#define NET_FTP_FTP_NETWORK_TRANSACTION_H_
#include <stdint.h>
#include <string>
#include <utility>
#include "base/compiler_specific.h"
#include "base/gtest_prod_util.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
#include "net/base/address_list.h"
#include "net/base/auth.h"
#include "net/dns/host_resolver.h"
#include "net/dns/single_request_host_resolver.h"
#include "net/ftp/ftp_ctrl_response_buffer.h"
#include "net/ftp/ftp_response_info.h"
#include "net/ftp/ftp_transaction.h"
#include "net/log/net_log.h"
namespace net {
class ClientSocketFactory;
class StreamSocket;
class NET_EXPORT_PRIVATE FtpNetworkTransaction : public FtpTransaction {
public:
FtpNetworkTransaction(HostResolver* resolver,
ClientSocketFactory* socket_factory);
~FtpNetworkTransaction() override;
int Stop(int error);
// FtpTransaction methods:
int Start(const FtpRequestInfo* request_info,
const CompletionCallback& callback,
const BoundNetLog& net_log) override;
int RestartWithAuth(const AuthCredentials& credentials,
const CompletionCallback& callback) override;
int Read(IOBuffer* buf,
int buf_len,
const CompletionCallback& callback) override;
const FtpResponseInfo* GetResponseInfo() const override;
LoadState GetLoadState() const override;
uint64_t GetUploadProgress() const override;
private:
FRIEND_TEST_ALL_PREFIXES(FtpNetworkTransactionTest,
DownloadTransactionEvilPasvUnsafeHost);
enum Command {
COMMAND_NONE,
COMMAND_USER,
COMMAND_PASS,
COMMAND_SYST,
COMMAND_TYPE,
COMMAND_EPSV,
COMMAND_PASV,
COMMAND_PWD,
COMMAND_SIZE,
COMMAND_RETR,
COMMAND_CWD,
COMMAND_LIST,
COMMAND_QUIT,
};
// Major categories of remote system types, as returned by SYST command.
enum SystemType {
SYSTEM_TYPE_UNKNOWN,
SYSTEM_TYPE_UNIX,
SYSTEM_TYPE_WINDOWS,
SYSTEM_TYPE_OS2,
SYSTEM_TYPE_VMS,
};
// Data representation type, see RFC 959 section 3.1.1. Data Types.
// We only support the two most popular data types.
enum DataType {
DATA_TYPE_ASCII,
DATA_TYPE_IMAGE,
};
// In FTP we need to issue different commands depending on whether a resource
// is a file or directory. If we don't know that, we're going to autodetect
// it.
enum ResourceType {
RESOURCE_TYPE_UNKNOWN,
RESOURCE_TYPE_FILE,
RESOURCE_TYPE_DIRECTORY,
};
enum State {
// Control connection states:
STATE_CTRL_RESOLVE_HOST,
STATE_CTRL_RESOLVE_HOST_COMPLETE,
STATE_CTRL_CONNECT,
STATE_CTRL_CONNECT_COMPLETE,
STATE_CTRL_READ,
STATE_CTRL_READ_COMPLETE,
STATE_CTRL_WRITE,
STATE_CTRL_WRITE_COMPLETE,
STATE_CTRL_WRITE_USER,
STATE_CTRL_WRITE_PASS,
STATE_CTRL_WRITE_SYST,
STATE_CTRL_WRITE_TYPE,
STATE_CTRL_WRITE_EPSV,
STATE_CTRL_WRITE_PASV,
STATE_CTRL_WRITE_PWD,
STATE_CTRL_WRITE_RETR,
STATE_CTRL_WRITE_SIZE,
STATE_CTRL_WRITE_CWD,
STATE_CTRL_WRITE_LIST,
STATE_CTRL_WRITE_QUIT,
// Data connection states:
STATE_DATA_CONNECT,
STATE_DATA_CONNECT_COMPLETE,
STATE_DATA_READ,
STATE_DATA_READ_COMPLETE,
STATE_NONE
};
// Resets the members of the transaction so it can be restarted.
void ResetStateForRestart();
// Establishes the data connection and switches to |state_after_connect|.
// |state_after_connect| should only be RETR or LIST.
void EstablishDataConnection(State state_after_connect);
void DoCallback(int result);
void OnIOComplete(int result);
// Executes correct ProcessResponse + command_name function based on last
// issued command. Returns error code.
int ProcessCtrlResponse();
int SendFtpCommand(const std::string& command,
const std::string& command_for_log,
Command cmd);
// Returns request path suitable to be included in an FTP command. If the path
// will be used as a directory, |is_directory| should be true.
std::string GetRequestPathForFtpCommand(bool is_directory) const;
// See if the request URL contains a typecode and make us respect it.
void DetectTypecode();
// Runs the state transition loop.
int DoLoop(int result);
// Each of these methods corresponds to a State value. Those with an input
// argument receive the result from the previous state. If a method returns
// ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
// next state method as the result arg.
int DoCtrlResolveHost();
int DoCtrlResolveHostComplete(int result);
int DoCtrlConnect();
int DoCtrlConnectComplete(int result);
int DoCtrlRead();
int DoCtrlReadComplete(int result);
int DoCtrlWrite();
int DoCtrlWriteComplete(int result);
int DoCtrlWriteUSER();
int ProcessResponseUSER(const FtpCtrlResponse& response);
int DoCtrlWritePASS();
int ProcessResponsePASS(const FtpCtrlResponse& response);
int DoCtrlWriteSYST();
int ProcessResponseSYST(const FtpCtrlResponse& response);
int DoCtrlWritePWD();
int ProcessResponsePWD(const FtpCtrlResponse& response);
int DoCtrlWriteTYPE();
int ProcessResponseTYPE(const FtpCtrlResponse& response);
int DoCtrlWriteEPSV();
int ProcessResponseEPSV(const FtpCtrlResponse& response);
int DoCtrlWritePASV();
int ProcessResponsePASV(const FtpCtrlResponse& response);
int DoCtrlWriteRETR();
int ProcessResponseRETR(const FtpCtrlResponse& response);
int DoCtrlWriteSIZE();
int ProcessResponseSIZE(const FtpCtrlResponse& response);
int DoCtrlWriteCWD();
int ProcessResponseCWD(const FtpCtrlResponse& response);
int ProcessResponseCWDNotADirectory();
int DoCtrlWriteLIST();
int ProcessResponseLIST(const FtpCtrlResponse& response);
int DoCtrlWriteQUIT();
int ProcessResponseQUIT(const FtpCtrlResponse& response);
int DoDataConnect();
int DoDataConnectComplete(int result);
int DoDataRead();
int DoDataReadComplete(int result);
void RecordDataConnectionError(int result);
Command command_sent_;
CompletionCallback io_callback_;
CompletionCallback user_callback_;
BoundNetLog net_log_;
const FtpRequestInfo* request_;
FtpResponseInfo response_;
// Cancels the outstanding request on destruction.
SingleRequestHostResolver resolver_;
AddressList addresses_;
// User buffer passed to the Read method for control socket.
scoped_refptr<IOBuffer> read_ctrl_buf_;
scoped_ptr<FtpCtrlResponseBuffer> ctrl_response_buffer_;
scoped_refptr<IOBuffer> read_data_buf_;
int read_data_buf_len_;
// Buffer holding the command line to be written to the control socket.
scoped_refptr<IOBufferWithSize> write_command_buf_;
// Buffer passed to the Write method of control socket. It actually writes
// to the write_command_buf_ at correct offset.
scoped_refptr<DrainableIOBuffer> write_buf_;
int last_error_;
SystemType system_type_;
// Data type to be used for the TYPE command.
DataType data_type_;
// Detected resource type (file or directory).
ResourceType resource_type_;
// Initially we favour EPSV over PASV for transfers but should any
// EPSV fail, we fall back to PASV for the duration of connection.
bool use_epsv_;
AuthCredentials credentials_;
// Current directory on the remote server, as returned by last PWD command,
// with any trailing slash removed.
std::string current_remote_directory_;
uint16_t data_connection_port_;
ClientSocketFactory* socket_factory_;
scoped_ptr<StreamSocket> ctrl_socket_;
scoped_ptr<StreamSocket> data_socket_;
State next_state_;
// State to switch to after data connection is complete.
State state_after_data_connect_complete_;
};
} // namespace net
#endif // NET_FTP_FTP_NETWORK_TRANSACTION_H_
| [
"junhuac@hotmail.com"
] | junhuac@hotmail.com |
4c144649924ed465079b211bde3170611940e0f9 | f3cc7fafad9d507bd608fb1c15fc792fd07f4615 | /src/Collisions/CollisionalFusionDD.cpp | 770e262337b3cf79624f5615f01e9271855fee47 | [] | no_license | michaeltouati/Smilei | 2eb3367b950bc4defe7a023bc802e169f6bf95a9 | e551c9640859e11df33211c37d06f83b65773132 | refs/heads/master | 2021-11-29T22:35:00.808182 | 2021-10-08T13:07:14 | 2021-10-08T13:07:14 | 235,618,233 | 0 | 0 | null | 2020-01-22T16:45:01 | 2020-01-22T16:45:00 | null | UTF-8 | C++ | false | false | 4,079 | cpp | #include "CollisionalFusionDD.h"
#include "Collisions.h"
#include "Species.h"
#include "Patch.h"
#include <cmath>
using namespace std;
// Coefficients used for energy interpolation
// The list of energies is in logarithmic scale,
// with Emin=1 keV, Emax=631 MeV and npoints=50.
const int CollisionalFusionDD::npoints = 50;
const double CollisionalFusionDD::npointsm1 = ( double )( npoints-1 );
const double CollisionalFusionDD::a1 = log(511./(2.*2.013553)); // = ln(me*c^2 / Emin / n_nucleons)
const double CollisionalFusionDD::a2 = 3.669039; // = (npoints-1) / ln( Emax/Emin )
const double CollisionalFusionDD::a3 = log(511./0.7/(2.*2.013553));; // = ln(me*c^2 / Eref / n_nucleons)
// Log of cross-section in units of 4 pi re^2
const double CollisionalFusionDD::DB_log_crossSection[50] = {
-27.307, -23.595, -20.383, -17.607, -15.216, -13.167, -11.418, -9.930, -8.666, -7.593,
-6.682, -5.911, -5.260, -4.710, -4.248, -3.858, -3.530, -3.252, -3.015, -2.814, -2.645,
-2.507, -2.398, -2.321, -2.273, -2.252, -2.255, -2.276, -2.310, -2.352, -2.402, -2.464,
-2.547, -2.664, -2.831, -3.064, -3.377, -3.773, -4.249, -4.794, -5.390, -6.021, -6.677,
-7.357, -8.072, -8.835, -9.648, -10.498, -11.387, -12.459
};
// Constructor
CollisionalFusionDD::CollisionalFusionDD(
Params *params,
vector<Particles*> product_particles,
vector<unsigned int> product_species,
double rate_multiplier
)
: CollisionalNuclearReaction(params, &product_particles, &product_species, rate_multiplier)
{
}
// Cloning constructor
CollisionalFusionDD::CollisionalFusionDD( CollisionalNuclearReaction *NR )
: CollisionalNuclearReaction( NR )
{
}
double CollisionalFusionDD::crossSection( double log_ekin )
{
// Interpolate the total cross-section at some value of ekin = m1(g1-1) + m2(g2-1)
double x = a2*( a1 + log_ekin );
double cs;
// if energy below Emin, approximate to 0.
if( x < 0. ) {
cs = 0.;
}
// if energy within table range, interpolate
else if( x < npointsm1 ) {
int i = int( x );
double a = x - ( double )i;
cs = exp(
( DB_log_crossSection[i+1]-DB_log_crossSection[i] )*a + DB_log_crossSection[i]
);
}
// if energy above table range, extrapolate
else {
double a = x - npointsm1;
cs = exp(
( DB_log_crossSection[npoints-1]-DB_log_crossSection[npoints-2] )*a + DB_log_crossSection[npoints-1]
);
}
return cs;
}
void CollisionalFusionDD::makeProducts(
Random* random, // Access to random numbers
double ekin, double log_ekin, // total kinetic energy and its natural log
double tot_charge, // total charge
std::vector<Particles*> &particles, // List of Particles objects to store the reaction products
std::vector<double> &new_p_COM, // List of gamma*v of reaction products in COM frame
std::vector<short> &q, // List of charges of reaction products
std::vector<double> &sinX, // List of sin of outgoing angle of reaction products
std::vector<double> &cosX // List of cos of outgoing angle of reaction products
) {
double U = random->uniform2(); // random number ]-1,1]
double U1 = abs( U );
bool up = U > 0.;
// Sample the products angle from empirical fits
double lnE = a3 + log_ekin;
double alpha = lnE < 0. ? 1. : exp(-0.024*lnE*lnE);
double one_m_cosX = alpha*U1 / sqrt( (1.-U1) + alpha*alpha*U1 );
cosX = { 1. - one_m_cosX };
sinX = { sqrt( one_m_cosX * (1.+cosX[0]) ) };
// Calculate the resulting momenta from energy / momentum conservation
const double Q = 6.397; // Qvalue
const double m_n = 1838.7;
const double m_He = 5497.9;
double p_COM = { sqrt(
(ekin+Q) * (ekin+Q+2.*m_n) * (ekin+Q+2.*m_He) * (ekin+Q+2.*m_n+2.*m_He) )
/ ( ( ekin+Q+m_n+m_He ) * (2.*m_He)
) };
// Set particle properties
q = { (short) tot_charge };
particles = { product_particles_[0] }; // helium3
if( up ) {
new_p_COM = { p_COM };
} else {
new_p_COM = { -p_COM };
}
}
| [
"frederic.perez@polytechnique.edu"
] | frederic.perez@polytechnique.edu |
d42c8deff676e637fed89c4e7e2a62848f769323 | 76957b84c5c97ac08dd2baea6cd3d5db96d26012 | /common_project/nim/nim_doc/callback/doc_callback.h | 4c062c88ae2734f183bbc7743fddb5d21976e41b | [] | no_license | luchengbiao/base | 4e14e71b9c17ff4d2f2c064ec4f5eb7e9ce09ac8 | f8af675e01b0fee31a2b648eb0b95d0c115d68ff | refs/heads/master | 2021-06-27T12:04:29.620264 | 2019-04-29T02:39:32 | 2019-04-29T02:39:32 | 136,405,188 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 856 | h | #pragma once
#include <stdint.h>
#include <list>
#include "nim_sdk_manager\helper\nim_doc_trans_helper.h"
namespace nim_comp
{
/** @class DocTransCallback
* @brief 文档传输回调类
* @copyright (c) 2016, NetEase Inc. All rights reserved
* @author redrain
* @date 2016/12/15
*/
class DocTransCallback
{
public:
/**
* 文档转换结果通知的回调函数
* @param[in] code 错误码
* @param[in] doc_info 文档信息
* @return void 无返回值
*/
static void DocTransNotifyCallback(int32_t code, const nim::DocTransInfo& doc_info);
/**
* 接收文档信息的回调函数
* @param[in] code 错误码
* @param[in] count 服务器总条数
* @param[in] doc_infos 文档信息
* @return void 无返回值
*/
static void DocInfosCallback(int32_t code, int32_t count, const std::list<nim::DocTransInfo>& doc_infos);
};
} | [
"993925668@qq.com"
] | 993925668@qq.com |
eab58b1d187bbc8260bb2f0bfad521cf86d7c74a | 68c0596591ca804f3f5d4cebc1332704ab89fd14 | /BibliotecaSTL/Pilha.cpp | bc75838c2e941dcbc0e0f908ee297b993874ee39 | [] | no_license | Daniel-Fonseca-da-Silva/C-Basic-Codes | dcf6cbb3145f5fdcba1465f8a92c498400bef2bd | f20af5e636a236e07f35c4c49d12d2a8fb47ac5c | refs/heads/master | 2020-06-23T08:37:00.501384 | 2019-07-29T03:56:23 | 2019-07-29T03:56:23 | 198,572,860 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 555 | cpp | #include <iostream>
#include <stack> // pilha
// Pilha retira o primeiro elemento do topo
// Primeiro que entra é o último que sai (first in last out)
using namespace std;
int main()
{
stack<double> pilha;
pilha.push(3.14);
pilha.push(5.123);
pilha.push(10.56);
pilha.pop(); // Retira 3.14 do topo
cout << "Topo: " << pilha.top() << endl;
cout << "Tamanho da pilha: " << pilha.size() << endl;
if(pilha.empty())
{
std::cout << "Pilha vazia: " << '\n';
}
else
{
std::cout << "Pilha não vazia: " << '\n';
}
return 0;
}
| [
"developer-web@programmer.net"
] | developer-web@programmer.net |
010fbde138ce792da167028ff08cf326c7859740 | 755e7b5e73c5aa3b9702ba97ec33ca30c9e4e667 | /CFEM/PhyElementBar.cpp | b769156b8bb4823dda83c03c2b51522255fa7db5 | [] | no_license | JohnDTill/QtFEM | a18733aed7a42f50874c6a098b1128327e2dbb2c | 95ed1ba67e95760209f20733aee2d6be085b91cb | refs/heads/master | 2022-11-08T02:03:33.570951 | 2020-06-10T01:27:05 | 2020-06-10T01:27:05 | 174,175,275 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | #include "PhyElementBar.h"
#include "PhyNode.h"
void PhyElementBar::setGeometry(){
L = fabs(eNodePtrs[1]->coordinate(0) - eNodePtrs[0]->coordinate(0));
}
void PhyElementBar::setInternalMaterialProperties(VectorXd& pMat){
A = pMat(mpb_A);
E = pMat(mpb_E);
}
void PhyElementBar::Calculate_ElementStiffness(){
// compute stiffness matrix:
ke.resize(2, 2);
double factor = A * E / L;
ke(0, 0) = ke(1, 1) = factor;
ke(1, 0) = ke(0, 1) = -factor;
}
void PhyElementBar::SpecificOutput(ostream& out) const{
double tension = A*E/L * (eNodePtrs[1]->dofs[0].value - eNodePtrs[0]->dofs[0].value);
out << tension;
}
| [
"JohnDTill@gmail.com"
] | JohnDTill@gmail.com |
95a21d796bda56e0e7ea2fd477905e76111afe4b | 2586a6db26d414dfbfeee28d9eeeaf50c13a3941 | /strobingled.ino | d2ddf66d9dc3eb0d969ffbc35aae9fe2527cffa8 | [] | no_license | minakhan01/ClockArduinoCode | 334b6e9221d499498978611b6402494fda45d452 | 68043e47fefe239de9ed1c81c5539668119f1fb1 | refs/heads/master | 2021-01-20T06:59:55.981210 | 2017-05-02T19:29:10 | 2017-05-02T19:29:10 | 89,946,412 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,124 | ino | // Stroboscopic Tachometer
// Ed Nisley - KE4ANU - December 2012
//----------
// Pin assignments
const byte PIN_KNOB_A = 2; // knob A switch - must be on ext interrupt 2
const byte PIN_KNOB_B = 4; // .. B switch
const byte PIN_BUTTONS = A5; // .. push-close momentary switches
const byte PIN_STROBE = 9; // LED drive, must be PWM9 = OCR1A using Timer1
const byte PIN_PWM10 = 10; // drivers for LED strip, must turn these off...
const byte PIN_PWM11 = 11;
const byte PIN_SYNC = 13; // scope sync
//----------
// Constants
const int UPDATEMS = 10; // update LEDs only this many ms apart
#define TCCRxB_CS 0x03 // Timer prescaler CS=3 -> 1:64 division
const float TICKPD = 64.0 * 62.5e-9; // basic Timer1 tick rate: prescaler * clock
enum KNOB_STATES {KNOB_CLICK_0,KNOB_CLICK_1};
// ButtonThreshold must have N_BUTTONS elements, last = 1024
enum BUTTONS {SW_KNOB, B_1, B_2, B_3, B_4, N_BUTTONS};
const word ButtonThreshold[] = {265/2, (475+265)/2, (658+475)/2, (834+658)/2, (1023+834)/2, 1024};
//----------
// Globals
float FlashLength = 0.1e-3; // strobe flash duration in seconds
word FlashLengthCt = FlashLength / TICKPD; // ... in Timer1 ticks
float FlashFreq = 50.0; // strobe flash frequency in Hz
float FlashPd = 1.0 / FlashFreq; // ... period in sec
word FlashPdCt = FlashPd / TICKPD; // ... period in Timer1 ticks
float FreqIncr = 1.0; // default frequency increment
const float FreqMin = 4.0;
const float FreqMax = 1.0/(4.0*FlashLength);
volatile char KnobCounter = 0;
volatile char KnobState;
byte Button, PrevButton;
unsigned long MillisNow;
unsigned long MillisThen;
//-- Helper routine for printf()
int s_putc(char c, FILE *t) {
Serial.write(c);
}
//-- Knob interrupt handler
void KnobHandler(void)
{
byte Inputs;
Inputs = digitalRead(PIN_KNOB_B) << 1 | digitalRead(PIN_KNOB_A); // align raw inputs
// Inputs ^= 0x02; // fix direction
switch (KnobState << 2 | Inputs) {
case 0x00 : // 0 00 - glitch
break;
case 0x01 : // 0 01 - UP to 1
KnobCounter++;
KnobState = KNOB_CLICK_1;
break;
case 0x03 : // 0 11 - DOWN to 1
KnobCounter--;
KnobState = KNOB_CLICK_1;
break;
case 0x02 : // 0 10 - glitch
break;
case 0x04 : // 1 00 - DOWN to 0
KnobCounter--;
KnobState = KNOB_CLICK_0;
break;
case 0x05 : // 1 01 - glitch
break;
case 0x07 : // 1 11 - glitch
break;
case 0x06 : // 1 10 - UP to 0
KnobCounter++;
KnobState = KNOB_CLICK_0;
break;
default : // something is broken!
KnobCounter = 0;
KnobState = KNOB_CLICK_0;
}
}
//-- Read and decipher analog switch inputs
// returns N_BUTTONS if no buttons pressed
byte ReadButtons(int PinNumber) {
word RawButton;
byte ButtonNum;
RawButton = analogRead(PinNumber);
for (ButtonNum = 0; ButtonNum <= N_BUTTONS; ButtonNum++){
if (RawButton < ButtonThreshold[ButtonNum])
break;
}
return ButtonNum;
}
//------------------
// Set things up
void setup() {
pinMode(PIN_SYNC,OUTPUT);
digitalWrite(PIN_SYNC,LOW); // show we arrived
analogWrite(PIN_PWM10,0); // turn off other PWM outputs
analogWrite(PIN_PWM11,0);
analogWrite(PIN_STROBE,1); // let Arduino set up default Timer1 PWM
TCCR1B = 0; // turn off Timer1 for strobe setup
TCCR1A = 0x82; // clear OCR1A on match, Fast PWM, lower WGM1x = 14
ICR1 = FlashPdCt;
OCR1A = FlashLengthCt;
TCNT1 = FlashLengthCt - 1;
TCCR1B = 0x18 | TCCRxB_CS; // upper WGM1x = 14, Prescale 1:64, start Timer1
pinMode(PIN_KNOB_B,INPUT_PULLUP);
pinMode(PIN_KNOB_A,INPUT_PULLUP);
KnobState = digitalRead(PIN_KNOB_A);
Button = PrevButton = ReadButtons(PIN_BUTTONS);
attachInterrupt((PIN_KNOB_A - 2),KnobHandler,CHANGE);
Serial.begin(9600);
fdevopen(&s_putc,0); // set up serial output for printf()
printf("Stroboscope Tachometer\r\nEd Nisley - KE4ZNU - December 2012\r\n");
printf("Frequency: %d.%02d\nPulse duration: %d us\n",
(int)FlashFreq,(int)(100.0 * (FlashFreq - trunc(FlashFreq))),
(int)(1e6 * FlashLength));
MillisThen = millis();
}
//------------------
// Run the test loop
void loop() {
MillisNow = millis();
if ((MillisNow - MillisThen) > UPDATEMS) {
digitalWrite(PIN_SYNC,HIGH);
Button = ReadButtons(PIN_BUTTONS);
if (PrevButton != Button) {
if (Button == N_BUTTONS) {
// printf("Button %d released\n",PrevButton);
FreqIncr = 1.0;
}
else
// printf("Button %d pressed\n",Button);
// if (Button == SW_KNOB)
FreqIncr = 0.01;
PrevButton = Button;
}
if (KnobCounter) {
FlashFreq += (float)KnobCounter * FreqIncr;
KnobCounter = 0;
FlashFreq = constrain(FlashFreq,FreqMin,FreqMax);
FlashFreq = round(100.0 * FlashFreq) / 100.0;
FlashPd = 1.0 / FlashFreq;
FlashPdCt = FlashPd / TICKPD;
noInterrupts();
TCCR1B &= 0xf8; // stop Timer1
ICR1 = FlashPdCt; // set new period
TCNT1 = FlashPdCt - 1; // force immediate update
TCCR1B |= TCCRxB_CS; // start Timer1
interrupts();
printf("Frequency: %d.%02d\n",
(int)FlashFreq,(int)(100.0 * (FlashFreq - trunc(FlashFreq))));
}
digitalWrite(PIN_SYNC,LOW);
MillisThen = MillisNow;
}
}
| [
"gordo@ALIENWARE-15-R3.mit.edu"
] | gordo@ALIENWARE-15-R3.mit.edu |
137e6ba78c4bd25145f987530a4b8f4daf98a295 | 59515f3d82033ed774c135a5310ed86f7db8b7f7 | /mainwindow.h | 8c77496833d1743f0fa21a1c3b628cb6df0835b4 | [] | no_license | CyberMakaron/2019_VT-22_Klesov_Makar_2 | e3295a27466debe43295686e46987a5937a25fa1 | e9c2de2618e906783929f301b9c2d30d276dcd20 | refs/heads/master | 2020-05-23T19:18:39.123124 | 2019-05-22T21:12:50 | 2019-05-22T21:12:50 | 186,909,171 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 737 | h | #ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include <QString>
#include <QPixmap>
#include "dir_imagesworker.h"
#include "shortcutworker.h"
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = nullptr);
void setImage(QString img);
~MainWindow();
private slots:
void on_openFolder_triggered();
void on_previous_img_clicked();
void on_next_img_clicked();
void on_addShortcut_triggered();
void on_Shortcut_triggered();
void on_removeShortcut_triggered();
private:
Ui::MainWindow *ui;
DirImagesWorker dir_img_w;
ShortcutWorker shortcut_w;
int mode;
};
#endif // MAINWINDOW_H
| [
"makrusim@yandex.ru"
] | makrusim@yandex.ru |
562386b22cb290f536bf08ae70457fa8816770fe | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /components/safe_browsing/core/common/safe_browsing_prefs.cc | e0b3f4727e8d5b419b756fedb9ed9953ca61da84 | [
"BSD-3-Clause"
] | permissive | otcshare/chromium-src | 26a7372773b53b236784c51677c566dc0ad839e4 | 64bee65c921db7e78e25d08f1e98da2668b57be5 | refs/heads/webml | 2023-03-21T03:20:15.377034 | 2020-11-16T01:40:14 | 2020-11-16T01:40:14 | 209,262,645 | 18 | 21 | BSD-3-Clause | 2023-03-23T06:20:07 | 2019-09-18T08:52:07 | null | UTF-8 | C++ | false | false | 16,705 | cc | // Copyright (c) 2016 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "components/safe_browsing/core/common/safe_browsing_prefs.h"
#include "base/check_op.h"
#include "base/command_line.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "components/pref_registry/pref_registry_syncable.h"
#include "components/prefs/pref_registry_simple.h"
#include "components/prefs/pref_service.h"
#include "components/safe_browsing/core/common/thread_utils.h"
#include "components/safe_browsing/core/features.h"
#include "net/base/url_util.h"
#include "url/gurl.h"
#include "url/url_canon.h"
namespace {
// Update the correct UMA metric based on which pref was changed and which UI
// the change was made on.
void RecordExtendedReportingPrefChanged(
const PrefService& prefs,
safe_browsing::ExtendedReportingOptInLocation location) {
bool pref_value = safe_browsing::IsExtendedReportingEnabled(prefs);
switch (location) {
case safe_browsing::SBER_OPTIN_SITE_CHROME_SETTINGS:
UMA_HISTOGRAM_BOOLEAN(
"SafeBrowsing.Pref.Scout.SetPref.SBER2Pref.ChromeSettings",
pref_value);
break;
case safe_browsing::SBER_OPTIN_SITE_ANDROID_SETTINGS:
UMA_HISTOGRAM_BOOLEAN(
"SafeBrowsing.Pref.Scout.SetPref.SBER2Pref.AndroidSettings",
pref_value);
break;
case safe_browsing::SBER_OPTIN_SITE_DOWNLOAD_FEEDBACK_POPUP:
UMA_HISTOGRAM_BOOLEAN(
"SafeBrowsing.Pref.Scout.SetPref.SBER2Pref.DownloadPopup",
pref_value);
break;
case safe_browsing::SBER_OPTIN_SITE_SECURITY_INTERSTITIAL:
UMA_HISTOGRAM_BOOLEAN(
"SafeBrowsing.Pref.Scout.SetPref.SBER2Pref.SecurityInterstitial",
pref_value);
break;
default:
NOTREACHED();
}
}
// A helper function to return a GURL containing just the scheme, host, port,
// and path from a URL. Equivalent to clearing any username, password, query,
// and ref. Return empty URL if |url| is not valid.
GURL GetSimplifiedURL(const GURL& url) {
if (!url.is_valid() || !url.IsStandard())
return GURL();
url::Replacements<char> replacements;
replacements.ClearUsername();
replacements.ClearPassword();
replacements.ClearQuery();
replacements.ClearRef();
return url.ReplaceComponents(replacements);
}
} // namespace
namespace prefs {
const char kSafeBrowsingEnabled[] = "safebrowsing.enabled";
const char kSafeBrowsingEnhanced[] = "safebrowsing.enhanced";
const char kSafeBrowsingEnterpriseRealTimeUrlCheckMode[] =
"safebrowsing.enterprise_real_time_url_check_mode";
const char kSafeBrowsingExtendedReportingOptInAllowed[] =
"safebrowsing.extended_reporting_opt_in_allowed";
const char kSafeBrowsingIncidentsSent[] = "safebrowsing.incidents_sent";
const char kSafeBrowsingProceedAnywayDisabled[] =
"safebrowsing.proceed_anyway_disabled";
const char kSafeBrowsingSawInterstitialScoutReporting[] =
"safebrowsing.saw_interstitial_sber2";
const char kSafeBrowsingScoutReportingEnabled[] =
"safebrowsing.scout_reporting_enabled";
const char kSafeBrowsingTriggerEventTimestamps[] =
"safebrowsing.trigger_event_timestamps";
const char kSafeBrowsingUnhandledGaiaPasswordReuses[] =
"safebrowsing.unhandled_sync_password_reuses";
const char kSafeBrowsingNextPasswordCaptureEventLogTime[] =
"safebrowsing.next_password_capture_event_log_time";
const char kSafeBrowsingWhitelistDomains[] =
"safebrowsing.safe_browsing_whitelist_domains";
const char kPasswordProtectionChangePasswordURL[] =
"safebrowsing.password_protection_change_password_url";
const char kPasswordProtectionLoginURLs[] =
"safebrowsing.password_protection_login_urls";
const char kPasswordProtectionWarningTrigger[] =
"safebrowsing.password_protection_warning_trigger";
const char kAdvancedProtectionLastRefreshInUs[] =
"safebrowsing.advanced_protection_last_refresh";
const char kSafeBrowsingSendFilesForMalwareCheck[] =
"safebrowsing.send_files_for_malware_check";
const char kUnsafeEventsReportingEnabled[] =
"safebrowsing.unsafe_events_reporting";
const char kBlockLargeFileTransfer[] =
"safebrowsing.block_large_file_transfers";
const char kDelayDeliveryUntilVerdict[] =
"safebrowsing.delay_delivery_until_verdict";
const char kAllowPasswordProtectedFiles[] =
"safebrowsing.allow_password_protected_files";
const char kCheckContentCompliance[] = "safebrowsing.check_content_compliance";
const char kBlockUnsupportedFiletypes[] =
"safebrowsing.block_unsupported_filetypes";
const char kURLsToCheckComplianceOfDownloadedContent[] =
"safebrowsing.urls_to_check_compliance_of_downloaded_content";
const char kURLsToCheckForMalwareOfUploadedContent[] =
"safebrowsing.urls_to_check_for_malware_of_uploaded_content";
const char kURLsToNotCheckForMalwareOfDownloadedContent[] =
"safebrowsing.urls_to_not_check_for_malware_of_downloaded_content";
const char kURLsToNotCheckComplianceOfUploadedContent[] =
"policy.urls_to_not_check_compliance_of_uploaded_content";
const char kAdvancedProtectionAllowed[] =
"safebrowsing.advanced_protection_allowed";
} // namespace prefs
namespace safe_browsing {
SafeBrowsingState GetSafeBrowsingState(const PrefService& prefs) {
if (IsEnhancedProtectionEnabled(prefs)) {
return ENHANCED_PROTECTION;
} else if (prefs.GetBoolean(prefs::kSafeBrowsingEnabled)) {
return STANDARD_PROTECTION;
} else {
return NO_SAFE_BROWSING;
}
}
void SetSafeBrowsingState(PrefService* prefs, SafeBrowsingState state) {
if (state == ENHANCED_PROTECTION) {
SetEnhancedProtectionPref(prefs, true);
SetStandardProtectionPref(prefs, true);
} else if (state == STANDARD_PROTECTION) {
SetEnhancedProtectionPref(prefs, false);
SetStandardProtectionPref(prefs, true);
} else {
SetEnhancedProtectionPref(prefs, false);
SetStandardProtectionPref(prefs, false);
}
}
bool IsSafeBrowsingEnabled(const PrefService& prefs) {
return prefs.GetBoolean(prefs::kSafeBrowsingEnabled);
}
bool IsEnhancedProtectionEnabled(const PrefService& prefs) {
// SafeBrowsingEnabled is checked too due to devices being out
// of sync or not on a version that includes SafeBrowsingEnhanced pref.
return prefs.GetBoolean(prefs::kSafeBrowsingEnhanced) &&
IsSafeBrowsingEnabled(prefs) &&
base::FeatureList::IsEnabled(kEnhancedProtection);
}
bool ExtendedReportingPrefExists(const PrefService& prefs) {
return prefs.HasPrefPath(prefs::kSafeBrowsingScoutReportingEnabled);
}
ExtendedReportingLevel GetExtendedReportingLevel(const PrefService& prefs) {
return IsExtendedReportingEnabled(prefs) ? SBER_LEVEL_SCOUT : SBER_LEVEL_OFF;
}
bool IsExtendedReportingOptInAllowed(const PrefService& prefs) {
return prefs.GetBoolean(prefs::kSafeBrowsingExtendedReportingOptInAllowed);
}
bool IsExtendedReportingEnabled(const PrefService& prefs) {
return (IsSafeBrowsingEnabled(prefs) &&
prefs.GetBoolean(prefs::kSafeBrowsingScoutReportingEnabled)) ||
IsEnhancedProtectionEnabled(prefs);
}
bool IsExtendedReportingPolicyManaged(const PrefService& prefs) {
return prefs.IsManagedPreference(prefs::kSafeBrowsingScoutReportingEnabled);
}
void RecordExtendedReportingMetrics(const PrefService& prefs) {
// This metric tracks the extended browsing opt-in based on whichever setting
// the user is currently seeing. It tells us whether extended reporting is
// happening for this user.
UMA_HISTOGRAM_BOOLEAN("SafeBrowsing.Pref.Extended",
IsExtendedReportingEnabled(prefs));
// Track whether this user has ever seen a security interstitial.
UMA_HISTOGRAM_BOOLEAN(
"SafeBrowsing.Pref.SawInterstitial.SBER2Pref",
prefs.GetBoolean(prefs::kSafeBrowsingSawInterstitialScoutReporting));
}
void RegisterProfilePrefs(PrefRegistrySimple* registry) {
registry->RegisterBooleanPref(prefs::kSafeBrowsingScoutReportingEnabled,
false);
registry->RegisterBooleanPref(
prefs::kSafeBrowsingSawInterstitialScoutReporting, false);
registry->RegisterBooleanPref(
prefs::kSafeBrowsingExtendedReportingOptInAllowed, true);
registry->RegisterBooleanPref(
prefs::kSafeBrowsingEnabled, true,
user_prefs::PrefRegistrySyncable::SYNCABLE_PREF);
registry->RegisterBooleanPref(prefs::kSafeBrowsingEnhanced, false);
registry->RegisterBooleanPref(prefs::kSafeBrowsingProceedAnywayDisabled,
false);
registry->RegisterDictionaryPref(prefs::kSafeBrowsingIncidentsSent);
registry->RegisterDictionaryPref(
prefs::kSafeBrowsingUnhandledGaiaPasswordReuses);
registry->RegisterStringPref(
prefs::kSafeBrowsingNextPasswordCaptureEventLogTime,
"0"); // int64 as string
registry->RegisterListPref(prefs::kSafeBrowsingWhitelistDomains);
registry->RegisterStringPref(prefs::kPasswordProtectionChangePasswordURL, "");
registry->RegisterListPref(prefs::kPasswordProtectionLoginURLs);
registry->RegisterIntegerPref(prefs::kPasswordProtectionWarningTrigger,
PASSWORD_PROTECTION_OFF);
registry->RegisterInt64Pref(prefs::kAdvancedProtectionLastRefreshInUs, 0);
registry->RegisterIntegerPref(prefs::kSafeBrowsingSendFilesForMalwareCheck,
DO_NOT_SCAN);
registry->RegisterBooleanPref(prefs::kAdvancedProtectionAllowed, true);
registry->RegisterIntegerPref(
prefs::kSafeBrowsingEnterpriseRealTimeUrlCheckMode,
REAL_TIME_CHECK_DISABLED);
}
void RegisterLocalStatePrefs(PrefRegistrySimple* registry) {
registry->RegisterDictionaryPref(prefs::kSafeBrowsingTriggerEventTimestamps);
registry->RegisterBooleanPref(prefs::kUnsafeEventsReportingEnabled, false);
registry->RegisterIntegerPref(prefs::kBlockLargeFileTransfer, 0);
registry->RegisterIntegerPref(prefs::kDelayDeliveryUntilVerdict, DELAY_NONE);
registry->RegisterIntegerPref(
prefs::kAllowPasswordProtectedFiles,
AllowPasswordProtectedFilesValues::ALLOW_UPLOADS_AND_DOWNLOADS);
registry->RegisterIntegerPref(prefs::kCheckContentCompliance, CHECK_NONE);
registry->RegisterIntegerPref(prefs::kBlockUnsupportedFiletypes,
BLOCK_UNSUPPORTED_FILETYPES_NONE);
registry->RegisterListPref(prefs::kURLsToCheckComplianceOfDownloadedContent);
registry->RegisterListPref(prefs::kURLsToNotCheckComplianceOfUploadedContent);
registry->RegisterListPref(prefs::kURLsToCheckForMalwareOfUploadedContent);
registry->RegisterListPref(
prefs::kURLsToNotCheckForMalwareOfDownloadedContent);
}
void SetExtendedReportingPrefAndMetric(
PrefService* prefs,
bool value,
ExtendedReportingOptInLocation location) {
prefs->SetBoolean(prefs::kSafeBrowsingScoutReportingEnabled, value);
RecordExtendedReportingPrefChanged(*prefs, location);
}
void SetExtendedReportingPrefForTests(PrefService* prefs, bool value) {
prefs->SetBoolean(prefs::kSafeBrowsingScoutReportingEnabled, value);
}
void SetEnhancedProtectionPrefForTests(PrefService* prefs, bool value) {
// SafeBrowsingEnabled pref needs to be turned on in order for enhanced
// protection pref to be turned on. This method is only used for tests.
prefs->SetBoolean(prefs::kSafeBrowsingEnabled, value);
prefs->SetBoolean(prefs::kSafeBrowsingEnhanced, value);
}
void SetEnhancedProtectionPref(PrefService* prefs, bool value) {
prefs->SetBoolean(prefs::kSafeBrowsingEnhanced, value);
}
void SetStandardProtectionPref(PrefService* prefs, bool value) {
prefs->SetBoolean(prefs::kSafeBrowsingEnabled, value);
}
void UpdatePrefsBeforeSecurityInterstitial(PrefService* prefs) {
// Remember that this user saw an interstitial.
prefs->SetBoolean(prefs::kSafeBrowsingSawInterstitialScoutReporting, true);
}
base::ListValue GetSafeBrowsingPreferencesList(PrefService* prefs) {
base::ListValue preferences_list;
const char* safe_browsing_preferences[] = {
prefs::kSafeBrowsingEnabled,
prefs::kSafeBrowsingExtendedReportingOptInAllowed,
prefs::kSafeBrowsingScoutReportingEnabled, prefs::kSafeBrowsingEnhanced};
// Add the status of the preferences if they are Enabled or Disabled for the
// user.
for (const char* preference : safe_browsing_preferences) {
preferences_list.Append(base::Value(preference));
bool enabled = prefs->GetBoolean(preference);
preferences_list.Append(base::Value(enabled ? "Enabled" : "Disabled"));
}
return preferences_list;
}
void GetSafeBrowsingWhitelistDomainsPref(
const PrefService& prefs,
std::vector<std::string>* out_canonicalized_domain_list) {
const base::ListValue* pref_value =
prefs.GetList(prefs::kSafeBrowsingWhitelistDomains);
CanonicalizeDomainList(*pref_value, out_canonicalized_domain_list);
}
void CanonicalizeDomainList(
const base::ListValue& raw_domain_list,
std::vector<std::string>* out_canonicalized_domain_list) {
out_canonicalized_domain_list->clear();
for (auto it = raw_domain_list.GetList().begin();
it != raw_domain_list.GetList().end(); it++) {
// Verify if it is valid domain string.
url::CanonHostInfo host_info;
std::string canonical_host =
net::CanonicalizeHost(it->GetString(), &host_info);
if (!canonical_host.empty())
out_canonicalized_domain_list->push_back(canonical_host);
}
}
bool IsURLWhitelistedByPolicy(const GURL& url,
StringListPrefMember* pref_member) {
DCHECK(CurrentlyOnThread(ThreadID::IO));
if (!pref_member)
return false;
std::vector<std::string> sb_whitelist_domains = pref_member->GetValue();
return std::find_if(sb_whitelist_domains.begin(), sb_whitelist_domains.end(),
[&url](const std::string& domain) {
return url.DomainIs(domain);
}) != sb_whitelist_domains.end();
}
bool IsURLWhitelistedByPolicy(const GURL& url, const PrefService& pref) {
DCHECK(CurrentlyOnThread(ThreadID::UI));
if (!pref.HasPrefPath(prefs::kSafeBrowsingWhitelistDomains))
return false;
const base::ListValue* whitelist =
pref.GetList(prefs::kSafeBrowsingWhitelistDomains);
for (const base::Value& value : whitelist->GetList()) {
if (url.DomainIs(value.GetString()))
return true;
}
return false;
}
bool MatchesEnterpriseWhitelist(const PrefService& pref,
const std::vector<GURL>& url_chain) {
for (const GURL& url : url_chain) {
if (IsURLWhitelistedByPolicy(url, pref))
return true;
}
return false;
}
void GetPasswordProtectionLoginURLsPref(const PrefService& prefs,
std::vector<GURL>* out_login_url_list) {
const base::ListValue* pref_value =
prefs.GetList(prefs::kPasswordProtectionLoginURLs);
out_login_url_list->clear();
for (const base::Value& value : pref_value->GetList()) {
GURL login_url(value.GetString());
// Skip invalid or none-http/https login URLs.
if (login_url.is_valid() && login_url.SchemeIsHTTPOrHTTPS())
out_login_url_list->push_back(login_url);
}
}
bool MatchesPasswordProtectionLoginURL(const GURL& url,
const PrefService& prefs) {
if (!url.is_valid())
return false;
std::vector<GURL> login_urls;
GetPasswordProtectionLoginURLsPref(prefs, &login_urls);
return MatchesURLList(url, login_urls);
}
bool MatchesURLList(const GURL& target_url, const std::vector<GURL> url_list) {
if (url_list.empty() || !target_url.is_valid())
return false;
GURL simple_target_url = GetSimplifiedURL(target_url);
for (const GURL& url : url_list) {
if (GetSimplifiedURL(url) == simple_target_url) {
return true;
}
}
return false;
}
GURL GetPasswordProtectionChangePasswordURLPref(const PrefService& prefs) {
if (!prefs.HasPrefPath(prefs::kPasswordProtectionChangePasswordURL))
return GURL();
GURL change_password_url_from_pref(
prefs.GetString(prefs::kPasswordProtectionChangePasswordURL));
// Skip invalid or non-http/https URL.
if (change_password_url_from_pref.is_valid() &&
change_password_url_from_pref.SchemeIsHTTPOrHTTPS()) {
return change_password_url_from_pref;
}
return GURL();
}
bool MatchesPasswordProtectionChangePasswordURL(const GURL& url,
const PrefService& prefs) {
if (!url.is_valid())
return false;
GURL change_password_url = GetPasswordProtectionChangePasswordURLPref(prefs);
if (change_password_url.is_empty())
return false;
return GetSimplifiedURL(change_password_url) == GetSimplifiedURL(url);
}
} // namespace safe_browsing
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
3167ccf6e5b50889cd259f7d2e9fe70f35c7ba2f | 7fc9ca1aa8c9281160105c7f2b3a96007630add7 | /template.cpp | 3076c5a8cd36ce2830193cc88ca60a1cc58f617a | [] | no_license | PatelManav/Codeforces_Backup | 9b2318d02c42d8402c9874ae0c570d4176348857 | 9671a37b9de20f0f9d9849cd74e00c18de780498 | refs/heads/master | 2023-01-04T03:18:14.823128 | 2020-10-27T12:07:22 | 2020-10-27T12:07:22 | 300,317,389 | 2 | 1 | null | 2020-10-27T12:07:23 | 2020-10-01T14:54:31 | C++ | UTF-8 | C++ | false | false | 462 | cpp | /*May The Force Be With Me*/
#include <bits/stdc++.h>
#define ll long long
#define MOD 1000000007
#define endl '\n'
using namespace std;
ll N;
vector<ll> arr;
void Input(){
cin >> N, arr.clear(), arr.resize(N);
for(ll i = 0; i < N; i++)
cin >> arr[i];
}
void Solve(){
}
int main(){
ios_base::sync_with_stdio(false);
cin.tie(NULL);
ll T = 1;
//cin >> T;
while(T--){
Input();
Solve();
}
return 0;
} | [
"helewrer3@gmail.com"
] | helewrer3@gmail.com |
144ffdbbbf1c194afd07c31ea87856ddb6f41d95 | 37097fdaecb287e965273b1eeb089db69d4c0ce1 | /src/planning/knowledge_representation/src/kdb_node.cpp | df7cfc6d35fa9ad88c49df2dc0b8cad7e5054319 | [
"BSD-3-Clause-Clear",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | RobotJustina/tmc_justina_docker | 9d5fc63188238608bc47ec896aae0fdd9e490223 | 8aa968a81ae4526f6f6c2d55b83954b57b28ea92 | refs/heads/main | 2023-06-01T04:37:55.193899 | 2021-06-27T04:23:21 | 2021-06-27T04:23:21 | 361,206,568 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,800 | cpp | #include <iostream>
#include <sstream>
#include "ros/ros.h"
#include "knowledge_msgs/kdbFilePath.h"
#include "std_msgs/Bool.h"
#include "std_msgs/Empty.h"
#include "std_msgs/String.h"
#include "std_msgs/ColorRGBA.h"
std::string locationsFilePath;
std::string objectsFilePath;
std::string categoriesFilePath;
std::string peopleFilePath;
bool srvLocationPath(knowledge_msgs::kdbFilePath::Request &req, knowledge_msgs::kdbFilePath::Response &res){
std::cout << "location server"<< std::endl;
res.kdb_file_path = locationsFilePath;
return true;
}
bool srvObjectPath(knowledge_msgs::kdbFilePath::Request &req, knowledge_msgs::kdbFilePath::Response &res){
std::cout << "objects server"<< std::endl;
res.kdb_file_path = objectsFilePath;
return true;
}
bool srvCategoryPath(knowledge_msgs::kdbFilePath::Request &req, knowledge_msgs::kdbFilePath::Response &res){
std::cout << "categories server"<< std::endl;
res.kdb_file_path = categoriesFilePath;
return true;
}
bool srvPeoplePath(knowledge_msgs::kdbFilePath::Request &req, knowledge_msgs::kdbFilePath::Response &res){
std::cout << "people server"<< std::endl;
res.kdb_file_path = peopleFilePath;
return true;
}
int main(int argc, char ** argv) {
std::cout << "Node for set kdb paths" << std::endl;
ros::init(argc, argv, "kdb_node");
ros::NodeHandle nh;
ros::Rate rate(10);
locationsFilePath = "";
for (int i = 0; i < argc; i++) {
std::string strParam(argv[i]);
if (strParam.compare("-l") == 0)
locationsFilePath = argv[++i];
}
objectsFilePath = "";
for (int i = 0; i < argc; i++) {
std::string strParam(argv[i]);
if (strParam.compare("-o") == 0)
objectsFilePath = argv[++i];
}
categoriesFilePath = "";
for (int i = 0; i < argc; i++) {
std::string strParam(argv[i]);
if (strParam.compare("-c") == 0)
categoriesFilePath = argv[++i];
}
peopleFilePath = "";
for (int i = 0; i < argc; i++) {
std::string strParam(argv[i]);
if (strParam.compare("-p") == 0)
peopleFilePath = argv[++i];
}
ros::ServiceServer serviceLocationPath = nh.advertiseService("/knowledge_representation/getLocationPath", srvLocationPath);
ros::ServiceServer serviceObjectPath = nh.advertiseService("/knowledge_representation/getObjectPath", srvObjectPath);
ros::ServiceServer serviceCategoryPath = nh.advertiseService("/knowledge_representation/getCategoryPath", srvCategoryPath);
ros::ServiceServer servicePeoplePath = nh.advertiseService("/knowledge_representation/getPeoplePath", srvPeoplePath);
while (ros::ok()) {
rate.sleep();
ros::spinOnce();
}
return 1;
}
| [
"jc.shogun.t6s@gmail.com"
] | jc.shogun.t6s@gmail.com |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.