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 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
9d4bf305c762f09f5c62b41b7e4dbfaee8857a4c | 6d54a7b26d0eb82152a549a6a9dfde656687752c | /src/platform/nxp/crypto/se05x/CHIPCryptoPALHsm_se05x_hkdf.cpp | 4a3c06d48282722e24da4e0642456b0bbb280293 | [
"Apache-2.0",
"LicenseRef-scancode-warranty-disclaimer"
] | permissive | project-chip/connectedhomeip | 81a123d675cf527773f70047d1ed1c43be5ffe6d | ea3970a7f11cd227ac55917edaa835a2a9bc4fc8 | refs/heads/master | 2023-09-01T11:43:37.546040 | 2023-09-01T08:01:32 | 2023-09-01T08:01:32 | 244,694,174 | 6,409 | 1,789 | Apache-2.0 | 2023-09-14T20:56:31 | 2020-03-03T17:05:10 | C++ | UTF-8 | C++ | false | false | 4,055 | cpp | /*
*
* Copyright (c) 2021 Project CHIP Authors
*
* 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.
*/
/**
* @file
* HSM based implementation of CHIP crypto primitives
* Based on configurations in CHIPCryptoPALHsm_config.h file,
* chip crypto apis use either HSM or rollback to software implementation.
*/
#include "CHIPCryptoPALHsm_se05x_utils.h"
#include <lib/core/CHIPEncoding.h>
namespace chip {
namespace Crypto {
extern CHIP_ERROR HKDF_SHA256_H(const uint8_t * secret, const size_t secret_length, const uint8_t * salt, const size_t salt_length,
const uint8_t * info, const size_t info_length, uint8_t * out_buffer, size_t out_length);
CHIP_ERROR HKDF_sha::HKDF_SHA256(const uint8_t * secret, const size_t secret_length, const uint8_t * salt, const size_t salt_length,
const uint8_t * info, const size_t info_length, uint8_t * out_buffer, size_t out_length)
{
#if !ENABLE_SE05X_HKDF_SHA256
return HKDF_SHA256_H(secret, secret_length, salt, salt_length, info, info_length, out_buffer, out_length);
#else
CHIP_ERROR error = CHIP_ERROR_INTERNAL;
uint32_t keyid = kKeyId_hkdf_sha256_hmac_keyid;
sss_object_t keyObject = { 0 };
if (salt_length > 64 || info_length > 80 || secret_length > 256 || out_length > 768)
{
/* Length not supported by se05x. Rollback to SW */
return HKDF_SHA256_H(secret, secret_length, salt, salt_length, info, info_length, out_buffer, out_length);
}
ChipLogDetail(Crypto, "HKDF_SHA256 : Using se05x for HKDF");
// Salt is optional
if (salt_length > 0)
{
VerifyOrReturnError(salt != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
}
VerifyOrReturnError(info_length > 0, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(info != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(out_length > 0, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(out_buffer != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(secret != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(se05x_sessionOpen() == CHIP_NO_ERROR, CHIP_ERROR_INTERNAL);
VerifyOrReturnError(gex_sss_chip_ctx.ks.session != NULL, CHIP_ERROR_INTERNAL);
sss_status_t status = sss_key_object_init(&keyObject, &gex_sss_chip_ctx.ks);
VerifyOrReturnError(status == kStatus_SSS_Success, CHIP_ERROR_INTERNAL);
status = sss_key_object_allocate_handle(&keyObject, keyid, kSSS_KeyPart_Default, kSSS_CipherType_HMAC, secret_length,
kKeyObject_Mode_Transient);
VerifyOrReturnError(status == kStatus_SSS_Success, CHIP_ERROR_INTERNAL);
status = sss_key_store_set_key(&gex_sss_chip_ctx.ks, &keyObject, secret, secret_length, secret_length * 8, NULL, 0);
VerifyOrReturnError(status == kStatus_SSS_Success, CHIP_ERROR_INTERNAL);
const smStatus_t smstatus = Se05x_API_HKDF_Extended(
&((sss_se05x_session_t *) &gex_sss_chip_ctx.session)->s_ctx, keyObject.keyId, kSE05x_DigestMode_SHA256,
kSE05x_HkdfMode_ExtractExpand, salt, salt_length, 0, info, info_length, 0, (uint16_t) out_length, out_buffer, &out_length);
VerifyOrExit(smstatus == SM_OK, error = CHIP_ERROR_INTERNAL);
error = CHIP_NO_ERROR;
exit:
if (keyObject.keyStore->session != NULL)
{
sss_key_store_erase_key(&gex_sss_chip_ctx.ks, &keyObject);
}
return error;
#endif // ENABLE_SE05X_HKDF_SHA256
}
} // namespace Crypto
} // namespace chip
| [
"noreply@github.com"
] | project-chip.noreply@github.com |
e1f4b76db6dc982ba81b488404b1a5d65daf9c85 | f7be31ceb4e2f41964ff3a6bdcc9b31b11279d18 | /src/Display/Display.hpp | 2e7992baa5cfe36780f596164b8502aa8b148c40 | [] | no_license | limepixl/mc-clone | 11c313f11194c9251ad3d9078c631129573dcb87 | 894ce4e067b9f1e2a73f67190546e77d0919fbe4 | refs/heads/master | 2021-10-27T03:19:45.000789 | 2019-04-15T17:16:42 | 2019-04-15T17:16:42 | 164,831,283 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 524 | hpp | #pragma once
class Display
{
public:
struct GLFWwindow* window;
// Values used for deltatime calculation
double deltaTime = 0.0;
double lastFrame = 0.0;
// Window's dimensions
int width;
int height;
public:
Display(int windowWidth, int windowHeight);
// Calculates the delta time between frames
void calcDelta(double currentTime);
// Clear the buffer with a color
void clear();
// Swap buffers and poll glfw events
void update();
bool isOpen() const;
private:
// GLFW and GLAD init
void init();
}; | [
"stefs.ivanovski@gmail.com"
] | stefs.ivanovski@gmail.com |
566f9ccf6495947b57e6e69ea8ba5ed1828ecc4e | b0df518f64806d0cee925fa617913ea3eaacb605 | /Mk2_PV_phaseAngle_v0/Mk2_PV_phaseAngle_v0.ino | b0570b4eb1722eec866f2c94693a4e3ead011606 | [] | no_license | tomasuz/Mk2_3phase | c94c8ebc79e0990e1e3ad8c843af2a19760fe71b | 71d3a2bb29a15725da045a15ecde7f6b8c4c17f3 | refs/heads/master | 2021-08-16T13:28:32.424230 | 2021-06-13T14:21:07 | 2021-06-13T14:21:07 | 133,177,228 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 33,145 | ino | // This is a cut-down version of my stand-alone sketch for diverting suplus
// PV power to a dump load using a triac. The original version, which includes
// more explanation and 'debug' code to support off-line working, may be found at
// http://openenergymonitor.org/emon/node/841
//
// Further modified to use phase-angle control of the triac rather than
// burst mode
//
// Robin Emley (calypso_rae on Open Energy Monitor Forum)
// October 2012
/*
Circuit for monitoring pulses from a supply meter using checkLedStatus():
----------------> +5V
|
/
\ 8K2
/
|
---------------------> dig 2
| |
--> / |
--> \ _
LDR / - 0.01uF
| |
----------------------> GND
*/
#include "Arduino.h"
#define POSITIVE 1
#define NEGATIVE 0
#define ON 0 // for use with trigger device (active low)
#define OFF 1
//#define ON 1 // for use with LED( active high)
//#define OFF 0
#define REQUIRED_EXPORT_IN_WATTS 0 // when set to a negative value, this acts as a PV generator
#define NO_OF_PHASES 3
// WORKLOAD_CHECK is available for determining how much spare processing time there
// is. To activate this mode, the #define line below should be included:
// #define WORKLOAD_CHECK
// const byte noOfDumploads = 3;
const byte noOfDumploads = 1;
enum loadPriorityModes {LOAD_1_HAS_PRIORITY, LOAD_0_HAS_PRIORITY};
// enum loadPriorityModes {LOAD_0_HAS_PRIORITY};
// enum loadStates {LOAD_ON, LOAD_OFF}; // for use if loads are active low (original PCB)
enum loadStates {LOAD_OFF, LOAD_ON}; // for use if loads are active high (Rev 2 PCB)
enum loadStates logicalLoadState[noOfDumploads];
enum loadStates physicalLoadState[noOfDumploads];
// array defining to which phase which load is connected.
const byte loadPhases[noOfDumploads] = {0};
// ----------- Pinout assignments -----------
byte outputPinForLed = 13;
byte outputPinForTrigger = 5;
byte outputPinForPAcontrol[noOfDumploads] = {10};
// byte voltageSensorPin = 2;
// byte currentSensorPin = 1;
byte ledDetectorPin = 2; // digital
byte ledRepeaterPin = 10; // digital
// analogue input pins
// const byte sensorV[NO_OF_PHASES] = {B00000000, B00000010, B00000100}; // for 3-phase PCB
// const byte sensorI[NO_OF_PHASES] = {B00000001, B00000011, B00000101}; // for 3-phase PCB
const byte sensorV[3] = {B00000000, B00000010, B00000100}; // for 3-phase PCB
const byte sensorI[3] = {B00000001, B00000011, B00000101}; // for 3-phase PCB
// 1 phase:
// const byte sensorV[NO_OF_PHASES] = {B00000000}; // for 3-phase PCB
// const byte sensorI[NO_OF_PHASES] = {B00000001}; // for 3-phase PCB
// 2 phase
// const byte sensorV[NO_OF_PHASES] = {B00000000, B00000010}; // for 3-phase PCB
// const byte sensorI[NO_OF_PHASES] = {B00000001, B00000011}; // for 3-phase PCB
float safetyMargin_watts = 0; // <<<------ increase for more export
long cycleCount[NO_OF_PHASES];
long loopCount = 0;
// long samplesindex = 0;
// int samplesDuringThisMainsCycle[NO_OF_PHASES] = {0,0,0};
// Initial values setting moved to setup().....
int samplesDuringThisMainsCycle[NO_OF_PHASES];
byte nextStateOfTriac;
float cyclesPerSecond = 50; // use float to ensure accurate maths
long noOfSamplePairs = 0;
byte polarityNow[NO_OF_PHASES];
boolean triggerNeedsToBeArmed = false;
boolean beyondStartUpPhase = false;
float energyInBucket = 0; // mimics the operation of a meter at the grid connection point.
//float energyInBucket_4trial = 0; // as entered by used for p-a control trials
int capacityOfEnergyBucket = 3600; // 0.001 kWh = 3600 Joules
// int sampleV,sampleI; // voltage & current samples are integers in the ADC's input range 0 - 1023
int lastSampleV[NO_OF_PHASES]; // stored value from the previous loop (HP filter is for voltage samples only)
float lastFilteredV[NO_OF_PHASES], filteredV[NO_OF_PHASES]; // voltage values after HP-filtering to remove the DC offset
// int lastSampleI[NO_OF_PHASES]; // stored value from the previous loop (HP filter is for voltage samples only)
// float lastFilteredI[NO_OF_PHASES], filteredI[NO_OF_PHASES]; // voltage values after HP-filtering to remove the DC offset
float prevVDCoffset[NO_OF_PHASES]; // <<--- for LPF
float VDCoffset[NO_OF_PHASES]; // <<--- for LPF
float cumVdeltasThisCycle[NO_OF_PHASES]; // <<--- for LPF
float prevIDCoffset[NO_OF_PHASES]; // <<--- for LPF
float IDCoffset[NO_OF_PHASES]; // <<--- for LPF
float cumIdeltasThisCycle[NO_OF_PHASES]; // <<--- for LPF
float sampleVminusDC[NO_OF_PHASES]; // <<--- for LPF
float sampleIminusDC[NO_OF_PHASES]; // <<--- used with LPF
float lastSampleVminusDC[NO_OF_PHASES]; // <<--- used with LPF
// float lastSampleIminusDC[NO_OF_PHASES]; // <<--- used with LPF
float sumP[NO_OF_PHASES]; // cumulative sum of power calculations within each mains cycle
float sumV[NO_OF_PHASES]; // cumulative sum of voltage calculations within each mains cycle
float realV[NO_OF_PHASES];
float PHASECAL;
float POWERCAL; // To convert the product of raw V & I samples into Joules.
float VOLTAGECAL; // To convert raw voltage samples into volts. Used for determining when
// the trigger device can be safely armed
// for interaction between the main processor and the ISR
volatile byte dataReadyForPhase = 3; // Use byte for data ready from ADC and store phase to it. 3 - no data ready.
volatile int sampleV[NO_OF_PHASES];
volatile int sampleI[NO_OF_PHASES];
// Calibration values
//-------------------
// Three calibration values are used in this sketch: powerCal, phaseCal and voltageCal.
// With most hardware, the default values are likely to work fine without
// need for change. A compact explanation of each of these values now follows:
// When calculating real power, which is what this code does, the individual
// conversion rates for voltage and current are not of importance. It is
// only the conversion rate for POWER which is important. This is the
// product of the individual conversion rates for voltage and current. It
// therefore has the units of ADC-steps squared per Watt. Most systems will
// have a power conversion rate of around 20 (ADC-steps squared per Watt).
//
// powerCal is the RECIPR0CAL of the power conversion rate. A good value
// to start with is therefore 1/20 = 0.05 (Watts per ADC-step squared)
//
// const float powerCal[NO_OF_PHASES] = {0.043, 0.043, 0.043};
// Initial values setting moved to setup().....
float powerCal[NO_OF_PHASES];
// phaseCal is used to alter the phase of the voltage waveform relative to the
// current waveform. The algorithm interpolates between the most recent pair
// of voltage samples according to the value of phaseCal.
//
// With phaseCal = 1, the most recent sample is used.
// With phaseCal = 0, the previous sample is used
// With phaseCal = 0.5, the mid-point (average) value in used
//
// NB. Any tool which determines the optimal value of phaseCal must have a similar
// scheme for taking sample values as does this sketch.
//
// Initial values seting moved to setup().....
// float phaseCal[NO_OF_PHASES];
// const float phaseCal[NO_OF_PHASES] = {0.5, 0.5, 0.5}; // <- nominal values only
int phaseCal_int[NO_OF_PHASES]; // to avoid the need for floating-point maths
// For datalogging purposes, voltageCal has been added too. Because the range of ADC values is
// similar to the actual range of volts, the optimal value for this cal factor is likely to be
// close to unity.
// Initial values seting moved to setup().....
// const float voltageCal[NO_OF_PHASES] = {1.03, 1.03, 1.03}; // compared with Fluke 77 meter
// float voltageCal[NO_OF_PHASES]; // compared with Fluke 77 meter
// items for LED monitoring
byte ledState, prevLedState;
boolean ledRecentlyOnFlag = false;
unsigned long ledOnAt;
float energyInBucket_4led = 0;
float energyLevelAtLastLedPulse;
// items for phase-angle control of triac
boolean firstLoopOfHalfCycle[NO_OF_PHASES];
boolean phaseAngleTriggerActivated[noOfDumploads];
unsigned long timeAtStartOfHalfCycleInMicros[NO_OF_PHASES];
unsigned long firingDelayInMicros[NO_OF_PHASES];
// Arrays for debugging
// int samplesV[NO_OF_PHASES][50];
// int samplesI[NO_OF_PHASES][50];
// unsigned long firingDelaysInMicros[NO_OF_PHASES][50];
float phaseShiftedVminusDCs[NO_OF_PHASES][50];
float sampleVminusDCs[NO_OF_PHASES][50];
void setup() {
// Serial.begin(9600);
// Serial.begin(115200);
// Serial.begin(230400);
Serial.begin(500000);
Serial.setTimeout(20); // for rapid input of data (default is 1000ms)
pinMode(outputPinForTrigger, OUTPUT);
for (byte load = 0; load < noOfDumploads; load++) {
pinMode(outputPinForPAcontrol[load], OUTPUT);
}
pinMode(outputPinForLed, OUTPUT);
for(int i = 0; i< noOfDumploads; i++) {
logicalLoadState[i] = LOAD_OFF;
}
POWERCAL = 0.042; // Units are Joules per ADC-level squared. Used for converting the product of
// voltage and current samples into Joules.
// To determine this value, note the rate that the energy bucket's
// level increases when a known load is being measured at a convenient
// test location (e.g using a mains extention with the outer cover removed so that
// the current-clamp can fit around just one core. Adjust POWERCAL so that
// 'measured value' = 'expected value' for various loads. The value of
// POWERCAL is not critical as any absolute error will cancel out when
// import and export flows are balanced.
VOLTAGECAL = (float)679 / 471; // Units are Volts per ADC-level.
// This value is used to determine when the voltage level is suitable for
// arming the external trigger device. To set this value, note the min and max
// numbers that are seen when measuring 240Vac via the voltage sensor, which
// is 678.8V p-t-p. The range on my setup is 471 meaning that I'm under-reading
// voltage by 471/679. VOLTAGECAL therefore need to be the inverse of this, i.e.
// 679/471 or 1.44
PHASECAL = 1.0; // the default or 'do nothing' value
Serial.println ("ADC mode: free-running");
Serial.print ("requiredExport in Watts = ");
Serial.println (REQUIRED_EXPORT_IN_WATTS);
// Set the ADC's clock to system clock / 128
ADCSRA = (1 << ADPS0) + (1 << ADPS1) + (1 << ADPS2);
// Set up the ADC to be free-running
// Clear ADTS2..0 in ADCSRB (0x7B) to set trigger mode to free running.
ADCSRB &= B11111000;
ADCSRA |= (1 << ADEN); // Enable the ADC
ADCSRA |= (1 << ADATE); // set the Auto Trigger Enable bit in the ADCSRA register. Because
// bits ADTS0-2 have not been set (i.e. they are all zero), the
// ADC's trigger source is set to "free running mode".
ADCSRA |= (1 << ADIE); // set the ADC interrupt enable bit. When this bit is written
// to one and the I-bit in SREG is set, the
// ADC Conversion Complete Interrupt is activated.
ADCSRA |= (1 << ADSC); // start ADC manually first time
sei(); // Enable Global Interrupts
for (byte phase = 0; phase < NO_OF_PHASES; phase++) {
firstLoopOfHalfCycle[phase] = false;
sumP[phase] = 0.0;
sumV[phase] = 0.0;
realV[phase] = 0.0;
cycleCount[phase] = 0;
samplesDuringThisMainsCycle[phase] = 0;
powerCal[phase] = 0.043;
// phaseCal[phase] = 0.5; // <- nominal values only
// voltageCal[phase] = 1.03;
Serial.print ( "powerCal for L"); Serial.print(phase + 1);
Serial.print (" = "); Serial.println (powerCal[phase], 4);
// Serial.print ( "phaseCal for L"); Serial.print(phase + 1);
// Serial.print (" = "); Serial.println (phaseCal[phase]);
// Serial.print ( "voltageCal for L"); Serial.print(phase + 1);
// Serial.print (" = "); Serial.println (voltageCal[phase], 3);
}
Serial.println ("----");
#ifdef WORKLOAD_CHECK
Serial.println ("WELCOME TO WORKLOAD_CHECK ");
// <<- start of commented out section, to save on RAM space!
/*
Serial.println (" This mode of operation allows the spare processing capacity of the system");
Serial.println ("to be analysed. Additional delay is gradually increased until all spare time");
Serial.println ("has been used up. This value (in uS) is noted and the process is repeated. ");
Serial.println ("The delay setting is increased by 1uS at a time, and each value of delay is ");
Serial.println ("checked several times before the delay is increased. ");
*/
// <<- end of commented out section, to save on RAM space!
Serial.println (" The displayed value is the amount of spare time, per set of V & I samples, ");
Serial.println ("that is available for doing additional processing.");
Serial.println ();
#endif
}
// An Interrupt Service Routine is now defined which instructs the ADC to perform a conversion
// for each of the voltage and current sensors in turn. A "data ready" flag is set after
// each set of converstions has been completed.
// This Interrupt Service Routine is for use when the ADC is in the free-running mode.
// It is executed whenever an ADC conversion has finished, approx every 104 us. In
// free-running mode, the ADC has already started its next conversion by the time that
// the ISR is executed. The ISR therefore needs to "look ahead".
// At the end of conversion Type N, conversion Type N+1 will start automatically. The ISR
// which runs at this point therefore needs to capture the results of conversion Type N,
// and set up the conditions for conversion Type N+2, and so on.
//
// ADC Multiplexer Source:
// Because we only have a single ADC but 6 ADC pins to choose from we need to feed the signal into the ADC using the built in multiplexer.
// To do this by setting the MUXn bits in the ADMUX register.
// The neat thing is that if you change these values while the conversion is running, the conversion will finish before the change takes
// (so if you ever find yourself having problems with bad data you might be switching before the ADC finishes).
ISR(ADC_vect) {
static unsigned char sample_index = 0;
static int sample_I0_raw;
static int sample_I1_raw;
static int sample_I2_raw;
switch(sample_index) {
case 0:
sample_I0_raw = ADC;
if (NO_OF_PHASES == 1) {
ADMUX = 0x40 + sensorI[0];
} else {
ADMUX = 0x40 + sensorI[1]; // set up the next-but-one conversion
}
sample_index++; // advance the control flag
break;
case 1:
sampleV[0] = ADC;
sampleI[0] = sample_I0_raw;
if (NO_OF_PHASES == 1) {
ADMUX = 0x40 + sensorV[0]; // for the next-but-one conversion
sample_index = 0;
} else {
ADMUX = 0x40 + sensorV[1]; // for the next-but-one conversion
sample_index++; // advance the control flag
}
dataReadyForPhase = 0;
break;
case 2:
sample_I1_raw = ADC;
if (NO_OF_PHASES == 2) {
ADMUX = 0x40 + sensorI[0];
} else {
ADMUX = 0x40 + sensorI[2]; // for the next-but-one conversion
}
sample_index++; // advance the control flag
break;
case 3:
sampleV[1] = ADC;
sampleI[1] = sample_I1_raw;
if (NO_OF_PHASES == 2) {
ADMUX = 0x40 + sensorV[0];
sample_index = 0;
} else {
ADMUX = 0x40 + sensorV[2]; // for the next-but-one conversion
sample_index++; // advance the control flag
}
dataReadyForPhase = 1;
break;
case 4:
sample_I2_raw = ADC;
ADMUX = 0x40 + sensorI[0]; // for the next-but-one conversion
sample_index++; // advance the control flag
break;
case 5:
sampleV[2] = ADC;
sampleI[2] = sample_I2_raw;
ADMUX = 0x40 + sensorV[0]; // for the next-but-one conversion
sample_index = 0; // reset the control flag
dataReadyForPhase = 2;
break;
default:
sample_index = 0; // to prevent lockup (should never get here)
}
}
void loop() {
#ifdef WORKLOAD_CHECK
static int del = 0; // delay, as passed to delayMicroseconds()
static int res = 0; // result, to be displayed at the next opportunity
static byte count = 0; // to allow multiple runs per setting
static byte displayFlag = 0; // to determine when printing may occur
#endif
// each loop is for one pair of V & I measurements
if (dataReadyForPhase < NO_OF_PHASES) { // flag is set after every pair of ADC conversions
byte phase = dataReadyForPhase;
dataReadyForPhase = NO_OF_PHASES; // clear dataready flag.
// samplesindex++;
// if ( samplesindex >= 50 ) {
// samplesindex = 0;
// }
noOfSamplePairs++; // for stats only
samplesDuringThisMainsCycle[phase]++; // for power calculation at the start of each mains cycle
// store values from previous loop
// lastSampleV[phase]=sampleV[phase]; // for digital high-pass filter
// lastFilteredV[phase] = filteredV[phase]; // for HPF, used to identify the start of each mains cycle
// lastSampleVminusDC[phase] = sampleVminusDC[phase]; // for phasecal calculation
// remove the DC offset from these samples as determined by a low-pass filter
sampleVminusDC[phase] = sampleV[phase] - VDCoffset[phase];
sampleIminusDC[phase] = sampleI[phase] - IDCoffset[phase];
// a high-pass filter is used just for determining the start of each mains cycle
filteredV[phase] = 0.996 * (lastFilteredV[phase] + sampleV[phase] - lastSampleV[phase]);
// Establish the polarities of the latest and previous filtered voltage samples
byte polarityOfLastReading = polarityNow[phase];
if (filteredV[phase] >= 0)
polarityNow[phase] = POSITIVE;
else
polarityNow[phase] = NEGATIVE;
// Block executed once then
// Only detect the start of a new mains cycle if phase voltage is greater then some noise voltage:
if (polarityNow[phase] == POSITIVE && realV[phase] > 10.0) {
if (polarityOfLastReading != POSITIVE) {
// This is the start of a new mains cycle (just after the +ve going z-c point)
cycleCount[phase]++; // for stats only
firstLoopOfHalfCycle[phase] = true;
// checkLedStatus(); // a really useful function, but can be commented out if not required
// update the Low Pass Filter for DC-offset removal
prevVDCoffset[phase] = VDCoffset[phase];
VDCoffset[phase] = prevVDCoffset[phase] + (0.01 * cumVdeltasThisCycle[phase]);
prevIDCoffset[phase] = IDCoffset[phase];
IDCoffset[phase] = prevIDCoffset[phase] + (0.01 * cumIdeltasThisCycle[phase]);
// Calculate the real power of all instantaneous measurements taken during the
// previous mains cycle, and determine the gain (or loss) in energy.
realV[phase] = sumV[phase] / (float)samplesDuringThisMainsCycle[phase];
float realPower = POWERCAL * sumP[phase] / (float)samplesDuringThisMainsCycle[phase];
float realEnergy = realPower / cyclesPerSecond;
// Debug output.
/* if (phase == 0 && (cycleCount[0] % 10) == 5) {
Serial.print("realPower = ");
Serial.println(realPower);
}
*/
//----------------------------------------------------------------
// WARNING - Serial statements can interfere with time-critical code, but
// they can be really useful for calibration trials!
// ----------------------------------------------------------------
if ((cycleCount[phase] % 100) == 5) {// display once per second
controlPhaseSwichRellay(phase);
Serial.print ("Phase:\t");
Serial.print ((String)phase + "\tfiringDelayInMicros:\t" + firingDelayInMicros[phase]);
Serial.print ("\tSamples:\t");
Serial.println (samplesDuringThisMainsCycle[phase]);
Serial.print ("realV:\t");
Serial.println ((String)realV[phase] + "\tenergyInBucket:\t" + energyInBucket);
Serial.print ("realPower:\t");
Serial.println (realPower);
/*
for (int i = 0; i < samplesDuringThisMainsCycle[phase]; i++) {
Serial.print (sampleVminusDCs[phase][i]);
Serial.print ("\t");
}
Serial.println("");
// Serial.print (" ");
for (int i = 0; i < samplesDuringThisMainsCycle[phase]; i++) {
Serial.print (phaseShiftedVminusDCs[phase][i]);
Serial.print ("\t");
}
Serial.println(""); */
}
/* Serial.println(cycleCount[phase]);
Serial.print(" loopCount between samples = ");
Serial.println (loopCount);
// for (byte i_phase = 0; i_phase < NO_OF_PHASES; i_phase++) {
Serial.print(" phase = ");
Serial.println(phase); */
/* for (long i = 0; i < 100; i++) {
Serial.print (samplesV[i_phase][i]);
Serial.print (" ");
}
Serial.println ("");
for (long i = 0; i < 100; i++) {
Serial.print (samplesI[i_phase][i]);
Serial.print (" ");
}
Serial.println ("");
} */
/* Serial.print(" samplesDuringThisMainsCycle = ");
Serial.println(samplesDuringThisMainsCycle[phase]);
// Serial.print("energy in bucket = "); Serial.println(energyInBucket);
// Serial.println(energyInBucket_4led); // has no upper or lower limits
// energyInBucket_4led = 0; // for calibration purposes only
Serial.print("realEnergy = ");
Serial.print(realEnergy);
Serial.print(", energyInBucket = ");
Serial.print(energyInBucket);
Serial.print(", firingDelay = ");
Serial.println(firingDelayInMicros[phase]);
// Serial.print(", samples = ");
} */
// This is the start of a new mains cycle (just after the +ve going z-c point)
if (beyondStartUpPhase == true) {
// Providing that the DC-blocking filters have had sufficient time to settle,
// add this power contribution to the energy bucket
energyInBucket += realEnergy;
energyInBucket_4led += realEnergy;
// Reduce the level in the energy bucket by the specified safety margin.
// This allows the system to be positively biassed towards export or import
energyInBucket -= safetyMargin_watts / cyclesPerSecond;
// Apply max and min limits to bucket's level
if (energyInBucket > capacityOfEnergyBucket)
energyInBucket = capacityOfEnergyBucket;
if (energyInBucket < 0)
energyInBucket = 0;
} else {
// wait until the DC-blocking filters have had time to settle
if ( cycleCount[0] > 100) // 100 mains cycles is 2 seconds
beyondStartUpPhase = true;
}
// energyInBucket = energyInBucket_4trial; // over-ride the measured value
triggerNeedsToBeArmed = true; // the trigger is armed every mains cycle
calculateFiringDelay(phase);
// clear the per-cycle accumulators for use in this new mains cycle.
sumP[phase] = 0;
sumV[phase] = 0;
samplesDuringThisMainsCycle[phase] = 0;
cumVdeltasThisCycle[phase] = 0;
cumIdeltasThisCycle[phase] = 0;
// end of processing that is specific to the first +ve Vsample in each new mains cycle
}
// still processing POSITIVE Vsamples ...
// this next block is for burst mode control of the triac, the output
// pin for its trigger being on digital pin 9
if (triggerNeedsToBeArmed == true) {
// check to see whether the trigger device can now be reliably armed
if ((sampleVminusDC[phase] * VOLTAGECAL) > 50) // 20V min for Motorola trigger
{
// It's now safe to arm the trigger. So ...
// first check the level in the energy bucket to determine whether the
// triac should be fired or not at the next opportunity
//
if (energyInBucket > (capacityOfEnergyBucket / 2))
{
nextStateOfTriac = ON; // the external trigger device is active low
digitalWrite(outputPinForLed, 1); // active high
} else {
nextStateOfTriac = OFF;
digitalWrite(outputPinForLed, 0);
}
// then set the Arduino's output pin accordingly,
digitalWrite(outputPinForTrigger, nextStateOfTriac);
// and clear the flag.
triggerNeedsToBeArmed = false;
}
}
} // end of processing that is specific to positive Vsamples
else {
if (polarityOfLastReading != NEGATIVE) {
firstLoopOfHalfCycle[phase] = true;
}
}
processSamplePair(phase);
#ifdef WORKLOAD_CHECK
delayMicroseconds(del); // <--- to assess how much spare time there is
if (dataReady < NO_OF_PHASES) { // if data is ready again, delay was too long
res = del; // note the exact value
del = 1; // and start again with 1us delay
count = 0;
displayFlag = 0;
} else {
count++; // to give several runs with the same value
if (count > 50) {
count = 0;
del++; // increase delay by 1uS
}
}
#endif
loopCount = 0;
// End of each loop is for one pair of V & I measurements
} else {
loopCount++;
}
// Executed on every loop.
//------------------------------------------------------------
phaseAngleTriacControl();
#ifdef WORKLOAD_CHECK
switch (displayFlag)
{
case 0: // the result is available now, but don't display until the next loop
displayFlag++;
break;
case 1: // with minimum delay, it's OK to print now
Serial.print(res);
displayFlag++;
break;
case 2: // with minimum delay, it's OK to print now
Serial.println("uS");
displayFlag++;
break;
default:; // for most of the time, displayFlag is 3
}
#endif
} // end of loop()
void calculateFiringDelay(byte phase) {
// ********************************************************
// start of section to support phase-angle control of triac
// determines the correct firing delay for a direct-acting trigger
// never fire if energy level is below lower threshold (zero power)
if (energyInBucket <= 1300) {
firingDelayInMicros[phase] = 99999;
} else {
// fire immediately if energy level is above upper threshold (full power)
if (energyInBucket >= 2300) {
firingDelayInMicros[phase] = 0;
} else {
// determine the appropriate firing point for the bucket's level
// by using either of the following algorithms
// simple algorithm (with non-linear power response across the energy range)
// firingDelayInMicros = 10 * (2300 - energyInBucket);
// complex algorithm which reflects the non-linear nature of phase-angle control.
firingDelayInMicros[phase] = (asin((-1 * (energyInBucket - 1800) / 500)) + (PI / 2)) * (10000 / PI);
// Suppress firing at low energy levels to avoid complications with
// logic near the end of each half-cycle of the mains.
// This cut-off affects approximately the bottom 5% of the energy range.
if (firingDelayInMicros[phase] > 8500) {
firingDelayInMicros[phase] = 99999; // never fire
}
}
}
// end of section to support phase-angle control of triac
//*******************************************************
}
void phaseAngleTriacControl() {
// ********************************************************
// start of section to support phase-angle control of triac
// controls the signal for firing the direct-acting trigger.
for (byte load = 0; load < noOfDumploads; load++) {
unsigned long timeNowInMicros = micros(); // occurs every loop, for consistent timing
byte loadphase = loadPhases[load];
if (firstLoopOfHalfCycle[loadphase] == true) {
timeAtStartOfHalfCycleInMicros[loadphase] = timeNowInMicros;
firstLoopOfHalfCycle[loadphase] = false;
phaseAngleTriggerActivated[load] = false;
// Unless dumping full power, release the trigger on the first loop in each
// half cycle. Ensures that trigger can't get stuck 'on'.
if (firingDelayInMicros[loadphase] > 100) {
digitalWrite(outputPinForPAcontrol[load], OFF);
}
}
if (phaseAngleTriggerActivated[load] == true) {
// Unless dumping full power, release the trigger on all loops in this
// half cycle after the one during which the trigger was set.
if (firingDelayInMicros > 100) {
digitalWrite(outputPinForPAcontrol[load], OFF);
}
} else {
if (timeNowInMicros >= (timeAtStartOfHalfCycleInMicros[loadphase] + firingDelayInMicros[loadphase])) {
digitalWrite(outputPinForPAcontrol[load], ON);
phaseAngleTriggerActivated[load] = true;
}
}
// end of section to support phase-angle control of triac
//*******************************************************
}
}
void processSamplePair(byte phase) {
// Apply phase-shift to the voltage waveform to ensure that the system measures a
// resistive load with a power factor of unity.
// sampleVminusDCs[phase][samplesDuringThisMainsCycle[phase]] = sampleVminusDC[phase];
float phaseShiftedVminusDC = lastSampleVminusDC[phase] + PHASECAL * (sampleVminusDC[phase] - lastSampleVminusDC[phase]);
// phaseShiftedVminusDCs[phase][(samplesDuringThisMainsCycle[phase])] = phaseShiftedVminusDC;
float instP = phaseShiftedVminusDC * sampleIminusDC[phase]; // power contribution for this pair of V&I samples
sumV[phase] += abs(phaseShiftedVminusDC);
sumP[phase] += instP; // cumulative power contributions for this mains cycle
cumVdeltasThisCycle[phase] += (sampleV[phase] - VDCoffset[phase]); // for use with LP filter
cumIdeltasThisCycle[phase] += (sampleI[phase] - IDCoffset[phase]); // for use with LP filter
// store values from previous loop
lastSampleV[phase] = sampleV[phase]; // for digital high-pass filter
lastFilteredV[phase] = filteredV[phase]; // for HPF, used to identify the start of each mains cycle
lastSampleVminusDC[phase] = sampleVminusDC[phase]; // for phasecal calculation
// lastSampleI[phase] = sampleI[phase]; // for digital high-pass filter
// lastFilteredI[phase] = filteredI[phase]; // for HPF, used to identify the start of each mains cycle
// lastSampleIminusDC[phase] = sampleIminusDC[phase]; // for phasecal calculation
// Clear summed values of phase with low voltage (no connected) after 100 cycles:
if ( samplesDuringThisMainsCycle[phase] > 100 ) {
realV[phase] = sumV[phase] / (float)samplesDuringThisMainsCycle[phase];
sumP[phase] = 0;
sumV[phase] = 0;
samplesDuringThisMainsCycle[phase] = 0;
cumVdeltasThisCycle[phase] = 0;
cumIdeltasThisCycle[phase] = 0;
}
}
void controlPhaseSwichRellay(byte phase) {
}
// helper function, to process LED events:
// can be conveniently called every 20ms, at the start of each mains cycle
void checkLedStatus()
{
#ifdef DEBUG
ledState = OFF;
#else
ledState = digitalRead (ledDetectorPin);
#endif
if (ledState != prevLedState)
{
// led has changed state
if (ledState == ON)
{
// led has just gone on
ledOnAt = millis();
ledRecentlyOnFlag = true;
}
else
{
// led has just gone off
if (ledRecentlyOnFlag == true)
{
ledRecentlyOnFlag = false;
Serial.print ("** LED PULSE ** "); // this is a chargeable event
}
else
{
Serial.print ("** LED OFF ** "); // 'no longer exporting' is also a chargeable event
}
Serial.println(millis() / 1000);
// Serial.print (", energy change = ");
// Serial.println((long)(energyInBucket_4led - energyLevelAtLastLedPulse)); // imported energy is -ve
// Serial.print (" J, energyInBucket_4led = ");
// Serial.println ((long)energyInBucket_4led);
// energyLevelAtLastLedPulse = energyInBucket_4led; // also applicable to LED OFF events
}
}
else
{
// the LED state has not changed
if (ledState == ON)
{
if (ledRecentlyOnFlag == true)
{
// check to see if the known duration of a pulse has been exceeded
unsigned long timeNow = millis();
if ((timeNow - ledOnAt) > 50)
{
Serial.print ("** LED ON **"); // 'exporting' is a non-chargeable state
Serial.print (", energy in bucket = ");
Serial.println((long)(energyInBucket_4led));
ledRecentlyOnFlag = false;
}
}
}
}
prevLedState = ledState;
}
| [
"tomas@martišiai.lt"
] | tomas@martišiai.lt |
e2d471fef6a4f725543bed3643d296847864978a | 31ccf88e290a086c53e4b884cd5d6cf0f41d1367 | /HolographicJS/WebGLProgram.h | 821ec9379366b4e58429af0bdb6c4082d33e6032 | [
"Apache-2.0"
] | permissive | lwansbrough/HolographicJS | 40d29030610f5e4f712196a87a12f3404901fc23 | 8e71dd890e587929e46fba25c9dcaa72748ba73f | refs/heads/master | 2020-01-27T09:57:03.028370 | 2016-12-22T17:36:56 | 2016-12-22T17:36:56 | 73,271,948 | 113 | 6 | null | null | null | null | UTF-8 | C++ | false | false | 161 | h | #pragma once
#include "WebGLObject.h"
namespace HolographicJS
{
public ref class WebGLProgram sealed :
public WebGLObject
{
public:
WebGLProgram();
};
}
| [
"lochie@live.com"
] | lochie@live.com |
de0db65bccfea0c6e81ab1d288e3bb9488fb4c97 | b14c48085a7611008754cac38a1d1abe4653fa6a | /main.cpp | 2c636ddc1b56ccf1a06aaecbea7a97791b57a5fc | [] | no_license | yayayat/EV3_Proto | a3cc6591ef83a82cd4609d2201a7624dcb4ab659 | 1fcd954ac17fd13e35bd9ad3dbaa2fad101466ac | refs/heads/master | 2022-11-30T14:05:37.753681 | 2020-08-19T14:39:04 | 2020-08-19T14:39:04 | 288,725,926 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,573 | cpp | #include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <vector>
#include <math.h>
#define HEX_OUTPUT
uint8_t mas[200];
uint8_t pack[34];
uint16_t n = 0;
using namespace std;
uint8_t hex_decode(const uint8_t *in)
{
uint8_t out;
unsigned int i, t, hn, ln;
hn = in[0] > '9' ? in[0] - 'A' + 10 : in[0] - '0';
ln = in[1] > '9' ? in[1] - 'A' + 10 : in[1] - '0';
out = (hn << 4) | ln;
return out;
}
struct message
{
uint8_t header;
uint8_t kind, cmd, mode;
//! 00 SYS
//* 000000 SYNC
//* 000010 NACK
//* 000100 ACK
//* xxx110 ESC (reserved)
//! 01 CMD
// LLL
//* |||000 TYPE
//* |||001 MODES
//* |||010 SPEED
//* |||011 SELECT
//* |||100 WRITE
//* |||101 RSRV
//* |||110 RSRV
//* |||111 RSRV
// |||
//! 10||| INFO
// LLLMMM
//! 11|||||| DATA
// LLLMMM
// ||||||
//* 000||| Message payload is 1 byte not including command byte and check byte
//* 001||| Message payload is 2 bytes not including command byte and check byte
//* 010||| Message payload is 4 bytes not including command byte and check byte
//* 011||| Message payload is 8 bytes not including command byte and check byte
//* 100||| Message payload is 16 bytes not including command byte and check byte
//* 101||| Message payload is 32 bytes not including command byte and check byte
// |||
//* 000 Mode 0 default
//* 001 Mode 1
//* 010 Mode 2
//* 011 Mode 3
//* 100 Mode 4
//* 101 Mode 5
//* 110 Mode 6
//* 111 Mode 7
uint8_t length;
uint8_t *payload;
bool crcPassed;
uint8_t crc;
uint8_t calculatedCrc;
};
int main(int argc, const char *argv[])
{
FILE *pFile;
long lSize;
uint8_t *buffer;
size_t result;
pFile = fopen("hex/x8l.txt", "rb");
if (pFile == NULL)
{
fputs("File error", stderr);
exit(1);
}
//obtain file size:
fseek(pFile, 0, SEEK_END);
lSize = ftell(pFile);
rewind(pFile);
//allocate memory to contain the whole file:
buffer = (uint8_t *)malloc(sizeof(uint8_t) * lSize);
if (buffer == NULL)
{
fputs("Memory error", stderr);
exit(2);
}
// copy the file into the buffer:
result = fread(buffer, 1, lSize, pFile);
if (result != lSize)
{
fputs("Reading error", stderr);
exit(3);
}
// the whole file is now loaded in the memory buffer.
vector<uint8_t> input(buffer, buffer + lSize);
for (uint32_t i = 0; i < input.size() - 2; i += 2)
{
while (input[i] == '\n')
input.erase(input.begin() + i);
while (input[i + 2] != '\n')
input.erase(input.begin() + i + 2);
input.erase(input.begin() + i + 2);
}
vector<message> messages;
for (int c = 0; c < 1000; c++)
{
if (input.size() < 2)
break;
static uint8_t crc;
static message mes;
static int8_t stage = -1, len = 0;
uint8_t hex = hex_decode(input.data());
if (input.size() >= 2)
input.erase(input.begin(), input.begin() + 2);
if (stage < 0)
{
crc = 0xFF;
mes.header = hex;
if (mes.header & 0xC0)
{
stage = len = mes.length = 1 << ((mes.header & 0x38) >> 3);
mes.payload = (uint8_t *)malloc(sizeof(uint8_t) * len);
if ((mes.header & 0xC0) == 0x80)
{
crc ^= (uint8_t)hex;
hex = hex_decode(input.data());
if (input.size() >= 2)
input.erase(input.begin(), input.begin() + 2);
mes.cmd = hex;
}
}
else
mes.length = 0;
}
else if (stage == 0)
{
mes.crc = hex;
mes.calculatedCrc = crc;
mes.crcPassed = ((uint8_t)hex == (uint8_t)crc);
messages.push_back(mes);
stage--;
}
else
{
mes.payload[len - stage] = hex;
stage--;
}
crc ^= (uint8_t)hex;
}
for (uint8_t i = 0; i < messages.size(); i++)
{
#ifdef HEX_OUTPUT
printf("#%d ", i);
printf("Header: 0x%02X ", (uint8_t)messages[i].header);
printf("Length: %d ", messages[i].length);
printf("Payload: ");
for (int8_t j = 0; j < messages[i].length; j++)
printf("0x%02X ", (uint8_t)messages[i].payload[j]);
printf("CRC: (calc/read:0x%02X/0x%02X) %s\n", messages[i].calculatedCrc, messages[i].crc, messages[i].crcPassed ? "Passed!" : "Error!");
#endif
printf("[");
switch (messages[i].header & 0xC0)
{
case 0x00:
printf("SYS");
switch (messages[i].header & 0x07)
{
case 0x00:
printf(" SYNC");
break;
case 0x02:
printf(" NACK");
break;
case 0x04:
printf(" ACK");
break;
}
break;
case 0x40:
printf("CMD");
switch (messages[i].header & 0x07)
{
case 0x00:
printf(" TYPE: 0x%X", (uint8_t)*messages[i].payload);
break;
case 0x01:
printf(" MODES:");
if (messages[i].length == 2)
{
if (messages[i].payload[0])
printf(" 0-%d modes used", messages[i].payload[0]);
else
printf(" 0 mode only used");
if (messages[i].payload[1])
printf(" (0-%d modes in view and data log)", messages[i].payload[1]);
else
printf(" (0 mode only in view and data log)");
}
else
{
if (messages[i].payload[0])
printf(" 0-%d modes in view and data log", messages[i].payload[0]);
else
printf(" 0 mode only in view and data log");
}
break;
case 0x02:
printf(" SPEED: %d boad", *(uint32_t *)messages[i].payload);
break;
case 0x03:
printf(" SELECT");
break;
case 0x04:
printf(" WRITE");
break;
}
break;
case 0x80:
printf("INFO Mode %d ", messages[i].header & 0x07);
switch (messages[i].cmd)
{
case 0x00:
printf(" NAME: %s", messages[i].payload);
break;
case 0x01:
printf(" RAW: %g-%g", *(float *)messages[i].payload, *(float *)(&messages[i].payload[4]));
break;
case 0x02:
printf(" PCT: %g-%g", *(float *)messages[i].payload, *(float *)(&messages[i].payload[4]));
break;
case 0x03:
printf(" SI: %g-%g", *(float *)messages[i].payload, *(float *)(&messages[i].payload[4]));
break;
case 0x04:
printf(" SYMBOL %s", messages[i].payload);
break;
case 0x80:
printf(" FORMAT: %d of ", *messages[i].payload);
switch (messages[i].payload[1])
{
case 0x00:
printf(" DATA8");
break;
case 0x01:
printf(" DATA16");
break;
case 0x02:
printf(" DATA32");
break;
case 0x03:
printf(" DATAF");
break;
}
if (messages[i].length > 2)
printf(", %d figure, %d decimals", messages[i].payload[2], messages[i].payload[3]);
break;
}
break;
case 0xC0:
printf("DATA Mode%d", messages[i].header & 0x07);
break;
}
printf("]\n\n");
}
// terminate
fclose(pFile);
free(buffer);
return 0;
} | [
"mitya.borisov@yandex.ru"
] | mitya.borisov@yandex.ru |
2f249ae37eb6759ecf42a2ce463a1d6384a02014 | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5631572862566400_1/C++/AlexWang1993/main6.cpp | bcd3a92d5e95730a21ba33998054dc4f8b01eb39 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 3,379 | cpp | //
// main.cpp
// Mushroom
//
// Created by Alex Wang on 2016-04-15.
// Copyright © 2016 Alex Wang. All rights reserved.
//
#include <iostream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;
int test;
int f[1000];
int best = 0;
int findCycle(int* part, int* num, int n, int v, int k, int &left, int length, int *a) {
int u = a[v];
if (part[u] == k) {
return length - num[u];
} else if (part[u] >= 0){
return 0;
}
left--;
part[u] = k;
num[u] = length;
return findCycle(part, num, n, u, k, left, length+1, a);
}
int dfs(bool* visited, int n, vector<int>* h, int* a, int v) {
if (visited[v]) {
return f[v];
}
visited[v] = true;
int ans = 1;
for (int i = 0; i < h[v].size(); i++) {
int j = h[v][i];
if (a[v]!=j) {
ans = max(dfs(visited, n, h, a, j) + 1, ans);
}
}
f[v] = ans;
return ans;
}
int main(int argc, const char * argv[]) {
cin>>test;
for (int time = 0; time < test; time++) {
int n;
cin>>n;
// string output = "";
bool visited[n];
for (int i = 0; i < n; i++) visited[i] = false;
int part[n];
for (int i = 0;i < n;i++) part[i] = -1;
int a[n];
vector<int>* h;
h = new vector<int>[n];
for (int i = 0; i < n;i++) {
h[i] = vector<int>();
}
// int a[n][n];
// for (int i = 0; i < 2*n-1; i++) {
// for (int j = 0; j < n; j++) {
// cin>>lists[i][j];
// visited[lists[i][j]] = !visited[lists[i][j]];
// }
// }
for (int i =0; i < n; i++) {
cin>>a[i];
h[a[i]-1].push_back(i);
a[i]--;
}
int largest = 0;
int num[n];
for (int i = 0; i < n ; i++) {
num[i]=0;
}
int parts = 0;
int all = n;
for (int i = 0; i < n; i++) {
if (part[i] <0) {
parts++;
largest = max(largest, findCycle(part, num, n, i, parts, all, 0, a));
}
}
int ans = 0;
for (int i = 0; i < n; i++) {
for (int j = 0; j < h[i].size(); j++) {
int v = h[i][j];
if ((a[i] == v)&&(i<v)) {
int count1 =dfs(visited, n, h, a, i);
int count2=dfs(visited, n, h, a, v);
ans += dfs(visited, n, h, a, i) +
dfs(visited, n, h, a, v);
}
}
}
// int list[n];
// for (int i=0;i<n;i++) list[i]=0;
// bool found = false;
// int ans = 0;
// for (int i = n ; i > 0 ; i--) {
// if (dfs(visited, n, i, list, 0, a)) {
// found = true;
// ans = i;
// break;
// }
// }
cout<<"Case #"<<time+1<<": "<<max(ans, largest)<<endl;
// for (int i = 0; i < 2500; i++) {
// if (visited[i]) {
// cout<<" "<<i;
// }
//
// }
// cout<<endl;
}
return 0;
}
| [
"alexandra1.back@gmail.com"
] | alexandra1.back@gmail.com |
9daca6d0be2848882c768213192b5fa53d6dbbe1 | 54f352a242a8ad6ff5516703e91da61e08d9a9e6 | /Source Codes/AtCoder/abc003/A/3806690.cpp | d6e2a6d4725a7049af2b4142da125ff706ea5987 | [] | no_license | Kawser-nerd/CLCDSA | 5cbd8a4c3f65173e4e8e0d7ed845574c4770c3eb | aee32551795763b54acb26856ab239370cac4e75 | refs/heads/master | 2022-02-09T11:08:56.588303 | 2022-01-26T18:53:40 | 2022-01-26T18:53:40 | 211,783,197 | 23 | 9 | null | null | null | null | UTF-8 | C++ | false | false | 185 | cpp | #include <iostream>
using namespace std;
int main()
{
int n,sum=0;;
cin >> n;
for(int i=1;i<=n;i++){
sum += i*10000;
}
sum = sum/n;
cout << sum << endl;
return 0;
} | [
"kwnafi@yahoo.com"
] | kwnafi@yahoo.com |
ef493d3c334824f52d1fd24850e9b74abbfe1f9b | bb54eba6989920d1d5e37c0f98a0d75c0ab8af38 | /src/chainparamsbase.cpp | 46e73f6e9613d477455f17327aab82227a6041bc | [
"MIT"
] | permissive | olivingcoin/olivingcoin | 8e4de2b44aba1eedbd7f43fb8cef59e76d56b922 | e34ee63da7c35c717c8045b1ed1c43562430c508 | refs/heads/master | 2023-06-21T17:31:36.932592 | 2021-07-30T08:45:16 | 2021-07-30T08:45:16 | 380,154,480 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,925 | cpp | // Copyright (c) 2010 Satoshi Nakamoto
// Copyright (c) 2009-2018 The Olivingcoin Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include <chainparamsbase.h>
#include <tinyformat.h>
#include <util/system.h>
#include <util/memory.h>
#include <assert.h>
const std::string CBaseChainParams::MAIN = "main";
const std::string CBaseChainParams::TESTNET = "test";
const std::string CBaseChainParams::REGTEST = "regtest";
void SetupChainParamsBaseOptions()
{
gArgs.AddArg("-regtest", "Enter regression test mode, which uses a special chain in which blocks can be solved instantly. "
"This is intended for regression testing tools and app development.", true, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-testnet", "Use the test chain", false, OptionsCategory::CHAINPARAMS);
gArgs.AddArg("-vbparams=deployment:start:end", "Use given start/end times for specified version bits deployment (regtest-only)", true, OptionsCategory::CHAINPARAMS);
}
static std::unique_ptr<CBaseChainParams> globalChainBaseParams;
const CBaseChainParams& BaseParams()
{
assert(globalChainBaseParams);
return *globalChainBaseParams;
}
std::unique_ptr<CBaseChainParams> CreateBaseChainParams(const std::string& chain)
{
if (chain == CBaseChainParams::MAIN)
return MakeUnique<CBaseChainParams>("", 5232);
else if (chain == CBaseChainParams::TESTNET)
return MakeUnique<CBaseChainParams>("testnet4", 15232);
else if (chain == CBaseChainParams::REGTEST)
return MakeUnique<CBaseChainParams>("regtest", 25232);
else
throw std::runtime_error(strprintf("%s: Unknown chain %s.", __func__, chain));
}
void SelectBaseParams(const std::string& chain)
{
globalChainBaseParams = CreateBaseChainParams(chain);
gArgs.SelectConfigNetwork(chain);
}
| [
"teri98@naver.com"
] | teri98@naver.com |
dee57b2dec3f2ca3b2eca5d6b039f364d42d646d | f56811229e26c65e1ce942d8d09ae88ed936c09c | /src/Renderer.cpp | ef7386c42e21fb59d33a8f60573790494f873c11 | [] | no_license | UnsafePointer/opengl-renderer-tests-archived | 5e3e940f03a1cdf3851ebe29d9b2b285b43b4505 | 8516b2bc9313b654faf641fe23527bcd15f414f5 | refs/heads/master | 2022-07-14T22:00:11.027246 | 2020-05-09T09:41:28 | 2020-05-09T09:41:28 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,724 | cpp | #include "Renderer.hpp"
#include <iostream>
#include "Framebuffer.hpp"
#include "RendererDebugger.hpp"
using namespace std;
const uint32_t WIDTH = 1024;
const uint32_t HEIGHT = 768;
Renderer::Renderer() {
if (SDL_Init(SDL_INIT_VIDEO) != 0) {
cout << "Error initializing SDL: " << SDL_GetError() << endl;
exit(1);
}
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 4);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, 5);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_FLAGS, SDL_GL_CONTEXT_DEBUG_FLAG);
window = SDL_CreateWindow("renderer", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, WIDTH, HEIGHT, SDL_WINDOW_OPENGL);
glContext = SDL_GL_CreateContext(window);
if (!gladLoadGLLoader((GLADloadproc) SDL_GL_GetProcAddress)) {
cout << "Failed to initialize the OpenGL context." << endl;
exit(1);
}
cout << "OpenGL " << GLVersion.major << "." << GLVersion.minor << endl;
glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
program = make_unique<RendererProgram>("glsl/vertex.glsl", "glsl/fragment.glsl");
program->useProgram();
GLuint offsetUniform = program->findProgramUniform("offset");
glUniform2f(offsetUniform, -0.5, -0.5);
buffer = make_unique<RendererBuffer<Vertex>>(program, 1024);
framebufferTexture = make_unique<Texture>(WIDTH, HEIGHT);
screenProgram = make_unique<RendererProgram>("glsl/screen_vertex.glsl", "glsl/screen_fragment.glsl");
screenBuffer = make_unique<RendererBuffer<Pixel>>(screenProgram, 1024);
checkForOpenGLErrors();
}
Renderer::~Renderer() {
SDL_Quit();
}
void Renderer::addPolygon(std::vector<Vertex> vertices) {
buffer->addData(vertices);
}
void Renderer::prepareFrame() {
framebufferTexture->bind(GL_TEXTURE0);
checkForOpenGLErrors();
}
void Renderer::render() {
Framebuffer framebuffer = Framebuffer(framebufferTexture);
glClearColor(1.0f, 0.0f, 0.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
buffer->draw();
checkForOpenGLErrors();
}
void Renderer::finishFrame() {
glBindFramebuffer(GL_FRAMEBUFFER, 0);
glClearColor(0.0f, 0.0f, 1.0f, 1.0f);
glClear(GL_COLOR_BUFFER_BIT);
std::vector<Pixel> pixels = {
Pixel({-0.9f, 0.9f}, {0.0f, 1.0f}),
Pixel({-0.9f, -0.9f}, {0.0f, 0.0f}),
Pixel({0.9f, -0.9f}, {1.0f, 0.0f}),
Pixel({-0.9f, 0.9f}, {0.0f, 1.0f}),
Pixel({0.9f, -0.9f}, {1.0f, 0.0f}),
Pixel({0.9f, 0.9f}, {1.0f, 1.0f})
};
screenBuffer->bind();
screenProgram->useProgram();
screenBuffer->addData(pixels);
glBindTexture(GL_TEXTURE_2D, framebufferTexture->object);
screenBuffer->draw();
SDL_GL_SwapWindow(window);
checkForOpenGLErrors();
return;
}
| [
"renzo@crisostomo.me"
] | renzo@crisostomo.me |
c2b3a8af0f8304dc02338be711a6cc782a946f8f | 4f307eb085ad9f340aaaa2b6a4aa443b4d3977fe | /chuntao.lin/assignment3.3/GraphicsLib/GraphicsBuffer.h | 377172a8e1e52296bf85a528597b8980df790eab | [] | no_license | Connellj99/GameArch | 034f4a0f52441d6dde37956a9662dce452a685c7 | 5c95e9bdfce504c02c73a0c3cb566a010299a9b8 | refs/heads/master | 2020-12-28T10:29:19.935573 | 2020-02-04T19:41:09 | 2020-02-04T19:41:09 | 238,286,390 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,677 | h | #ifndef GraphicsBuffer_H
#define GraphicsBuffer_H
#include <allegro5/allegro.h>
#include <allegro5/allegro_font.h>
#include <allegro5/allegro_ttf.h>
#include <allegro5/allegro_audio.h>
#include <allegro5/allegro_acodec.h>
#include <allegro5/allegro_image.h>
#include <allegro5/allegro_primitives.h>
#include <iostream>
#include <cassert>
#include <string>
#include <stdlib.h>
#include "Colors.h"
#include "GraphicsBuffer.h"
#include <PerformanceTracker.h>
#include <MemoryTracker.h>
//Graphics Buffer ------------------------A class to hold a chunk of memory used to display something--------------------------------/
class GraphicsBuffer : public Trackable
{
public:
friend class Game;
friend class GraphicsSystem;
friend class Sprite;
friend class Animations;
GraphicsBuffer();//default constructor
GraphicsBuffer(Colors color,float xSize,float ySize);//constructor that takes in a Colors object
GraphicsBuffer(std::string filePath);//constructor that takes in filepath for the img
~GraphicsBuffer();//destructor
float getBufferHeight();//function that returns buffer height
float getBufferWidth();//function that returns buffer width
void setBuffer(ALLEGRO_BITMAP*& bitmap);//set buffer really just sets the mBuffWidth/Height to the passed in buffers dimensions.
//set the passed in bitmap and set it to this ones
//void getBuffer(ALLEGRO_BITMAP& buffer);
void getBuffer(GraphicsBuffer& buffer);
//function that returns mBuffer
ALLEGRO_BITMAP* returnBuff();
private:
//Allegro bitmap mbuffer that will hold data of the allegro bitmap
ALLEGRO_BITMAP* mpBuffer;
ALLEGRO_BITMAP* mpBufferSprite;
float mBuffHeight;
float mBuffWidth;
};
#endif | [
"john.connelly@mymail.champlain.edu"
] | john.connelly@mymail.champlain.edu |
5d7b12947c037dcc05e0c4bf3e85a0efe797f042 | 48520fac58b33e8c79d1c927e5eb8dced0534b16 | /ch_5/static_mem_fun.cpp | 004fc83cdd8c5e13b46edfd3f9aeb69f8c7f62b3 | [] | no_license | Anushalagadapati/cpp | 60b43a4cc905a62daa9f37412263927552788f15 | 45d67386088982b20b1e46dac237996e9af22364 | refs/heads/master | 2020-05-20T23:22:18.535787 | 2019-05-09T12:55:58 | 2019-05-09T12:55:58 | 185,798,520 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 429 | cpp | /*nesting functions */
#include<iostream>
using namespace std;
class sample
{
static int x;
static int y;
public:
static void display(void);
static void swap(void);
};
int sample :: x = 10;
int sample :: y = 20;
main()
{
sample a;
sample :: swap();
sample :: display();
}
static void sample :: display(void)
{
cout <<"x=" <<x <<"\n";
cout <<"y=" <<y <<"\n";
}
static void sample :: swap(void)
{
int t=x;
x=y;
y=t;
//display();
}
| [
"anusha.lagadapati3@gmail.com"
] | anusha.lagadapati3@gmail.com |
2021073af9f6fa59780a2d0648fcbe4cccb26026 | 72210b764d9ccb796a0351e78afa810cc2e83677 | /code/threads/main.cc | d6383859e0c4f83826ddf27e5cdb78c622e56501 | [
"MIT-Modern-Variant"
] | permissive | ilms49898723/OS_MP4 | f28ba3848abe0b75dbabe35a97ad946fb29de98e | 686bb223ee3b2dd413f6bc115a0364dc579602b9 | refs/heads/master | 2021-06-12T05:33:14.691887 | 2017-01-15T08:22:49 | 2017-01-15T08:22:49 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 11,708 | cc | // main.cc
// Driver code to initialize, selftest, and run the
// operating system kernel.
//
// Usage: nachos -d <debugflags> -rs <random seed #>
// -s -x <nachos file> -ci <consoleIn> -co <consoleOut>
// -f -cp <unix file> <nachos file>
// -p <nachos file> -r <nachos file> -l -D
// -n <network reliability> -m <machine id>
// -z -K -C -N
//
// -d causes certain debugging messages to be printed (see debug.h)
// -rs causes Yield to occur at random (but repeatable) spots
// -z prints the copyright message
// -s causes user programs to be executed in single-step mode
// -x runs a user program
// -ci specify file for console input (stdin is the default)
// -co specify file for console output (stdout is the default)
// -n sets the network reliability
// -m sets this machine's host id (needed for the network)
// -K run a simple self test of kernel threads and synchronization
// -C run an interactive console test
// -N run a two-machine network test (see Kernel::NetworkTest)
//
// Filesystem-related flags:
// -f forces the Nachos disk to be formatted
// -cp copies a file from UNIX to Nachos
// -p prints a Nachos file to stdout
// -r removes a Nachos file from the file system
// -l lists the contents of the Nachos directory
// -D prints the contents of the entire file system
//
// Note: the file system flags are not used if the stub filesystem
// is being used
//
// Copyright (c) 1992-1996 The Regents of the University of California.
// All rights reserved. See copyright.h for copyright notice and limitation
// of liability and disclaimer of warranty provisions.
#define MAIN
#include "copyright.h"
#undef MAIN
#include "main.h"
#include "filesys.h"
#include "openfile.h"
#include "sysdep.h"
// global variables
Kernel* kernel;
Debug* debug;
//----------------------------------------------------------------------
// Cleanup
// Delete kernel data structures; called when user hits "ctl-C".
//----------------------------------------------------------------------
static void
Cleanup(int x) {
cerr << "\nCleaning up after signal " << x << "\n";
delete kernel;
}
//-------------------------------------------------------------------
// Constant used by "Copy" and "Print"
// It is the number of bytes read from the Unix file (for Copy)
// or the Nachos file (for Print) by each read operation
//-------------------------------------------------------------------
static const int TransferSize = 128;
#ifndef FILESYS_STUB
//----------------------------------------------------------------------
// Copy
// Copy the contents of the UNIX file "from" to the Nachos file "to"
//----------------------------------------------------------------------
static void
Copy(char* from, char* to) {
int fd;
OpenFile* openFile;
int amountRead, fileLength;
char* buffer;
// Open UNIX file
if ((fd = OpenForReadWrite(from, FALSE)) < 0) {
printf("Copy: couldn't open input file %s\n", from);
return;
}
// Figure out length of UNIX file
Lseek(fd, 0, 2);
fileLength = Tell(fd);
Lseek(fd, 0, 0);
// Create a Nachos file of the same length
DEBUG('f', "Copying file " << from << " of size " << fileLength << " to file " << to);
if (!kernel->fileSystem->Create(to, fileLength)) { // Create Nachos file
printf("Copy: couldn't create output file %s\n", to);
Close(fd);
return;
}
openFile = kernel->fileSystem->Open(to);
ASSERT(openFile != NULL);
// Copy the data in TransferSize chunks
buffer = new char[TransferSize];
while ((amountRead = ReadPartial(fd, buffer, sizeof(char) * TransferSize)) > 0) {
openFile->Write(buffer, amountRead);
}
delete [] buffer;
// Close the UNIX and the Nachos files
delete openFile;
Close(fd);
}
#endif // FILESYS_STUB
//----------------------------------------------------------------------
// Print
// Print the contents of the Nachos file "name".
//----------------------------------------------------------------------
void
Print(char* name) {
cout << "Print file " << name << endl;
OpenFile* openFile;
int i, amountRead;
char* buffer;
if ((openFile = kernel->fileSystem->Open(name)) == NULL) {
printf("Print: unable to open file %s\n", name);
return;
}
buffer = new char[TransferSize];
while ((amountRead = openFile->Read(buffer, TransferSize)) > 0)
for (i = 0; i < amountRead; i++) {
printf("%c", buffer[i]);
}
delete [] buffer;
delete openFile; // close the Nachos file
return;
}
//----------------------------------------------------------------------
// MP4 mod tag
// CreateDirectory
// Create a new directory with "name"
//----------------------------------------------------------------------
static void
CreateDirectory(char* name) {
// MP4 Assignment
char* split;
char myname[1024];
char lastDir[1024] = "/";
strncpy(myname, name, 1024);
split = strtok(myname, "/");
while (split != NULL) {
kernel->fileSystem->CreateDirectory(split, lastDir);
if (lastDir[strlen(lastDir) - 1] != '/') {
strcat(lastDir, "/");
}
strcat(lastDir, split);
split = strtok(split + strlen(split) + 1, "/");
}
}
//----------------------------------------------------------------------
// main
// Bootstrap the operating system kernel.
//
// Initialize kernel data structures
// Call some test routines
// Call "Run" to start an initial user program running
//
// "argc" is the number of command line arguments (including the name
// of the command) -- ex: "nachos -d +" -> argc = 3
// "argv" is an array of strings, one for each command line argument
// ex: "nachos -d +" -> argv = {"nachos", "-d", "+"}
//----------------------------------------------------------------------
int
main(int argc, char** argv) {
int i;
static char emptyDebug[10] = "";
static char rootString[10] = "/";
char* debugArg = emptyDebug;
char* userProgName = NULL; // default is not to execute a user prog
bool threadTestFlag = false;
bool consoleTestFlag = false;
bool networkTestFlag = false;
#ifndef FILESYS_STUB
char* copyUnixFileName = NULL; // UNIX file to be copied into Nachos
char* copyNachosFileName = NULL; // name of copied file in Nachos
char* printFileName = NULL;
char* removeFileName = NULL;
bool dirListFlag = false;
bool dumpFlag = false;
// MP4 mod tag
char* createDirectoryName = NULL;
char* listDirectoryName = NULL;
bool mkdirFlag = false;
bool recursiveListFlag = false;
bool recursiveRemoveFlag = false;
#endif //FILESYS_STUB
// some command line arguments are handled here.
// those that set kernel parameters are handled in
// the Kernel constructor
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-d") == 0) {
ASSERT(i + 1 < argc); // next argument is debug string
debugArg = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-z") == 0) {
cout << copyright << "\n";
} else if (strcmp(argv[i], "-x") == 0) {
ASSERT(i + 1 < argc);
userProgName = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-K") == 0) {
threadTestFlag = TRUE;
} else if (strcmp(argv[i], "-C") == 0) {
consoleTestFlag = TRUE;
} else if (strcmp(argv[i], "-N") == 0) {
networkTestFlag = TRUE;
}
#ifndef FILESYS_STUB
else if (strcmp(argv[i], "-cp") == 0) {
ASSERT(i + 2 < argc);
copyUnixFileName = argv[i + 1];
copyNachosFileName = argv[i + 2];
i += 2;
} else if (strcmp(argv[i], "-p") == 0) {
ASSERT(i + 1 < argc);
printFileName = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-r") == 0) {
ASSERT(i + 1 < argc);
removeFileName = argv[i + 1];
i++;
} else if (strcmp(argv[i], "-rr") == 0) {
// MP4 mod tag
ASSERT(i + 1 < argc);
removeFileName = argv[i + 1];
recursiveRemoveFlag = true;
i++;
} else if (strcmp(argv[i], "-l") == 0) {
// MP4 mod tag
if (i + 1 < argc) {
listDirectoryName = argv[i + 1];
} else {
listDirectoryName = rootString;
}
dirListFlag = true;
i++;
} else if (strcmp(argv[i], "-lr") == 0) {
// MP4 mod tag
// recursive list
if (i + 1 < argc) {
listDirectoryName = argv[i + 1];
} else {
listDirectoryName = rootString;
}
dirListFlag = true;
recursiveListFlag = true;
i++;
} else if (strcmp(argv[i], "-mkdir") == 0) {
// MP4 mod tag
ASSERT(i + 1 < argc);
createDirectoryName = argv[i + 1];
mkdirFlag = true;
i++;
} else if (strcmp(argv[i], "-D") == 0) {
dumpFlag = true;
}
#endif //FILESYS_STUB
else if (strcmp(argv[i], "-u") == 0) {
cout << "Partial usage: nachos [-z -d debugFlags]\n";
cout << "Partial usage: nachos [-x programName]\n";
cout << "Partial usage: nachos [-K] [-C] [-N]\n";
#ifndef FILESYS_STUB
cout << "Partial usage: nachos [-cp UnixFile NachosFile]\n";
cout << "Partial usage: nachos [-p fileName] [-r fileName]\n";
cout << "Partial usage: nachos [-l] [-D]\n";
#endif //FILESYS_STUB
}
}
debug = new Debug(debugArg);
DEBUG(dbgThread, "Entering main");
kernel = new Kernel(argc, argv);
kernel->Initialize();
CallOnUserAbort(Cleanup); // if user hits ctl-C
// at this point, the kernel is ready to do something
// run some tests, if requested
if (threadTestFlag) {
kernel->ThreadSelfTest(); // test threads and synchronization
}
if (consoleTestFlag) {
kernel->ConsoleTest(); // interactive test of the synchronized console
}
if (networkTestFlag) {
kernel->NetworkTest(); // two-machine test of the network
}
#ifndef FILESYS_STUB
if (removeFileName != NULL) {
kernel->fileSystem->Remove(removeFileName, recursiveRemoveFlag);
}
if (copyUnixFileName != NULL && copyNachosFileName != NULL) {
Copy(copyUnixFileName, copyNachosFileName);
}
if (dumpFlag) {
kernel->fileSystem->Print();
}
if (dirListFlag) {
if (recursiveListFlag) {
cout << "List directory " << listDirectoryName << endl;
cout << "\x1B[1;34m" << listDirectoryName << "\x1B[0m" << endl;
kernel->fileSystem->RecursiveList(listDirectoryName);
} else {
kernel->fileSystem->List(listDirectoryName);
}
}
if (mkdirFlag) {
// MP4 mod tag
CreateDirectory(createDirectoryName);
}
if (printFileName != NULL) {
Print(printFileName);
}
#endif // FILESYS_STUB
// finally, run an initial user program if requested to do so
kernel->ExecAll();
// If we don't run a user program, we may get here.
// Calling "return" would terminate the program.
// Instead, call Halt, which will first clean up, then
// terminate.
// kernel->interrupt->Halt();
ASSERTNOTREACHED();
}
| [
"ilms49898723@gmail.com"
] | ilms49898723@gmail.com |
ee42d2ed9f418a010e072ac118a7836de04b7220 | 3139c77ec3acb0b3cc71e7a6cc40215d238e683c | /Lab2/Cw5/cw5.cpp | d1145aac8981c523e322b32127fdef8135f1744f | [] | no_license | JatsaCantWin/JIPPLab20202021 | d5a61236a9a060e13a5225b91fcc1962cc56ad83 | a16105b26f0f3a6b4373e5b03af4f891abd3be69 | refs/heads/master | 2023-04-29T08:23:10.455667 | 2021-01-21T15:44:01 | 2021-01-21T15:44:01 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 960 | cpp | #include <iostream>
using namespace std;
void swap(int &a, int &b)
{
a = a + b;
b = a - b;
a = a - b;
}
int main()
{
int a; int b;
cout << "Kilka testow funckji swap:" << endl;
a = 5; b = 2;
swap(a, b);
cout << a << " " << b << endl;
a = -500; b = 1;
swap(a, b);
cout << a << " " << b << endl;
a = 1000; b = 0;
swap(a, b);
cout << a << " " << b << endl;
a = -30000; b = 32112323;
swap(a, b);
cout << a << " " << b << endl;
a = -333; b = 333;
swap(a, b);
cout << a << " " << b << endl;
a = -321332; b = 2322;
swap(a, b);
cout << a << " " << b << endl;
a = 0; b = 0;
swap(a, b);
cout << a << " " << b << endl;
a = 22222; b = 0;
swap(a, b);
cout << a << " " << b << endl;
a = 23232; b = 132321;
swap(a, b);
cout << a << " " << b << endl;
a = 2131245; b = -23142141;
swap(a, b);
cout << a << " " << b;
return 0;
} | [
"bomburpl@gmail.com"
] | bomburpl@gmail.com |
5539cbc369be0f26e4fb6b81642ccd4ab917229e | 16ca66e4f61d76b9afe81c6d8cd4a932217efd16 | /Space.hpp | d5be56a8b34935c133aee26977587ae690b28562 | [] | no_license | d685shvarts/textGame | 5b9dd5ae29504691df74228ae1901c2e61aeeded | e83ebd962d82b4d52371902f37505418d804a649 | refs/heads/master | 2020-04-26T22:02:16.926269 | 2019-03-17T19:44:42 | 2019-03-17T19:44:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,969 | hpp | /***************************************************************************************************************************************
** Program name: Space header file
** Author: Daniel Shvarts
** Date: 03/19/2019
** Description: Declaration of abstract Space class that will be used to create 6 other derived Space classes for player to inhabit. Contains
** member variables of 4 pointers to other Space objects which will be used to link the space objects together. Also contains variables to store
** the Space's name and pointers to the Character and Inventory object in order to interact with and modify them. Its function include a
** constructor to initialize the derived Space objects, 4 functions to initialize the Space pointers to point to their respective space,
** getter function for space name, abstract menu function for the space, and function to output characters position on the map.
****************************************************************************************************************************************/
#ifndef SPACE_HPP
#define SPACE_HPP
#include "Inventory.hpp"
#include "Character.hpp"
#include <string>
using std::string;
class Character;
class Inventory;
class Space {
protected:
//4 pointers to Spsace objects to link spaces together
Space* top,
*left,
*right,
*bottom;
//String to store spaces name
string name;
//Pointers to inventory and character objects
Inventory* inventory;
Character* character;
public:
//Space constructor
Space(Inventory* inventory, Character* character);
//Function to initialize Space pointers to point to other spaces
void addTop(Space* top);
void addBottom(Space* bottom );
void addLeft(Space* left);
void addRight(Space* right);
//Abstract menu for space objects
virtual void spaceMenu() = 0;
//Function to output characters location
void printLocation();
void printMap();
};
#endif | [
"d685shvarts@gmail.com"
] | d685shvarts@gmail.com |
83ec22481eb4d3a54747e7175e3275b689a50f28 | ddad5e9ee062d18c33b9192e3db95b58a4a67f77 | /base/pthread_utils.cc | 4ef54dfe0c676678ab90f2c2cfebf008ef970863 | [
"BSD-2-Clause"
] | permissive | romange/gaia | c7115acf55e4b4939f8111f08e5331dff964fd02 | 8ef14627a4bf42eba83bb6df4d180beca305b307 | refs/heads/master | 2022-01-11T13:35:22.352252 | 2021-12-28T16:11:13 | 2021-12-28T16:11:13 | 114,404,005 | 84 | 17 | BSD-2-Clause | 2021-12-28T16:11:14 | 2017-12-15T19:20:34 | C++ | UTF-8 | C++ | false | false | 1,386 | cc | // Copyright 2013, Beeri 15. All rights reserved.
// Author: Roman Gershman (romange@gmail.com)
//
#include "base/logging.h"
#include "base/pthread_utils.h"
namespace base {
static void* start_cpp_function(void *arg) {
std::function<void()>* fp = (std::function<void()>*)arg;
CHECK(*fp);
(*fp)();
delete fp;
return nullptr;
}
void InitCondVarWithClock(clockid_t clock_id, pthread_cond_t* var) {
pthread_condattr_t attr;
PTHREAD_CHECK(condattr_init(&attr));
PTHREAD_CHECK(condattr_setclock(&attr, clock_id));
PTHREAD_CHECK(cond_init(var, &attr));
PTHREAD_CHECK(condattr_destroy(&attr));
}
pthread_t StartThread(const char* name, void *(*start_routine) (void *), void *arg) {
CHECK_LT(strlen(name), 16);
pthread_attr_t attrs;
PTHREAD_CHECK(attr_init(&attrs));
PTHREAD_CHECK(attr_setstacksize(&attrs, kThreadStackSize));
pthread_t result;
VLOG(1) << "Starting thread " << name;
PTHREAD_CHECK(create(&result, &attrs, start_routine, arg));
int my_err = pthread_setname_np(result, name);
if (my_err != 0) {
LOG(WARNING) << "Could not set name on thread " << result << " : " << strerror(my_err);
}
PTHREAD_CHECK(attr_destroy(&attrs));
return result;
}
pthread_t StartThread(const char* name, std::function<void()> f) {
return StartThread(name, start_cpp_function, new std::function<void()>(std::move(f)));
}
} // namespace base | [
"romange@gmail.com"
] | romange@gmail.com |
ce149516be1f9754bb01d4e6bbb11a36dd8ec93d | d845462300ff6f608ed3453d6aff43034eb84706 | /grid/src/grid.cpp | 39e363273762eb04f3f5a70db576d2f87833a417 | [] | no_license | chenhao94/FluidSimulation | 3af2900f37f6a72af3a086a0d80e8bb1f8d0e0bd | e3659b5e5d13f55e43f20bd32c1af077e571fa00 | refs/heads/master | 2020-12-30T13:20:27.876926 | 2017-05-15T02:31:38 | 2017-05-15T02:31:38 | 91,199,925 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,168 | cpp | #include "grid.hpp"
#include "particle.hpp"
#include <cmath>
#include <cstring>
#include <algorithm>
#include <Eigen/Dense>
#include <Eigen/Sparse>
#include <Eigen/IterativeLinearSolvers>
#include <iostream>
using namespace std;
static constexpr auto g = 9.8;
vector<int> Grid::fluidCells;
float Grid::xbound = 0;
float Grid::ybound = 0;
Grid::Grid(int _d, int _w, float cell, float _r, int _p) :
D(_d), W(_w), particleNum(_p), r(_r), cellsize(cell)
{
gc.resize(D * W);
xbound = cellsize * (D - 1);
ybound = cellsize * (W - 1);
p.reserve(particleNum * particleNum * 20);
}
void Grid::reset()
{
t = 0;
fill(gc.begin(), gc.end(), GridCell());
p.clear();
}
void Grid::addFluid(int x, int y)
{
markFluid(x, y);
// add marker particles
for (float i = 0.5; i < particleNum; i += 1.)
for (float j = 0.5; j < particleNum; j += 1.)
p.emplace_back(Particle((x + i / particleNum) * cellsize,
(y + j / particleNum) * cellsize));
}
void Grid::markFluid(int x, int y)
{
int pos = getIndex(x, y);
if (gc[pos].tid >= 0)
return;
fluidCells.push_back(pos);
gc[pos].tid = fluidCells.size() - 1;
}
float Grid::step()
{
float vmax = 0.0;
for (int i = 0; i < D * W; ++i)
vmax = max(vmax, max(fabs(gc[i].ux), fabs(gc[i].uy)));
float dt = 0.01;
float &h = cellsize;
if (vmax > h / dt)
dt = h / vmax;
// advect velocity and pressure
advect(dt);
// update pressure
typedef Eigen::SparseMatrix<float, Eigen::RowMajor> MatType;
MatType A(fluidCells.size(), fluidCells.size());
typedef Eigen::VectorXf VecType;
VecType b(fluidCells.size()), x;
static constexpr int d[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
for (int i = 0; i < D - 1; ++i)
for (int j = 0; j < W - 1; ++j)
{
int pos = getIndex(i, j), tpos, id, tid;
if ((id = gc[pos].tid) < 0)
gc[pos].p = 0;
else
{
int omega = 0;
for (int k = 0; k < 4; ++k)
{
int x = i + d[k][0], y = j + d[k][1];
if (0 < x && x < D - 1 && 0 < y && y < W - 1)
{
++omega;
tpos = getIndex(x, y);
if ((tid = gc[tpos].tid) >= 0)
{
A.insert(id, tid) = - dt / r / h / h;
}
}
}
A.insert(id, id) = omega * dt / r / h / h;
b(id) = -getDivergence(pos);
}
}
Eigen::BiCGSTAB<MatType> solver;
x = solver.compute(A).solve(b);
for (int i = 0; i < fluidCells.size(); ++i)
gc[fluidCells[i]].p = x(i);
// update velocity
#pragma omp parallel for
for (int i = 1; i < D; ++i)
for (int j = 1 ; j < W; ++j)
{
int pos = getIndex(i, j);
float cur_p = gc[pos].p;
if (i < D - 2)
gc[pos].ux -= dt * (gc[getIndex(i + 1, j)].p - cur_p) / r / h;
else
gc[pos].ux = 0;
if (j < W - 2)
gc[pos].uy -= dt * (gc[getIndex(i, j + 1)].p - cur_p) / r / h;
else
gc[pos].uy = 0;
}
// update marker particles
fluidCells.clear();
for (auto &c : gc)
c.tid = -1;
for (auto & i : p)
i.updatePos(dt, *this);
t += dt;
return t;
}
float Grid::getDivergence(int pos) const
{
return (gc[pos].ux + gc[pos].uy - gc[pos - W].ux - gc[pos - 1].uy) / cellsize;
}
void Grid::advect(float dt)
{
vector<pair<float, float>> v;
v.resize(D * W);
int pos;
#pragma omp parallel for schedule(dynamic,1) collapse(2)
for (int i = 1; i < D - 1; ++i)
for (int j = 1; j < W - 1; ++j)
{
pos = getIndex(i, j);
v[pos] = pair<float, float>(gc[pos].ux, gc[pos].uy);
}
// cannot be parallelized, o.w. it will become 'sticky'
//#pragma omp parallel for schedule(dynamic,1) collapse(1)
for (int i = 1; i < D - 1; ++i)
for (int j = 1; j < W - 1; ++j)
{
pos = getIndex(i, j);
{
// --- update ux -------
float vx = v[pos].first;
float vy = (v[pos].second + v[getIndex(i, j - 1)].second +
v[getIndex(i + 1, j - 1)].second + v[getIndex(i + 1, j)].second) / 4.;
float x = (i + 1.0) * cellsize - vx * dt;
float y = (j + 0.5) * cellsize - vy * dt;
x = min(max(0.5f * cellsize, x), xbound - 0.5f * cellsize);
y = min(max(0.5f * cellsize, y), ybound - 0.5f * cellsize);
int ni = floor(x / cellsize), nj = floor(y / cellsize - 0.5);
float ux = ni * cellsize, dx = (ni + 1.0) * cellsize;
float ly = (nj + 0.5) * cellsize, ry = (nj + 1.5) * cellsize;
int ul = getIndex(ni - 1, nj), ur = getIndex(ni - 1, nj + 1);
int dl = getIndex(ni, nj), dr = getIndex(ni, nj + 1);
gc[pos].ux = bilinearInterpolate(x, y, ux, ly, dx, ry, v[ul].first, v[ur].first, v[dl].first, v[dr].first);
}
{
// --- update uy -------
float vx = (v[pos].first + v[getIndex(i, j + 1)].first +
v[getIndex(i + 1, j)].first + v[getIndex(i + 1, j + 1)].first) / 4.;
float vy = v[pos].second;
float x = (i + 0.5) * cellsize - vx * dt;
float y = (j + 1.0) * cellsize - vy * dt;
x = min(max(0.5f * cellsize, x), xbound - 0.5f * cellsize);
y = min(max(0.5f * cellsize, y), ybound - 0.5f * cellsize);
int ni = floor(x / cellsize - 0.5), nj = floor(y / cellsize);
float ux = (ni + 0.5) * cellsize, dx = (ni + 1.5) * cellsize;
float ly = nj * cellsize, ry = (nj + 1.0) * cellsize;
int ul = getIndex(ni, nj - 1), ur = getIndex(ni, nj);
int dl = getIndex(ni + 1, nj - 1), dr = getIndex(ni + 1, nj);
gc[pos].uy = bilinearInterpolate(x, y, ux, ly, dx, ry, v[ul].second, v[ur].second, v[dl].second, v[dr].second);
}
}
#pragma omp parallel for schedule(dynamic,1) collapse(2)
for (int i = 1; i < D - 1; ++i)
for (int j = 1; j < W - 1; ++j)
{
pos = getIndex(i, j);
if (gc[pos].tid >= 0)
{
gc[pos].ux += g * dt;
if (i == D - 2 && gc[pos].ux > 0)
gc[pos].ux = 0;
if (j == W - 2 && gc[pos].uy > 0)
gc[pos].uy = 0;
}
else
gc[pos].ux = gc[pos].uy = 0;
}
#pragma omp parallel for schedule(dynamic,1) collapse(2)
for (int i = 1; i < D - 1; ++i)
for (int j = 1; j < W - 1; ++j)
{
pos = getIndex(i, j);
if (gc[pos].tid < 0)
{
if (gc[getIndex(i-1, j)].tid >=0)
gc[pos].ux = gc[getIndex(i-1, j)].ux;
if (gc[getIndex(i+1, j)].tid >=0)
gc[pos].ux = gc[getIndex(i+1, j)].ux;
if (gc[getIndex(i, j-1)].tid >=0)
gc[pos].uy = gc[getIndex(i, j-1)].uy;
if (gc[getIndex(i, j+1)].tid >=0)
gc[pos].uy = gc[getIndex(i, j+1)].uy;
}
}
}
float Grid::bilinearInterpolate(float x, float y, float ux, float ly, float dx, float ry, float vul, float vur, float vdl, float vdr)
{
float s = (dx - ux) * (ry - ly);
float a = (x - ux) * (y - ly) / s;
float b = (dx - x) * (y - ly) / s;
float c = (x - ux) * (ry - y) / s;
float d = (dx - x) * (ry - y) / s;
if (!(a > -1e-4 && b > -1e-4 && c > -1e-4 && d > -1e-4 && fabs(a+b+c+d-1.0) < 1e-4))
{
std::cerr << "error!" << a << " " << b << " " << c << " " << d <<std::endl;
exit(-1);
}
return vul * d + vur * b + vdl * c + vdr * a;
}
| [
"chenhao@cs.utexas.edu"
] | chenhao@cs.utexas.edu |
e1becd4098f55a9944e69c61507e3d551d7c8d6f | 8f81ca33cd8b0605dc1cc16cfcf36aafefbeeb3c | /sudoku_solver.cpp | 6fea5551b26479061d00dfe5b885f23eccd9330a | [] | no_license | tfonzi/Cplusplus_Sudoku | 3256ee8f0bcbdfcea37ed0a5786d4aa53bf02d6e | e290ed5ff1af3ce2f76e47a739fdd36d34de9237 | refs/heads/main | 2023-02-07T19:01:34.132829 | 2021-01-03T19:08:52 | 2021-01-03T19:08:52 | 324,901,480 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 3,686 | cpp | #include "sudoku_solver.h"
sudoku_solver::sudoku_solver(){
//default constructor
std::vector<cell> zero_array;
for (int i = 0; i < 81; i++){
zero_array.push_back(cell());
}
this->starting_array = zero_array;
this->solution_array = zero_array;
}
std::vector<cell> sudoku_solver::get_solution_array(){
return this->solution_array;
}
void sudoku_solver::set_solution_array(std::vector<cell> sudoku_array){
this->solution_array = sudoku_array;
}
std::vector<cell> sudoku_solver::get_starting_array(){
return this->starting_array;
}
void sudoku_solver::set_starting_array(std::vector<cell> sudoku_array){
this->solution_array = sudoku_array;
}
bool sudoku_solver::backtrack(std::vector<cell> sudoku_array){
int next_empty_square = find_next_empty_square(sudoku_array);
if(next_empty_square == -1){
//You've reached the end
sudoku_solver::set_solution_array(sudoku_array);
return true;
}
//else
for(int value = 1; value < 10; value++){
int row = next_empty_square / 9;
int col = next_empty_square % 9;
std::vector<int> location = {row, col};
if(is_valid(sudoku_array,location,value)){
//If it is valid, set value of empty square
sudoku_array[next_empty_square].set_value(value);
if(backtrack(sudoku_array)){
//if future instance of backtrack returns true, return all true
return true;
}
}
//if future instance of back track returns false, the next numbers are tried.
}
//If this point is reached, then at a particular empty cell, all values 1 - 9 were tried and none of them were valid.
//The algorithm tried to backtrack but found no valid solution
return false;
}
bool sudoku_solver::is_valid(std::vector<cell> sudoku_array, std::vector<int> location, int value){
//Checks cell designated by location with others in same row, col, and box
//if the values == eachother, then the move is invalid
int row = location[0];
int col = location[1];
int box = calculate_box(row, col);
//Check if cells with same row, col, or box match in value
for(int i = 0; i < 81; i++){
if(row == sudoku_array[i].get_row()){
if(value == sudoku_array[i].get_value()){
return false;
}
}
else if(col == sudoku_array[i].get_col()){
if(value == sudoku_array[i].get_value()){
return false;
}
}
else if(box == sudoku_array[i].get_box()){
if(value == sudoku_array[i].get_value()){
return false;
}
}
else{
continue;
}
}
return true;
}
int sudoku_solver::find_next_empty_square(std::vector<cell> sudoku_array){
for(int i = 0; i < 81; i++){
if(sudoku_array[i].get_value() == 0){
return i;
}
}
return -1; //There are no more empty squares
}
int sudoku_solver::calculate_box(int row, int col){
//box chart is essentially a dictionary. reads [row,col]
std::map<std::pair<int,int>, int> box_chart;
box_chart[std::make_pair(0,0)] = 0;
box_chart[std::make_pair(0,1)] = 1;
box_chart[std::make_pair(0,2)] = 2;
box_chart[std::make_pair(1,0)] = 3;
box_chart[std::make_pair(1,1)] = 4;
box_chart[std::make_pair(1,2)] = 5;
box_chart[std::make_pair(2,0)] = 6;
box_chart[std::make_pair(2,1)] = 7;
box_chart[std::make_pair(2,2)] = 8;
int row_region = row / 3;
int col_region = col / 3;
return box_chart[std::make_pair(row_region,col_region)];
}
| [
"tyler.a.fonzi@gmail.com"
] | tyler.a.fonzi@gmail.com |
fd239264e2959a69074ff61f8bba20c969a9390b | a34a1a79a2c576304b1c6a6183f049cb54a189df | /ffxi/audio/adpcmstream.cpp | a9ad964a116c927a41729797294573a60990542a | [] | no_license | Aenge/lotus-engine | c7f93e57ffb57af8620a867a1c704ec43ccd83f4 | e4b334c5b4c9e87ab92fdefd2c7ab5b16f832c3f | refs/heads/master | 2023-07-10T00:42:56.263503 | 2021-08-22T20:10:04 | 2021-08-22T20:10:04 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,016 | cpp | #include "adpcmstream.h"
ADPCMStreamInstance::ADPCMStreamInstance(ADPCMStream* adpcm) : adpcm(adpcm)
{
data = adpcm->getNextBlock();
mFlags |= PROTECTED;
}
unsigned int ADPCMStreamInstance::getAudio(float* buffer, unsigned int samples, unsigned int buffer_size)
{
if (!adpcm)
return 0;
unsigned int written = 0;
while (written < samples)
{
if (offset == adpcm->block_size && adpcm->file.eof())
{
adpcm->resetLoop();
}
if ((samples - written) + offset > adpcm->block_size)
{
for (uint32_t i = 0; i < mChannels; ++i)
{
memcpy(buffer + i * buffer_size + written + offset, data.data() + adpcm->block_size * i + offset, sizeof(float) * (adpcm->block_size - offset));
}
data = adpcm->getNextBlock();
written += (adpcm->block_size - offset);
offset = 0;
}
else
{
for (uint32_t i = 0; i < mChannels; ++i)
{
memcpy(buffer + i * buffer_size + written + offset, data.data() + adpcm->block_size * i + offset, sizeof(float) * (samples - written));
}
offset += (samples - written);
written += (samples - written);
}
}
if (written < samples)
{
memset(buffer + written, 0, sizeof(float) * (samples - written));
}
return written;
}
bool ADPCMStreamInstance::hasEnded()
{
//loops forever
return false;
}
ADPCMStream::ADPCMStream(std::ifstream&& _file, uint32_t _blocks, uint32_t _block_size, uint32_t _loop_start, uint32_t _channels, float _sample_rate) :
samples(_blocks * _block_size), loop_start(_loop_start), block_size(_block_size)
{
file = std::move(_file);
data_begin = file.tellg();
mChannels = _channels;
mFlags = SHOULD_LOOP | SINGLE_INSTANCE;
mBaseSamplerate = _sample_rate;
decoder_state.resize(mChannels * 2);
}
SoLoud::AudioSourceInstance* ADPCMStream::createInstance()
{
return new ADPCMStreamInstance(this);
}
std::vector<float> ADPCMStream::getNextBlock()
{
std::vector<std::byte> block;
block.resize((1 + block_size / 2) * mChannels);
file.read((char*)block.data(), (1 + block_size / 2) * mChannels);
std::vector<float> output{};
output.reserve(mChannels * block_size);
std::byte* compressed_block_start = block.data();
if (current_block == loop_start)
{
decoder_state_loop_start = decoder_state;
}
for (size_t channel = 0; channel < mChannels; channel++)
{
int base_index = channel * (1 + block_size / 2);
int scale = 0x0C - std::to_integer<int>((compressed_block_start[base_index] & std::byte{ 0b1111 }));
int index = std::to_integer<size_t>(compressed_block_start[base_index] >> 4);
if (index < 5)
{
for (uint8_t sample = 0; sample < (block_size / 2); ++sample)
{
std::byte sample_byte = compressed_block_start[base_index + sample + 1];
for (uint8_t nibble = 0; nibble < 2; ++nibble)
{
int value = std::to_integer<int>(sample_byte >> (4 * nibble) & std::byte(0b1111));
if (value >= 8) value -= 16;
value <<= scale;
value += (decoder_state[channel * 2] * filter0[index] + decoder_state[channel * 2 + 1] * filter1[index]) / 256;
decoder_state[channel * 2 + 1] = decoder_state[channel * 2];
decoder_state[channel * 2] = value > 0x7FFF ? 0x7FFF : value < -0x8000 ? -0x8000 : value;
output.push_back(int16_t(decoder_state[channel * 2]) / float(0x8000));
}
}
}
}
current_block++;
return output;
}
void ADPCMStream::resetLoop()
{
file.clear();
file.seekg((int)data_begin + loop_start * (1 + block_size / 2) * mChannels);
decoder_state = decoder_state_loop_start;
current_block = loop_start;
} | [
"teschnei@gmail.com"
] | teschnei@gmail.com |
4349107c7223758721b980cb563b6acb8c0c5725 | a2111a80faf35749d74a533e123d9da9da108214 | /raw/pmbs12/pmsb13-data-20120615/sources/brbym28nz827lxic/41/sandbox/meyerclp/demos/Quelle1.cpp | 3bd3f6352b198a4c0be265f27196d42841525045 | [
"MIT"
] | permissive | bkahlert/seqan-research | f2c550d539f511825842a60f6b994c1f0a3934c2 | 21945be863855077eec7cbdb51c3450afcf560a3 | refs/heads/master | 2022-12-24T13:05:48.828734 | 2015-07-01T01:56:22 | 2015-07-01T01:56:22 | 21,610,669 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,257 | cpp | #include <seqan/sequence.h>
#include <seqan/basic.h>
#include <seqan/find_motif.h>
#include <seqan/file.h>
#include <iostream>
using namespace seqan;
template<typename TAlphabet>
void countAllLetters(TAlphabet const&, String<char> str){
typedef typename Size<TAlphabet>::Type TSize;
TSize alphSize = ValueSize<TAlphabet>::VALUE;
Iterator<String<char> >::Type StringIterator = begin(str);
Iterator<String<char> >::Type it2 = end(str);
while(StringIterator != it2){
std::cout<<position(*StringIterator);
++StringIterator;
}
}
int main(){
String<char> str = "MQDRVKRPMNAFIVWSRDQRRKMALEN";
Iterator<String<char> >::Type StringIterator = begin(str);
Iterator<String<char> >::Type it2 = end(str);
while(StringIterator != it2){
if(*StringIterator == 'R')
*StringIterator = 'A';
++StringIterator;
}
std::cout<<str;
countAllLetters(AminoAcid(),str);
/*
FrequencyDistribution<AminoAcid> F;
Iterator<String<char> >::Type it1 = begin(str);
absFreqOfLettersInSeq(F,it1,it2);
Iterator<FrequencyDistribution<AminoAcid> >::Type DistributionIterator = begin(F);
Iterator<FrequencyDistribution<AminoAcid> >::Type it4 = end(F);
while(DistributionIterator != it4){
std::cout<< *DistributionIterator;
++DistributionIterator;
}
*/
return 0;
} | [
"mail@bkahlert.com"
] | mail@bkahlert.com |
15ea2cb73ad081ffbb5315bece1ee3fbda510690 | e3cb0a797c6dd46f71fe9fef77f5fb4b301b3ac9 | /Matrix/Matrix2D.h | ac1498558893b36a7ba425b1d9f70d8219c3ae7c | [] | no_license | MarinaNem/C_Lab | f451b9c47c2baf9781f0633b2a95cc04d8797fdd | 731fc6a5ac2d1f2ca65cb809aee56f4b9c89f486 | refs/heads/master | 2021-05-21T02:12:03.845043 | 2020-09-19T10:46:22 | 2020-09-19T10:46:22 | 252,497,944 | 0 | 0 | null | 2020-09-19T10:46:24 | 2020-04-02T15:44:11 | C++ | UTF-8 | C++ | false | false | 312 | h | #pragma once
#include "MatrixBase.h"
class Matrix2D :public MatrixBase
{
public:
Matrix2D() : MatrixBase(m2D_size) {};
virtual int element(unsigned int i, unsigned int j) const override;
virtual int& element(unsigned int i, unsigned int j) override;
private:
int matrix[m2D_size * m2D_size];
};
| [
"marina.laimik@gmail.com"
] | marina.laimik@gmail.com |
a7f54927571f6f3e3da28ca8182d967c5a143a90 | 12715c011c9920758e72eb08b5cc627501b4bc5d | /src/mesh_to_traversability_gridmap_node.cpp | ba76e672cc454b77f842935ab273292ad298b863 | [] | no_license | Renaudeau82/mesh_to_traversability_gridmap | 0014616ba36d71f4d7452f130dda63017fc5ddba | 13d508ac3440ab9c060fbd6883b4ce54ad898cde | refs/heads/master | 2021-01-01T17:53:35.073073 | 2017-07-26T13:52:20 | 2017-07-26T13:52:20 | 98,191,035 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 722 | cpp | #include <ros/ros.h>
#include <mesh_to_traversability_gridmap/mesh_to_traversability_gridmap.hpp>
// Standard C++ entry point
int main(int argc, char **argv) {
// Announce this program to the ROS master
ros::init(argc, argv, "mesh_to_traversability_gridmap_node");
ros::NodeHandle nh;
ros::NodeHandle private_nh("~");
// Creating the object to do the work.
mesh_to_traversability::MeshToGridMapConverter mesh_to_traversability_gridmap(nh, private_nh);
// automatic start after 10 sec
ros::Rate rate(0.1);
rate.sleep();
rate.sleep();
if(mesh_to_traversability_gridmap.loop_)
{
std_srvs::Empty srv;
mesh_to_traversability_gridmap.caller_.call(srv);
}
ros::spin();
return 0;
}
| [
"brice_ren@hotmail.fr"
] | brice_ren@hotmail.fr |
03b41fc9ffb8b630f8f0d28be3b6f8d988997765 | fa5750449293d2cf330dd57ecddaf9fbd64119a2 | /IO streams/04 - reading from files.cpp | 28e82b9ab1302e219a48072eb39c179dbbc87dba | [] | no_license | TutoRepos/cookbook-c-cpp | 397831848c4d740cc69656267ad97898f4f099b4 | ea506038e4b001432677df7c92abc71a87030e21 | refs/heads/master | 2022-03-25T07:37:38.107288 | 2019-12-28T13:01:47 | 2019-12-28T13:01:47 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,850 | cpp | #include <iostream>
#include <fstream>
#include <string>
#include <vector>
//fstream or ifstream are commonly used for input files
//steps always needed when reading from files:
//1) include <fstream>
//2) declare fstream or ifstream oject
//3) connect it to a file in local filesystem
//4) read data from the file via the stream
//5) close te file
//different methods how to read -binary, text, line by line, character by character.. etc..
//reading text data using fstream:
//std::fstream in_file{ "/path/to/file/name.txt", std::ios::in };
//reading non text file:
//std::fstream in_file{"/path/to/file/name.mp3", std::ios::in | std::ios::binary}
//reading text data using ifstream:
//std::iftream in_file{ "/path/to/file/name.txt"}; //no need to specify the flag since it is defaultstd::iftream in_file{ "/path/to/file/name.txt" };
//reading non text file:
//std::iftream in_file{ "/path/to/file/name.txt", std::ios::binary };
//if we dont know the name of the file
//std::ifstream in_file;
//in_file.open(filename); //filename we get from somewhere on runtime
//check if opened
//if(in_file) //if(in_file.is_ope())
//close
//in_file.close()
//reading from it just like from cin
//int variable;
//in_file >> variable;;
//reading entire line
//std::string line;
//std::getline(in_file, line);
//while(!in_file.eof()) std::getline(in_file, line); .... //read entire file
//while(std::getline(in_file,line)) ....// getline returns ref to stream object, so it will return false if no other text to read
//while(in_file.get(c)) ....//reading unformatted single character, usefull because other >> operator or getline depend on whitespace
void read_file_word_by_word_using_insertion_opertator()
{
std::string line;
int x;
float y;
std::fstream in_file{ "C:\\Users\\nirvikalpa\\Desktop\\test1.txt" };
if (!in_file)
std::cerr << "error reading file\n";
else
{
in_file >> line >> x >> y;
std::cout << line << " " << x << " " << y;
}
in_file.close();
}
int read_file_line_by_line_using_getline()
{
std::string line;
std::fstream in_file{ "C:\\Users\\nirvikalpa\\Desktop\\infile.txt" };
char const* c_line;
if (!in_file)
{
std::cerr << "file not found\n";
return 1;
}
else
{
while (std::getline(in_file, line))
std::cout << line <<"\n";
}
in_file.close();
return 0;
}
void read_file_char_by_char_using_get()
{
char c{};
std::ifstream in_file{ "C:\\Users\\nirvikalpa\\Desktop\\infile.txt" };
if (!in_file)
{
std::cerr << "error opening..\n";
}
else
{
while (in_file.get(c))
std::cout << c;
}
in_file.close();
}
int main()
{
//read_file_word_by_word_using_insertion_opertator();
//read_file_line_by_line_using_getline();
read_file_char_by_char_using_get();
return 0;
} | [
"noreply@github.com"
] | TutoRepos.noreply@github.com |
5e4cac42e0f8440d58a6b92e45edad2ea14fffb1 | b154bc66fe8ab508f285a0214bc6d380d2e29327 | /optical.ino | dcf7d48541583cea4ba49576fd1d05fb9adf1ca3 | [] | no_license | uicnma/art_150 | 5221453e9aba493c8475f06534ecb045b13d2e18 | 6965072b6f9f61abc70a0a10e68bf57fa1c686b5 | refs/heads/master | 2021-05-02T16:50:15.561669 | 2016-10-31T22:36:32 | 2016-10-31T22:36:32 | 72,481,783 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 471 | ino | const int photocellPin = A0; //photocell attach to
int sensorValue = 0; // value read from the sensor
const int buzzerPin = 9; //buzzer attach to
void setup()
{
pinMode(buzzerPin, OUTPUT); //initialize buzzer as an output
}
void loop()
{
sensorValue = analogRead(photocellPin);
digitalWrite(buzzerPin, HIGH);
delay(sensorValue); //wait for a while,and the delay time depend on the sensorValue
digitalWrite(buzzerPin, LOW);
delay(sensorValue);
}
| [
"noreply@github.com"
] | uicnma.noreply@github.com |
ad01754fc5db5441713d5a9cf35ad25f3cfdfdc0 | 5a68ad40aeb3a8fb1e7dca1b65669b636bd8360f | /Libs/Door/Door.cpp | 4552658c39477c50d2afc18acab0ae1e8224a16e | [] | no_license | xrgman/Schuur | 0ad4add5559a266b858628c7f67c4b57c10df872 | 57ee14ffaf5e66fb28d6a8d5d296592e5f9d0cf8 | refs/heads/master | 2021-01-01T03:53:14.304849 | 2016-05-26T18:51:13 | 2016-05-26T18:51:19 | 57,442,642 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,363 | cpp | #include "Arduino.h"
#include "Door.h"
//******************************************************************
//** Constructor.
//** Paramater ledPin - The pin the led of the door is connected to.
//******************************************************************
Door::Door(int ledPin) {
doorLedPin = ledPin;
doorLedOn = false;
}
//******************************************************************
//** handleDoorEvent - Turns led at the door on or of.
//** Paramater lstate - Whether the door is open or closed.
//******************************************************************
void Door::handleDoorEvent(bool state) {
//Checking if its open or closed:
if(!state) {
if(!doorLedOn)
fadeLedOnStart(doorLedPin);
}
else {
if(doorLedOn)
fadeLedOffStart(doorLedPin);
}
}
//*********************************************************************
//** fadeLedOnStart - Initializes fading on the door led.
//** Paramater doorLedPin - The pin the led of the door is connected to.
//**********************************************************************
void Door::fadeLedOnStart(int doorLedPin) {
delay(200);
doorLedValue = 0;
doorLedFading = true;
doorLedOn = true;
}
//*********************************************************************
//** fadeLedOffStart - Initializes fading off the door led.
//** Paramater doorLedPin - The pin the led of the door is connected to.
//**********************************************************************
void Door::fadeLedOffStart(int doorLedPin) {
doorLedValue = 255;
doorLedFading = true;
doorLedOn = false;
}
//*********************************************************************
//** fadeLed - Fades the led placed at the door.
//**********************************************************************
void Door::fadeLed() {
if(doorLedValue <= 255 && doorLedValue >= 0)
analogWrite(doorLedPin,doorLedValue);
else
doorLedFading = false;
if(doorLedOn)
doorLedValue +=5;
else
doorLedValue -=5;
}
//*********************************************************************
//** getDoorLedFading.
//** Return whether or not the door led is fading.
//**********************************************************************
bool Door::getDoorLedFading() {
return doorLedFading;
} | [
"xrgman@gmail.com"
] | xrgman@gmail.com |
5c6bc402c40b3ffdc59b0f3da9acba6ed63c75ec | d623a9b3ca379226010d111388f98c62c1e4a25d | /Nahajowski12/Nahajowski12/Nahajowski09/CRandom.cpp | 316d13fa4abf7cc82d8df92bed01367a5d3fefa6 | [] | no_license | mnahajowski/Multi-echelon-Supply-Chain-Network-Problem | 864482e8072d7549927760040fae455f94694f24 | de99fa3a9cd635969cc7671fdf523da9bf3a6633 | refs/heads/master | 2021-01-14T23:12:52.943271 | 2020-02-25T20:24:15 | 2020-02-25T20:24:15 | 242,790,506 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,317 | cpp | #include "CRandom.h"
CRandom::CRandom()
{
std::random_device random_seed;
setSeed(random_seed());
}
CRandom::CRandom(int new_seed) {
setSeed(new_seed);
}
CRandom::~CRandom()
{
}
/*int *CRandom::getInts(int left, int right) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_int_distribution<> dis(left, right);
std::cout << "\n";
for (int i = 0; i < this->size; i++) {
this->rand_ints[i] = dis(gen);
std::cout << rand_ints[i] << " ";
}
std::cout << "\n";
return this->rand_ints;
}
double *CRandom::getDoubles(double left, double right) {
std::random_device rd;
std::mt19937 gen(rd());
std::uniform_real_distribution<> dis(left, right);
std::cout << "\n";
for (int i = 0; i < this->size; i++) {
this->rand_dbls[i] = dis(gen);
std::cout << rand_dbls[i] << " ";
}
std::cout << "\n";
return this->rand_dbls;
}*/
int CRandom::getInt(int left, int right) {
if (left > right) {
int temp = left;
left = right;
right = temp;
}
std::uniform_int_distribution<> dis(left, right);
return dis(gen);
}
double CRandom::getDouble(double left, double right) {
if (left > right) {
double temp = left;
left = right;
right = temp;
}
std::uniform_real_distribution<> dis(left, right);
return dis(gen);
}
void CRandom::setSeed(int new_seed) {
gen.seed(new_seed);
}
| [
"immortalmar0@gmail.com"
] | immortalmar0@gmail.com |
6cfac5f83e8a8d8c2c56e6fe095bd72eaa50fb42 | 284d8657b07536bea5d400168a98c1a3ce0bc851 | /xray/core/sources/threading_functions.h | 4c31abe7d3165acf655c389da712398107e92a6d | [] | no_license | yxf010/xray-2.0 | c6bcd35caa4677ab19cd8be241ce1cc0a25c74a7 | 47461806c25e34005453a373b07ce5b00df2c295 | refs/heads/master | 2020-08-29T21:35:38.253150 | 2019-05-23T16:00:42 | 2019-05-23T16:00:42 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 744 | h | ////////////////////////////////////////////////////////////////////////////
// Created : 05.05.2010
// Author : Dmitriy Iassenev
// Copyright (C) GSC Game World - 2010
////////////////////////////////////////////////////////////////////////////
#ifndef THREADING_FUNCTIONS_H_INCLUDED
#define THREADING_FUNCTIONS_H_INCLUDED
namespace xray {
namespace threading {
struct thread_entry_params {
thread_function_type function_to_call;
volatile pcstr thread_name_for_logging;
volatile pcstr thread_name_for_debugger;
u32 hardware_thread;
threading::tasks_awareness tasks_awareness;
bool processed;
};
} // namespace threading
} // namespace xray
#endif // #ifndef THREADING_FUNCTIONS_H_INCLUDED | [
"tyabustest@gmail.com"
] | tyabustest@gmail.com |
9b18a972817f6fc970257ce119220ac6946ff7b9 | 6df4b4779de1395e1e3772faee0779b0ceeff2d5 | /10519 - !! Really Strange !!.cpp | 1bdcc5bdc5e5075e5d5895b3ad2c7d35d8dc842b | [] | no_license | rezwan4029/UVA-CODES | 13c8179107d573733a40108dfd772829e551c0cb | 7c92715cca8a72bd576faa7c1927eac0f0c95ca9 | refs/heads/master | 2020-04-12T08:01:14.854931 | 2018-11-07T22:45:13 | 2018-11-07T22:45:13 | 6,367,809 | 34 | 38 | null | null | null | null | UTF-8 | C++ | false | false | 521 | cpp | import java.math.*;
import java.util.*;
public class Main {
public static void main(String args[]) {
Scanner ob = new Scanner(System.in);
while(ob.hasNext()){
BigInteger x = ob.nextBigInteger();
if( x.equals( BigInteger.ZERO ) ){
System.out.println(1);
continue;
}
BigInteger ans = ( x.multiply(x) ).subtract(x);
ans = ans.add( BigInteger.valueOf(2) );
System.out.println(ans);
}
}
}
| [
"rezwan.maruf.ndc09@gmail.com"
] | rezwan.maruf.ndc09@gmail.com |
5ee6da18f083fdbac6dd9636cd1b49fb1954a968 | 02450e6f83bf914087bb2e9cc3805a6c06027889 | /Black/Week4/partN/main.cpp | 58e30e6a243316c30ed022a5fefaa73cb74b6815 | [] | no_license | RinokuS/yandex-cpp-belts | d4962c022a53e64cf540c79feb979752814e9b29 | b863efe12dedf5a93517c937308b5f140ea86725 | refs/heads/main | 2022-12-25T22:02:36.059625 | 2020-10-03T09:31:41 | 2020-10-03T09:31:41 | 300,842,700 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,545 | cpp | #include <iostream>
#include "test_runner.h"
#include "misc.h"
#include "io.h"
#include "json.h"
#include <string>
#include <iomanip>
#include "graph.h"
#include "router.h"
using namespace std;
int main(void) {
stringstream ss{R"(
{
"routing_settings": {
"bus_wait_time": 2,
"bus_velocity": 30
},
"render_settings": {
"width": 1200,
"height": 500,
"padding": 50,
"stop_radius": 5,
"line_width": 14,
"bus_label_font_size": 20,
"bus_label_offset": [
7,
15
],
"stop_label_font_size": 18,
"stop_label_offset": [
7,
-3
],
"underlayer_color": [
255,
255,
255,
0.85
],
"underlayer_width": 3,
"color_palette": [
"green",
[
255,
160,
0
],
"red"
],
"layers": [
"bus_lines",
"bus_labels",
"stop_points",
"stop_labels"
]
},
"base_requests": [
{
"type": "Bus",
"name": "14",
"stops": [
"Улица Лизы Чайкиной",
"Электросети",
"Ривьерский мост",
"Гостиница Сочи",
"Кубанская улица",
"По требованию",
"Улица Докучаева",
"Улица Лизы Чайкиной"
],
"is_roundtrip": true
},
{
"type": "Bus",
"name": "24",
"stops": [
"Улица Докучаева",
"Параллельная улица",
"Электросети",
"Санаторий Родина"
],
"is_roundtrip": false
},
{
"type": "Bus",
"name": "114",
"stops": [
"Морской вокзал",
"Ривьерский мост"
],
"is_roundtrip": false
},
{
"type": "Stop",
"name": "Улица Лизы Чайкиной",
"latitude": 43.590317,
"longitude": 39.746833,
"road_distances": {
"Электросети": 4300,
"Улица Докучаева": 2000
}
},
{
"type": "Stop",
"name": "Морской вокзал",
"latitude": 43.581969,
"longitude": 39.719848,
"road_distances": {
"Ривьерский мост": 850
}
},
{
"type": "Stop",
"name": "Электросети",
"latitude": 43.598701,
"longitude": 39.730623,
"road_distances": {
"Санаторий Родина": 4500,
"Параллельная улица": 1200,
"Ривьерский мост": 1900
}
},
{
"type": "Stop",
"name": "Ривьерский мост",
"latitude": 43.587795,
"longitude": 39.716901,
"road_distances": {
"Морской вокзал": 850,
"Гостиница Сочи": 1740
}
},
{
"type": "Stop",
"name": "Гостиница Сочи",
"latitude": 43.578079,
"longitude": 39.728068,
"road_distances": {
"Кубанская улица": 320
}
},
{
"type": "Stop",
"name": "Кубанская улица",
"latitude": 43.578509,
"longitude": 39.730959,
"road_distances": {
"По требованию": 370
}
},
{
"type": "Stop",
"name": "По требованию",
"latitude": 43.579285,
"longitude": 39.733742,
"road_distances": {
"Улица Докучаева": 600
}
},
{
"type": "Stop",
"name": "Улица Докучаева",
"latitude": 43.585586,
"longitude": 39.733879,
"road_distances": {
"Параллельная улица": 1100
}
},
{
"type": "Stop",
"name": "Параллельная улица",
"latitude": 43.590041,
"longitude": 39.732886,
"road_distances": {}
},
{
"type": "Stop",
"name": "Санаторий Родина",
"latitude": 43.601202,
"longitude": 39.715498,
"road_distances": {}
}
],
"stat_requests": [
{
"id": 826874078,
"type": "Bus",
"name": "14"
},
{
"id": 1086967114,
"type": "Route",
"from": "Морской вокзал",
"to": "Параллельная улица"
},
{
"id": 1218663236,
"type": "Map"
}
]
}
)"};
TransportCatalog handler;
Json::Document doc = Json::Load(cin);
auto responses = handler.ReadRequests(doc).ProcessRequests().GetResponses();
cout << setprecision(6);
Json::Print(responses, cout);
return 0;
} | [
"JeffTheKilller@mail.ru"
] | JeffTheKilller@mail.ru |
3531c37dc37287fe69adb42420409d1d660f4ff5 | a8525b53387406fcf22db093226c46558e016811 | /src/game/server/gamecontext.h | 5e776c63e8d8164e26a1b51c1b81005b82964160 | [
"Zlib",
"LicenseRef-scancode-other-permissive"
] | permissive | teeworldsCloudFell/teeworlds-ptum | 34b3b95bf054df658a0ad0e123e0aa1469e06b02 | 4383938a0df89f321a755f299e2218d42aee9e9b | refs/heads/master | 2021-12-12T11:46:06.590229 | 2017-01-03T13:04:27 | 2017-01-03T13:04:27 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,899 | h | /* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
/* If you are missing that file, acquire a complete release at teeworlds.com. */
#ifndef GAME_SERVER_GAMECONTEXT_H
#define GAME_SERVER_GAMECONTEXT_H
#include <engine/server.h>
#include <engine/console.h>
#include <engine/shared/memheap.h>
#include <game/layers.h>
#include <game/voting.h>
#include "eventhandler.h"
#include "gamecontroller.h"
#include "gameworld.h"
#include "player.h"
/*
Tick
Game Context (CGameContext::tick)
Game World (GAMEWORLD::tick)
Reset world if requested (GAMEWORLD::reset)
All entities in the world (ENTITY::tick)
All entities in the world (ENTITY::tick_defered)
Remove entities marked for deletion (GAMEWORLD::remove_entities)
Game Controller (GAMECONTROLLER::tick)
All players (CPlayer::tick)
Snap
Game Context (CGameContext::snap)
Game World (GAMEWORLD::snap)
All entities in the world (ENTITY::snap)
Game Controller (GAMECONTROLLER::snap)
Events handler (EVENT_HANDLER::snap)
All players (CPlayer::snap)
*/
class CGameContext : public IGameServer
{
IServer *m_pServer;
class IConsole *m_pConsole;
CLayers m_Layers;
CCollision m_Collision;
CNetObjHandler m_NetObjHandler;
CTuningParams m_Tuning;
static void ConTuneParam(IConsole::IResult *pResult, void *pUserData);
static void ConTuneReset(IConsole::IResult *pResult, void *pUserData);
static void ConTuneDump(IConsole::IResult *pResult, void *pUserData);
static void ConPause(IConsole::IResult *pResult, void *pUserData);
static void ConChangeMap(IConsole::IResult *pResult, void *pUserData);
static void ConRestart(IConsole::IResult *pResult, void *pUserData);
static void ConBroadcast(IConsole::IResult *pResult, void *pUserData);
static void ConSay(IConsole::IResult *pResult, void *pUserData);
static void ConSetTeam(IConsole::IResult *pResult, void *pUserData);
static void ConSetTeamAll(IConsole::IResult *pResult, void *pUserData);
static void ConSwapTeams(IConsole::IResult *pResult, void *pUserData);
static void ConShuffleTeams(IConsole::IResult *pResult, void *pUserData);
static void ConLockTeams(IConsole::IResult *pResult, void *pUserData);
static void ConAddVote(IConsole::IResult *pResult, void *pUserData);
static void ConRemoveVote(IConsole::IResult *pResult, void *pUserData);
static void ConForceVote(IConsole::IResult *pResult, void *pUserData);
static void ConClearVotes(IConsole::IResult *pResult, void *pUserData);
static void ConVote(IConsole::IResult *pResult, void *pUserData);
static void ConchainSpecialMotdupdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
CGameContext(int Resetting);
void Construct(int Resetting);
bool m_Resetting;
public:
int m_ZoneHandle_TeeWorlds;
public:
IServer *Server() const { return m_pServer; }
class IConsole *Console() { return m_pConsole; }
CCollision *Collision() { return &m_Collision; }
CTuningParams *Tuning() { return &m_Tuning; }
virtual class CLayers *Layers() { return &m_Layers; }
CGameContext();
~CGameContext();
void Clear();
CEventHandler m_Events;
CPlayer *m_apPlayers[MAX_CLIENTS];
IGameController *m_pController;
CGameWorld m_World;
// helper functions
class CCharacter *GetPlayerChar(int ClientID);
int m_LockTeams;
// voting
void StartVote(const char *pDesc, const char *pCommand, const char *pReason);
void EndVote();
void SendVoteSet(int ClientID);
void SendVoteStatus(int ClientID, int Total, int Yes, int No);
void AbortVoteKickOnDisconnect(int ClientID);
int m_VoteCreator;
int64 m_VoteCloseTime;
bool m_VoteUpdate;
int m_VotePos;
char m_aVoteDescription[VOTE_DESC_LENGTH];
char m_aVoteCommand[VOTE_CMD_LENGTH];
char m_aVoteReason[VOTE_REASON_LENGTH];
int m_NumVoteOptions;
int m_VoteEnforce;
enum
{
VOTE_ENFORCE_UNKNOWN=0,
VOTE_ENFORCE_NO,
VOTE_ENFORCE_YES,
};
CHeap *m_pVoteOptionHeap;
CVoteOptionServer *m_pVoteOptionFirst;
CVoteOptionServer *m_pVoteOptionLast;
// helper functions
void CreateDamageInd(vec2 Pos, float AngleMod, int Amount);
void CreateExplosion(vec2 Pos, int Owner, int Weapon, bool NoDamage);
void CreateHammerHit(vec2 Pos);
void CreatePlayerSpawn(vec2 Pos);
void CreateDeath(vec2 Pos, int Who);
void CreateSound(vec2 Pos, int Sound, int Mask=-1);
void CreateSoundGlobal(int Sound, int Target=-1);
enum
{
CHAT_ALL=-2,
CHAT_SPEC=-1,
CHAT_RED=0,
CHAT_BLUE=1
};
// network
void SendChatTarget(int To, const char *pText);
void SendChat(int ClientID, int Team, const char *pText);
void SendEmoticon(int ClientID, int Emoticon);
void SendWeaponPickup(int ClientID, int Weapon);
void SendBroadcast(const char *pText, int ClientID);
//
void CheckPureTuning();
void SendTuningParams(int ClientID);
//
void SwapTeams();
// engine events
virtual void OnInit();
virtual void OnConsoleInit();
virtual void OnShutdown();
virtual void OnTick();
virtual void OnPreSnap();
virtual void OnSnap(int ClientID);
virtual void OnPostSnap();
virtual void OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID);
virtual void OnClientConnected(int ClientID);
virtual void OnClientEnter(int ClientID);
virtual void OnClientDrop(int ClientID, const char *pReason);
virtual void OnClientDirectInput(int ClientID, void *pInput);
virtual void OnClientPredictedInput(int ClientID, void *pInput);
virtual bool IsClientReady(int ClientID);
virtual bool IsClientPlayer(int ClientID);
virtual const char *GameType();
virtual const char *Version();
virtual const char *NetVersion();
};
inline int CmaskAll() { return -1; }
inline int CmaskOne(int ClientID) { return 1<<ClientID; }
inline int CmaskAllExceptOne(int ClientID) { return 0x7fffffff^CmaskOne(ClientID); }
inline bool CmaskIsSet(int Mask, int ClientID) { return (Mask&CmaskOne(ClientID)) != 0; }
#endif
| [
"necropotame@gmail.com"
] | necropotame@gmail.com |
bdd29fe116e2db34b09f5d7d41256b39aee390d6 | 47e58df7e2b22b2e172aa9a298a1820623fab629 | /icuSources/i18n/unicode/measfmt.h | febc75d9c7f6c9315d9e45c3e5b3188189618a03 | [
"ICU",
"NAIST-2003",
"LicenseRef-scancode-unicode",
"BSD-3-Clause",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | aosm/ICU | 2ba445771447448462d46449fd560dfa193cf2f7 | 71cb850a00a24b8ea5c3583cce3d26124acece20 | refs/heads/master | 2023-07-08T21:46:03.354183 | 2014-10-31T07:34:07 | 2014-10-31T07:34:07 | 8,897,215 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 9,520 | h | /*
**********************************************************************
* Copyright (c) 2004-2014, International Business Machines
* Corporation and others. All Rights Reserved.
**********************************************************************
* Author: Alan Liu
* Created: April 20, 2004
* Since: ICU 3.0
**********************************************************************
*/
#ifndef MEASUREFORMAT_H
#define MEASUREFORMAT_H
#include "unicode/utypes.h"
#include "unicode/measure.h"
#if !UCONFIG_NO_FORMATTING
#include "unicode/format.h"
#include "unicode/udat.h"
/**
* \file
* \brief C++ API: Formatter for measure objects.
*/
#ifndef U_HIDE_DRAFT_API
/**
* Constants for various widths.
* There are 3 widths: Wide, Short, Narrow.
* For example, for English, when formatting "3 hours"
* Wide is "3 hours"; short is "3 hrs"; narrow is "3h"
* @draft ICU 53
*/
enum UMeasureFormatWidth {
// Wide, short, and narrow must be first and in this order.
/**
* Spell out measure units.
* @draft ICU 53
*/
UMEASFMT_WIDTH_WIDE,
/**
* Abbreviate measure units.
* @draft ICU 53
*/
UMEASFMT_WIDTH_SHORT,
/**
* Use symbols for measure units when possible.
* @draft ICU 53
*/
UMEASFMT_WIDTH_NARROW,
/**
* Completely omit measure units when possible. For example, format
* '5 hours, 37 minutes' as '5:37'
* @draft ICU 53
*/
UMEASFMT_WIDTH_NUMERIC,
/**
* Count of values in this enum.
* @draft ICU 53
*/
UMEASFMT_WIDTH_COUNT
};
/** @draft ICU 53 */
typedef enum UMeasureFormatWidth UMeasureFormatWidth;
#endif /* U_HIDE_DRAFT_API */
U_NAMESPACE_BEGIN
class NumberFormat;
class PluralRules;
class MeasureFormatCacheData;
class SharedNumberFormat;
class SharedPluralRules;
class QuantityFormatter;
class ListFormatter;
class DateFormat;
/**
*
* A formatter for measure objects.
*
* @see Format
* @author Alan Liu
* @stable ICU 3.0
*/
class U_I18N_API MeasureFormat : public Format {
public:
using Format::parseObject;
using Format::format;
#ifndef U_HIDE_DRAFT_API
/**
* Constructor.
* @draft ICU 53
*/
MeasureFormat(
const Locale &locale, UMeasureFormatWidth width, UErrorCode &status);
/**
* Constructor.
* @draft ICU 53
*/
MeasureFormat(
const Locale &locale,
UMeasureFormatWidth width,
NumberFormat *nfToAdopt,
UErrorCode &status);
#endif /* U_HIDE_DRAFT_API */
/**
* Copy constructor.
* @draft ICU 53
*/
MeasureFormat(const MeasureFormat &other);
/**
* Assignment operator.
* @draft ICU 53
*/
MeasureFormat &operator=(const MeasureFormat &rhs);
/**
* Destructor.
* @stable ICU 3.0
*/
virtual ~MeasureFormat();
/**
* Return true if given Format objects are semantically equal.
* @draft ICU 53
*/
virtual UBool operator==(const Format &other) const;
/**
* Clones this object polymorphically.
* @draft ICU 53
*/
virtual Format *clone() const;
/**
* Formats object to produce a string.
* @draft ICU 53
*/
virtual UnicodeString &format(
const Formattable &obj,
UnicodeString &appendTo,
FieldPosition &pos,
UErrorCode &status) const;
/**
* Parse a string to produce an object. This implementation sets
* status to U_UNSUPPORTED_ERROR.
*
* @draft ICU 53
*/
virtual void parseObject(
const UnicodeString &source,
Formattable &reslt,
ParsePosition &pos) const;
#ifndef U_HIDE_DRAFT_API
/**
* Formats measure objects to produce a string. An example of such a
* formatted string is 3 meters, 3.5 centimeters. Measure objects appear
* in the formatted string in the same order they appear in the "measures"
* array. The NumberFormat of this object is used only to format the amount
* of the very last measure. The other amounts are formatted with zero
* decimal places while rounding toward zero.
* @param measures array of measure objects.
* @param measureCount the number of measure objects.
* @param appendTo formatted string appended here.
* @param pos the field position.
* @param status the error.
* @return appendTo reference
*
* @draft ICU 53
*/
UnicodeString &formatMeasures(
const Measure *measures,
int32_t measureCount,
UnicodeString &appendTo,
FieldPosition &pos,
UErrorCode &status) const;
#endif /* U_HIDE_DRAFT_API */
/**
* Return a formatter for CurrencyAmount objects in the given
* locale.
* @param locale desired locale
* @param ec input-output error code
* @return a formatter object, or NULL upon error
* @stable ICU 3.0
*/
static MeasureFormat* U_EXPORT2 createCurrencyFormat(const Locale& locale,
UErrorCode& ec);
/**
* Return a formatter for CurrencyAmount objects in the default
* locale.
* @param ec input-output error code
* @return a formatter object, or NULL upon error
* @stable ICU 3.0
*/
static MeasureFormat* U_EXPORT2 createCurrencyFormat(UErrorCode& ec);
/**
* Return the class ID for this class. This is useful only for comparing to
* a return value from getDynamicClassID(). For example:
* <pre>
* . Base* polymorphic_pointer = createPolymorphicObject();
* . if (polymorphic_pointer->getDynamicClassID() ==
* . erived::getStaticClassID()) ...
* </pre>
* @return The class ID for all objects of this class.
* @draft ICU 53
*/
static UClassID U_EXPORT2 getStaticClassID(void);
/**
* Returns a unique class ID POLYMORPHICALLY. Pure virtual override. This
* method is to implement a simple version of RTTI, since not all C++
* compilers support genuine RTTI. Polymorphic operator==() and clone()
* methods call this method.
*
* @return The class ID for this object. All objects of a
* given class have the same class ID. Objects of
* other classes have different class IDs.
* @draft ICU 53
*/
virtual UClassID getDynamicClassID(void) const;
protected:
/**
* Default constructor.
* @stable ICU 3.0
*/
MeasureFormat();
#ifndef U_HIDE_INTERNAL_API
#ifndef U_HIDE_DRAFT_API
/**
* ICU use only.
* Initialize or change MeasureFormat class from subclass.
* @internal.
*/
void initMeasureFormat(
const Locale &locale,
UMeasureFormatWidth width,
NumberFormat *nfToAdopt,
UErrorCode &status);
#endif
/**
* ICU use only.
* Allows subclass to change locale. Note that this method also changes
* the NumberFormat object. Returns TRUE if locale changed; FALSE if no
* change was made.
* @internal.
*/
UBool setMeasureFormatLocale(const Locale &locale, UErrorCode &status);
public:
// Apple-only, temporarily public for Apple use
/**
* ICU use only.
* Let subclass change NumberFormat.
* @internal.
*/
void adoptNumberFormat(NumberFormat *nfToAdopt, UErrorCode &status);
protected:
/**
* ICU use only.
* @internal.
*/
const NumberFormat &getNumberFormat() const;
/**
* ICU use only.
* @internal.
*/
const PluralRules &getPluralRules() const;
/**
* ICU use only.
* @internal.
*/
Locale getLocale(UErrorCode &status) const;
/**
* ICU use only.
* @internal.
*/
const char *getLocaleID(UErrorCode &status) const;
#endif /* U_HIDE_INTERNAL_API */
private:
const MeasureFormatCacheData *cache;
const SharedNumberFormat *numberFormat;
const SharedPluralRules *pluralRules;
#ifndef U_HIDE_DRAFT_API
UMeasureFormatWidth width;
#endif
// Declared outside of MeasureFormatSharedData because ListFormatter
// objects are relatively cheap to copy; therefore, they don't need to be
// shared across instances.
ListFormatter *listFormatter;
const QuantityFormatter *getQuantityFormatter(
int32_t index,
int32_t widthIndex,
UErrorCode &status) const;
UnicodeString &formatMeasure(
const Measure &measure,
const NumberFormat &nf,
UnicodeString &appendTo,
FieldPosition &pos,
UErrorCode &status) const;
UnicodeString &formatMeasuresSlowTrack(
const Measure *measures,
int32_t measureCount,
UnicodeString& appendTo,
FieldPosition& pos,
UErrorCode& status) const;
UnicodeString &formatNumeric(
const Formattable *hms, // always length 3: [0] is hour; [1] is
// minute; [2] is second.
int32_t bitMap, // 1=hour set, 2=minute set, 4=second set
UnicodeString &appendTo,
UErrorCode &status) const;
UnicodeString &formatNumeric(
UDate date,
const DateFormat &dateFmt,
UDateFormatField smallestField,
const Formattable &smallestAmount,
UnicodeString &appendTo,
UErrorCode &status) const;
};
U_NAMESPACE_END
#endif // #if !UCONFIG_NO_FORMATTING
#endif // #ifndef MEASUREFORMAT_H
| [
"rasmus@dll.nu"
] | rasmus@dll.nu |
e663cf6e32f614c97e0da544bc68f3816d8efa55 | 02bc9e671a9bb5b2b963370b44bdc4e47aa21142 | /deps/chakrashim/core/lib/Runtime/Base/PropertyRecord.h | 4073bc48fb8fe71409a28167f3fbe341182bd0da | [
"LicenseRef-scancode-openssl",
"Zlib",
"NTP",
"NAIST-2003",
"LicenseRef-scancode-unicode",
"LicenseRef-scancode-unknown-license-reference",
"Artistic-2.0",
"ISC",
"MIT",
"BSD-3-Clause",
"ICU",
"LicenseRef-scancode-public-domain",
"BSD-2-Clause"
] | permissive | JefferyQ/spidernode | 2f61e76326d97088ae9f1ab74a6bada2136ba888 | c735553973e2045ed4e6c09ebdeaf7a1b90a8686 | refs/heads/master | 2021-01-17T07:00:13.639117 | 2016-07-26T15:59:10 | 2016-07-26T15:59:10 | 64,418,277 | 1 | 0 | null | 2016-07-28T18:19:39 | 2016-07-28T18:19:39 | null | UTF-8 | C++ | false | false | 11,189 | h | //-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
#pragma once
#ifdef PROPERTY_RECORD_TRACE
#define PropertyRecordTrace(...) \
if (Js::Configuration::Global.flags.Trace.IsEnabled(Js::PropertyRecordPhase)) \
{ \
Output::Print(__VA_ARGS__); \
}
#else
#define PropertyRecordTrace(...)
#endif
class ThreadContext;
namespace Js
{
class PropertyRecord : FinalizableObject
{
friend class ThreadContext;
template <int LEN>
friend struct BuiltInPropertyRecord;
friend class InternalPropertyRecords;
friend class BuiltInPropertyRecords;
friend class DOMBuiltInPropertyRecords;
private:
PropertyId pid;
//Made this mutable so that we can set it for Built-In js property records when we are adding it.
//If we try to set it when initializing; we get extra code added for each built in; and thus increasing the size of chakracore
mutable uint hash;
bool isNumeric;
bool isBound;
bool isSymbol;
// Have the length before the buffer so that the buffer would have a BSTR format
DWORD byteCount;
PropertyRecord(DWORD bytelength, bool isNumeric, uint hash, bool isSymbol);
PropertyRecord(PropertyId pid, uint hash, bool isNumeric, DWORD byteCount, bool isSymbol);
PropertyRecord() { Assert(false); } // never used, needed by compiler for BuiltInPropertyRecord
static bool IsPropertyNameNumeric(const char16* str, int length, uint32* intVal);
public:
#ifdef DEBUG
static bool IsPropertyNameNumeric(const char16* str, int length);
#endif
static PropertyRecord * New(Recycler * recycler, JsUtil::CharacterBuffer<WCHAR> const& propertyName);
static PropertyAttributes DefaultAttributesForPropertyId(PropertyId propertyId, bool __proto__AsDeleted);
PropertyId GetPropertyId() const { return pid; }
uint GetHashCode() const { return hash; }
charcount_t GetLength() const
{
return byteCount / sizeof(char16);
}
const char16* GetBuffer() const
{
return (const char16 *)(this + 1);
}
bool IsNumeric() const { return isNumeric; }
uint32 GetNumericValue() const;
bool IsBound() const { return isBound; }
bool IsSymbol() const { return isSymbol; }
void SetHash(uint hash) const
{
this->hash = hash;
}
bool Equals(JsUtil::CharacterBuffer<WCHAR> const & str) const
{
return (this->GetLength() == str.GetLength() && !Js::IsInternalPropertyId(this->GetPropertyId()) &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(this->GetBuffer(), str.GetBuffer(), this->GetLength()));
}
bool Equals(PropertyRecord const & propertyRecord) const
{
return (this->GetLength() == propertyRecord.GetLength() &&
Js::IsInternalPropertyId(this->GetPropertyId()) == Js::IsInternalPropertyId(propertyRecord.GetPropertyId()) &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(this->GetBuffer(), propertyRecord.GetBuffer(), this->GetLength()));
}
public:
// Finalizable support
virtual void Finalize(bool isShutdown);
virtual void Dispose(bool isShutdown)
{
}
virtual void Mark(Recycler *recycler) override { AssertMsg(false, "Mark called on object that isn't TrackableObject"); }
};
// This struct maps to the layout of runtime allocated PropertyRecord. Used for creating built-in PropertyRecords statically.
template <int LEN>
struct BuiltInPropertyRecord
{
PropertyRecord propertyRecord;
char16 buffer[LEN];
operator const PropertyRecord*() const
{
return &propertyRecord;
}
bool Equals(JsUtil::CharacterBuffer<WCHAR> const & str) const
{
return (LEN - 1 == str.GetLength() &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(buffer, str.GetBuffer(), LEN - 1));
}
};
// Internal PropertyRecords mapping to InternalPropertyIds. Property names of internal PropertyRecords are not used
// and set to empty string.
class InternalPropertyRecords
{
public:
#define INTERNALPROPERTY(n) const static BuiltInPropertyRecord<1> n;
#include "InternalPropertyList.h"
static const PropertyRecord* GetInternalPropertyName(PropertyId propertyId);
};
// Built-in PropertyRecords. Created statically with known PropertyIds.
class BuiltInPropertyRecords
{
public:
const static BuiltInPropertyRecord<1> EMPTY;
#define ENTRY_INTERNAL_SYMBOL(n) const static BuiltInPropertyRecord<ARRAYSIZE(_u("<") _u(#n) _u(">"))> n;
#define ENTRY_SYMBOL(n, d) const static BuiltInPropertyRecord<ARRAYSIZE(d)> n;
#define ENTRY(n) const static BuiltInPropertyRecord<ARRAYSIZE(_u(#n))> n;
#define ENTRY2(n, s) const static BuiltInPropertyRecord<ARRAYSIZE(s)> n;
#include "Base/JnDirectFields.h"
};
template <typename TChar>
class HashedCharacterBuffer : public JsUtil::CharacterBuffer<TChar>
{
private:
hash_t hashCode;
public:
HashedCharacterBuffer(TChar const * string, charcount_t len) :
JsUtil::CharacterBuffer<TChar>(string, len)
{
this->hashCode = JsUtil::CharacterBuffer<WCHAR>::StaticGetHashCode(string, len);
}
hash_t GetHashCode() const { return this->hashCode; }
};
struct PropertyRecordPointerComparer
{
__inline static bool Equals(PropertyRecord const * str1, PropertyRecord const * str2)
{
return (str1->GetLength() == str2->GetLength() &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(str1->GetBuffer(), str2->GetBuffer(), str1->GetLength()));
}
__inline static bool Equals(PropertyRecord const * str1, JsUtil::CharacterBuffer<WCHAR> const * str2)
{
return (str1->GetLength() == str2->GetLength() && !Js::IsInternalPropertyId(str1->GetPropertyId()) &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(str1->GetBuffer(), str2->GetBuffer(), str1->GetLength()));
}
__inline static hash_t GetHashCode(PropertyRecord const * str)
{
return str->GetHashCode();
}
__inline static hash_t GetHashCode(JsUtil::CharacterBuffer<WCHAR> const * str)
{
return JsUtil::CharacterBuffer<WCHAR>::StaticGetHashCode(str->GetBuffer(), str->GetLength());
}
};
template<typename T>
struct PropertyRecordStringHashComparer
{
__inline static bool Equals(T str1, T str2)
{
static_assert(false, "Unexpected type T; note T == PropertyId not allowed!");
}
__inline static hash_t GetHashCode(T str)
{
// T == PropertyId is not allowed because there is no way to get the string hash
// from just a PropertyId value, the PropertyRecord is required for that.
static_assert(false, "Unexpected type T; note T == PropertyId not allowed!");
}
};
template<>
struct PropertyRecordStringHashComparer<PropertyRecord const *>
{
__inline static bool Equals(PropertyRecord const * str1, PropertyRecord const * str2)
{
return str1 == str2;
}
__inline static bool Equals(PropertyRecord const * str1, JsUtil::CharacterBuffer<WCHAR> const & str2)
{
return (!str1->IsSymbol() &&
str1->GetLength() == str2.GetLength() &&
!Js::IsInternalPropertyId(str1->GetPropertyId()) &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(str1->GetBuffer(), str2.GetBuffer(), str1->GetLength()));
}
__inline static bool Equals(PropertyRecord const * str1, HashedCharacterBuffer<char16> const & str2)
{
return (!str1->IsSymbol() &&
str1->GetHashCode() == str2.GetHashCode() &&
str1->GetLength() == str2.GetLength() &&
!Js::IsInternalPropertyId(str1->GetPropertyId()) &&
JsUtil::CharacterBuffer<char16>::StaticEquals(str1->GetBuffer(), str2.GetBuffer(), str1->GetLength()));
}
__inline static bool Equals(PropertyRecord const * str1, JavascriptString * str2);
__inline static hash_t GetHashCode(const PropertyRecord* str)
{
return str->GetHashCode();
}
};
template<>
struct PropertyRecordStringHashComparer<JsUtil::CharacterBuffer<WCHAR>>
{
__inline static bool Equals(JsUtil::CharacterBuffer<WCHAR> const & str1, JsUtil::CharacterBuffer<WCHAR> const & str2)
{
return (str1.GetLength() == str2.GetLength() &&
JsUtil::CharacterBuffer<WCHAR>::StaticEquals(str1.GetBuffer(), str2.GetBuffer(), str1.GetLength()));
}
__inline static hash_t GetHashCode(JsUtil::CharacterBuffer<WCHAR> const & str)
{
return JsUtil::CharacterBuffer<WCHAR>::StaticGetHashCode(str.GetBuffer(), str.GetLength());
}
};
template<>
struct PropertyRecordStringHashComparer<HashedCharacterBuffer<char16>>
{
__inline static hash_t GetHashCode(HashedCharacterBuffer<char16> const & str)
{
return str.GetHashCode();
}
};
class CaseInvariantPropertyListWithHashCode: public JsUtil::List<const RecyclerWeakReference<Js::PropertyRecord const>*>
{
public:
CaseInvariantPropertyListWithHashCode(Recycler* recycler, int increment):
JsUtil::List<const RecyclerWeakReference<Js::PropertyRecord const>*>(recycler, increment),
caseInvariantHashCode(0)
{
}
uint caseInvariantHashCode;
};
}
// Hash and lookup by PropertyId
template <>
struct DefaultComparer<const Js::PropertyRecord*>
{
__inline static hash_t GetHashCode(const Js::PropertyRecord* str)
{
return DefaultComparer<Js::PropertyId>::GetHashCode(str->GetPropertyId());
}
__inline static bool Equals(const Js::PropertyRecord* str, Js::PropertyId propertyId)
{
return str->GetPropertyId() == propertyId;
}
__inline static bool Equals(const Js::PropertyRecord* str1, const Js::PropertyRecord* str2)
{
return str1 == str2;
}
};
namespace JsUtil
{
template<>
struct NoCaseComparer<Js::CaseInvariantPropertyListWithHashCode*>
{
static bool Equals(_In_ Js::CaseInvariantPropertyListWithHashCode* list1, _In_ Js::CaseInvariantPropertyListWithHashCode* list2);
static bool Equals(_In_ Js::CaseInvariantPropertyListWithHashCode* list, JsUtil::CharacterBuffer<WCHAR> const& str);
static hash_t GetHashCode(_In_ Js::CaseInvariantPropertyListWithHashCode* list);
};
}
| [
"Kunal.Pathak@microsoft.com"
] | Kunal.Pathak@microsoft.com |
4046f536afcac84a7a09ff5d360371fbf950e9f7 | 09946f08e430e04497d7e1e12b21c1f9bafc1a45 | /hw/lab1/fsm.h | ac8e02ae715e64eaf7b6f15f9a5987ea5e834ccf | [] | no_license | vlazarew/kamkin | 298e50611036ea9ccae67fb7a56b2079b50ea706 | 98f4be2a6b129b7e7cf383325052c7f886daf6a1 | refs/heads/main | 2023-04-30T20:23:54.463089 | 2021-05-30T19:25:25 | 2021-05-30T19:25:25 | 351,830,144 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,887 | h | /*
* Copyright 2021 ISP RAS (http://www.ispras.ru)
*
* 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.
*/
#pragma once
#include <iostream>
#include <map>
#include <set>
#include <vector>
namespace model::fsm {
class State final {
public:
State(const std::string &label): _label(label) {}
bool operator ==(const State &rhs) const {
return _label == rhs._label;
}
std::string label() const { return _label; }
private:
const std::string _label;
};
std::ostream& operator <<(std::ostream &out, const State &state) {
return out << state.label();
}
class Transition final {
public:
Transition(const State &source, const std::set<std::string> &symbol, const State &target):
_source(source), _target(target), _symbol(symbol) {}
bool operator ==(const Transition &rhs) const {
return _source == rhs._source
&& _symbol == rhs._symbol
&& _target == rhs._target;
}
const State& source() const { return _source; }
const State& target() const { return _target; }
const std::set<std::string>& symbol() const { return _symbol; }
private:
const State &_source;
const State &_target;
std::set<std::string> _symbol;
};
std::ostream& operator <<(std::ostream &out, const Transition &transition) {
out << transition.source();
out << " --[";
bool separator = false;
for (auto i = transition.symbol().begin(); i != transition.symbol().end(); i++) {
out << (separator ? ", " : "") << *i;
separator = true;
}
out << "]--> ";
out << transition.target();
return out;
}
class Automaton final {
friend std::ostream& operator <<(std::ostream &out, const Automaton &automaton);
public:
Automaton() {}
void add_state(const std::string &state_label);
void set_initial(const std::string &state_label);
void set_final(const std::string &state_label, unsigned final_set_index);
void add_trans(
const std::string &source,
const std::set<std::string> &symbol,
const std::string &target
);
private:
std::map<std::string, State> _states;
std::set<std::string> _initial_states;
std::map<unsigned, std::set<std::string>> _final_states;
std::map<std::string, std::vector<Transition>> _transitions;
};
inline void Automaton::add_state(const std::string &state_label) {
State state(state_label);
_states.insert({state_label, state});
}
inline void Automaton::set_initial(const std::string &state_label) {
_initial_states.insert(state_label);
}
inline void Automaton::set_final(const std::string &state_label, unsigned final_set_index) {
_final_states[final_set_index].insert(state_label);
}
inline void Automaton::add_trans(
const std::string &source,
const std::set<std::string> &symbol,
const std::string &target) {
auto s = _states.find(source);
auto t = _states.find(target);
Transition trans(s->second, symbol, t->second);
_transitions[source].push_back(trans);
}
std::ostream& operator <<(std::ostream &out, const Automaton &automaton) {
bool separator;
out << "S0 = {";
separator = false;
for (const auto &state: automaton._initial_states) {
out << (separator ? ", " : " ") << state;
}
out << "}" << std::endl;
for (const auto &entry: automaton._final_states) {
out << "F" << entry.first << " = {";
separator = false;
for (const auto &state: entry.second) {
out << (separator ? ", " : " ") << state;
}
out << "}" << std::endl;
}
out << "T = {" << std::endl;
separator = false;
for (const auto &entry: automaton._transitions) {
for (const auto &transition: entry.second) {
out << (separator ? "\n" : "") << " " << transition;
separator = true;
}
}
out << std::endl << "}";
return out;
}
} // namespace model::fsm | [
"Lazarewvladimir18@gmail.com"
] | Lazarewvladimir18@gmail.com |
ed76617d5ba686f26af10922e02aa1b72211e0f3 | ef9cf7e9e1083ba41aafa1e71dc1dbd393c90515 | /Contact.cpp | 4320c38eaab17aa7dd073abcbac727913d00fd91 | [] | no_license | OvenVan/Contact | eeab3dc7f05f4d4839abc05b67f9b035087d72a6 | e8c9eeadc989c9bff1183bb7d598874609d11ea8 | refs/heads/master | 2020-03-19T20:34:17.985779 | 2018-09-22T03:25:47 | 2018-09-22T03:25:47 | 136,907,592 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,043 | cpp |
#include "stdafx.h"
#include "Contact.h"
extern vector<Person*> contact_item;
extern string errorMsg;
Contact::Contact()
{
MainFunctionsNum = 5;
refresh();
}
Contact::~Contact()
{
int freei = contact_item.size();
for (int i = 0; i<freei; ++i){
delete(contact_item.at(i));
}
}
MainStrategy* Contact::setMainStrategy(int num){
switch (num){
case 1:
return new MainNewMenu();
case 2:
return new MainDelMenu();
case 3:
return new MainMdfMenu();
case 4:
return new MainVewMenu();
case 5:
return NULL;
}
return NULL;
}
void Contact::removeMainStrategy(MainStrategy* p){
delete p;
}
void Contact::welcome() const{
int n = 0;
system("cls");
cout<<"\n\n\n----------Welcome to the Address Book System.--------\n\n";
cout<<"-----now LOADING address book...";
n = refresh();
Sleep(800);
if (n > 0){
cout<<"\t"<<n<<" contact(s) have been imported.\n";
}
else if (n == -1){
cout<<"\tFolder contact does not exist!.Please retry later!\n";
getch();
exit(0);
}
else{
cout<<"\t"<<"no contact has been imported.\n";
}
Sleep(50);
cout<<" Login...";
Sleep(300);
cout<<" Successful!";
Sleep(40);
}
int Contact::refresh() const{
string info_check;
contact_item.clear();
long hFile = 0;
struct _finddata_t fileinfo;
const char* cp = ".\\contact\\*";
const char* dir = ".\\contact";
int freei = contact_item.size();
for (int i = 0; i<freei; ++i){
delete(contact_item.at(i));
}
if ((hFile = _findfirst(cp, &fileinfo)) != -1){
do{
if (!(fileinfo.attrib & _A_SUBDIR)){
string path = ".\\contact\\";
path += fileinfo.name;
Person *temp_p = new Person;
FILE* fp = fopen(path.c_str(), "rb");
fread(temp_p, sizeof(*temp_p), 1, fp);
fclose(fp);
info_check = temp_p->name;
info_check += ".ctt";
if (info_check == fileinfo.name)
contact_item.push_back(temp_p);
}
} while (_findnext(hFile, &fileinfo) == 0);
_findclose(hFile);
}
else{
if (!CreateDirectory(dir, NULL)) return -1;
}
return contact_item.size();
}
| [
"yew_oven@outlook.com"
] | yew_oven@outlook.com |
ce70f84beabc11df6742523cca07e8e446559885 | bffdf3f0cfa0e6c0cac32f032cdfb159560e01af | /TransformToNav/main.cpp | 2888e9415bdf022d49e908f1e2e676d45f8a5a7e | [] | no_license | BrokenRain/TransformToNav | c356cd88b271598a32246dd518cbb90b4f69be7d | fd6bd51abfcac6bdb7d3655f122b688ad16451c9 | refs/heads/master | 2021-06-18T05:30:02.630039 | 2017-06-24T01:23:22 | 2017-06-24T01:23:22 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 167 | cpp | #include "Nav.h"
#include <QtWidgets/QApplication>
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Nav w;
w.show();
return a.exec();
}
| [
"497381250@qq.com"
] | 497381250@qq.com |
15d386c39fb1ac0ec098c907d19d598b497462c4 | 7a4173164c3f2a29f89e8daa22f20a9ddf50cc2a | /src/urg_node-indigo-devel/include/urg_node/urg_node_driver.h | 4ba7c2be17ef36c3254ea7adaa0f37895881b584 | [] | no_license | temburuyk/y_ws | 10325d370de5a1da6bea88d71950261dfd8cadc3 | 2b2ec0e81bc31f5ed20c73bcd2faebef8a99b1d1 | refs/heads/master | 2021-01-20T08:30:27.648840 | 2017-05-10T19:20:06 | 2017-05-10T19:20:06 | 90,156,435 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,443 | h | /*
* Copyright (c) 2013, Willow Garage, Inc.
* Copyright (c) 2017, Clearpath Robotics, 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 the Willow Garage, 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.
*/
/*
* Author: Mike O'Driscoll
*/
#ifndef URG_NODE_URG_NODE_DRIVER_H
#define URG_NODE_URG_NODE_DRIVER_H
#include <string>
#include <ros/ros.h>
#include <dynamic_reconfigure/server.h>
#include <laser_proc/LaserTransport.h>
#include <diagnostic_updater/diagnostic_updater.h>
#include <diagnostic_updater/publisher.h>
#include <urg_node/URGConfig.h>
#include <std_srvs/Trigger.h>
#include "urg_node/urg_c_wrapper.h"
namespace urg_node
{
class UrgNode
{
public:
UrgNode();
UrgNode(ros::NodeHandle nh, ros::NodeHandle private_nh);
~UrgNode();
/**
* @brief Start's the nodes threads to run the lidar.
*/
void run();
/**
* @brief Trigger an update of the lidar's status
* publish the latest known information about the lidar on latched topic.
* @return True on update successful, false otherwise.
*/
bool updateStatus();
private:
void initSetup();
bool connect();
bool reconfigure_callback(urg_node::URGConfig& config, int level);
void update_reconfigure_limits();
void calibrate_time_offset();
void updateDiagnostics();
void populateDiagnosticsStatus(diagnostic_updater::DiagnosticStatusWrapper &stat);
void scanThread();
bool statusCallback(std_srvs::Trigger::Request &req, std_srvs::Trigger::Response &res);
ros::NodeHandle nh_;
ros::NodeHandle pnh_;
boost::thread diagnostics_thread_;
boost::thread scan_thread_;
boost::shared_ptr<urg_node::URGCWrapper> urg_;
boost::shared_ptr<dynamic_reconfigure::Server<urg_node::URGConfig> > srv_; ///< Dynamic reconfigure server
boost::shared_ptr<diagnostic_updater::Updater> diagnostic_updater_;
boost::shared_ptr<diagnostic_updater::HeaderlessTopicDiagnostic> laser_freq_;
boost::shared_ptr<diagnostic_updater::HeaderlessTopicDiagnostic> echoes_freq_;
boost::mutex lidar_mutex_;
/* Non-const device properties. If you poll the driver for these
* while scanning is running, then the scan will probably fail.
*/
std::string device_status_;
std::string vendor_name_;
std::string product_name_;
std::string firmware_version_;
std::string firmware_date_;
std::string protocol_version_;
std::string device_id_;
uint16_t error_code_;
bool lockout_status_;
int error_count_;
double freq_min_;
bool close_diagnostics_;
bool close_scan_;
int ip_port_;
std::string ip_address_;
std::string serial_port_;
int serial_baud_;
bool calibrate_time_;
bool publish_intensity_;
bool publish_multiecho_;
int error_limit_;
double diagnostics_tolerance_;
double diagnostics_window_time_;
volatile bool service_yield_;
ros::Publisher laser_pub_;
laser_proc::LaserPublisher echoes_pub_;
ros::Publisher status_pub_;
ros::ServiceServer status_service_;
};
} // namespace urg_node
#endif // URG_NODE_URG_NODE_DRIVER_H
| [
"temburuyk@gmail.com"
] | temburuyk@gmail.com |
8c97b1542857826c29db203c0cded3164a646865 | 6525746e3478741d5658406b2a7b1df287b46288 | /openFoam/dlrReactingFoam/system/blockMeshDict | fab789bfd21bfa37cce399f9b65e07bfad2872e2 | [] | no_license | scramjetFoam/cfdCaseSetups | 05a91228988a01feeca95676590fd0c3b7a60479 | 37bf3f07aae6e274133d1c9d289c43ebdd87d741 | refs/heads/master | 2023-07-06T02:57:54.810381 | 2020-11-05T15:42:20 | 2020-11-05T15:42:20 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 9,487 | /*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 5 |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}
convertToMeters 1.0;
vertices
(
(0 0.013 -0.013)
(0 -0.013 -0.013)
(0 -0.013 0.013)
(0 0.013 0.013)
(0 0.018384776310850233 -0.01838477631085024)
(0 -0.01838477631085024 -0.018384776310850233)
(0 -0.018384776310850233 0.018384776310850236)
(0 0.018384776310850236 0.018384776310850233)
(0.765 0.013 -0.013)
(0.765 -0.013 -0.013)
(0.765 -0.013 0.013)
(0.765 0.013 0.013)
(0.765 0.018384776310850233 -0.01838477631085024)
(0.765 -0.01838477631085024 -0.018384776310850233)
(0.765 -0.018384776310850233 0.018384776310850236)
(0.765 0.018384776310850236 0.018384776310850233)
(0 0.03783021279348029 -0.0378302127934803)
(0 -0.0378302127934803 -0.03783021279348029)
(0 -0.03783021279348029 0.0378302127934803)
(0 0.0378302127934803 0.03783021279348029)
(0.765 0.03783021279348029 -0.0378302127934803)
(0.765 -0.0378302127934803 -0.03783021279348029)
(0.765 -0.03783021279348029 0.0378302127934803)
(0.765 0.0378302127934803 0.03783021279348029)
(0 0.15803836559519335 -0.1580383655951934)
(0 -0.1580383655951934 -0.15803836559519335)
(0 -0.15803836559519335 0.15803836559519338)
(0 0.15803836559519338 0.15803836559519335)
(0.765 0.15803836559519335 -0.1580383655951934)
(0.765 -0.1580383655951934 -0.15803836559519335)
(0.765 -0.15803836559519335 0.15803836559519338)
(0.765 0.15803836559519338 0.15803836559519335)
(1.0 0.018384776310850233 -0.01838477631085024)
(1.0 -0.01838477631085024 -0.018384776310850233)
(1.0 -0.018384776310850233 0.018384776310850236)
(1.0 0.018384776310850236 0.018384776310850233)
(1.0 0.03783021279348029 -0.0378302127934803)
(1.0 -0.0378302127934803 -0.03783021279348029)
(1.0 -0.03783021279348029 0.0378302127934803)
(1.0 0.0378302127934803 0.03783021279348029)
);
axialCells 8;
firstCellFrac 0.72;
secondCellFrac 0.28;
firstGrade 1.05;
secondGrade 1.4;
blocks
(
// Bluff body
hex ( 1 0 3 2 9 8 11 10)
innerSquare
(40 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 0 4 7 3 8 12 15 11)
bluffBodyCircle0
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 3 7 6 2 11 15 14 10)
bluffBodyCircle1
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 2 6 5 1 10 14 13 9)
bluffBodyCircle2
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 1 5 4 0 9 13 12 8)
bluffBodyCircle3
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
// Inflow boundary
hex ( 4 16 19 7 12 20 23 15)
inflow0
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 7 19 18 6 15 23 22 14)
inflow1
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 6 18 17 5 14 22 21 13)
inflow2
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 5 17 16 4 13 21 20 12)
inflow3
(10 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
// Combustor circumference
hex ( 16 24 27 19 20 28 31 23)
combustorCircum0
(100 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 19 27 26 18 23 31 30 22)
combustorCircum1
(100 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 18 26 25 17 22 30 29 21)
combustorCircum2
(100 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
hex ( 17 25 24 16 21 29 28 20)
combustorCircum3
(100 40 $axialCells)
simpleGrading
(
1
1
(
(0.6 $firstCellFrac $firstGrade)
(0.4 $secondCellFrac $secondGrade)
)
)
// Constriction channel
hex ( 12 20 23 15 32 36 39 35)
constrChannel0
(10 40 100)
simpleGrading (1 1 1)
hex ( 15 23 22 14 35 39 38 34)
constrChannel1
(10 40 100)
simpleGrading (1 1 1)
hex ( 14 22 21 13 34 38 37 33)
constrChannel2
(10 40 100)
simpleGrading (1 1 1)
hex ( 13 21 20 12 33 37 36 32)
constrChannel3
(10 40 100)
simpleGrading (1 1 1)
);
edges
(
arc 7 4 ( 0 0.026 0.0)
arc 4 5 ( 0 1.5920408388915591e-18 -0.026)
arc 5 6 ( 0 -0.026 -3.1840816777831182e-18)
arc 6 7 ( 0 -4.776122516674677e-18 0.026)
arc 15 12 ( 0.765 0.026 0.0)
arc 12 13 ( 0.765 1.5920408388915591e-18 -0.026)
arc 13 14 ( 0.765 -0.026 -3.1840816777831182e-18)
arc 14 15 ( 0.765 -4.776122516674677e-18 0.026)
arc 3 0 ( 0 0.014949999999999998 0.0)
arc 0 1 ( 0 0.0 -0.014949999999999998)
arc 1 2 ( 0 -0.014949999999999998 0.0)
arc 2 3 ( 0 0.0 0.014949999999999998)
arc 11 8 ( 0.765 0.014949999999999998 0.0)
arc 8 9 ( 0.765 0.0 -0.014949999999999998)
arc 9 10 ( 0.765 -0.014949999999999998 0.0)
arc 10 11 ( 0.765 0.0 0.014949999999999998)
arc 19 16 ( 0 0.0535 0.0)
arc 16 17 ( 0 3.27593018771917e-18 -0.0535)
arc 17 18 ( 0 -0.0535 -6.55186037543834e-18)
arc 18 19 ( 0 -9.82779056315751e-18 0.0535)
arc 23 20 ( 0.765 0.0535 0.0)
arc 20 21 ( 0.765 3.27593018771917e-18 -0.0535)
arc 21 22 ( 0.765 -0.0535 -6.55186037543834e-18)
arc 22 23 ( 0.765 -9.82779056315751e-18 0.0535)
arc 27 24 ( 0 0.2235 0.0)
arc 24 25 ( 0 1.3685427980471673e-17 -0.2235)
arc 25 26 ( 0 -0.2235 -2.7370855960943345e-17)
arc 26 27 ( 0 -4.1056283941415015e-17 0.2235)
arc 31 28 ( 0.765 0.2235 0.0)
arc 28 29 ( 0.765 1.3685427980471673e-17 -0.2235)
arc 29 30 ( 0.765 -0.2235 -2.7370855960943345e-17)
arc 30 31 ( 0.765 -4.1056283941415015e-17 0.2235)
arc 35 32 ( 1.0 0.026 0.0)
arc 32 33 ( 1.0 1.5920408388915591e-18 -0.026)
arc 33 34 ( 1.0 -0.026 -3.1840816777831182e-18)
arc 34 35 ( 1.0 -4.776122516674677e-18 0.026)
arc 39 36 ( 1.0 0.0535 0.0)
arc 36 37 ( 1.0 3.27593018771917e-18 -0.0535)
arc 37 38 ( 1.0 -0.0535 -6.55186037543834e-18)
arc 38 39 ( 1.0 -9.82779056315751e-18 0.0535)
);
boundary
(
combustorInlet
{
type patch;
faces
(
(7 19 16 4)
(4 16 17 5)
(5 17 18 6)
(6 18 19 7)
);
}
combustorOutlet
{
type patch;
faces
(
(35 39 36 32)
(32 36 37 33)
(33 37 38 34)
(34 38 39 35)
);
}
combustorWall
{
type wall;
faces
(
// Combustor circumference walls
(24 27 31 28)
(25 24 28 29)
(26 25 29 30)
(27 26 30 31)
);
}
combustorFrontWall
{
type wall;
faces
(
// Combustor front wall
// Inner radius
(3 0 1 2)
(3 7 4 0)
(2 6 7 3)
(1 5 6 2)
(0 4 5 1)
// Outer radius
(19 27 24 16)
(16 24 25 17)
(17 25 26 18)
(18 26 27 19)
);
}
combustorExitWall
{
type wall;
faces
(
// Combustor exit wall
(23 31 28 20)
(20 28 29 21)
(21 29 30 22)
(22 30 31 23)
);
}
constrictionChannel
{
type wall;
faces
(
// Constriction channel outer walls
(20 23 39 36)
(21 20 36 37)
(22 21 37 38)
(23 22 38 39)
// Constriction channel inner walls
(12 15 35 32)
(13 12 32 33)
(14 13 33 34)
(15 14 34 35)
// Constriction channel bluff body
(11 8 9 10)
(11 15 12 8)
(8 12 13 9)
(9 13 14 10)
(10 14 15 11)
);
}
);
mergePatchPairs
(
);
| [
"julian.toumey@uconn.edu"
] | julian.toumey@uconn.edu | |
c20660f9d77f45a4caba57a7ce3044635468d4f5 | bd1fea86d862456a2ec9f56d57f8948456d55ee6 | /000/113/860/CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_calloc_74b.cpp | 1af9db6a6cfc78a1b35a08d06a2b8ef5c08bcc9a | [] | no_license | CU-0xff/juliet-cpp | d62b8485104d8a9160f29213368324c946f38274 | d8586a217bc94cbcfeeec5d39b12d02e9c6045a2 | refs/heads/master | 2021-03-07T15:44:19.446957 | 2020-03-10T12:45:40 | 2020-03-10T12:45:40 | 246,275,244 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 1,741 | cpp | /* TEMPLATE GENERATED TESTCASE FILE
Filename: CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_calloc_74b.cpp
Label Definition File: CWE762_Mismatched_Memory_Management_Routines__delete_array.label.xml
Template File: sources-sinks-74b.tmpl.cpp
*/
/*
* @description
* CWE: 762 Mismatched Memory Management Routines
* BadSource: calloc Allocate data using calloc()
* GoodSource: Allocate data using new []
* Sinks:
* GoodSink: Deallocate data using free()
* BadSink : Deallocate data using delete []
* Flow Variant: 74 Data flow: data passed in a map from one function to another in different source files
*
* */
#include "std_testcase.h"
#include <map>
using namespace std;
namespace CWE762_Mismatched_Memory_Management_Routines__delete_array_struct_calloc_74
{
#ifndef OMITBAD
void badSink(map<int, twoIntsStruct *> dataMap)
{
/* copy data out of dataMap */
twoIntsStruct * data = dataMap[2];
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
}
#endif /* OMITBAD */
#ifndef OMITGOOD
/* goodG2B uses the GoodSource with the BadSink */
void goodG2BSink(map<int, twoIntsStruct *> dataMap)
{
twoIntsStruct * data = dataMap[2];
/* POTENTIAL FLAW: Deallocate memory using delete [] - the source memory allocation function may
* require a call to free() to deallocate the memory */
delete [] data;
}
/* goodB2G uses the BadSource with the GoodSink */
void goodB2GSink(map<int, twoIntsStruct *> dataMap)
{
twoIntsStruct * data = dataMap[2];
/* FIX: Free memory using free() */
free(data);
}
#endif /* OMITGOOD */
} /* close namespace */
| [
"frank@fischer.com.mt"
] | frank@fischer.com.mt |
1f5653f49e0c00d747ed22ccceea9c592f136a1f | ec0c10f6c207a3ad1832fabe824767f406a992e0 | /2141.cpp | eed0f7e465f3ae4eb0b74379fc46294bbe156811 | [] | no_license | luck2901/Algorithm | 5f8e88f6fa6d49e11ce880a2550d5ed8c4c57b05 | 3462c77d1aa6af3da73c4f10b6dd7bb7a8e8a9b4 | refs/heads/main | 2023-07-14T09:32:33.963583 | 2021-08-26T02:10:09 | 2021-08-26T02:10:09 | 339,104,020 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 779 | cpp | #include<iostream>
#include<vector>
#include<algorithm>
#include<cstring>
#include<queue>
using namespace std;
typedef long long ll;
vector<pair<int, int>>v;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int N, tag = 0; cin >> N;
ll sum = 0;
for (int i = 0; i < N; i++) {
int x, a; cin >> x >> a;
v.push_back({ x,a });
sum += a;
}
sort(v.begin(), v.end());
if (sum % 2 == 1) tag = 1;
sum = ceil(sum/2);
ll temp = 0;
int i = 0;
if (tag == 0)
while (temp < sum) {
temp += v[i].second;
i++;
}
else
while (temp <= sum) {
temp += v[i].second;
i++;
}
cout << v[i - 1].first << endl;
} | [
"luck2901@naver.com"
] | luck2901@naver.com |
a9a1e4c5367f0d6f4f82252d3c1c001758addbf8 | b7f3edb5b7c62174bed808079c3b21fb9ea51d52 | /components/performance_manager/performance_manager_impl.h | 25869114d8255367fd50b225a677b4f18f2f7bdd | [
"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 | 8,495 | h | // Copyright 2019 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 COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_IMPL_H_
#define COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_IMPL_H_
#include <memory>
#include <string>
#include <utility>
#include <vector>
#include "base/callback.h"
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/sequence_checker.h"
#include "base/sequenced_task_runner.h"
#include "base/task_runner_util.h"
#include "components/performance_manager/graph/graph_impl.h"
#include "components/performance_manager/public/graph/frame_node.h"
#include "components/performance_manager/public/graph/worker_node.h"
#include "components/performance_manager/public/performance_manager.h"
#include "components/performance_manager/public/render_process_host_proxy.h"
#include "components/performance_manager/public/web_contents_proxy.h"
#include "content/public/common/process_type.h"
class GURL;
namespace performance_manager {
class PageNodeImpl;
// The performance manager is a rendezvous point for binding to performance
// manager interfaces.
class PerformanceManagerImpl : public PerformanceManager {
public:
using FrameNodeCreationCallback = base::OnceCallback<void(FrameNodeImpl*)>;
~PerformanceManagerImpl() override;
// Posts a callback that will run on the PM sequence. Valid to call from any
// sequence.
//
// Note: If called from the main thread, the |graph_callback| is guaranteed to
// run if and only if "IsAvailable()" returns true.
//
// If called from any other sequence, there is no guarantee that the
// callback will run. It will depend on if the PerformanceManager was
// destroyed before the the task is scheduled.
static void CallOnGraphImpl(const base::Location& from_here,
base::OnceClosure callback);
// Same as the above, but the callback is provided a pointer to the graph.
using GraphImplCallback = base::OnceCallback<void(GraphImpl*)>;
static void CallOnGraphImpl(const base::Location& from_here,
GraphImplCallback graph_callback);
// Posts a callback that will run on the PM sequence, and be provided a
// pointer to the Graph. The return value is returned as an argument to the
// reply callback. As opposed to CallOnGraphImpl(), this is valid to call from
// the main thread only, and only if "IsAvailable" returns true.
template <typename TaskReturnType>
static void CallOnGraphAndReplyWithResult(
const base::Location& from_here,
base::OnceCallback<TaskReturnType(GraphImpl*)> task,
base::OnceCallback<void(TaskReturnType)> reply);
// Creates, initializes and registers an instance. Invokes |on_start| on the
// PM sequence. Valid to call from the main thread only.
static std::unique_ptr<PerformanceManagerImpl> Create(
GraphImplCallback on_start);
// Unregisters |instance| and arranges for its deletion on its sequence. Valid
// to call from the main thread only.
static void Destroy(std::unique_ptr<PerformanceManager> instance);
// Creates a new node of the requested type and adds it to the graph.
// May be called from any sequence. If a |creation_callback| is provided, it
// will be run on the performance manager sequence immediately after adding
// the node to the graph. This callback will not be executed if the node could
// not be added to the graph.
//
// Note: If called from the main thread, the node is guaranteed to be added to
// the graph if and only if "IsAvailable()" returns true.
//
// If called from any other sequence, there is no guarantee that the
// node will be added to the graph. It will depend on if the
// PerformanceManager was destroyed before the the task is scheduled.
static std::unique_ptr<FrameNodeImpl> CreateFrameNode(
ProcessNodeImpl* process_node,
PageNodeImpl* page_node,
FrameNodeImpl* parent_frame_node,
int frame_tree_node_id,
int render_frame_id,
const FrameToken& frame_token,
int32_t browsing_instance_id,
int32_t site_instance_id,
FrameNodeCreationCallback creation_callback =
FrameNodeCreationCallback());
static std::unique_ptr<PageNodeImpl> CreatePageNode(
const WebContentsProxy& contents_proxy,
const std::string& browser_context_id,
const GURL& visible_url,
bool is_visible,
bool is_audible,
base::TimeTicks visibility_change_time);
static std::unique_ptr<ProcessNodeImpl> CreateProcessNode(
content::ProcessType process_type,
RenderProcessHostProxy proxy);
static std::unique_ptr<WorkerNodeImpl> CreateWorkerNode(
const std::string& browser_context_id,
WorkerNode::WorkerType worker_type,
ProcessNodeImpl* process_node,
const base::UnguessableToken& dev_tools_token);
// Destroys a node returned from the creation functions above. May be called
// from any sequence.
static void DeleteNode(std::unique_ptr<NodeBase> node);
// Destroys multiples nodes in one single task. Equivalent to calling
// DeleteNode() on all elements of the vector. This function takes care of
// removing them from the graph in topological order and destroying them.
// May be called from any sequence.
static void BatchDeleteNodes(std::vector<std::unique_ptr<NodeBase>> nodes);
// Indicates whether or not the caller is currently running on the PM task
// runner.
static bool OnPMTaskRunnerForTesting();
// Allows testing code to know when tear down is complete. This can only be
// called from the main thread, and the callback will also be invoked on the
// main thread.
static void SetOnDestroyedCallbackForTesting(base::OnceClosure callback);
private:
friend class PerformanceManager;
PerformanceManagerImpl();
// Returns the performance manager TaskRunner.
static scoped_refptr<base::SequencedTaskRunner> GetTaskRunner();
// Retrieves the currently registered instance. Can only be called from the PM
// sequence.
// Note: Only exists so that RunCallbackWithGraphAndReplyWithResult can be
// implemented in the header file.
static PerformanceManagerImpl* GetInstance();
template <typename NodeType, typename... Args>
static std::unique_ptr<NodeType> CreateNodeImpl(
base::OnceCallback<void(NodeType*)> creation_callback,
Args&&... constructor_args);
// Helper functions that removes a node/vector of nodes from the graph on the
// PM sequence and deletes them.
//
// Note that this function has similar semantics to
// SequencedTaskRunner::DeleteSoon(). The node/vector of nodes is passed via a
// regular pointer so that they are not deleted if the task is not executed.
static void DeleteNodeImpl(NodeBase* node_ptr, GraphImpl* graph);
static void BatchDeleteNodesImpl(
std::vector<std::unique_ptr<NodeBase>>* nodes_ptr,
GraphImpl* graph);
void OnStartImpl(GraphImplCallback graph_callback);
static void RunCallbackWithGraphImpl(GraphImplCallback graph_callback);
static void RunCallbackWithGraph(GraphCallback graph_callback);
template <typename TaskReturnType>
static TaskReturnType RunCallbackWithGraphAndReplyWithResult(
base::OnceCallback<TaskReturnType(GraphImpl*)> task);
static void SetOnDestroyedCallbackImpl(base::OnceClosure callback);
GraphImpl graph_;
base::OnceClosure on_destroyed_callback_;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(PerformanceManagerImpl);
};
// static
template <typename TaskReturnType>
void PerformanceManagerImpl::CallOnGraphAndReplyWithResult(
const base::Location& from_here,
base::OnceCallback<TaskReturnType(GraphImpl*)> task,
base::OnceCallback<void(TaskReturnType)> reply) {
base::PostTaskAndReplyWithResult(
GetTaskRunner().get(), from_here,
base::BindOnce(
&PerformanceManagerImpl::RunCallbackWithGraphAndReplyWithResult<
TaskReturnType>,
std::move(task)),
std::move(reply));
}
// static
template <typename TaskReturnType>
TaskReturnType PerformanceManagerImpl::RunCallbackWithGraphAndReplyWithResult(
base::OnceCallback<TaskReturnType(GraphImpl*)> task) {
return std::move(task).Run(&GetInstance()->graph_);
}
} // namespace performance_manager
#endif // COMPONENTS_PERFORMANCE_MANAGER_PERFORMANCE_MANAGER_IMPL_H_
| [
"commit-bot@chromium.org"
] | commit-bot@chromium.org |
91fbdc8215b4cd3d9ca24721ef197258da6ecaae | 06b1016cea82c738d19a76ed22b6170a2fcc6d22 | /ChessEngine/Constants.cpp | 915139aa39a30bcd1be6dcb2cd10e267f0af27c9 | [] | no_license | mpweinge/Chess-AI | 335df616137a37ae3c0162864d6ac1098d9bbb69 | c04cedf5cf1ca57a161b4c1c17e14fd9ef37f074 | refs/heads/master | 2021-01-19T11:02:45.477045 | 2012-05-29T22:16:34 | 2012-05-29T22:16:34 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 572 | cpp | /*
* Constants.cpp
* ChessEngine
*
* Created by Michael Weingert on 12-03-28.
* Copyright 2012 __MyCompanyName__. All rights reserved.
*
*/
#include "Constants.h"
#include "ChessBoard.h"
#include "ChessLog.h"
#include <execinfo.h>
void ChessAssert()
{
void* callstack[128];
int i, frames = backtrace(callstack, 128);
char** strs = backtrace_symbols(callstack, frames);
for (i = 0; i < frames; ++i) {
printf("%s\n", strs[i]);
}
free(strs);
ChessBoard::GetInstance()->PrintBoard();
ChessLog::GetInstance()->printLog();
fflush(stdout);
assert(0);
} | [
"mpweinge@uwaterloo.ca"
] | mpweinge@uwaterloo.ca |
d5367545c15ec6d67738a4ac4edcb8c7e3611f2a | 3fb019aa6d769775122d18402564137ddfada664 | /RayTracingRenderer-master/src/normalvector.h | 10e0c57ece588e46d80c4ee6d2a71f53e9d6be8d | [] | no_license | anastasialavrova/bmstu_CG_course_work | 8ce3f7ecdcefd485272578e35b62e69a780852fc | 8e64b96ea72ea5e85e56114274ef696cc9719e17 | refs/heads/master | 2020-11-27T04:33:06.184151 | 2019-12-20T15:38:43 | 2019-12-20T15:38:43 | 229,304,999 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,359 | h | #ifndef NORMALVECTOR_H
#define NORMALVECTOR_H
#include "transformationmatrix.h"
class NormalVector
{
public:
// Конструктор по умолчанию
NormalVector();
// XYZ Конструктор
NormalVector(double newX, double newY, double newZ);
// Конструктор копирования
NormalVector(const NormalVector& rhs);
// Интерполяционный конструктор: создает интерполированный нормальный вектор на основе текущего между началом и концом
NormalVector(const NormalVector& lhs, double lhsZ, const NormalVector& rhs, double rhsZ, double current, double start, double end);
// Перегрузка оператора присваивания
NormalVector& operator=(const NormalVector& rhs);
// Нормализация вектора
void normalize();
// Получить длину этого нормализованного вектора
double length();
// Получить векторное произведение двух векторов
NormalVector crossProduct(const NormalVector& rhs);
// Получите скалярное произведение двух векторов
double dotProduct(const NormalVector& rhs);
// Перегрузка оператора умножения
NormalVector& operator*=(const double rhs);
// Перегрузка оператора умножения
NormalVector operator*(double scalar);
// Перегрузка оператора вычитания
NormalVector operator-(const NormalVector& rhs);
// Перегрузка оператора вычитания
NormalVector& operator-=(const NormalVector& rhs);
// Детерминировать, если нормальный вектор (0,0,0)
bool isZero();
// Преобразовать нормальный вектор с помощью матрицы преобразования
void transform(TransformationMatrix* theMatrix);
// Изменить направление вектора
void reverse();
// Атрибуты нормального вектора:
double xn = 0;
double yn = 0;
double zn = 0;
void debug();
};
#endif // NORMALVECTOR_H
| [
"44167571+anastasialavrova@users.noreply.github.com"
] | 44167571+anastasialavrova@users.noreply.github.com |
31fe2ca28b2af769ddbcd8a2ab2f575c12efcc25 | cffc460605febc80e8bb7c417266bde1bd1988eb | /before2020/NTHU/NTHU 9050(Math, Matrix).cpp | 3322fcd07793a4d6d7482df2500ab7c48cfee154 | [] | no_license | m80126colin/Judge | f79b2077f2bf67a3b176d073fcdf68a8583d5a2c | 56258ea977733e992b11f9e0cb74d630799ba274 | refs/heads/master | 2021-06-11T04:25:27.786735 | 2020-05-21T08:55:03 | 2020-05-21T08:55:03 | 19,424,030 | 7 | 4 | null | null | null | null | UTF-8 | C++ | false | false | 788 | cpp | /**
* @judge NTHU
* @id 9050
* @tag Math, Matrix
*/
#include <stdio.h>
#include <string.h>
#include <iostream>
#define M 110
using namespace std;
int main()
{
int i, j, k;
int t, m, n, p;
int a[M][M], b[M][M], c[M][M];
for (scanf("%d", &t); t; t--)
{
scanf("%d%d%d", &m, &n, &p);
for (i = 0; i < m; i++)
for (k = 0; k < n; k++)
scanf("%d", &a[i][k]);
for (k = 0; k < n; k++)
for (j = 0; j < p; j++)
scanf("%d", &b[k][j]);
for (i = 0; i < m; i++)
for (j = 0; j < p; j++)
{
c[i][j] = 0;
for (k = 0; k < n; k++)
c[i][j] += a[i][k] * b[k][j];
}
for (i = 0; i < m; i++)
{
for (j = 0; j < p; j++)
{
if (j) putchar(' ');
printf("%d", c[i][j]);
}
puts("");
}
puts("");
}
} | [
"m80126colin@gmail.com"
] | m80126colin@gmail.com |
16b10709bfd7d8110151143157882864fea81e32 | 0ac15597fb5fa2363c4ffd1e41b15f1f45c69abc | /SplashScreenRoomNet/SplashScreenRoomNet/HttpResponse.h | 73740b7da5cc8e61028ba49f39b57b0568cdae4e | [] | no_license | tomconnolly94/splash-screen-room_net | f1896e7f88201a51ad93c8fae93206bca6bec60d | 761eea64962c3ad659aa6c0fe9da81b7ccc4b2e5 | refs/heads/master | 2022-11-20T13:42:25.586636 | 2020-07-09T19:44:19 | 2020-07-09T19:44:19 | 283,328,074 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 741 | h | #pragma once
//external includes
#include <string>
#include <vector>
//internal includes
#include "Properties.h"
class HttpResponse
{
public:
HttpResponse();
HttpResponse(int responseCode, std::string responseContent, std::string _contentType);
void SetStatusCode(int statusCode);
int GetStatusCode();
void SetContent(std::string content);
std::string GetContent();
void SetContentType(Properties::CONTENT_TYPE contentType);
std::string GetContentType();
bool ResponseSuccessful();
void SetError(int responseCode = 500, std::string errorMessage = "Undefined Error");
protected:
int _statusCode;
std::string _content;
std::string _contentType;
static std::vector<int> _successCodeList;
}; | [
"tom.connolly@protonmail.com"
] | tom.connolly@protonmail.com |
167639fb650341c8a4ddc225970013b363d99a50 | b46eef7254d8919bd796149b3fc28041e778c679 | /src/util.h | 1ef6bc21755b0efcc78f12b1166bd421415f17e0 | [
"MIT"
] | permissive | KingricharVD/XDNA | 9f7eb1b2dfb8749fa309cb044da4f509c033899f | b96dc7a18f330083057744b869ddb46bf8b180e0 | refs/heads/master | 2020-09-16T17:16:44.675957 | 2019-11-20T14:39:35 | 2019-11-20T14:39:35 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,782 | h | // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin developers
// Copyright (c) 2014-2015 The Dash developers
// Copyright (c) 2015-2017 The PIVX developers
// Copyright (c) 2017-2019 The XDNA Core developers
// Distributed under the MIT software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
/**
* Server/client environment: argument handling, config file parsing,
* logging, thread wrappers
*/
#ifndef BITCOIN_UTIL_H
#define BITCOIN_UTIL_H
#if defined(HAVE_CONFIG_H)
#include "config/xdna-config.h"
#endif
#include "compat.h"
#include "tinyformat.h"
#include "utiltime.h"
#include <exception>
#include <map>
#include <stdint.h>
#include <string>
#include <vector>
#include <boost/filesystem/path.hpp>
#include <boost/thread/exceptions.hpp>
//XDNA only features
extern bool fMasterNode;
extern bool fLiteMode;
extern bool fEnableSwiftTX;
extern int nSwiftTXDepth;
extern int nObfuscationRounds;
extern int nAnonymizeXDnaAmount;
extern int nLiquidityProvider;
extern bool fEnableObfuscation;
extern int64_t enforceMasternodePaymentsTime;
extern std::string strMasterNodeAddr;
extern int keysLoaded;
extern bool fSucessfullyLoaded;
extern std::vector<int64_t> obfuScationDenominations;
extern std::map<std::string, std::string> mapArgs;
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
extern bool fDebug;
extern bool fPrintToConsole;
extern bool fPrintToDebugLog;
extern bool fServer;
extern std::string strMiscWarning;
extern bool fLogTimestamps;
extern bool fLogIPs;
extern volatile bool fReopenDebugLog;
void SetupEnvironment();
/** Return true if log accepts specified category */
bool LogAcceptCategory(const char* category);
/** Send a string to the log output */
int LogPrintStr(const std::string& str);
#define LogPrintf(...) LogPrint(NULL, __VA_ARGS__)
/**
* When we switch to C++11, this can be switched to variadic templates instead
* of this macro-based construction (see tinyformat.h).
*/
#define MAKE_ERROR_AND_LOG_FUNC(n) \
/** Print to debug.log if -debug=category switch is given OR category is NULL. */ \
template <TINYFORMAT_ARGTYPES(n)> \
static inline int LogPrint(const char* category, const char* format, TINYFORMAT_VARARGS(n)) \
{ \
if (!LogAcceptCategory(category)) return 0; \
return LogPrintStr(tfm::format(format, TINYFORMAT_PASSARGS(n))); \
} \
/** Log error and return false */ \
template <TINYFORMAT_ARGTYPES(n)> \
static inline bool error(const char* format, TINYFORMAT_VARARGS(n)) \
{ \
LogPrintStr(std::string("ERROR: ") + tfm::format(format, TINYFORMAT_PASSARGS(n)) + "\n"); \
return false; \
}
TINYFORMAT_FOREACH_ARGNUM(MAKE_ERROR_AND_LOG_FUNC)
/**
* Zero-arg versions of logging and error, these are not covered by
* TINYFORMAT_FOREACH_ARGNUM
*/
static inline int LogPrint(const char* category, const char* format)
{
if (!LogAcceptCategory(category)) return 0;
return LogPrintStr(format);
}
static inline bool error(const char* format)
{
LogPrintStr(std::string("ERROR: ") + format + "\n");
return false;
}
void PrintExceptionContinue(std::exception* pex, const char* pszThread);
void ParseParameters(int argc, const char* const argv[]);
void FileCommit(FILE* fileout);
bool TruncateFile(FILE* file, unsigned int length);
int RaiseFileDescriptorLimit(int nMinFD);
void AllocateFileRange(FILE* file, unsigned int offset, unsigned int length);
bool RenameOver(boost::filesystem::path src, boost::filesystem::path dest);
bool TryCreateDirectory(const boost::filesystem::path& p);
boost::filesystem::path GetDefaultDataDir();
const boost::filesystem::path& GetDataDir(bool fNetSpecific = true);
boost::filesystem::path GetConfigFile();
boost::filesystem::path GetMasternodeConfigFile();
#ifndef WIN32
boost::filesystem::path GetPidFile();
void CreatePidFile(const boost::filesystem::path& path, pid_t pid);
#endif
void ReadConfigFile(std::map<std::string, std::string>& mapSettingsRet, std::map<std::string, std::vector<std::string> >& mapMultiSettingsRet);
#ifdef WIN32
boost::filesystem::path GetSpecialFolderPath(int nFolder, bool fCreate = true);
#endif
boost::filesystem::path GetTempPath();
void ShrinkDebugFile();
void runCommand(std::string strCommand);
inline bool IsSwitchChar(char c)
{
#ifdef WIN32
return c == '-' || c == '/';
#else
return c == '-';
#endif
}
/**
* Return string argument or default value
*
* @param strArg Argument to get (e.g. "-foo")
* @param default (e.g. "1")
* @return command-line argument or default value
*/
std::string GetArg(const std::string& strArg, const std::string& strDefault);
/**
* Return integer argument or default value
*
* @param strArg Argument to get (e.g. "-foo")
* @param default (e.g. 1)
* @return command-line argument (0 if invalid number) or default value
*/
int64_t GetArg(const std::string& strArg, int64_t nDefault);
/**
* Return boolean argument or default value
*
* @param strArg Argument to get (e.g. "-foo")
* @param default (true or false)
* @return command-line argument or default value
*/
bool GetBoolArg(const std::string& strArg, bool fDefault);
/**
* Set an argument if it doesn't already have a value
*
* @param strArg Argument to set (e.g. "-foo")
* @param strValue Value (e.g. "1")
* @return true if argument gets set, false if it already had a value
*/
bool SoftSetArg(const std::string& strArg, const std::string& strValue);
/**
* Set a boolean argument if it doesn't already have a value
*
* @param strArg Argument to set (e.g. "-foo")
* @param fValue Value (e.g. false)
* @return true if argument gets set, false if it already had a value
*/
bool SoftSetBoolArg(const std::string& strArg, bool fValue);
/**
* Format a string to be used as group of options in help messages
*
* @param message Group name (e.g. "RPC server options:")
* @return the formatted string
*/
std::string HelpMessageGroup(const std::string& message);
/**
* Format a string to be used as option description in help messages
*
* @param option Option message (e.g. "-rpcuser=<user>")
* @param message Option description (e.g. "Username for JSON-RPC connections")
* @return the formatted string
*/
std::string HelpMessageOpt(const std::string& option, const std::string& message);
void SetThreadPriority(int nPriority);
void RenameThread(const char* name);
/**
* Standard wrapper for do-something-forever thread functions.
* "Forever" really means until the thread is interrupted.
* Use it like:
* new boost::thread(boost::bind(&LoopForever<void (*)()>, "dumpaddr", &DumpAddresses, 900000));
* or maybe:
* boost::function<void()> f = boost::bind(&FunctionWithArg, argument);
* threadGroup.create_thread(boost::bind(&LoopForever<boost::function<void()> >, "nothing", f, milliseconds));
*/
template <typename Callable>
void LoopForever(const char* name, Callable func, int64_t msecs)
{
std::string s = strprintf("xdna-%s", name);
RenameThread(s.c_str());
LogPrintf("%s thread start\n", name);
try {
while (1) {
MilliSleep(msecs);
func();
}
} catch (boost::thread_interrupted) {
LogPrintf("%s thread stop\n", name);
throw;
} catch (std::exception& e) {
PrintExceptionContinue(&e, name);
throw;
} catch (...) {
PrintExceptionContinue(NULL, name);
throw;
}
}
/**
* .. and a wrapper that just calls func once
*/
template <typename Callable>
void TraceThread(const char* name, Callable func)
{
std::string s = strprintf("xdna-%s", name);
RenameThread(s.c_str());
try {
LogPrintf("%s thread start\n", name);
func();
LogPrintf("%s thread exit\n", name);
} catch (boost::thread_interrupted) {
LogPrintf("%s thread interrupt\n", name);
throw;
} catch (std::exception& e) {
PrintExceptionContinue(&e, name);
throw;
} catch (...) {
PrintExceptionContinue(NULL, name);
throw;
}
}
#endif // BITCOIN_UTIL_H
| [
"hllmr1@gmail.com"
] | hllmr1@gmail.com |
0a7bc70d5edd2a2a44270f476759b3a36f9df810 | 9e6089ae0d70d8edf586bbd21b9064034f059f80 | /src/qt/splashscreen.cpp | bc89e2bd6e46a52db84b3c608de70b8dacf99ba6 | [
"MIT"
] | permissive | kinchcomputers/Thinkcoin- | fed8d8883da0553915dbd070d9b5c7979f919083 | 98a11a6ad403f2add5cab5d8b1402dddc2ba56f7 | refs/heads/master | 2021-01-16T18:44:19.810896 | 2015-08-21T20:51:22 | 2015-08-21T20:51:22 | 41,176,832 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,048 | cpp | // Copyright (c) 2011-2013 The Bitcoin developers
// Distributed under the MIT/X11 software license, see the accompanying
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
#include "splashscreen.h"
#include "clientversion.h"
#include "util.h"
#include <QPainter>
#undef loop /* ugh, remove this when the #define loop is gone from util.h */
#include <QApplication>
SplashScreen::SplashScreen(const QPixmap &pixmap, Qt::WindowFlags f) :
QSplashScreen(pixmap, f)
{
// set reference point, paddings
int paddingLeftCol2 = 230;
int paddingTopCol2 = 376;
int line1 = 0;
int line2 = 13;
int line3 = 26;
float fontFactor = 1.0;
// define text to place
QString titleText = QString(QApplication::applicationName()).replace(QString("-testnet"), QString(""), Qt::CaseSensitive); // cut of testnet, place it as single object further down
QString versionText = QString("Version %1 ").arg(QString::fromStdString(FormatFullVersion()));
QString copyrightText1 = QChar(0xA9)+QString(" 2009-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Bitcoin developers"));
QString copyrightText2 = QChar(0xA9)+QString(" 2011-%1 ").arg(COPYRIGHT_YEAR) + QString(tr("The Thinkcoin developers"));
QString font = "Arial";
// load the bitmap for writing some text over it
QPixmap newPixmap;
if(GetBoolArg("-testnet")) {
newPixmap = QPixmap(":/images/splash_testnet");
}
else {
newPixmap = QPixmap(":/images/splash");
}
QPainter pixPaint(&newPixmap);
pixPaint.setPen(QColor(70,70,70));
pixPaint.setFont(QFont(font, 9*fontFactor));
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line3,versionText);
// draw copyright stuff
pixPaint.setFont(QFont(font, 9*fontFactor));
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line1,copyrightText1);
pixPaint.drawText(paddingLeftCol2,paddingTopCol2+line2,copyrightText2);
pixPaint.end();
this->setPixmap(newPixmap);
}
| [
"computer.mad@hotmail.co.uk"
] | computer.mad@hotmail.co.uk |
56df8217f9d62df1ccbf84d4ba5b4eada927c71b | ecec137010f2cb4631f96b8c183983a62c9b2ca0 | /C++/college_code/expr/.history/exprei_5_20200517212958.cpp | cc282ed64831ed3d347e620a2bfd7ba4a74a8a32 | [] | no_license | lijiayan2020/Code | d6296658bdec1adb6353faa3ca1ae583542ce926 | ba9f015c51a60fc8aeb1f5efbd33e96126c34265 | refs/heads/master | 2023-04-12T19:23:21.860951 | 2021-04-21T16:21:11 | 2021-04-21T16:21:11 | 330,329,460 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,979 | cpp | //1函数实验
// 1. 定义一个函数,判断三个整型边长能否构成三角形,如果是三角形,则判断它是否是直角三角形。
// #include<iostream>
// //#include<algorithm>
// //#include<stdlib.h>
// //#include<cmath>
// using namespace std;
// void judge(int a,int b,int c);
// int max(int a,int b,int c);
// int main()
// {
// int a,b,c;
// cout << "Please enter three integer:\n";
// cout << "first:";cin >> a;
// cout << "second:";cin >> b;
// cout << "third:";cin >> c;
// judge(a,b,c);
// return 0;
// }
// void judge(int a,int b,int c)
// {
// int temp,sum,m;
// sum = a+b+c;
// m=max(a,b,c);
// if(a!=m)
// {
// if(a+sum-m-a<=m) cout << "It's a not triangle!\n";
// else
// {
// cout << "It's a triangle!\n";
// int n;
// n =sum-m-a;
// if(a*a+n*n==m*m) cout << "And it's a right triangle!\n";
// else cout << "But it's not a right triangle!\n";
// }
// }
// }
// int max(int a,int b,int c)
// {
// int temp;
// if(a<b)
// {
// temp=a;
// a=b;
// b=temp;
// }
// if(a<c)
// {
// temp=a;
// a=c;
// c=temp;
// }
// return a;
// }
//2. 定义一个函数,判断三个二维坐标上的点是否在同一条直线上。
#include<iostream>
using namespace std;
void judge(char a[2],char b[2],char c[2]);
int main()
{
char a[2],b[2],c[2];
int i;
cout << "Please enter three pairs of coordinates:\n";
cout << "First:\n";
cout << "x:";cin >> a[0];
cout << "y:"; cin >> a[1];
cout << "Second:\n";
cout << "x:";cin >> b[0];
cout << "y:"; cin >> b[1];
cout << "Third:\n";
cout << "x:";cin >> c[0];
cout << "y:"; cin >> c[1];
judge(a,b,c); //开始写的 a[2] !!!!
return 0;
}
void judge(char a[2],char b[2],char c[2])
{
int n1,n2,n3;
n1=b[1]-a[1];
n2=a[0]-b[0];
n3=-n1*a[0]+n2*b[2];
if(n1*c[0]+n2*c[1]+n3==0) cout << "Three points are in a straight line!\n";
else cout << "Three points are not in a straight line!\n";
}
| [
"1131106863@qq.com"
] | 1131106863@qq.com |
89dcd31e564d16d94e0df146a09731cacc44acfc | cc615e472a0bbe02a3f32f62ed62ceb6018f821d | /IPDSsniffer/winstyle/winstyle/ChildFrm.cpp | 5edc6991bfe50825120d75bdaa164c71fd5f3dd4 | [] | no_license | mianalishan/IPDSSniffer- | c1c557c663e87f2e0a450b361a71079c5e22fdc8 | 122cdba25b815b0a32cbe7b3f0a50ba5a7990d7c | refs/heads/main | 2023-06-25T11:06:18.517393 | 2021-07-23T10:08:21 | 2021-07-23T10:08:21 | 388,757,939 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,242 | cpp |
// ChildFrm.cpp : implementation of the CChildFrame class
//
#include "stdafx.h"
#include "winstyle.h"
#include "ChildFrm.h"
#include "LeftView.h"
#include "winstyleView.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CChildFrame
IMPLEMENT_DYNCREATE(CChildFrame, CMDIChildWndEx)
BEGIN_MESSAGE_MAP(CChildFrame, CMDIChildWndEx)
ON_UPDATE_COMMAND_UI_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, &CChildFrame::OnUpdateViewStyles)
ON_COMMAND_RANGE(AFX_ID_VIEW_MINIMUM, AFX_ID_VIEW_MAXIMUM, &CChildFrame::OnViewStyle)
ON_COMMAND(ID_FILE_OPEN, &CChildFrame::OnFileOpen)
END_MESSAGE_MAP()
// CChildFrame construction/destruction
CChildFrame::CChildFrame()
{
// TODO: add member initialization code here
}
CChildFrame::~CChildFrame()
{
}
BOOL CChildFrame::OnCreateClient(LPCREATESTRUCT /*lpcs*/, CCreateContext* pContext)
{
// create splitter window
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE;
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CLeftView), CSize(100, 100), pContext) ||
!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CwinstyleView), CSize(100, 100), pContext))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
}
BOOL CChildFrame::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying the CREATESTRUCT cs
if( !CMDIChildWndEx::PreCreateWindow(cs) )
return FALSE;
return TRUE;
}
// CChildFrame diagnostics
#ifdef _DEBUG
void CChildFrame::AssertValid() const
{
CMDIChildWndEx::AssertValid();
}
void CChildFrame::Dump(CDumpContext& dc) const
{
CMDIChildWndEx::Dump(dc);
}
#endif //_DEBUG
// CChildFrame message handlers
CwinstyleView* CChildFrame::GetRightPane()
{
CWnd* pWnd = m_wndSplitter.GetPane(0, 1);
CwinstyleView* pView = DYNAMIC_DOWNCAST(CwinstyleView, pWnd);
return pView;
}
void CChildFrame::OnUpdateViewStyles(CCmdUI* pCmdUI)
{
if (!pCmdUI)
return;
// TODO: customize or extend this code to handle choices on the View menu.
CwinstyleView* pView = GetRightPane();
// if the right-hand pane hasn't been created or isn't a view, disable commands in our range
if (pView == NULL)
pCmdUI->Enable(FALSE);
else
{
DWORD dwStyle = pView->GetStyle() & LVS_TYPEMASK;
// if the command is ID_VIEW_LINEUP, only enable command
// when we're in LVS_ICON or LVS_SMALLICON mode
if (pCmdUI->m_nID == ID_VIEW_LINEUP)
{
if (dwStyle == LVS_ICON || dwStyle == LVS_SMALLICON)
pCmdUI->Enable();
else
pCmdUI->Enable(FALSE);
}
else
{
// otherwise, use dots to reflect the style of the view
pCmdUI->Enable();
BOOL bChecked = FALSE;
switch (pCmdUI->m_nID)
{
case ID_VIEW_DETAILS:
bChecked = (dwStyle == LVS_REPORT);
break;
case ID_VIEW_SMALLICON:
bChecked = (dwStyle == LVS_SMALLICON);
break;
case ID_VIEW_LARGEICON:
bChecked = (dwStyle == LVS_ICON);
break;
case ID_VIEW_LIST:
bChecked = (dwStyle == LVS_LIST);
break;
default:
bChecked = FALSE;
break;
}
pCmdUI->SetRadio(bChecked ? 1 : 0);
}
}
}
void CChildFrame::OnViewStyle(UINT nCommandID)
{
// TODO: customize or extend this code to handle choices on the View menu.
CwinstyleView* pView = GetRightPane();
// if the right-hand pane has been created and is a CwinstyleView, process the menu commands...
if (pView != NULL)
{
int nStyle = -1;
switch (nCommandID)
{
case ID_VIEW_LINEUP:
{
// ask the list control to snap to grid
CListCtrl& refListCtrl = pView->GetListCtrl();
refListCtrl.Arrange(LVA_SNAPTOGRID);
}
break;
// other commands change the style on the list control
case ID_VIEW_DETAILS:
nStyle = LVS_REPORT;
break;
case ID_VIEW_SMALLICON:
nStyle = LVS_SMALLICON;
break;
case ID_VIEW_LARGEICON:
nStyle = LVS_ICON;
break;
case ID_VIEW_LIST:
nStyle = LVS_LIST;
break;
}
// change the style; window will repaint automatically
if (nStyle != -1)
pView->ModifyStyle(LVS_TYPEMASK, nStyle);
}
}
void CChildFrame::OnFileOpen()
{
// TODO: Add your command handler code here
}
| [
"noreply@github.com"
] | mianalishan.noreply@github.com |
96d94abb2cd03b29b1db7376d4c3d109ce83cd8b | 536656cd89e4fa3a92b5dcab28657d60d1d244bd | /chrome/browser/ui/views/crostini/crostini_package_install_failure_view.cc | 779283a558a0011cb24c2efa5c7c1f4e3531f74d | [
"BSD-3-Clause"
] | permissive | ECS-251-W2020/chromium | 79caebf50443f297557d9510620bf8d44a68399a | ac814e85cb870a6b569e184c7a60a70ff3cb19f9 | refs/heads/master | 2022-08-19T17:42:46.887573 | 2020-03-18T06:08:44 | 2020-03-18T06:08:44 | 248,141,336 | 7 | 8 | BSD-3-Clause | 2022-07-06T20:32:48 | 2020-03-18T04:52:18 | null | UTF-8 | C++ | false | false | 3,089 | cc | // Copyright 2019 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 "chrome/browser/ui/views/crostini/crostini_package_install_failure_view.h"
#include "base/strings/utf_string_conversions.h"
#include "chrome/browser/chromeos/crostini/crostini_util.h"
#include "chrome/browser/ui/browser_dialogs.h"
#include "chrome/browser/ui/views/chrome_layout_provider.h"
#include "chrome/grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/gfx/text_constants.h"
#include "ui/views/controls/label.h"
#include "ui/views/controls/message_box_view.h"
#include "ui/views/controls/styled_label.h"
#include "ui/views/layout/box_layout.h"
namespace crostini {
// Implementation from crostini_util.h, necessary due to chrome's inclusion
// rules.
void ShowCrostiniPackageInstallFailureView(const std::string& error_message) {
CrostiniPackageInstallFailureView::Show(error_message);
}
} // namespace crostini
void CrostiniPackageInstallFailureView::Show(const std::string& error_message) {
views::DialogDelegate::CreateDialogWidget(
new CrostiniPackageInstallFailureView(error_message), nullptr, nullptr)
->Show();
}
bool CrostiniPackageInstallFailureView::ShouldShowCloseButton() const {
return false;
}
base::string16 CrostiniPackageInstallFailureView::GetWindowTitle() const {
return l10n_util::GetStringUTF16(
IDS_CROSTINI_PACKAGE_INSTALL_FAILURE_VIEW_TITLE);
}
gfx::Size CrostiniPackageInstallFailureView::CalculatePreferredSize() const {
const int dialog_width = ChromeLayoutProvider::Get()->GetDistanceMetric(
DISTANCE_MODAL_DIALOG_PREFERRED_WIDTH) -
margins().width();
return gfx::Size(dialog_width, GetHeightForWidth(dialog_width));
}
CrostiniPackageInstallFailureView::CrostiniPackageInstallFailureView(
const std::string& error_message) {
DialogDelegate::set_buttons(ui::DIALOG_BUTTON_OK);
views::LayoutProvider* provider = views::LayoutProvider::Get();
SetLayoutManager(std::make_unique<views::BoxLayout>(
views::BoxLayout::Orientation::kVertical,
provider->GetInsetsMetric(views::InsetsMetric::INSETS_DIALOG),
provider->GetDistanceMetric(views::DISTANCE_RELATED_CONTROL_VERTICAL)));
set_margins(provider->GetDialogInsetsForContentType(
views::DialogContentType::TEXT, views::DialogContentType::TEXT));
views::StyledLabel* message_label = new views::StyledLabel(
l10n_util::GetStringUTF16(
IDS_CROSTINI_PACKAGE_INSTALL_FAILURE_VIEW_MESSAGE),
nullptr);
AddChildView(message_label);
views::MessageBoxView::InitParams error_box_init_params(
base::UTF8ToUTF16(error_message));
views::MessageBoxView* error_box =
new views::MessageBoxView(error_box_init_params);
AddChildView(error_box);
set_close_on_deactivate(true);
chrome::RecordDialogCreation(chrome::DialogIdentifier::CROSTINI_FORCE_CLOSE);
}
CrostiniPackageInstallFailureView::~CrostiniPackageInstallFailureView() =
default;
| [
"pcding@ucdavis.edu"
] | pcding@ucdavis.edu |
51ebf94486b2ec5d0ceb9687c906b2351bb79bac | bd544c9e74d911bc75f60809691c4ea43f31cb67 | /CPUCharge.cpp | e8459a30fe97458d6f10e95e8fca08d14f0e035e | [] | no_license | AhmedFakhreddine/Programs | 47565f6ab375a751fb40855a504995b23402f0be | b0c90dc40a4001e020f9e5cebdb4172073adef67 | refs/heads/master | 2020-07-04T07:53:20.230838 | 2019-08-13T19:42:21 | 2019-08-13T19:42:21 | 202,212,088 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,126 | cpp | #include <iostream>
#include <vector>
using namespace std;
class CPU{
private:
string modelNumber;
float speed;
string manufacture;
public:
CPU(string m, string mn, float s)
{
modelNumber=mn;
speed=s;
manufacture=m;
}
friend ostream& operator<<(ostream& o, CPU &cpu)
{
o<<"The CPU is made by: "<<cpu.manufacture<<endl;
o<<"Model#: "<<cpu.modelNumber<<endl;
o<<"Speed: "<<cpu.speed<<" GHZ"<<endl;
return o;
}
};//endlcass
class Motherboard{
private:
string modelNumber;
string manufacture;
public:
Motherboard(string model, string manu)
{
modelNumber=model;
manufacture=manu;
}
friend ostream& operator<<(ostream& o, Motherboard &motherboard)
{
o<<"The motherboard is made by: "<<motherboard.manufacture<<endl;
o<<"Model#: "<<motherboard.modelNumber<<endl;
return o;
}
};
class RAM{
private:
int size, speed;
public:
RAM(int si, int spe)
{
size=si;
speed=spe;
}
friend ostream& operator<<(ostream& o, RAM &ram)
{
o<<"The motherboard is size by: "<<ram.size<<" GB"<<endl;
o<<"Speed: "<<ram.speed<<endl;
return o;
}
};//endlcass
class PersonalComputer{
private:
CPU newCpu;
Motherboard newMother;
RAM newRam;
float price;
public:
int getPrice() {return price;}
PersonalComputer(string mf, string m, float sp, string mod, string man, int sii, int spee, float pric)
:newCpu(mf,m,sp), newMother(mod,man), newRam(sii, spee)
{
price=pric;
}
friend ostream& operator<<(ostream& o, PersonalComputer &computer)
{
o<<"\nI am Contructing a PC: "<<endl;
cout<<computer.newCpu<<endl;
cout<<computer.newMother<<endl;
cout<<computer.newRam<<endl;
o<<"Price: "<<computer.price<<endl;
return o;
}
float operator+=(PersonalComputer computer)
{
float total;
total+=computer.price;
return total;
}
};
int main()
{
char again;
int choice;
float total;
PersonalComputer computer("Intel","Z196", 5.2, "Asus", "I5-750", 4,1600, 200.23);
vector <PersonalComputer> comp;
comp.push_back(computer);
do
{
for (unsigned int x=0; x < comp.size(); x++)
{
cout<<comp[x];
}
// enter 1 or 2 so the PC can be added to total costs.
cout<<"Would you like to add this to your order Enter 1 for yes and 2 for no?"<<endl;
while(cin>>choice)
{
if (choice==1)
{
cout<<"Total was added"<<endl;
total += computer.getPrice();
}
else if (choice==2)
{
cout<<"Did not want to add this PC!!!"<<endl;
}
else if (choice<2 || choice>=0)
{
cout<<"Invailed choice!! Enter the right choice\n";
}
}//end
//loop question
cout << "Do you want to play again? y or n\n";
cin >> again;
}while (again == 'y');
cout << "Thanks for playing.\n";
///display the vector contents
for (unsigned int x=0; x < comp.size(); x++)
{
cout<<"\n\nOrder: "<< x+1;
cout<<comp[x];
}
//overloaded display
cout<<"Total price: "<<total<<endl;
system("PAUSE");
return 0;
}
| [
"noreply@github.com"
] | AhmedFakhreddine.noreply@github.com |
4671786127eb62f8ec7f87c8b2bbeca2e8395ee5 | afa53fe23d84296c3202ac1329f4ce55020f9e0d | /Intermediate/Build/Win64/UE4Editor/Inc/GameTaskEditor/GameTaskGraph.generated.h | 12ea2873fe35a54eb3628d30cf677269488ff69e | [] | no_license | 977908569/GameTask | 70d40f4bc1677be66c20ad0301332e8f8b896741 | 0cb7a5f97ee1eb0b28596f906c49117f56dcb7c7 | refs/heads/main | 2023-01-31T23:56:45.499708 | 2020-12-11T09:52:02 | 2020-12-11T09:52:02 | 309,542,809 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,164 | h | // Copyright Epic Games, Inc. All Rights Reserved.
/*===========================================================================
Generated code exported from UnrealHeaderTool.
DO NOT modify this manually! Edit the corresponding .h files instead!
===========================================================================*/
#include "UObject/ObjectMacros.h"
#include "UObject/ScriptMacros.h"
PRAGMA_DISABLE_DEPRECATION_WARNINGS
#ifdef GAMETASKEDITOR_GameTaskGraph_generated_h
#error "GameTaskGraph.generated.h already included, missing '#pragma once' in GameTaskGraph.h"
#endif
#define GAMETASKEDITOR_GameTaskGraph_generated_h
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_SPARSE_DATA
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_RPC_WRAPPERS
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_RPC_WRAPPERS_NO_PURE_DECLS
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_INCLASS_NO_PURE_DECLS \
private: \
static void StaticRegisterNativesUGameTaskGraph(); \
friend struct Z_Construct_UClass_UGameTaskGraph_Statics; \
public: \
DECLARE_CLASS(UGameTaskGraph, UGameTaskGraphBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/GameTaskEditor"), NO_API) \
DECLARE_SERIALIZER(UGameTaskGraph)
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_INCLASS \
private: \
static void StaticRegisterNativesUGameTaskGraph(); \
friend struct Z_Construct_UClass_UGameTaskGraph_Statics; \
public: \
DECLARE_CLASS(UGameTaskGraph, UGameTaskGraphBase, COMPILED_IN_FLAGS(0), CASTCLASS_None, TEXT("/Script/GameTaskEditor"), NO_API) \
DECLARE_SERIALIZER(UGameTaskGraph)
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_STANDARD_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
NO_API UGameTaskGraph(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UGameTaskGraph) \
DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, UGameTaskGraph); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UGameTaskGraph); \
private: \
/** Private move- and copy-constructors, should never be used */ \
NO_API UGameTaskGraph(UGameTaskGraph&&); \
NO_API UGameTaskGraph(const UGameTaskGraph&); \
public:
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_ENHANCED_CONSTRUCTORS \
/** Standard constructor, called after all reflected properties have been initialized */ \
NO_API UGameTaskGraph(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get()) : Super(ObjectInitializer) { }; \
private: \
/** Private move- and copy-constructors, should never be used */ \
NO_API UGameTaskGraph(UGameTaskGraph&&); \
NO_API UGameTaskGraph(const UGameTaskGraph&); \
public: \
DECLARE_VTABLE_PTR_HELPER_CTOR(NO_API, UGameTaskGraph); \
DEFINE_VTABLE_PTR_HELPER_CTOR_CALLER(UGameTaskGraph); \
DEFINE_DEFAULT_OBJECT_INITIALIZER_CONSTRUCTOR_CALL(UGameTaskGraph)
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_PRIVATE_PROPERTY_OFFSET
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_4_PROLOG
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_GENERATED_BODY_LEGACY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_PRIVATE_PROPERTY_OFFSET \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_SPARSE_DATA \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_RPC_WRAPPERS \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_INCLASS \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_STANDARD_CONSTRUCTORS \
public: \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
#define TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_GENERATED_BODY \
PRAGMA_DISABLE_DEPRECATION_WARNINGS \
public: \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_PRIVATE_PROPERTY_OFFSET \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_SPARSE_DATA \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_RPC_WRAPPERS_NO_PURE_DECLS \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_INCLASS_NO_PURE_DECLS \
TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h_7_ENHANCED_CONSTRUCTORS \
static_assert(false, "Unknown access specifier for GENERATED_BODY() macro in class GameTaskGraph."); \
PRAGMA_ENABLE_DEPRECATION_WARNINGS
template<> GAMETASKEDITOR_API UClass* StaticClass<class UGameTaskGraph>();
#undef CURRENT_FILE_ID
#define CURRENT_FILE_ID TaskProject_Plugins_GameTask_Source_GameTaskEditor_Private_Graph_GameTaskGraph_h
PRAGMA_ENABLE_DEPRECATION_WARNINGS
| [
"977908569@qq.com"
] | 977908569@qq.com |
a18f32701b7f2423012f90560d02dc210144a18b | 4d4822b29e666cea6b2d99d5b9d9c41916b455a9 | /Example/Pods/Headers/Private/GeoFeatures/boost/interprocess/detail/math_functions.hpp | 923cc0208bbf84fb395a8ad6c87954dce87048ca | [
"BSL-1.0",
"Apache-2.0"
] | permissive | eswiss/geofeatures | 7346210128358cca5001a04b0e380afc9d19663b | 1ffd5fdc49d859b829bdb8a9147ba6543d8d46c4 | refs/heads/master | 2020-04-05T19:45:33.653377 | 2016-01-28T20:11:44 | 2016-01-28T20:11:44 | 50,859,811 | 0 | 0 | null | 2016-02-01T18:12:28 | 2016-02-01T18:12:28 | null | UTF-8 | C++ | false | false | 80 | hpp | ../../../../../../../../GeoFeatures/boost/interprocess/detail/math_functions.hpp | [
"hatter24@gmail.com"
] | hatter24@gmail.com |
d22ed1a8c7f4ed6e5c0321f03956c08cb988e441 | 85edd16a14ed5c2aeb658c1763b30a7dc08b3095 | /Whisper/Source/UI/Source/App/Win/WBootStrap.cpp | 5851f2ae78bab4085c68edcef81bfb94bc4214ca | [
"MIT"
] | permissive | jesse99/whisper | 14a17f94de8fccad2ddc6e9abf9cfa5f40922d50 | c71c2da3d71463a59411b36730713f517934ffc4 | refs/heads/master | 2020-04-21T00:16:20.627290 | 2019-02-05T05:21:44 | 2019-02-05T05:21:44 | 169,191,357 | 0 | 0 | null | null | null | null | WINDOWS-1252 | C++ | false | false | 4,404 | cpp | /*
* File: WBootStrap.cpp
* Summary: Functions used to intialize and terminate UI apps.
* Written by: Jesse Jones
*
* Copyright © 1998-2001 Jesse Jones.
* This code is distributed under the zlib/libpng license (see License.txt for details).
*
* Change History (most recent first):
*
* $Log: WBootStrap.cpp,v $
* Revision 1.10 2001/04/27 09:18:01 jesjones
* Updated for the XTranscode changes.
*
* Revision 1.9 2001/04/21 03:30:17 jesjones
* Updated for the new debug macros.
*
* Revision 1.8 2001/03/16 10:23:17 jesjones
* Fixed gExitingNormally for Intel DLL targets.
*
* Revision 1.7 2001/03/06 07:31:51 jesjones
* Replaced size() with empty() where possible (std::list::size() may take linear time to execute).
*
* Revision 1.6 2001/03/01 11:43:03 jesjones
* Added #if DEBUG to a bit of code.
*
* Revision 1.5 2001/01/21 00:41:52 jesjones
* Added an include.
*
* Revision 1.4 2001/01/05 06:22:39 jesjones
* Major refactoring.
*
* Revision 1.3 2000/11/20 05:46:55 jesjones
* Added std:: to a few function calls.
*
* Revision 1.2 2000/11/09 12:04:50 jesjones
* 1) Removed double CRs introduced during the initial checkin. 2) Changed the header comments to make it clearer that Whisper is using the zlib license agreement. 3) Added the Log keyword.
*/
#include <XWhisperHeader.h>
#include <XBootStrap.h>
#include <WSystemInfo.h>
#include <XDebugMalloc.h>
#include <XDebugNew.h>
#include <XObjectModel.h>
#include <XStringUtils.h>
#include <XTranscode.h>
namespace Whisper {
#if DEBUG
extern RUNTIME_EXPORT bool gExitingNormally;
#endif
// ===================================================================================
// Global Functions
// ===================================================================================
//---------------------------------------------------------------
//
// InitUI
//
//---------------------------------------------------------------
void InitUI()
{
#if DEBUG
gExitingNormally = false;
#endif
#if WHISPER_OPERATOR_NEW && DEBUG
gDebugMalloc->EnableLeakChecking(); // we don't leak check static ctors
#endif
}
//---------------------------------------------------------------
//
// ShutDownUI
//
//---------------------------------------------------------------
void ShutDownUI()
{
#if DEBUG
gExitingNormally = true;
#endif
XObjectModel::Instance()->Shutdown();
}
//---------------------------------------------------------------
//
// DefaultSystemCheck
//
//---------------------------------------------------------------
void DefaultSystemCheck(std::list<std::wstring>& needs)
{
if (!WSystemInfo::IsWin32())
needs.push_back(LoadWhisperString(L"NT 4 or Win 95 or later"));
if (!WSystemInfo::IsNT() && WSystemInfo::GetMajorOSVersion() < 4)
needs.push_back(LoadWhisperString(L"NT 4 or later"));
}
//---------------------------------------------------------------
//
// HandleBadSystem
//
//---------------------------------------------------------------
void HandleBadSystem(const std::list<std::wstring>& needs)
{
PRECONDITION(!needs.empty());
// Build a string containing all of the reasons the app won't run.
std::wstring mesg;
if (needs.size() == 1)
mesg += needs.front();
else if (needs.size() == 2)
mesg += needs.front() + LoadWhisperString(L" and ") + needs.back();
else {
std::list<std::wstring>::const_iterator iter = needs.begin();
while (iter != needs.end()) {
std::wstring item = *iter++;
if (iter == needs.end())
mesg += LoadWhisperString(L"and ");
mesg += item;
if (iter != needs.end())
mesg += LoadWhisperString(L", ");
}
}
// Put up an alert to let the user know how badly their PC sucks.
std::wstring errorStr = LoadWhisperString(L"Unable to run the app because the system components below are missing:");
std::wstring text = errorStr + L"\n" + mesg;
uint32 flags = MB_OK + // just an OK button
MB_ICONSTOP + // display the stop sign icon
MB_DEFBUTTON1 + // select the OK button
MB_TASKMODAL + // don't let the user do anything else in the app
MB_SETFOREGROUND; // bring the app to the front
if (WSystemInfo::HasUnicode())
(void) MessageBoxW(nil, text.c_str(), nil, flags);
else
(void) MessageBoxA(nil, ToPlatformStr(text).c_str(), nil, flags);
// Bail
std::exit(1);
}
} // namespace Whisper
| [
"jesse9jones@gmail.com"
] | jesse9jones@gmail.com |
70bb9b4aa2079f745a28fa8236cd41919e11794c | 6edaf7e78c43f822c830043aec786b2be47dd73e | /cpp/acm/cqu_2018_summer_fifteen_day/uva_12661.cpp | 5cc253adbfe9c8bcac47d607e6089b47461766ee | [] | no_license | HBat11233/hbat_code | 8d2c8bc0e44775fafa3cb2820e8388e8d3702bc6 | 2f5de84498660863fd2816f0f8d49442689f88b8 | refs/heads/master | 2021-07-20T03:54:20.961518 | 2018-10-11T08:24:50 | 2018-10-11T08:24:50 | 112,096,574 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,381 | cpp | #include <bits/stdc++.h>
using namespace std;
int n,m,s,t;
struct ips
{
int n;
int o;
int c;
int r;
ips(int n=0,int o=0,int c=0,int r=0)
:n(n),o(o),c(c),r(r){}
};
vector< vector<ips> >da;
int dis[400];
int pk[400];
void spfa(int x)
{
memset(dis,0x7f,sizeof(dis));
memset(pk,0,sizeof(pk));
queue<int>que;
que.push(x);
pk[x]=true;
dis[x]=0;
while(!que.empty())
{
int h=que.front();
for(int j=0;j<da[h].size();++j)
{
int sy=dis[h]%(da[h][j].o+da[h][j].c);
int dt=0;
if(sy>da[h][j].o-da[h][j].r)dt=da[h][j].o+da[h][j].c-sy;
if(dis[da[h][j].n]>dis[h]+da[h][j].r+dt)
{
dis[da[h][j].n]=dis[h]+da[h][j].r+dt;
if(!pk[da[h][j].n])
{
pk[da[h][j].n]=true;
que.push(da[h][j].n);
}
}
}
que.pop();
pk[h]=false;
}
}
int main()
{
int o=0;
while(~scanf("%d%d%d%d",&n,&m,&s,&t))
{
da.clear();
da.resize(n+1);
int a,b,c,d,e;
for(int i=0;i<m;++i)
{
scanf("%d%d%d%d%d",&a,&b,&c,&d,&e);
if(c<e)continue;
da[a].push_back(ips(b,c,d,e));
}
spfa(s);
printf("Case %d: %d\n",++o,dis[t]);
}
return 0;
} | [
"33086330+HBat11233@users.noreply.github.com"
] | 33086330+HBat11233@users.noreply.github.com |
7db24552294ecd6b7e21b0990b767edba1d95aa4 | d01d5fe5c922517c58e4a386cc824a5a7400663c | /public/include/cpp_extensions/thread/detail/checked_unique_lock_timed_tracker.hpp | b0f5c41da4e151670c6ed8ee2f974adec7dc87b3 | [
"BSD-3-Clause"
] | permissive | ffceiltda/cpp_extensions | 6efe7b625a280b07b29d2411d45ec6d5aa291438 | d1bffee478fe7f3d574ce66ef7bb9a59379661df | refs/heads/main | 2023-04-03T19:27:01.763544 | 2021-04-18T01:21:07 | 2021-04-18T01:21:07 | 358,773,623 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,876 | hpp | #ifndef _CPP_EXTENSIONS_THREAD_CHECKED_UNIQUE_LOCK_TIMED_TRACKER_HPP_
#define _CPP_EXTENSIONS_THREAD_CHECKED_UNIQUE_LOCK_TIMED_TRACKER_HPP_
#include <cpp_extensions/prolog.hpp>
#include <cpp_extensions/thread/detail/checked_unique_lock_tracker.hpp>
#include <chrono>
namespace cpp_extensions
{
namespace thread
{
namespace detail
{
template <typename LockableType, bool const Recursive>
class checked_unique_lock_timed_tracker
: public checked_unique_lock_tracker<LockableType, Recursive>
{
public:
constexpr checked_unique_lock_timed_tracker() noexcept = default;
checked_unique_lock_timed_tracker(checked_unique_lock_timed_tracker const&) = delete;
checked_unique_lock_timed_tracker(checked_unique_lock_timed_tracker&&) = delete;
checked_unique_lock_timed_tracker& operator = (checked_unique_lock_timed_tracker const&) = delete;
checked_unique_lock_timed_tracker& operator = (checked_unique_lock_timed_tracker&&) = delete;
template <class Rep, class Period>
[[nodiscard]]
bool try_lock_for(std::chrono::duration<Rep, Period> const& timeout_duration)
{
if (this->try_lock_track_unique_recursive_current_thread())
{
return true;
}
return this->lock_track_unique_recursive_current_thread([this, &timeout_duration]() -> bool { return this->m_lockable.try_lock_for(timeout_duration); });
}
template <class Clock, class Duration>
[[nodiscard]]
bool try_lock_until(std::chrono::time_point<Clock, Duration> const& timeout_time)
{
if (this->try_lock_track_unique_recursive_current_thread())
{
return true;
}
return this->lock_track_unique_recursive_current_thread([this, &timeout_time]() -> bool { return this->m_lockable.try_lock_until(timeout_time); });
}
};
}
}
}
#endif // _CPP_EXTENSIONS_THREAD_CHECKED_UNIQUE_LOCK_TRACKER_HPP_
| [
"virgiliofornazin@gmail.com"
] | virgiliofornazin@gmail.com |
afc6e9c1526148b15bd3108a9ab32c91876bf17f | dec4ef167e1ce49062645cbf036be324ea677b5e | /SDK/PUBG_DmgType_BlueZone_parameters.hpp | 9f51d6165dbfab07275b580a07adc33d18982e81 | [] | no_license | qrluc/pubg-sdk-3.7.19.5 | 519746887fa2204f27f5c16354049a8527367bfb | 583559ee1fb428e8ba76398486c281099e92e011 | refs/heads/master | 2021-04-15T06:40:38.144620 | 2018-03-26T00:55:36 | 2018-03-26T00:55:36 | 126,754,368 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 389 | hpp | #pragma once
// PlayerUnknown's Battlegrounds (3.5.7.7) SDK
#ifdef _MSC_VER
#pragma pack(push, 0x8)
#endif
#include "PUBG_DmgType_BlueZone_classes.hpp"
namespace PUBG
{
//---------------------------------------------------------------------------
//Parameters
//---------------------------------------------------------------------------
}
#ifdef _MSC_VER
#pragma pack(pop)
#endif
| [
"qrl@uc.com"
] | qrl@uc.com |
0b73ea19934cf2cbdf0ecf0fe801d194504fa929 | faa33199a02f48084a3e4ca15602dfbabf792000 | /ideep4py/py/primitives/pooling_py.h | c00f864cdbc3a453768dce044b6977338ff49ea5 | [
"MIT",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | mingxiaoh/chainer_for_rebase | 11e50bb8f923aabafcf6ddd3b20fadd4dfc91180 | 8c5ba24bf81d648402d388dac1df7591b2557712 | refs/heads/master | 2020-03-08T07:42:58.960006 | 2018-04-17T08:14:40 | 2018-04-17T08:14:40 | 128,001,519 | 1 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,583 | h | /*
*COPYRIGHT
*All modification made by Intel Corporation: © 2017 Intel Corporation.
*Copyright (c) 2015 Preferred Infrastructure, Inc.
*Copyright (c) 2015 Preferred Networks, Inc.
*
*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.
*
*
*######################################################################
*# The CuPy is designed based on NumPy's API.
*# CuPy's source code and documents contain the original NumPy ones.
*######################################################################
*Copyright (c) 2005-2016, NumPy Developers.
*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 NumPy Developers nor the names of any
* 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.
*######################################################################
*/
#ifndef _POOLING_PY_H_
#define _POOLING_PY_H_
#include <vector>
#include <memory>
#include "op_param.h"
#include "mdarray.h"
#include "pooling.h"
template <typename T>
class Pooling2D_Py
{
public:
/*
* Python Pooling Forward
* params:
* src: input, x
* pp: pooling parameters
*/
static std::vector<mdarray> Forward(mdarray *src,
pooling_param_t *pp) {
std::vector<mdarray> outputs;
// Shoule be removed in future????
implementation::mdarray *src_internal = src->get();
std::vector<Tensor *> outputs_tensor = Pooling2D<T>::Forward(
(src_internal->tensor()),
pp);
// FIXME
//FIXME
for (int i = 0; i < outputs_tensor.size(); i++) {
outputs.push_back( mdarray(outputs_tensor[i]) );
}
return outputs;
}
/*
* Python Pooling backward
* param:
* diff_dst: diff dst, gy
* ws: workspace
* pp: pooling parameters
*/
static mdarray Backward(mdarray *diff_dst,
mdarray *ws,
pooling_param_t *pp) {
//FIXME
//Should be removed in future
implementation::mdarray *diff_dst_internal = diff_dst->get();
implementation::mdarray *ws_internal;
if ( pp->algo_kind == pooling_param_t::algorithm::pooling_max)
ws_internal = ws->get();
Tensor *diff_src_tensor;
if ( pp->algo_kind == pooling_param_t::algorithm::pooling_max) {
diff_src_tensor = Pooling2D<T>::Backward(
(diff_dst_internal->tensor()),
(ws_internal->tensor()),
pp);
} else {
diff_src_tensor = Pooling2D<T>::Backward(
(diff_dst_internal->tensor()),
NULL,
pp);
}
// FIXME
// In future, mdarray will have a Tensor member, no need to create a new one
mdarray diff_src_mdarray = mdarray(diff_src_tensor);
return diff_src_mdarray;
}
};
#endif // _POOLING_PY_H_
// vim: et ts=4 sw=4 cindent cino^=l0,\:0,N-s
| [
"yiqiang.li@intel.com"
] | yiqiang.li@intel.com |
fb0eba28002fc8ab405d73577dbc5ac4c0751149 | c33e3ffb3373cb012517a7bfb4c57f0198a93008 | /15649.cpp | fcbfa8174330051dfcc6af76414b4bc78158d44a | [] | no_license | dampers/algorithm | 8fecb03a23305e719fd349514addd658f878f16f | 689ff34d3f24276fddbffbdcb30f5e69dce7e44a | refs/heads/master | 2022-06-05T14:09:30.819594 | 2022-05-22T17:07:53 | 2022-05-22T17:07:53 | 153,278,883 | 5 | 0 | null | 2018-11-20T18:40:33 | 2018-10-16T12:05:42 | C | UTF-8 | C++ | false | false | 408 | cpp | #include<bits/stdc++.h>
using namespace std;
int num[9], check[9];
int n, m;
void sf(int pos)
{
if(pos==m)
{
for(int i=0;i<m;i++) printf("%d ", num[i]);
printf("\n");
return;
}
for(int i=0;i<n;i++)
{
if(check[i]==0)
{
check[i] = 1;
num[pos] = i+1;
sf(pos+1);
check[i] = 0;
}
}
}
int main()
{
scanf("%d %d", &n, &m);
sf(0);
return 0;
}
| [
"noreply@github.com"
] | dampers.noreply@github.com |
06784841ad2e89529a2859a6e3c8d726d873eaea | a0b0eb383ecfeaeed3d2b0271657a0c32472bf8e | /usaco/Training/Chapter 1 Getting started/wormhole.cpp | 35fe0bcaf05b2341f155f4cd70d5b2a4a45b61cf | [
"Apache-2.0"
] | permissive | tangjz/acm-icpc | 45764d717611d545976309f10bebf79c81182b57 | f1f3f15f7ed12c0ece39ad0dd044bfe35df9136d | refs/heads/master | 2023-04-07T10:23:07.075717 | 2022-12-24T15:30:19 | 2022-12-26T06:22:53 | 13,367,317 | 53 | 20 | Apache-2.0 | 2022-12-26T06:22:54 | 2013-10-06T18:57:09 | C++ | UTF-8 | C++ | false | false | 964 | cpp | /*
ID: tangjin2
LANG: C++
TASK: wormhole
*/
#include <cstdio>
const int maxn = 13;
int n, x[maxn], y[maxn], nxt[maxn], pos[maxn], ans;
void dfs(int dep)
{
if(dep == (n >> 1))
{
bool flag = 1;
for(int i = 1; i <= n && flag; ++i)
{
bool vis[maxn] = {};
for(int j = i; nxt[j] && flag; j = pos[nxt[j]])
{
flag &= !vis[j];
vis[j] = 1;
}
}
if(!flag)
++ans;
return;
}
for(int i = 1; i <= n; ++i)
if(!pos[i])
{
for(int j = i + 1; j <= n; ++j)
if(!pos[j])
{
pos[i] = j;
pos[j] = i;
dfs(dep + 1);
pos[j] = 0;
}
pos[i] = 0;
break;
}
}
int main()
{
freopen("wormhole.in", "r", stdin);
freopen("wormhole.out", "w", stdout);
scanf("%d", &n);
for(int i = 1; i <= n; ++i)
scanf("%d%d", x + i, y + i);
for(int i = 1; i <= n; ++i)
for(int j = 1; j <= n; ++j)
if(x[i] < x[j] && y[i] == y[j] && (!nxt[i] || x[j] < x[nxt[i]]))
nxt[i] = j;
dfs(0);
printf("%d\n", ans);
return 0;
}
| [
"t251346744@gmail.com"
] | t251346744@gmail.com |
c4219b78c7dace99093657e7cbe0e4943fe79c75 | a2f3c693d2bf6483ff77ff0c3ebef634485de3e5 | /Empty/EmptyApplication.cpp | 726b9de39f1c7b70c7747ae74b1326ee9b95fbca | [] | no_license | seraphim0423/MyEngine | 89173557610b442784447906a0d9163f89969dee | 790a9b7ba828d00c290310597eba2a27a3a38a35 | refs/heads/master | 2020-03-22T15:47:55.487772 | 2018-07-13T12:47:11 | 2018-07-13T12:47:11 | 140,279,322 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 112 | cpp | #include"BaseApplication.hpp"
namespace Game{
BaseApplication g_App;
IApplication * g_pApp = &g_App;
}
| [
"seraphim0423@gmail.com"
] | seraphim0423@gmail.com |
827b8e192dbc57d597993cd3dc2b78b33d51df9d | 9a3b9d80afd88e1fa9a24303877d6e130ce22702 | /src/Providers/UNIXProviders/AllocatedFromStoragePool/UNIX_AllocatedFromStoragePool.cpp | 143553d3011946d24a6d02ad17023d16c3bc550e | [
"MIT"
] | permissive | brunolauze/openpegasus-providers | 3244b76d075bc66a77e4ed135893437a66dd769f | f24c56acab2c4c210a8d165bb499cd1b3a12f222 | refs/heads/master | 2020-04-17T04:27:14.970917 | 2015-01-04T22:08:09 | 2015-01-04T22:08:09 | 19,707,296 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,532 | cpp | //%LICENSE////////////////////////////////////////////////////////////////
//
// Licensed to The Open Group (TOG) under one or more contributor license
// agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
// this work for additional information regarding copyright ownership.
// Each contributor licenses this file to you under the OpenPegasus Open
// Source License; you may not use this file except in compliance with the
// License.
//
// 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 "UNIX_AllocatedFromStoragePool.h"
#if defined(PEGASUS_OS_HPUX)
# include "UNIX_AllocatedFromStoragePool_HPUX.hxx"
# include "UNIX_AllocatedFromStoragePool_HPUX.hpp"
#elif defined(PEGASUS_OS_LINUX)
# include "UNIX_AllocatedFromStoragePool_LINUX.hxx"
# include "UNIX_AllocatedFromStoragePool_LINUX.hpp"
#elif defined(PEGASUS_OS_DARWIN)
# include "UNIX_AllocatedFromStoragePool_DARWIN.hxx"
# include "UNIX_AllocatedFromStoragePool_DARWIN.hpp"
#elif defined(PEGASUS_OS_AIX)
# include "UNIX_AllocatedFromStoragePool_AIX.hxx"
# include "UNIX_AllocatedFromStoragePool_AIX.hpp"
#elif defined(PEGASUS_OS_FREEBSD)
# include "UNIX_AllocatedFromStoragePool_FREEBSD.hxx"
# include "UNIX_AllocatedFromStoragePool_FREEBSD.hpp"
#elif defined(PEGASUS_OS_SOLARIS)
# include "UNIX_AllocatedFromStoragePool_SOLARIS.hxx"
# include "UNIX_AllocatedFromStoragePool_SOLARIS.hpp"
#elif defined(PEGASUS_OS_ZOS)
# include "UNIX_AllocatedFromStoragePool_ZOS.hxx"
# include "UNIX_AllocatedFromStoragePool_ZOS.hpp"
#elif defined(PEGASUS_OS_VMS)
# include "UNIX_AllocatedFromStoragePool_VMS.hxx"
# include "UNIX_AllocatedFromStoragePool_VMS.hpp"
#elif defined(PEGASUS_OS_TRU64)
# include "UNIX_AllocatedFromStoragePool_TRU64.hxx"
# include "UNIX_AllocatedFromStoragePool_TRU64.hpp"
#else
# include "UNIX_AllocatedFromStoragePool_STUB.hxx"
# include "UNIX_AllocatedFromStoragePool_STUB.hpp"
#endif
Boolean UNIX_AllocatedFromStoragePool::validateKey(CIMKeyBinding &kb) const
{
/* Keys */
//Antecedent
//Dependent
CIMName name = kb.getName();
if (name.equal(PROPERTY_ANTECEDENT) ||
name.equal(PROPERTY_DEPENDENT)
)
return true;
return false;
}
void UNIX_AllocatedFromStoragePool::setScope(CIMName scope)
{
currentScope = CIMName(scope.getString());
}
void UNIX_AllocatedFromStoragePool::setCIMOMHandle(CIMOMHandle &ch)
{
_cimomHandle = ch;
}
| [
"brunolauze@msn.com"
] | brunolauze@msn.com |
39201c2532ff97de6cdc165a3b7c08680b6f0796 | d05aa5a5e46b356094ac801d80a35fc33a767299 | /src/commlib/zcelib/zce_predefine.cpp | 354b84dba718bd0044c42118849aaf2ceae61c74 | [
"Apache-2.0"
] | permissive | RiversFlows/zcelib | d2c131ca734964369d277bcbd354e62afab83d1b | 88e14ab436f1b40e8071e15ef6d9fae396efc3b4 | refs/heads/master | 2022-06-18T01:40:18.937878 | 2020-05-06T09:08:10 | 2020-05-06T09:08:10 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,590 | cpp | //预定义头文件对应的CPP文件,所有预定义信息描述
#include "zce_predefine.h"
/*
//摘抄:
// _ooOoo_
// o8888888o
// 88" . "88
// (| -_- |)
// O\ = /O
// ____/`---'\____
// . ' \\| |// `.
// / \\||| : |||// \
// / _||||| -:- |||||- \
// | | \\\ - /// | |
// | \_| ''\---/'' | |
// \ .-\__ `-` ___/-. /
// ___`. .' /--.--\ `. . __
// ."" '< `.___\_<|>_/___.' >'"".
// | | : `- \`.;`\ _ /`;.`/ - ` : | |
// \ \ `-. \_ __\ /__ _/ .-` / /
// ======`-.____`-.___\_____/___.-`____.-'======
// `=---='
//
// .............................................
// 佛祖镇楼 BUG辟易
// 佛曰:
// 写字楼里写字间,写字间里程序员;
// 程序人员写程序,又拿程序换酒钱。
// 酒醒只在网上坐,酒醉还来网下眠;
// 酒醉酒醒日复日,网上网下年复年。
// 但愿老死电脑间,不愿鞠躬老板前;
// 奔驰宝马贵者趣,公交自行程序员。
// 别人笑我忒疯癫,我笑自己命太贱;
// 不见满街漂亮妹,哪个归得程序员?
*/ | [
"fullsail@163.com"
] | fullsail@163.com |
6233441e8ceab02224a3d872cc46e9ba8acf7f98 | 93ac995bb97d67947c3c30665c2f4a7856bc7fbf | /Arduino_Samples/ChessSensor/MT7681.cpp | 3706b5ba9b6b5e760f64eee945d7341f523c428a | [] | no_license | WaDAMake/7681-ATcmd | bc3da1761758730a47f828a32f8a5b0dc2d417dc | 5bfe548a0e6d5b74ecdf54f071a2d9ede732a09a | refs/heads/master | 2020-05-29T11:07:32.917112 | 2016-04-14T05:38:42 | 2016-04-14T05:38:42 | 46,699,564 | 0 | 0 | null | 2015-11-23T05:52:56 | 2015-11-23T05:52:56 | null | UTF-8 | C++ | false | false | 10,559 | cpp | #include <Arduino.h>
#include <Stream.h>
#include "MT7681.h"
LC7681Wifi::LC7681Wifi(Stream *s, Stream* l) : m_lport(0)
{
m_stream = s;
m_log = l;
m_bufferPos = 0;
}
void LC7681Wifi::begin(int reset)
{
digitalWrite(reset, HIGH);
delay(100);
digitalWrite(reset, LOW);
delay(500);
digitalWrite(reset, HIGH);
char c;
// Detecting Recovery mode.
while (1) {
if (m_stream->available()) {
c = m_stream->read();
m_log->write(c);
if (c == '>') {
break;
}
}
}
while (1) {
if (m_stream->available()) {
c = m_stream->read();
m_log->write(c);
if (c == '<') {
break;
}
}
}
delay(1000);
while (m_stream->available()) {
c = m_stream->read();
m_log->write(c);
}
}
void LC7681Wifi::Version()
{
String str = F("AT#Ver");
m_stream->println(str);
if(m_log) {
m_log->print("[Send cmd]");
m_log->println(str);
}
}
void LC7681Wifi::EnterSmartConnection()
{
String str = F("AT#Smnt");
m_stream->println(str);
if(m_log) {
m_log->print("[Send cmd]");
m_log->println(str);
}
}
bool LC7681Wifi::connectAP(const char* ssid, const char* key,int type)
{
String ack, str = F("AT");
ack = F("+WCAP=");
ack += String(ssid);
ack += ",";
ack += String(key);
ack += ",";
str += (ack + String(type));
m_stream->println(str);
m_log->println(str);
str = _wait_for(ack.c_str(), 20);
if (str.length() != 0)
{
return true;
}
return false;
}
IPAddress LC7681Wifi::s2ip(const char* str)
{
uint32_t ip[4];
String ipaddress(0);
int count = 0;
// //Serial.print("INTPUT IP:");
// //Serial.print(str);
// //Serial.print(" Size:");
// //Serial.println(strlen(str));
/*
for (int i = 0; i <= strlen(str); ++i)
{
Serial.print(i);
Serial.println(str[i]);
if(str[i]=='.' || i==strlen(str)){
Serial.print("GET .");
Serial.print(ipaddress);
ip[count]=ipaddress.toInt();
Serial.print("=>");
Serial.print(count);
Serial.print("=>");
Serial.println(ip[count]);
ipaddress = "";
count++;
}
else {
ipaddress+=String(str[i]);
}
}
*/
sscanf(str, "%d.%d.%d.%d", ip, ip+1, ip+2, ip+3);
return IPAddress(ip[0], ip[1], ip[2], ip[3]);
}
IPAddress LC7681Wifi::IP()
{
String result, ips;
m_stream->println(F("AT+WQIP?"));
result = _wait_for("+WQIP:", 5);
if(result.length() == 0)
return IPAddress();
ips = result.substring(6, result.indexOf(',', 6));
return s2ip(ips.c_str());
}
IPAddress LC7681Wifi::nslookup(const char* server)
{
String result, ips;
result = F("AT+WDNL=");
result += server;
m_stream->println(result);
////Serial.println(result);
result = _wait_for("+WDNL:", 5);
if(result.length() == 0)
return IPAddress();
ips = result.substring(result.lastIndexOf(',')+1);
return s2ip(ips.c_str());
}
bool LC7681Wifi::connect(IPAddress ip, int port, bool udp )
{
char buf[20];
String AT = String(ip[0])+"." +String(ip[1])+"." +String(ip[2])+"." +String(ip[3]);
// //Serial.println(ip[3]);
//AT.reserve(AT.length());
AT.toCharArray(buf, AT.length()+1);
//sprintf(buf, "AT+WSW=%d,", m_lport);
//sprintf(buf, "%d.%d.%d.%d", ip[0], ip[1], ip[2], ip[3]);
return connect(buf, port, udp);
}
bool LC7681Wifi::connect(const char* ip, int port, bool udp )
{
String str = "AT+WSO=";
str += ip;
str += ",";
str += port;
str += ",";
str += udp ? "1" : "0";
m_stream->println(str);
//Serial.println(str);
str = _wait_for("+WSO:",30);
if (str.length() == 0)
return false;
m_lport = str.substring(5).toInt();
if (udp)
return true;
str = "+WSS:";
str += m_lport;
str = _wait_for(str.c_str(),30);
//
if (str.length() == 0)
{
m_lport = 0;
return false;
}
str.remove(0,str.lastIndexOf(',')+1);
if (str.toInt() == 0)
{
m_lport = 0;
return false;
}
return true;
}
int LC7681Wifi::freeRam()
{
extern int __heap_start, *__brkval;
int v;
return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}
bool LC7681Wifi::print(const char* data, int dataLen)
{
char buf[100];
const char *src = data;
char *dest = buf;
int remain = dataLen;
while (remain > 0)
{
int part = remain > 48 ? 48 : remain;
String AT = F("AT+WSW=");
AT = AT +String(m_lport);
AT = AT +',';
AT.toCharArray(buf, AT.length()+1);
dest = buf + strlen(buf);
base64_encode((uint8_t*)src, part, (uint8_t*)dest);
dest+= base64_encode_len(part);
dest[0] = '\r';
dest[1] = '\n';
dest[2] = 0;
m_stream->print(buf);
src += part;
remain -= part;
String str = _wait_for("+WSDS:",30);
int count = 0;
while(str.length() == 0){
count++;
m_stream->print(buf);
str = _wait_for("+WSDS:",30);
if (count>3)
{
return false;/* code */
}
}
}
return true;
}
bool LC7681Wifi::print(const char* data )
{
if(!data)
return false;
return print(data, strlen(data));
}
bool LC7681Wifi::println(const char* data)
{
String str;
if(data)
str = data;
str += "\r\n";
return print(str.c_str());
}
void LC7681Wifi::process(LC7681WifiCallback cb)
{
int c;
while(m_stream->available())
{
c = m_stream->read();
m_buffer[m_bufferPos] = (char)c;
m_bufferPos = (m_bufferPos + 1) % 256;
if(c == '\n')
{
m_buffer[m_bufferPos] = 0;
m_bufferPos = 0;
if(m_log)
{
m_log->print(F("[log]"));
m_log->println(m_buffer);
}
if(!strncmp(m_buffer, "+WSDR:", 6))
{
String s = m_buffer + 6;
s.trim();
int t1 = s.indexOf(',');
int t2 = s.indexOf(',', t1 + 1);
int port = s.substring(0, t1).toInt();
if(port == m_lport)
{
int len = s.substring(t1 + 1, t2).toInt();
String data = s.substring(t2 + 1);
if (m_log && data.length() != len)
{
m_log->print("[Warning] length not matching:");
m_log->println(len);
m_log->println(data.length());
m_log->println(data);
}
else{
// use m_buffer as temp buffer
t1 = base64_decode((const uint8_t*)data.c_str(), len, (uint8_t*)m_buffer);
m_buffer[t1] = 0;
cb(EVENT_DATA_RECEIVED, (uint8_t*)m_buffer, t1);
}
}
}
}
else if(!strncmp(m_buffer, "+WSS:", 5))
{
String s = m_buffer+5;
s.trim();
int t1 = s.indexOf(',');
int port = s.substring(0, t1).toInt();
int state = s.substring(t1+1).toInt();
if(port == m_lport)
{
if(state == 0)
cb(EVENT_SOCKET_DISCONNECT, NULL, 0);
m_lport = 0;
}
}
else if(!strncmp(m_buffer, "+WCAP:", 6))
{
String s = m_buffer+6;
if(s.substring(7)=="") {
cb(EVENT_AP_DISCONNECT, NULL, 0);
}
}
}
}
#define BUF_SIZE 128
String LC7681Wifi::_wait_for(const char* pattern, uint32_t timeout)
{
unsigned long _timeout = millis() + timeout * 1000;
char buf[BUF_SIZE];
int i, c;
if(m_log) {
m_log->print("[wait_for => ");
m_log->println(pattern);
}
i = 0;
while (millis() <= _timeout)
{
while (m_stream->available())
{
c = m_stream->read();
if (m_log) m_log->write(c);
buf[i] = (char)c;
i = (i + 1) % BUF_SIZE;
if (c == '\n')
{
buf[i] = 0;
if(0 == strncmp(buf, pattern, strlen(pattern)))
{
String result(buf);
result.trim();
if (m_log) m_log->println("[wait_for -]");
return result;
}
i = 0;
}
}
}
if (m_log) m_log->println("[wait_for -]");
return String(""); // timeout
}
void LC7681Wifi::logger(Stream *s)
{
m_log = s;
}
// Utility methods.
static int base64_encode_len(int len)
{
return ((len+2)/3)*4;
}
static uint8_t base64_enc_map(uint8_t n)
{
if(n < 26) return 'A'+n;
if(n < 52) return 'a'+(n-26);
if(n < 62) return '0'+(n-52);
return n == 62 ? '+' : '/';
}
static void base64_encode(const uint8_t* src, int len, uint8_t* dest)
{
uint32_t w;
uint8_t t;
while(len >= 3)
{
w = ((uint32_t)src[0])<<16 | ((uint32_t)src[1])<<8 | ((uint32_t)src[2]);
dest[0] = base64_enc_map((w>>18)&0x3F);
dest[1] = base64_enc_map((w>>12)&0x3F);
dest[2] = base64_enc_map((w>>6)&0x3F);
dest[3] = base64_enc_map((w)&0x3F);
len-=3;
src+=3;
dest+=4;
}
if(!len) return;
if(len == 2)
{
w = ((uint32_t)src[0])<<8 | ((uint32_t)src[1]);
dest[0] = base64_enc_map((w>>10)&0x3F);
dest[1] = base64_enc_map((w>>4)&0x3F);
dest[2] = base64_enc_map((w&0x0F)<<2);
dest[3] = '=';
}
else
{
w = src[0];
dest[0] = base64_enc_map((w>>2)&0x3F);
dest[1] = base64_enc_map((w&0x03)<<4);
dest[2] = '=';
dest[3] = '=';
}
}
static int base64_decode_len(int len)
{
return ((len + 3) / 4) * 3;
}
static uint32_t base64_dec_map(uint8_t n)
{
if(n >= 'A' && n <= 'Z')
return n - 'A';
if(n >= 'a' && n <= 'z')
return n - 'a' + 26;
if(n >= '0' && n <= '9')
return n - '0' + 52;
return n == '+' ? 62 : 63;
}
static int base64_decode(const uint8_t* src, int len, uint8_t* dest)
{
uint32_t w;
uint8_t t;
int result = 0;
// remove trailing =
while(src[len-1] == '=')
len--;
while(len >= 4)
{
w = (base64_dec_map(src[0]) << 18) |
(base64_dec_map(src[1]) << 12) |
(base64_dec_map(src[2]) << 6) |
base64_dec_map(src[3]);
dest[0] = (w>>16)&0xFF;
dest[1] = (w>>8)&0xFF;
dest[2] = (w)&0xFF;
len -= 4;
src += 4;
dest += 3;
result += 3;
}
if (!len) return result;
if (len == 3)
{
w = (base64_dec_map(src[0]) << 18) |
(base64_dec_map(src[1]) << 12) |
(base64_dec_map(src[2]) << 6) | 0;
dest[0] = (w>>16)&0xFF;
dest[1] = (w>>8)&0xFF;
result+=2;
}
else if (len == 2)
{
w = (base64_dec_map(src[0]) << 18) |
(base64_dec_map(src[1]) << 12) | 0;
dest[0] = (w >> 16) & 0xFF;
result += 1;
}
else
{
// should not happen.
}
return result;
}
| [
"lex.yang@wadacreative.com"
] | lex.yang@wadacreative.com |
0fbd32aa0e2c6322e7807e9840fe01c2bf11b686 | 70f881ddbfc9a4dc4a0e3b044b720aa07a0aee78 | /src/StringCleaner.cpp | 2d9a0e8e310840124b5cba1f7f88a892698f8890 | [] | no_license | maxiejbe/Kaggle-Word2vec | 86be0bb7f8afdac2ae446420aa67d88968b6efb9 | 34d655ca105f9a6b97e47ec5c581020bb3dc1121 | refs/heads/master | 2021-01-10T07:24:28.338768 | 2020-07-26T15:43:38 | 2020-07-26T15:43:38 | 54,922,469 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,250 | cpp | #include "StringCleaner.h"
using namespace std;
using namespace boost;
StringCleaner::StringCleaner()
{
//ctor
}
StringCleaner::~StringCleaner()
{
//dtor
}
void StringCleaner::CleanHTML(string* toClean)
{
regex htmlRegex("<[^>]*>");
*toClean = regex_replace(*toClean, htmlRegex, string(" "));
}
void StringCleaner::CollapseWhiteSpaces(string* toClean)
{
regex collapseSpacesRegex("\\s+");
*toClean = regex_replace(*toClean, collapseSpacesRegex, string(" "));
}
void StringCleaner::CleanNonLetters(string* toClean)
{
regex lettersRegex("[^a-zA-Z0-9']");
*toClean = regex_replace(*toClean, lettersRegex, string(" "));
}
void StringCleaner::CleanApostrophes(string* toClean){
regex lettersRegex("[']");
*toClean = regex_replace(*toClean, lettersRegex, string(""));
}
void StringCleaner::ToLowerCase(string* toClean)
{
algorithm::to_lower(*toClean);
}
void StringCleaner::Trim(string* toClean){
*toClean = trim_left_copy(*toClean);
*toClean = trim_right_copy(*toClean);
}
void StringCleaner::CompleteClean(string* toClean){
CleanHTML(toClean);
CleanNonLetters(toClean);
CleanApostrophes(toClean);
ToLowerCase(toClean);
CollapseWhiteSpaces(toClean);
Trim(toClean);
}
| [
"maxi.ejberowicz@graion.com"
] | maxi.ejberowicz@graion.com |
0771cfdb847a2644f63868cfdaeb3834b0c3a473 | 574329c8282d252cb07d2a193351cb9ad63470a4 | /AstroVolume/Widgets/qMRMLSliceAstroControllerWidget.h | 354c9b23fa1fd29f275455785af4a4ec1d3163eb | [
"BSD-3-Clause"
] | permissive | Punzo/SlicerAstro | 5d322af8792a1cc438ececbbd03ff3e891eac835 | 0ed225c5b1ef14ef9adf389aab3822ef01603eca | refs/heads/master | 2023-02-07T16:44:25.144317 | 2023-02-01T12:38:23 | 2023-02-01T12:38:23 | 31,323,638 | 42 | 6 | BSD-3-Clause | 2020-10-08T19:03:37 | 2015-02-25T16:36:43 | C++ | UTF-8 | C++ | false | false | 1,897 | h | /*==============================================================================
Copyright (c) Kapteyn Astronomical Institute
University of Groningen, Groningen, Netherlands. All Rights Reserved.
See COPYRIGHT.txt
or http://www.slicer.org/copyright/copyright.txt for details.
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.
This file was originally developed by Davide Punzo, Kapteyn Astronomical Institute,
and was supported through the European Research Council grant nr. 291531.
==============================================================================*/
#ifndef __qMRMLSliceAstroControllerWidget_h
#define __qMRMLSliceAstroControllerWidget_h
// qMRMLWidget includes
#include "qMRMLSliceControllerWidget.h"
#include <vtkVersion.h>
class qMRMLSliceAstroControllerWidgetPrivate;
// AstroVolume includes
#include "qSlicerAstroVolumeModuleWidgetsExport.h"
/// \ingroup SlicerAstro_QtModules_AstroVolume_Widgets
class Q_SLICERASTRO_QTMODULES_ASTROVOLUME_WIDGETS_EXPORT qMRMLSliceAstroControllerWidget
: public qMRMLSliceControllerWidget
{
Q_OBJECT
public:
/// Superclass typedef
typedef qMRMLSliceControllerWidget Superclass;
/// Constructors
explicit qMRMLSliceAstroControllerWidget(QWidget* parent = 0);
virtual ~qMRMLSliceAstroControllerWidget();
public slots:
/// Set the display of the WCS coordinate on the slice.
void setWCSDisplay();
protected:
qMRMLSliceAstroControllerWidget(qMRMLSliceAstroControllerWidgetPrivate* pimpl, QWidget* parent = 0);
private:
Q_DECLARE_PRIVATE(qMRMLSliceAstroControllerWidget);
Q_DISABLE_COPY(qMRMLSliceAstroControllerWidget);
};
#endif
| [
"punzodavide@hotmail.it"
] | punzodavide@hotmail.it |
d77a817efe243bfdc35f5e5c93aa60b17d8b23b0 | 0ebfd02c49ed146385a4d2efcc649402004d89c2 | /data types problems in c(lab)/(15,16)c.cpp | 5a0f81cf93b433f1b0c666f35d01e473d0d0114b | [] | no_license | BHAVITHASRRI-1905/data-structures | 35fe629716a5bce415f2318cf3d19aecfdbaf1d5 | b85d3d83b05a1251cbba676a7c1be5acbf8e711a | refs/heads/main | 2023-06-21T19:30:12.742690 | 2021-07-19T02:09:21 | 2021-07-19T02:09:21 | 377,110,390 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,403 | cpp | /*Write a C program that read 5 numbers and counts the number of positive numbers and negative numbers.
.Write a C program that read 5 numbers and find the sum of of positive numbers and negative numbers.*/
#include<stdio.h>
int main(){
int num1,num2,num3,num4,num5,count = 0,sum_p = 0,sum_n = 0;
printf("enter 5 numbers\n");
scanf("%d%d%d%d%d",&num1,&num2,&num3,&num4,&num5);
if (num1>0)
{
printf("positive number\n");
count = count+1;
sum_p = sum_p+num1;
}
else
printf("negative number\n");
sum_n = sum_n+num1;
if (num2>0)
{
printf("positive number\n");
count = count+1;
sum_p = sum_p+num2;
}
else
printf("negative number\n");
sum_n = sum_n+num2;
if(num3>0){
printf("positive number\n");
count = count+1;
sum_p = sum_p+num3;
}
else
printf("negative number\n");
sum_n = sum_n+num3;
if (num4>0){
printf("positive number\n");
count = count+1;
sum_p = sum_p+num4;
}
else
printf("negative number\n");
sum_n = sum_n+num4;
if (num5>0){
printf("positive number\n");
count = count+1;
sum_p = sum_p+num5;
}
else
printf("negative number\n");
sum_n = sum_n+num5;
printf("no.of positive numbers = %d\n",count);
printf("sum of positive numbers = %d\n",sum_p);
printf("no.of negative numbers = %d\n",5-count);
printf("sum of negative numbers = %d\n",sum_n);
return 0;
}
| [
"noreply@github.com"
] | BHAVITHASRRI-1905.noreply@github.com |
1aa46d91e1345858afdbf7001c9e01e1dea06495 | da9bca392e877999877f4d599060537a7e9c9c1e | /code/foundation/memory/win360/win360memoryconfig.h | dad0e21f5517b35aa2119eb56645fea3454ec310 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause"
] | permissive | Aggroo/nebula-trifid | 70ac63d12dcafa6772824d8173344ce4658d2bbc | 51ecc9ac5508a8a1bf09a9063888a80c9e2785f0 | refs/heads/master | 2021-01-17T11:03:12.438183 | 2016-03-03T22:38:19 | 2016-03-03T22:38:19 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 6,964 | h | #pragma once
//------------------------------------------------------------------------------
/**
@file memory/win360/win360memoryconfig.h
Central config file for memory setup on the Win32 and Xbox360 platform.
(C) 2008 Radon Labs GmbH
(C) 2013-2015 Individual contributors, see AUTHORS file
*/
#include "core/config.h"
#include "core/debug.h"
namespace Memory
{
//------------------------------------------------------------------------------
/**
Heap types are defined here. The main purpose for the different heap
types is to decrease memory fragmentation and to improve cache
usage by grouping similar data together. Platform ports may define
platform-specific heap types, as long as only platform specific
code uses those new heap types.
*/
enum HeapType
{
DefaultHeap = 0, // for stuff that doesn't fit into any category
ObjectHeap, // heap for global new allocator
ObjectArrayHeap, // heap for global new[] allocator
ResourceHeap, // heap for resource data (like animation buffers)
ScratchHeap, // for short-lived scratch memory (encode/decode buffers, etc...)
StringDataHeap, // special heap for string data
StreamDataHeap, // special heap for stream data like memory streams, zip file streams, etc...
PhysicsHeap, // physics engine allocations go here
AppHeap, // for general Application layer stuff
NetworkHeap, // for network layer
RocketHeap, // the librocket UI heap
Xbox360GraphicsHeap, // defines special Xbox360 graphical memory
Xbox360AudioHeap, // defines special Xbox360 audio memory
NumHeapTypes,
InvalidHeapType,
};
//------------------------------------------------------------------------------
/**
Heap pointers are defined here. Call ValidateHeap() to check whether
a heap already has been setup, and to setup the heap if not.
*/
extern HANDLE volatile Heaps[NumHeapTypes];
//------------------------------------------------------------------------------
/**
This method is called by SysFunc::Setup() to setup the different heap
types. This method can be tuned to define the start size of the
heaps and whether the heap may grow or not (non-growing heaps may
be especially useful on console platforms without memory paging).
*/
extern void SetupHeaps();
//------------------------------------------------------------------------------
/**
Returns a human readable name for a heap type.
*/
extern const char* GetHeapTypeName(HeapType heapType);
//------------------------------------------------------------------------------
/**
Global PoolArrayAllocator objects, these are all setup in a central
place in the Memory::SetupHeaps() function!
*/
#if NEBULA3_OBJECTS_USE_MEMORYPOOL
class PoolArrayAllocator;
extern PoolArrayAllocator* ObjectPoolAllocator; // Rtti::AllocInstanceMemory() and new operators alloc from here
#endif
//------------------------------------------------------------------------------
/**
Helper function for Heap16 functions: aligns pointer to 16 byte and
writes padding mask to byte before returned pointer.
*/
__forceinline unsigned char*
__HeapAlignPointerAndWritePadding16(unsigned char* ptr)
{
unsigned char paddingMask = DWORD(ptr) & 15;
ptr = (unsigned char*)(DWORD(ptr + 16) & ~15);
ptr[-1] = paddingMask;
return ptr;
}
//------------------------------------------------------------------------------
/**
Helper function for Heap16 functions: "un-aligns" pointer through
the padding mask stored in the byte before the pointer.
*/
__forceinline unsigned char*
__HeapUnalignPointer16(unsigned char* ptr)
{
return (unsigned char*)(DWORD(ptr - 16) | ptr[-1]);
}
//------------------------------------------------------------------------------
/**
HeapAlloc replacement which always returns 16-byte aligned addresses.
NOTE: only works for 32 bit pointers!
*/
__forceinline LPVOID
__HeapAlloc16(HANDLE hHeap, DWORD dwFlags, SIZE_T dwBytes)
{
#if __XBOX360__
return ::HeapAlloc(hHeap, dwFlags, dwBytes);
#else
unsigned char* ptr = (unsigned char*) ::HeapAlloc(hHeap, dwFlags, dwBytes + 16);
ptr = __HeapAlignPointerAndWritePadding16(ptr);
return (LPVOID) ptr;
#endif
}
//------------------------------------------------------------------------------
/**
HeapReAlloc replacement for 16-byte alignment.
NOTE: only works for 32 bit pointers!
*/
__forceinline LPVOID
__HeapReAlloc16(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem, SIZE_T dwBytes)
{
#if __XBOX360__
return HeapReAlloc(hHeap, dwFlags, lpMem, dwBytes);
#else
// restore unaligned pointer
unsigned char* ptr = (unsigned char*) lpMem;
unsigned char* rawPtr = __HeapUnalignPointer16(ptr);
// perform re-alloc, NOTE: if re-allocation can't happen in-place,
// we need to handle the allocation ourselves, in order not to destroy
// the original data because of different alignment!!!
ptr = (unsigned char*) ::HeapReAlloc(hHeap, (dwFlags | HEAP_REALLOC_IN_PLACE_ONLY), rawPtr, dwBytes + 16);
if (0 == ptr)
{
SIZE_T rawSize = ::HeapSize(hHeap, dwFlags, rawPtr);
// re-allocate manually because padding may be different!
ptr = (unsigned char*) ::HeapAlloc(hHeap, dwFlags, dwBytes + 16);
ptr = __HeapAlignPointerAndWritePadding16(ptr);
SIZE_T copySize = dwBytes <= (rawSize - 16) ? dwBytes : (rawSize - 16);
::CopyMemory(ptr, lpMem, copySize);
// release old mem block
::HeapFree(hHeap, dwFlags, rawPtr);
}
else
{
// was re-allocated in place
ptr = __HeapAlignPointerAndWritePadding16(ptr);
}
return (LPVOID) ptr;
#endif
}
//------------------------------------------------------------------------------
/**
HeapFree replacement which always returns 16-byte aligned addresses.
NOTE: only works for 32 bit pointers!
*/
__forceinline BOOL
__HeapFree16(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem)
{
#if __XBOX360__
return ::HeapFree(hHeap, dwFlags, lpMem);
#else
unsigned char* ptr = (unsigned char*) lpMem;
ptr = __HeapUnalignPointer16(ptr);
return ::HeapFree(hHeap, dwFlags, ptr);
#endif
}
//------------------------------------------------------------------------------
/**
HeapSize replacement function.
*/
__forceinline SIZE_T
__HeapSize16(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem)
{
#if __XBOX360__
return ::HeapSize(hHeap, dwFlags, lpMem);
#else
unsigned char* ptr = (unsigned char*) lpMem;
ptr = __HeapUnalignPointer16(ptr);
return ::HeapSize(hHeap, dwFlags, ptr);
#endif
}
} // namespace Memory
//------------------------------------------------------------------------------
| [
"johannes@gscept.com"
] | johannes@gscept.com |
0eec300c847f02686f6433f9181232c62f89f16c | 5a228deb9479ddadd1ef43e8355549979bd92ab6 | /ROS-Tutorial/Tutorial1/src/turtle_vis/src/solutions/turtle_vis_node.cpp | 314a1e81f63bf7329124620fd2ae6973eca1a036 | [] | no_license | hajiejue/ROS-Tutorial | ae0cf0e8d88a529c18acb8352c35371e51308b0f | 88757922ba1a9e06039d19a18dfa9e6b5a7a7405 | refs/heads/master | 2023-01-30T23:49:41.392892 | 2020-12-08T11:50:47 | 2020-12-08T11:50:47 | 319,430,404 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 4,897 | cpp | /*********************************************************************
* Compiler: gcc 4.6.3
*
* Company: Institute for Cognitive Systems
* Technical University of Munich
*
* Author: Emmanuel Dean (dean@tum.de)
* Karinne Ramirez (karinne.ramirez@tum.de)
*
* Compatibility: Ubuntu 12.04 64bit (ros hydro)
*
* Software Version: V0.1
*
* Created: 01.06.2015
*
* Comment: turtle connection and visualization (Sensor and Signals)
*
********************************************************************/
/*********************************************************************
* STD INCLUDES
********************************************************************/
#include <iostream>
#include <fstream>
#include <pthread.h>
/*********************************************************************
* ROS INCLUDES
********************************************************************/
#include <ros/ros.h>
#include <std_msgs/String.h>
#include <visualization_msgs/Marker.h>
#include <visualization_msgs/MarkerArray.h>
#include <tf/transform_listener.h>
#include <tf/transform_broadcaster.h>
#include <tf_conversions/tf_eigen.h>
/*********************************************************************
* CUSTOM CLASS
* ******************************************************************/
//INCLUDE TURTLE CLASS HEADER
#include<turtle_vis/myClass/TurtleClass.h>
#include <std_msgs/String.h>
const visualization_msgs::Marker createMarkerMesh(std::string frame_id, int id, int shape,
double x, double y, double z, /*position*/
double q_w, double q_x, double q_y, double q_z, /*orientation in quatern*/
double s_x, double s_y, double s_z, std::string meshFile/*scale*/)
{
visualization_msgs::Marker marker;
marker.header.frame_id = frame_id;
marker.header.stamp = ros::Time();
marker.ns = "tracker_markers";
marker.id = id;
marker.type = shape;
marker.action = visualization_msgs::Marker::ADD;
marker.pose.position.x = x;
marker.pose.position.y = y;
marker.pose.position.z = z;
marker.pose.orientation.x = q_x;
marker.pose.orientation.y = q_y;
marker.pose.orientation.z = q_z;
marker.pose.orientation.w = q_w;
marker.scale.x = s_x;
marker.scale.y = s_y;
marker.scale.z = s_z;
marker.mesh_resource = meshFile;
marker.color.r = 0;
marker.color.g = 0.7;
marker.color.b = 0.5;
marker.color.a = 1;
marker.lifetime = ros::Duration();
return marker;
}
int main( int argc, char** argv )
{
ros::init(argc, argv, "turtle_visualization",ros::init_options::AnonymousName);
ROS_INFO_STREAM("**Publishing turtle position for rviz..");
ros::NodeHandle n;
ros::Rate r(60);
static tf::TransformBroadcaster br;
tf::Transform transform;
//INITILIZE PUBLISHER FOR THE MARKERS
ros::Publisher marker_pub = n.advertise<visualization_msgs::Marker>("visualization_marker", 1);
visualization_msgs::Marker turtle3D;
turtle3D = createMarkerMesh("/turtle", 12345, visualization_msgs::Marker::MESH_RESOURCE,
/*pos xyz:*/ 0.0, 0.024, -0.021,
/*orientation quatern wxyz*/ 0 ,0 ,0, 1,
/*scale s_x s_y s_z*/ 0.025, 0.025, 0.025,
"package://turtle_vis/meshes/turtle2.dae");
////#>>>>TODO:INSTANTIATE THE TURTLE CLASS WITH THE VARIABLE turtleFunc;
turtleSpace::TurtleClass turtleFunc;
//INIT A SUBSCRIBER TO THE TOPIC "turtle_control" USING THE TURTLE CLASS OBJECT AND THE CALLBACK METHOD
ros::Subscriber sub=n.subscribe("turtle_control",100,
&turtleSpace::TurtleClass::getPose,
&turtleFunc);
tf::Quaternion qtf;
Vector3d turtlePose;
//INITIALIZE TURTLE POSITION
turtlePose<<1,0,0;
//INITIALIZE OBJECT CLASS VARIABLES
Vector3d turtlePose_local;
// turtleFunc.getLocalPose(turtlePose);
// turtleFunc.VARIABLE=turtlePose;
turtleFunc.turtlePose_g=turtlePose;
turtlePose_local=turtlePose;
while(ros::ok())
{
////#>>>>TODO:Get TURTLE POSE GENERATED BY THE CONTROL NODE
turtlePose_local = turtleFunc.getLocalPose();
//Control
qtf.setRPY(0,0,turtlePose_local(2));
transform.setOrigin(tf::Vector3(turtlePose_local(0),turtlePose_local(1),0));
////#>>>>TODO:PUBLISH THE TF FOR THE TURTLE USING transform, parent, child, and ros::Time::now()
br.sendTransform(tf::StampedTransform(transform, ros::Time::now(), "/world", "/turtle"));
////#>>>>TODO:PUBLISH THE TURTLE MARKER
marker_pub.publish(turtle3D);
ros::spinOnce();
r.sleep();
}
return 0;
}
| [
"wudamunb@gmail.com"
] | wudamunb@gmail.com |
304c2871413abfd41b19acfac3bdb32b0b7bbdd8 | 7493c8b5325c375c71cf5d4731e0c00e17ff565a | /Codeforces/121D.cpp | 489c9ec84cca3d002f0093f7c9df5b99064863d9 | [] | no_license | dhruvik1999/Competitive-Programming | a16de6395e2d2f9e743686539db21239a580de9b | 90ee034aa8ecda1990ce7e1cbb03b23125db9e2f | refs/heads/master | 2021-07-16T20:36:55.342370 | 2020-05-06T08:13:28 | 2020-05-06T08:13:28 | 146,222,258 | 1 | 0 | null | 2018-09-10T13:08:17 | 2018-08-26T22:51:58 | C++ | UTF-8 | C++ | false | false | 558 | cpp | #include<bits/stdc++.h>
using namespace std;
#define ll long long
string con(ll n){
string ans = "";
while(n!=0){
ans = ((char)('0'+n%2))+ans;
n=n/2;
}
return ans;
}
ll doWork(ll a){
a++;
ll ans = 0;
ll t;
for(ll i=0;i<62;i++){
t = (a/(1LL<<(i+1)))*(1LL<<i);
t+= max(0LL,a%(1LL<<(i+1))-((1LL<<(i+1))>>1));
if(t%2==1){
ans = ans | (1LL<<i);
}
}
//cout << con(ans) << "\n";
return ans;
}
int main(){
ll l,r;
cin >> l >> r;
ll t1 = doWork(min(l,r)-1);
ll t2 = doWork(max(l,r));
cout << (t1^t2) << "\n";
return 0;
} | [
"navadiyadhruvik2@gmail.com"
] | navadiyadhruvik2@gmail.com |
6b1c858f833803bf2b27de0ca26064b1b43e5b0a | 780cf092b3f1fb27087452ec1ab00465413d3c78 | /hdr_bloom/src/model.h | 8c0febfa8c9cfe973341f0422f82e85f71b417f2 | [] | no_license | Alsdnworks/OpenGL | 4badea909d93485fd4da991573c73e22f569e05c | e6f8a52094fb6fffb983a5adef411fd1267fa46c | refs/heads/master | 2023-06-20T08:53:12.378322 | 2021-07-10T08:22:58 | 2021-07-10T08:22:58 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 736 | h | #ifndef __MODEL_H__
#define __MODEL_H__
#include "common.h"
#include "mesh.h"
#include <assimp/Importer.hpp>
#include <assimp/scene.h>
#include <assimp/postprocess.h>
CLASS_PTR(Model);
class Model {
public:
static ModelUPtr Load(const std::string& filename);
int GetMeshCount() const { return (int)m_meshes.size(); }
MeshPtr GetMesh(int index) const { return m_meshes[index]; }
void Draw(const Program* program) const;
private:
Model() {}
bool LoadByAssimp(const std::string& filename);
void ProcessMesh(aiMesh* mesh, const aiScene* scene);
void ProcessNode(aiNode* node, const aiScene* scene);
std::vector<MeshPtr> m_meshes;
std::vector<MaterialPtr> m_materials;
};
#endif // __MODEL_H__ | [
"AlsdnWorks@gmail.com"
] | AlsdnWorks@gmail.com |
63153b00eec4681e2e46802a5604bb363e7b3eff | a9be3efcfe8581fb4be48fba7333379364019fa6 | /7.reverse-integer.cpp | 9ffa30c97be6648ca1609b7c9aae331ddfb43928 | [] | no_license | 12301098-Heminghui/LeetCode-Cpp | 57b1bef32e8cdc4869f410410f3003486a23a358 | 3d1ea65056f3ecf5672fdefa46cf4de1cb2a6bd3 | refs/heads/master | 2021-08-17T07:12:57.360677 | 2020-05-04T10:16:53 | 2020-05-04T10:16:53 | 175,957,974 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 344 | cpp | #include <math.h>
#include<cmath>
using namespace std;
class Solution {
public:
int reverse(int x) {
int res = 0;
while (x != 0) {
if (res > INT_MAX/10 || res < INT_MIN/10){
return 0;
}
res = res*10 + x%10;
x = x/10;
}
return res;
}
};
| [
"heminghui_i@didichuxing.com"
] | heminghui_i@didichuxing.com |
2ba13b97423b98be7e112c82a32e551897b56144 | 11c5881247676d1081c34432855306e89a9bfb6b | /Lab02_Assignment/SortedList/SortedList.cpp | 3894f7cad5b00f156bc4284ed3060c26464f27ad | [] | no_license | lazyyq/KHU_DS_Lab | 38a80a49b3e1f19d3709c9284450a8a38fe9ef54 | 9e8f268803bdab7ca2b60d65a2373f0e17881b17 | refs/heads/master | 2020-07-30T08:19:05.536776 | 2019-10-06T16:12:59 | 2019-10-10T04:31:39 | 210,151,158 | 0 | 0 | null | null | null | null | UHC | C++ | false | false | 3,629 | cpp | #include "SortedList.h"
SortedList::SortedList()
{
mLength = 0;
ResetIterator();
}
// Make list empty.
void SortedList::MakeEmpty()
{
mLength = 0;
}
// Get a number of records in current list.
int SortedList::GetLength()
{
return mLength;
}
// Check capacity of list is full.
bool SortedList::IsFull()
{
if (mLength > MAXSIZE - 1)
return true;
else
return false;
}
// Check is list is empty.
bool SortedList::IsEmpty() {
return mLength == 0;
}
// add a new data into list.
int SortedList::Add(ItemType inData)
{
if (IsFull()) {
// List is full
return 0;
}
else if (IsEmpty()) {
// Array is empty, just add the data at the very front
mArray[0] = inData;
}
else if (inData > mArray[mLength - 1]) {
// Item is bigger than last item in the list,
// just add to the very back
mArray[mLength] = inData;
}
else {
for (int curIndex = 0; curIndex <= mLength - 1; ++curIndex) {
// Iterate through each item, find a position
// where our item is bigger than the previous item
// and smaller than the next item.
if (inData == mArray[curIndex]) {
// Same item exists, abort since we do not allow duplicates
return 0;
}
else if (inData < mArray[curIndex]) {
// Found
// Push data backwards, make space for our item
PushBackward(curIndex);
mArray[curIndex] = inData;
break;
}
}
}
++mLength;
return 1;
}
// Get data from list using binary search.
int SortedList::Retrieve(ItemType& inData) {
if (IsEmpty() || mArray[mLength - 1] < inData) {
// Either list is empty or its last element's primary key is
// smaller than given data's, so no need to check.
return -1;
}
// Reset iterator
ResetIterator();
ItemType data; // Variable to hold info from list
// Start binary search
int start = 0, mid, end = mLength - 1;
while (start <= end) {
mid = (start + end) / 2;
data = mArray[mid];
if (data < inData) {
start = mid + 1;
}
else if (data > inData) {
end = mid - 1;
}
else {
inData = data;
return mid;
}
}
return -1;
}
// Delete data from list.
int SortedList::Delete(ItemType& inData) {
if (IsEmpty()) {
// List is empty, no need to check
return 0;
}
// Find the position of item that matches inData
int index = Retrieve(inData);
if (index != -1) { // Found
PushForward(index);
--mLength;
}
else { // Not found
return 0;
}
return 1;
}
// Replace data in list.
int SortedList::Replace(ItemType inData) {
if (IsEmpty()) {
// List is empty, no need to check
return 0;
}
ItemType data = inData; // Temporary variable to hold info to search
int index = Retrieve(data);
if (index != -1) { // Found
mArray[index] = inData;
}
else { // Not found
return 0;
}
return 1;
}
// Initialize list iterator.
void SortedList::ResetIterator()
{
mCurPointer = -1;
}
// move list iterator to the next item in list and get that item.
int SortedList::GetNextItem(ItemType& inData)
{
++mCurPointer; // list pointer 증가
if (mCurPointer >= MAXSIZE || mCurPointer >= mLength)
// end of list이거나 list의 마지막 element에 도달하면 -1을 리턴
return -1;
inData = mArray[mCurPointer]; // 현재 list pointer의 레코드를 복사
return mCurPointer;
}
// Move items to the previous index.
void SortedList::PushForward(int startIndex) {
for (int i = startIndex; i < mLength - 1; ++i) {
// Copy each item to the next index
mArray[i] = mArray[i + 1];
}
}
// Move items to the next index.
void SortedList::PushBackward(int startIndex) {
for (int i = mLength; i > startIndex; --i) {
// Copy each item to the previous index
mArray[i] = mArray[i - 1];
}
} | [
"kykint@naver.com"
] | kykint@naver.com |
6135dc39f1c59d97ed37c8f5abcbe979b18004c0 | b06c2b89645a35447ab7e07e4bfdb0e0ebb64fd1 | /Source/Parteh/MainMenuGameMode.h | 942a199fcda166c3dbb7b6594bb54283f30ffced | [
"MIT"
] | permissive | ErnestasJa/PTH_0112 | cc88f20e57ae74e4f489434719423479cb6b0972 | b1d00f55035cbdd89bf5c66269938c9a9253e6ad | refs/heads/master | 2021-07-06T18:53:56.440253 | 2017-09-30T17:56:09 | 2017-09-30T17:56:09 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 310 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/GameModeBase.h"
#include "MainMenuGameMode.generated.h"
/**
*
*/
UCLASS()
class PARTEH_API AMainMenuGameMode : public AGameModeBase
{
GENERATED_BODY()
};
| [
"ernestasjanusevicius@gmail.com"
] | ernestasjanusevicius@gmail.com |
2f8e31c9bccd20bb75a23ca8df927d427a8988b0 | ef187313537d520739b4918e0ef4c0b0041bf4e7 | /C25_GlobalPosition/src/C25_objectTest.cpp | 6e2ccfb8eb393ca49572d4690a3fd7f2a8fc1089 | [] | no_license | robotil/robil | e4a0a4eb92c0758101ecc1963d77142d51ed4c9c | 257cd66266f299fd5f696cd4b5e92fa195237e47 | refs/heads/master | 2021-05-30T13:34:35.303549 | 2013-11-20T06:46:25 | 2013-11-20T06:46:25 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,838 | cpp | #include "ros/ros.h"
#include <image_transport/image_transport.h>
#include <message_filters/synchronizer.h>
#include <message_filters/subscriber.h>
#include <message_filters/sync_policies/approximate_time.h>
#include <sensor_msgs/image_encodings.h>
#include <sensor_msgs/PointCloud2.h>
#include <sensor_msgs/Image.h>
#include <cv_bridge/cv_bridge.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv/cv.h>
#include <opencv/highgui.h>
#include <boost/thread/thread.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/locks.hpp>
#include <pcl/correspondence.h>
#include <pcl/point_cloud.h>
#include <pcl/common/common_headers.h>
#include <pcl/io/pcd_io.h>
#include <pcl/visualization/pcl_visualizer.h>
#include <image_transport/subscriber_filter.h>
#include "geometry_msgs/Point.h"
#include <pcl_ros/point_cloud.h>
#include <pcl/filters/passthrough.h>
#include <pcl/filters/statistical_outlier_removal.h>
#include <pcl_ros/transforms.h>
#include <tf/tf.h>
#include <tf/transform_listener.h>
#include <math.h>
#include <C23_ObjectRecognition/C23C0_ODIM.h>
namespace enc=sensor_msgs::image_encodings;
using namespace tf;
using namespace cv;
Mat *myImage;
void my_mouse_callback( int event, int x, int y, int flags, void* param );
Rect box;
bool drawing_box = false;
bool box_chosen = false;
int x1,y2;
double minx,maxx,miny,maxy;
void draw_box( Mat* img, Rect rect ){
cv::rectangle( *img, rect,
Scalar(255,100,100) );
}
// Implement mouse callback
void my_mouse_callback( int event, int x, int y, int flags, void* param ){
Mat* image = myImage;
switch( event ){
case CV_EVENT_MOUSEMOVE:
if( drawing_box ){
box.width = x-box.x;
box.height = y-box.y;
}
break;
case CV_EVENT_LBUTTONDOWN:
box_chosen = false;
drawing_box = true;
box = cvRect( x, y, 0, 0 );
x1=x;
y2=y;
break;
case CV_EVENT_LBUTTONUP:
drawing_box = false;
if( box.width < 0 ){
box.x += box.width;
box.width *= -1;
}
if( box.height < 0 ){
box.y += box.height;
box.height *= -1;
}
minx=std::min(x1,x);
maxx=std::max(x1,x);
miny=std::min(y2,y);
maxy=std::max(y2,y);
box_chosen = true;
break;
}
}
class C25_objectTest{
public:
C25_objectTest() :
it_(nh_)
{
left_image_sub_= it_.subscribe("/multisense_sl/camera/left/image_color", 1,&C25_objectTest::imagecallback,this );
objpub= nh_.advertise<C23_ObjectRecognition::C23C0_ODIM>("C23/object_deminsions", 1);
objsub=nh_.subscribe("C23/objectLocation", 1,&C25_objectTest::c25Callback,this);
}
void c25Callback(const geometry_msgs::Point::Ptr & msg){
std::cout<<"the object is at x:"<<msg->x<<" y:"<<msg->y<<" z:"<<msg->z<<std::endl;
}
void imagecallback(const sensor_msgs::ImageConstPtr& left_msg){
cv_bridge::CvImagePtr left;
try
{
left = cv_bridge::toCvCopy(left_msg,enc::RGB8);
}
catch (cv_bridge::Exception& e)
{
ROS_ERROR("cv_bridge exception: %s", e.what());
return;
}
myImage=&left->image;
if(box_chosen)
draw_box( myImage, box );
imshow("Window",*myImage);
if(!box_chosen)
return;
C23_ObjectRecognition::C23C0_ODIM msg;
msg.x=minx;
msg.y=miny;
msg.height=maxy-miny;
msg.width=maxx-minx;
objpub.publish(msg);
}
private:
ros::NodeHandle nh_;
image_transport::ImageTransport it_;
typedef image_transport::Subscriber ImageSubscriber;
ImageSubscriber left_image_sub_;
ros::Publisher objpub;
ros::Subscriber objsub;
};
int main(int argc, char* argv[])
{
ros::init(argc, argv,"cloud_fetch");
const char* name = "Window";
box = cvRect(-1,-1,0,0);
C25_objectTest *cf=new C25_objectTest;
cvNamedWindow( "Window" );
cvStartWindowThread();
// Set up the callback
cvSetMouseCallback( name, my_mouse_callback, (void*) myImage);
while(ros::ok()){
ros::spin();
}
// Main loop
cvDestroyWindow( name );
return 0;
}
| [
"odedyec@gmail.com"
] | odedyec@gmail.com |
f41c09119650beff0df223dd794d506c9c2b78a2 | c106e477330358a00357a14c6361b5f18c1a3314 | /KSPCtrl/KSPCtrl/KSPCtrl.ino | a4127c4c1125e3559d5a0ca891e9214d3da55e46 | [] | no_license | FreshmeatDK/Arduino | 37afaca20f86d370a01f68701eaa3a0c9f942ce7 | 8660eaa57077f0258fe0410beba6a4d904d3e70d | refs/heads/master | 2020-04-04T15:03:08.694721 | 2018-11-23T18:04:38 | 2018-11-23T18:04:38 | 156,023,078 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 3,861 | ino | /*
Name: KSPCtrl.ino
Created: 11/3/2018 9:57:35 PM
Author: Jesper
*/
#include <Joystick.h>
#include <Key.h>
#include <Keypad.h>
#include <Wire.h>
#include <SPI.h>
#include <FastLED.h>
#include <LedControl.h>
#include <NewLiquidCrystal/LiquidCrystal_I2C.h>
#include <avr\dtostrf.h>
//I2C adresses
#define RTCADR 0x68
// pin definitions
// PWR for gauges
#define CHARGE 4
#define MONO 5
#define SPEED 6
#define ALT 7
// 74hc165
#define SS1 46
#define CLKI 48
// CD4021
#define SS2 45
#define CLK 27
#define DTA 25
// FastLed
#define LEDPIN 23
// LedControl
#define LCCLK 43
#define LCCS 39
#define LCDATA 41
//Joystick buttons
#define JOY1BTN 50
#define JOY2BTN 42
#define JOY2FWD 38
#define JOY2BCK 40
// analog pins
#define TRIMYAW 2
#define TRIMPITCH 3
#define TRIMROLL 1
#define TRIMENGINE 0
#define JOY1X 4
#define JOY1Y 5
#define JOY1Z 6
#define THROTTLE 7
#define JOY2X 8
#define JOY2Y 9
// number of units attached
#define NUMLC 3
#define NUMLEDS 36
#define NUMIC1 4
#define NUMIC2 1
//other defs
#define TIMEOUT 10000
//vars
typedef struct
{
uint32_t pcount; //packet number
float ap; //apoapsis
float pe; //periapsis
uint32_t tap; //time to ap
uint32_t tpe; //time to pe
float alt; //mean altitude
float alts; //surface altitude
float vorb; //orbital speed
float vsurf; //surface speed
} VesselData;
VesselData VData;
struct ControlPacket
{
int8_t pitch;
int8_t yaw;
int8_t roll;
int8_t tx;
int8_t ty;
int8_t tz;
int8_t throttle;
uint8_t toggles[5];
};
ControlPacket Cpacket;
byte second = 0, minute, hour = 0, dayOfWeek, dayOfMonth, month, year; // bytes to hold RT clock
char key; // keypress buffer
char cmdStr[19]; // command string to pass
byte cmdStrIndex = 0; //current lenght of cmdStr
int trimY, trimP, trimR, trimE;
long timeout = 0; //timeout counter
bool connected, displayoff; // are we connected and are we in blackout
int bufferlenght;
char keys[5][8] = {
{ '7', '8', '9', '-', ',', '.', 'S', 'M' },
{ '4', '5', '6', 'c', 'v', 'V', 'P', 'R' },
{ '1', '2', '3', 91, 93, 'B', 'I', 'O' },
{ '0', '*', '#', 'm', 'T', 'B', 'N', 'A' },
{ 'W', 's', 'x', 'q', 'v', 'r', 'g', 'G' }
};
byte rowPins[5] = { 35, 33, 31, 29, 37 };
byte colPins[8] = { 26, 24, 22, 30, 28, 32, 34, 36 };
// objects
CRGB leds[NUMLEDS], oldLeds[NUMLEDS]; // Array of WS2811
byte dataIn[NUMIC1 + NUMIC2]; // Byte array of spi inputs
byte dataOld[NUMIC1 + NUMIC2]; //testing array
LedControl lc = LedControl(LCDATA, LCCLK, LCCS, NUMLC);
LiquidCrystal_I2C lcd(0x27, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // set the LCD address to 0x27
LiquidCrystal_I2C lcd2(0x23, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); // set the LCD address to 0x23
Keypad keymain(makeKeymap(keys), rowPins, colPins, 5, 8);
void setup()
{
Serial.begin(28800);
// Meter init
pinMode(CHARGE, OUTPUT);
analogWrite(CHARGE, 0);
pinMode(MONO, OUTPUT);
analogWrite(MONO, 0);
pinMode(SPEED, OUTPUT);
analogWrite(SPEED, 0);
pinMode(ALT, OUTPUT);
analogWrite(ALT, 0);
//Joystick init
pinMode(JOY1BTN, INPUT);
pinMode(JOY2BTN, INPUT);
pinMode(JOY2FWD, INPUT);
pinMode(JOY2BCK, INPUT);
// LCD init
lcd.begin(20, 4);
lcd.backlight();
lcd2.begin(20, 4);
lcd2.backlight();
// SPI init
SPI.begin();
pinMode(SS1, OUTPUT);
pinMode(SS2, OUTPUT);
pinMode(CLKI, OUTPUT);
pinMode(CLK, OUTPUT);
pinMode(DTA, INPUT);
//LED strip init
FastLED.addLeds<NEOPIXEL, LEDPIN>(leds, NUMLEDS);
//7seg LED init
for (int i = 0; i < NUMLC; i++)
{
lc.shutdown(i, false);
lc.setIntensity(i, 1);
lc.clearDisplay(i);
}
}
// Add the main program code into the continuous loop() function
void loop()
{
serialcoms();
//connected = true;
if (connected)
{
if (displayoff) reLight();
toggles();
StatusToggles();
Joysticks();
chkKeypad();
execCmd();
LCD1Rocket();
testSerial();
}
else
{
blackout();
}
printTime();
}
| [
"jkroghp@hotmail.com"
] | jkroghp@hotmail.com |
60f41480b75903066ccc7ea174a8976fd4b3e8c6 | ba9322f7db02d797f6984298d892f74768193dcf | /emr/src/model/RunETLJobRequest.cc | e8e7ed7a113a0432dccf2eebc71662b335e3a27e | [
"Apache-2.0"
] | permissive | sdk-team/aliyun-openapi-cpp-sdk | e27f91996b3bad9226c86f74475b5a1a91806861 | a27fc0000a2b061cd10df09cbe4fff9db4a7c707 | refs/heads/master | 2022-08-21T18:25:53.080066 | 2022-07-25T10:01:05 | 2022-07-25T10:01:05 | 183,356,893 | 3 | 0 | null | 2019-04-25T04:34:29 | 2019-04-25T04:34:28 | null | UTF-8 | C++ | false | false | 2,479 | cc | /*
* Copyright 2009-2017 Alibaba Cloud 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 <alibabacloud/emr/model/RunETLJobRequest.h>
using AlibabaCloud::Emr::Model::RunETLJobRequest;
RunETLJobRequest::RunETLJobRequest() :
RpcServiceRequest("emr", "2016-04-08", "RunETLJob")
{}
RunETLJobRequest::~RunETLJobRequest()
{}
long RunETLJobRequest::getResourceOwnerId()const
{
return resourceOwnerId_;
}
void RunETLJobRequest::setResourceOwnerId(long resourceOwnerId)
{
resourceOwnerId_ = resourceOwnerId;
setParameter("ResourceOwnerId", std::to_string(resourceOwnerId));
}
std::vector<RunETLJobRequest::InstanceRunParam> RunETLJobRequest::getInstanceRunParam()const
{
return instanceRunParam_;
}
void RunETLJobRequest::setInstanceRunParam(const std::vector<InstanceRunParam>& instanceRunParam)
{
instanceRunParam_ = instanceRunParam;
int i = 0;
for(int i = 0; i!= instanceRunParam.size(); i++) {
auto obj = instanceRunParam.at(i);
std::string str ="InstanceRunParam."+ std::to_string(i);
setParameter(str + ".Value", obj.value);
setParameter(str + ".Key", obj.key);
}
}
std::string RunETLJobRequest::getRegionId()const
{
return regionId_;
}
void RunETLJobRequest::setRegionId(const std::string& regionId)
{
regionId_ = regionId;
setParameter("RegionId", regionId);
}
bool RunETLJobRequest::getIsDebug()const
{
return isDebug_;
}
void RunETLJobRequest::setIsDebug(bool isDebug)
{
isDebug_ = isDebug;
setParameter("IsDebug", std::to_string(isDebug));
}
std::string RunETLJobRequest::getId()const
{
return id_;
}
void RunETLJobRequest::setId(const std::string& id)
{
id_ = id;
setParameter("Id", id);
}
std::string RunETLJobRequest::getAccessKeyId()const
{
return accessKeyId_;
}
void RunETLJobRequest::setAccessKeyId(const std::string& accessKeyId)
{
accessKeyId_ = accessKeyId;
setParameter("AccessKeyId", accessKeyId);
}
| [
"haowei.yao@alibaba-inc.com"
] | haowei.yao@alibaba-inc.com |
298e005c85a97824dafd87fccc1692584a105fa1 | cbbb378784d37056bb8a20d3a7acbc4eeb4925ec | /Project1/Project1/test/charToUint.cpp | c52b7127d2fd87e32c2a5a860850dcf057d4a2a8 | [] | no_license | jr2339/Memory-Management | a827c621db000e13ebe3574cc958619bfd47644f | cf8a5abc8807f0ff950b386dffbcd2dbe327ec05 | refs/heads/master | 2021-01-19T18:38:37.260943 | 2017-05-03T23:24:36 | 2017-05-03T23:24:36 | 88,371,524 | 2 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 461 | cpp | #include <stdint.h>
#include <cstdio>
uint64_t charsToUint64(unsigned char *chars, char numChars){
uint64_t uintVal = 0;
for(int i = 0; i < numChars; i++){
uintVal = uintVal | (chars[i] << ((numChars-(i+1))*8));
}
return uintVal;
}
int main(int argc, char **argv){
// In binary: 00000001 00001010 11001010 : should equal 68298
unsigned char charArray[3] = {1,10,202};
uint64_t myInt = charsToUint64(charArray, 3);
printf("%lu\n",myInt);
}
| [
"as2544@nau.edu"
] | as2544@nau.edu |
272016ba8ca6b645ea7d47d139e1c7414e0c7b1c | 5f2103b1083b088aed3f3be145d01a770465c762 | /31. Next Permutation.cpp | ef70105b9df36124d1996f9be9f80bd255e531cf | [] | no_license | supersj/LeetCode | 5605c9bcb5ddcaa83625de2ad9e06c3485220019 | 690adf05774a1c500d6c9160223dab7bcc38ccc1 | refs/heads/master | 2021-01-17T17:23:39.585738 | 2017-02-27T15:08:42 | 2017-02-27T15:08:42 | 65,526,089 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 844 | cpp | #include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
class Solution {
public:
void nextPermutation(vector<int>& nums) {
int len = nums.size();
int leftIndex = len;
for (int i = len - 1; i >= 1; i--) {
if (nums[i] > nums[i - 1])
{
leftIndex = i - 1;
break;
}
}
if (leftIndex == len)
{
reverse(nums.begin(), nums.end());
return;
}
for (int i = len - 1; i >= 1; i--) {
if (nums[i] > nums[leftIndex])
{
int tmp = nums[i];
nums[i] = nums[leftIndex];
nums[leftIndex] = tmp;
sort(nums.begin()+leftIndex+1,nums.end());
return;
}
}
}
}; | [
"sjzj1992@163.com"
] | sjzj1992@163.com |
87edecf120ed761857284e754ac70eaaf9f820bd | 97a569fe525b017307d33322d0cbc810c88b2bc6 | /src/core/integrators/bidirectional_path_tracer/PathVertex.cpp | a96ffdb10c106bf5c273bfe9056b3c1c786f5a47 | [
"BSL-1.0",
"Apache-2.0",
"LicenseRef-scancode-public-domain",
"BSD-3-Clause",
"MIT",
"Zlib",
"Unlicense",
"LicenseRef-scancode-warranty-disclaimer",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | ProjectAsura/tungsten | e564279219725946ab3282fcdadb3c30da59a210 | 30790940bf06779fb04de96d84a4c73257186ff4 | refs/heads/master | 2020-12-11T07:53:29.842678 | 2015-07-05T16:54:53 | 2015-07-05T16:54:53 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 8,799 | cpp | #include "PathVertex.hpp"
#include "PathEdge.hpp"
#include "integrators/TraceState.hpp"
#include "integrators/TraceBase.hpp"
#include "primitives/Primitive.hpp"
#include "renderer/TraceableScene.hpp"
#include "sampling/PathSampleGenerator.hpp"
#include "cameras/Camera.hpp"
#include "volume/Medium.hpp"
namespace Tungsten {
bool PathVertex::sampleRootVertex(TraceState &state)
{
switch (_type) {
case EmitterVertex: {
EmitterRecord &record = _record.emitter;
if (!_sampler.emitter->samplePosition(state.sampler, record.point))
return false;
// Infinite light sources are slightly awkward, because they sample
// a direction before sampling a position. The sampling interfaces
// don't directly allow for this, so the samplePosition samples
// both direction and position, and we use sampleDirection to retrieve
// the sampled direction. The pdfs/weights are then set appropriately
// (direction pdf for the first vertex, position pdf for the next vertex)
// Note that directional pdfs for infinite area lights are always in
// solid angle measure.
if (_sampler.emitter->isInfinite()) {
if (!_sampler.emitter->sampleDirection(state.sampler, record.point, record.direction))
return false;
_throughput = record.direction.weight/record.emitterPdf;
_pdfForward = record.direction.pdf*record.emitterPdf;
} else {
_throughput = record.point.weight/record.emitterPdf;
_pdfForward = record.point.pdf*record.emitterPdf;
}
return true;
} case CameraVertex: {
CameraRecord &record = _record.camera;
if (!_sampler.camera->samplePosition(state.sampler, record.point))
return false;
_throughput = record.point.weight;
_pdfForward = record.point.pdf;
return true;
} default:
return false;
}
}
bool PathVertex::sampleNextVertex(const TraceableScene &scene, TraceBase &tracer, TraceState &state, bool adjoint,
PathVertex *prev, PathEdge *prevEdge, PathVertex &next, PathEdge &nextEdge)
{
Vec3f weight;
float pdf;
switch (_type) {
case EmitterVertex: {
EmitterRecord &record = _record.emitter;
if (_sampler.emitter->isInfinite()) {
weight = record.point.weight;
pdf = record.point.pdf;
} else {
if (!_sampler.emitter->sampleDirection(state.sampler, record.point, record.direction))
return false;
weight = record.direction.weight;
pdf = record.direction.pdf;
}
state.ray = Ray(record.point.p, record.direction.d);
break;
} case CameraVertex: {
CameraRecord &record = _record.camera;
if (!_sampler.camera->sampleDirection(state.sampler, record.point, record.pixel, record.direction))
return false;
weight = record.direction.weight;
pdf = record.direction.pdf;
state.ray = Ray(record.point.p, record.direction.d);
state.ray.setPrimaryRay(true);
break;
} case SurfaceVertex: {
SurfaceRecord &record = _record.surface;
if (record.info.primitive->isInfinite())
return false;
Vec3f scatterWeight(1.0f);
Vec3f emission(0.0f);
bool scattered = tracer.handleSurface(record.event, record.data, record.info,
state.medium, state.bounce, adjoint, false, state.ray,
scatterWeight, emission, state.wasSpecular, state.mediumState);
if (!scattered)
return false;
prev->_pdfBackward = _sampler.bsdf->pdf(record.event.makeFlippedQuery());
_dirac = record.event.sampledLobe.isPureSpecular();
if (!_dirac && !prev->isInfiniteEmitter())
prev->_pdfBackward *= prev->cosineFactor(prevEdge->d)/prevEdge->rSq;
weight = record.event.weight;
pdf = record.event.pdf;
break;
} case VolumeVertex: {
VolumeScatterEvent &record = _record.volume;
// TODO: Participating media
prev->_pdfBackward = _sampler.medium->phasePdf(_record.volume.makeFlippedQuery())
*prev->cosineFactor(prevEdge->d)/prevEdge->rSq;
weight = record.weight;
pdf = record.pdf;
return false;
} default:
return false;
}
SurfaceRecord record;
if (scene.intersect(state.ray, record.data, record.info)) {
record.event = tracer.makeLocalScatterEvent(record.data, record.info, state.ray, &state.sampler);
next = PathVertex(record.info.bsdf, record, _throughput*weight);
next._record.surface.event.info = &next._record.surface.info;
state.bounce++;
nextEdge = PathEdge(*this, next);
next._pdfForward = pdf;
if (!_dirac && !isInfiniteEmitter())
next._pdfForward *= next.cosineFactor(nextEdge.d)/nextEdge.rSq;
return true;
} else if (!adjoint && scene.intersectInfinites(state.ray, record.data, record.info)) {
next = PathVertex(record.info.bsdf, record, _throughput*weight);
state.bounce++;
nextEdge = PathEdge(state.ray.dir(), 1.0f, 1.0f);
next._pdfForward = pdf;
return true;
} else {
return false;
}
}
Vec3f PathVertex::eval(const Vec3f &d, bool adjoint) const
{
switch (_type) {
case EmitterVertex:
if (_sampler.emitter->isInfinite())
return _sampler.emitter->evalPositionalEmission(_record.emitter.point);
else
return _sampler.emitter->evalDirectionalEmission(_record.emitter.point, DirectionSample(d));
case CameraVertex:
return Vec3f(0.0f);
case SurfaceVertex:
return _sampler.bsdf->eval(_record.surface.event.makeWarpedQuery(
_record.surface.event.wi,
_record.surface.event.frame.toLocal(d)),
adjoint);
case VolumeVertex:
return _sampler.medium->phaseEval(_record.volume.makeWarpedQuery(_record.volume.wi, d));
default:
return Vec3f(0.0f);
}
}
void PathVertex::evalPdfs(const PathVertex *prev, const PathEdge *prevEdge, const PathVertex &next,
const PathEdge &nextEdge, float *forward, float *backward) const
{
switch (_type) {
case EmitterVertex:
if (_sampler.emitter->isInfinite())
// Positional pdf is constant for a fixed direction, which is the case
// for connections to a point on an infinite emitter
*forward = _record.emitter.point.pdf;
else
*forward = next.cosineFactor(nextEdge.d)/nextEdge.rSq*
_sampler.emitter->directionalPdf(_record.emitter.point, DirectionSample(nextEdge.d));
break;
case CameraVertex:
*forward = next.cosineFactor(nextEdge.d)/nextEdge.rSq*
_sampler.camera->directionPdf(_record.camera.point, DirectionSample(nextEdge.d));
break;
case SurfaceVertex: {
const SurfaceScatterEvent &event = _record.surface.event;
Vec3f dPrev = event.frame.toLocal(-prevEdge->d);
Vec3f dNext = event.frame.toLocal(nextEdge.d);
*forward = _sampler.bsdf->pdf(event.makeWarpedQuery(dPrev, dNext));
*backward = _sampler.bsdf->pdf(event.makeWarpedQuery(dNext, dPrev));
if (!next .isInfiniteEmitter()) *forward *= next .cosineFactor(nextEdge .d)/nextEdge .rSq;
if (!prev->isInfiniteEmitter()) *backward *= prev->cosineFactor(prevEdge->d)/prevEdge->rSq;
break;
} case VolumeVertex: {
const VolumeScatterEvent &event = _record.volume;
Vec3f dPrev = -prevEdge->d;
Vec3f dNext = nextEdge.d;
*forward = next .cosineFactor(nextEdge .d)/nextEdge .rSq*
_sampler.medium->phasePdf(event.makeWarpedQuery(dPrev, dNext));
*backward = prev->cosineFactor(prevEdge->d)/prevEdge->rSq*
_sampler.medium->phasePdf(event.makeWarpedQuery(dNext, dPrev));
break;
}}
}
Vec3f PathVertex::pos() const
{
switch (_type) {
case EmitterVertex:
return _record.emitter.point.p;
case CameraVertex:
return _record.camera.point.p;
case SurfaceVertex:
return _record.surface.info.p;
case VolumeVertex:
return _record.volume.p;
default:
return Vec3f(0.0f);
}
}
float PathVertex::cosineFactor(const Vec3f &d) const
{
switch (_type) {
case EmitterVertex:
return std::abs(_record.emitter.point.Ng.dot(d));
case CameraVertex:
return std::abs(_record.camera.point.Ng.dot(d));
case SurfaceVertex:
return std::abs(_record.surface.info.Ng.dot(d));
case VolumeVertex:
return 1.0f;
default:
return 0.0f;
}
}
}
| [
"mail@noobody.org"
] | mail@noobody.org |
e64f4e59f5dba3bce82c83cc2290b0ee2febc6e6 | 83297e194f9840ca190b4e0d534a2928f6bebf8f | /unit-tests.wsjcpp/src/unit_test_basic.cpp | 13b48d368e73aa4a0a78bbf2625ae286f982f8ca | [
"MIT"
] | permissive | wsjcpp/wsjcpp-levenshtein | 7e87b8c8bbf59628a9334520a240144419964ca3 | dd16bb573377d6e7418f142de3ea1cf731092b83 | refs/heads/master | 2020-12-19T04:56:54.988996 | 2020-09-20T08:58:28 | 2020-09-20T08:58:28 | 235,627,466 | 1 | 0 | MIT | 2020-09-20T08:58:29 | 2020-01-22T17:32:19 | C++ | UTF-8 | C++ | false | false | 1,547 | cpp | #include "unit_test_basic.h"
#include <vector>
#include <iostream>
#include <wsjcpp_levenshtein.h>
REGISTRY_WSJCPP_UNIT_TEST(UnitTestBasic)
UnitTestBasic::UnitTestBasic()
: WsjcppUnitTestBase("UnitTestBasic") {
//
}
// ---------------------------------------------------------------------
bool UnitTestBasic::doBeforeTest() {
// nothing
return true;
}
// ---------------------------------------------------------------------
void UnitTestBasic::executeTest() {
struct LineTest {
LineTest(std::string s1, std::string s2, int nExpectedDistance)
: s1(s1), s2(s2), nExpectedDistance(nExpectedDistance) {}
std::string s1;
std::string s2;
int nExpectedDistance;
};
std::vector<LineTest> vTestLines;
vTestLines.push_back(LineTest("test", "test", 0));
vTestLines.push_back(LineTest("tttt", "aaaa", 4));
vTestLines.push_back(LineTest("ta", "t0", 1));
vTestLines.push_back(LineTest("taf", "t0", 2));
vTestLines.push_back(LineTest("111111111111111", "1111111112111111", 1));
vTestLines.push_back(LineTest("!@#$%^&*()_+", "!@#%$^&*()+", 3));
for (unsigned int i = 0; i < vTestLines.size(); i++) {
LineTest test = vTestLines[i];
int nGotDistance = WsjcppLevenshtein::distance(test.s1, test.s2);
compare("compare " + std::to_string(i), nGotDistance, test.nExpectedDistance);
}
}
// ---------------------------------------------------------------------
bool UnitTestBasic::doAfterTest() {
// nothing
return true;
} | [
"mrseakg@gmail.com"
] | mrseakg@gmail.com |
2c00163da3940de8d05aab3ac368a935924d0941 | 48580127d8146f07d31a4bc43cf9edae95961047 | /RachitGoyal/HackerRank/Insert a node at a specific position in a linked list.cpp | 15e3a27701b93de5015abf94e7964f5d6c4fc8d0 | [] | no_license | Bhawna11agg/Uplift-Project | b169ef9973f9b5fe569c6ad3864d21626d078bf9 | 04df721783074ad81f62cf014534dfb8d3a7660e | refs/heads/master | 2022-12-12T12:58:17.116477 | 2020-09-01T13:56:49 | 2020-09-01T13:56:49 | 270,994,809 | 11 | 23 | null | 2020-08-24T04:32:58 | 2020-06-09T12:20:09 | C++ | UTF-8 | C++ | false | false | 2,801 | cpp | #include <bits/stdc++.h>
using namespace std;
class SinglyLinkedListNode {
public:
int data;
SinglyLinkedListNode *next;
SinglyLinkedListNode(int node_data) {
this->data = node_data;
this->next = nullptr;
}
};
class SinglyLinkedList {
public:
SinglyLinkedListNode *head;
SinglyLinkedListNode *tail;
SinglyLinkedList() {
this->head = nullptr;
this->tail = nullptr;
}
void insert_node(int node_data) {
SinglyLinkedListNode* node = new SinglyLinkedListNode(node_data);
if (!this->head) {
this->head = node;
} else {
this->tail->next = node;
}
this->tail = node;
}
};
void print_singly_linked_list(SinglyLinkedListNode* node, string sep, ofstream& fout) {
while (node) {
fout << node->data;
node = node->next;
if (node) {
fout << sep;
}
}
}
void free_singly_linked_list(SinglyLinkedListNode* node) {
while (node) {
SinglyLinkedListNode* temp = node;
node = node->next;
free(temp);
}
}
// Complete the insertNodeAtPosition function below.
/*
* For your reference:
*
* SinglyLinkedListNode {
* int data;
* SinglyLinkedListNode* next;
* };
*
*/
SinglyLinkedListNode* insertNodeAtPosition(SinglyLinkedListNode* head, int data, int position) {
SinglyLinkedListNode* newnode=new SinglyLinkedListNode(data);
SinglyLinkedListNode* temp=head;
newnode->data=data;
if(head==NULL)
{
return newnode;
}
if(position==0)
{
newnode->next=head;
return newnode;
}
while(temp->next!=NULL and position-1 >0 )
{
temp=temp->next;
position--;
}
newnode->next=temp->next;
temp->next=newnode;
return head;
}
int main()
{
ofstream fout(getenv("OUTPUT_PATH"));
SinglyLinkedList* llist = new SinglyLinkedList();
int llist_count;
cin >> llist_count;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
for (int i = 0; i < llist_count; i++) {
int llist_item;
cin >> llist_item;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
llist->insert_node(llist_item);
}
int data;
cin >> data;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
int position;
cin >> position;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
SinglyLinkedListNode* llist_head = insertNodeAtPosition(llist->head, data, position);
print_singly_linked_list(llist_head, " ", fout);
fout << "\n";
free_singly_linked_list(llist_head);
fout.close();
return 0;
}
| [
"noreply@github.com"
] | Bhawna11agg.noreply@github.com |
1051e44c7665d969dfcceaef4dde6bee1dec7173 | 4d1614ba0104bb2b4528b32fa0a2a1e8caa3bfa3 | /code/bess-v1/core/modules/mttest.cc | 589f5426184ef246afa61ee42402ffed5912b3e0 | [
"BSD-3-Clause",
"MIT"
] | permissive | Lossless-Virtual-Switching/Backdraft | c292c87f8d483a5dbd8d28009cb3b5e263e7fb36 | 4cedd1403c7c9fe5e1afc647e374173c7c5c46f0 | refs/heads/master | 2023-05-24T03:27:49.553264 | 2023-03-01T14:59:00 | 2023-03-01T14:59:00 | 455,533,889 | 11 | 4 | MIT | 2022-04-20T16:34:22 | 2022-02-04T12:09:31 | C | UTF-8 | C++ | false | false | 3,595 | cc | // Copyright (c) 2014-2016, The Regents of the University of California.
// Copyright (c) 2016-2017, Nefeli Networks, 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 names of the copyright holders nor the names of their
// 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 HOLDER 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.
#include "mttest.h"
#include <glog/logging.h>
CommandResponse MetadataTest::AddAttributes(
const google::protobuf::Map<std::string, int64_t> &attributes,
Attribute::AccessMode mode) {
for (const auto &kv : attributes) {
int ret;
const char *attr_name = kv.first.c_str();
int attr_size = kv.second;
ret = AddMetadataAttr(attr_name, attr_size, mode);
if (ret < 0)
return CommandFailure(-ret, "invalid metadata declaration");
/* check /var/log/syslog for log messages */
switch (mode) {
case Attribute::AccessMode::kRead:
LOG(INFO) << "module " << name() << ": " << attr_name << ", "
<< attr_size << " bytes, read" << std::endl;
break;
case Attribute::AccessMode::kWrite:
LOG(INFO) << "module " << name() << ": " << attr_name << ", "
<< attr_size << " bytes, write" << std::endl;
break;
case Attribute::AccessMode::kUpdate:
LOG(INFO) << "module " << name() << ": " << attr_name << ", "
<< attr_size << " bytes, update" << std::endl;
break;
}
}
return CommandSuccess();
}
CommandResponse MetadataTest::Init(const bess::pb::MetadataTestArg &arg) {
CommandResponse err;
err = AddAttributes(arg.read(), Attribute::AccessMode::kRead);
if (err.error().code() != 0) {
return err;
}
err = AddAttributes(arg.write(), Attribute::AccessMode::kWrite);
if (err.error().code() != 0) {
return err;
}
err = AddAttributes(arg.update(), Attribute::AccessMode::kUpdate);
if (err.error().code() != 0) {
return err;
}
return CommandSuccess();
}
void MetadataTest::ProcessBatch(Context *ctx, bess::PacketBatch *batch) {
/* This module simply passes packets from input gate X down
* to output gate X (the same gate index) */
RunChooseModule(ctx, ctx->current_igate, batch);
}
ADD_MODULE(MetadataTest, "mt_test", "Dynamic metadata test module")
| [
"sarsanaee@gmail.com"
] | sarsanaee@gmail.com |
514c1b7fc4ce90a6965cc11e40b7f4285c3d2b6e | c6ecad18dd41ea69c22baf78dfeb95cf9ba547d0 | /src/boost_1_42_0/libs/math/test/erf_large_data.ipp | ef4ea8b3a5f138ecf7d95558028ad8ddab8782a6 | [
"BSL-1.0"
] | permissive | neuschaefer/qnap-gpl | b1418d504ebe17d7a31a504d315edac309430fcf | 7bb76f6cfe7abef08777451a75924f667cca335b | refs/heads/master | 2022-08-16T17:47:37.015870 | 2020-05-24T18:56:05 | 2020-05-24T18:56:05 | 266,605,194 | 3 | 2 | null | null | null | null | UTF-8 | C++ | false | false | 30,804 | ipp | // (C) Copyright John Maddock 2006-7.
// Use, modification and distribution are subject to 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)
#define SC_(x) static_cast<T>(BOOST_JOIN(x, L))
static const boost::array<boost::array<T, 3>, 300> erf_large_data = { {
{ SC_(8.2311115264892578125), SC_(0.9999999999999999999999999999997436415644), SC_(0.2563584356432915693836191701249115171878e-30) },
{ SC_(8.3800067901611328125), SC_(0.9999999999999999999999999999999787664373), SC_(0.212335626810981756102114466368867764939e-31) },
{ SC_(8.39224529266357421875), SC_(0.9999999999999999999999999999999827316301), SC_(0.1726836993826464997300336080711750877816e-31) },
{ SC_(8.66370105743408203125), SC_(0.9999999999999999999999999999999998367494), SC_(0.1632506054605993373182936619108145081694e-33) },
{ SC_(8.9759693145751953125), SC_(0.9999999999999999999999999999999999993611), SC_(0.6389109854135105643535885036658544645608e-36) },
{ SC_(9.1102085113525390625), SC_(0.9999999999999999999999999999999999999445), SC_(0.5554662272164108694298027082501260363284e-37) },
{ SC_(9.45745944976806640625), SC_(0.9999999999999999999999999999999999999999), SC_(0.8480477594433168680596946662186145070498e-40) },
{ SC_(10.61029338836669921875), SC_(1), SC_(0.6786472703144874611591306359565011820753e-50) },
{ SC_(10.8140201568603515625), SC_(1), SC_(0.8470069870191149998048954134093763207838e-52) },
{ SC_(10.82457828521728515625), SC_(1), SC_(0.6733586817565831939437647508350297170672e-52) },
{ SC_(10.9283580780029296875), SC_(1), SC_(0.6977670213613499261034444110870077646237e-53) },
{ SC_(10.98818302154541015625), SC_(1), SC_(0.1870385270398381154229086866501074415355e-53) },
{ SC_(11.31863117218017578125), SC_(1), SC_(0.1142544869245536263179923727458113771164e-56) },
{ SC_(11.69488239288330078125), SC_(1), SC_(0.1919907987324948057617154107998359393185e-60) },
{ SC_(11.78605365753173828125), SC_(1), SC_(0.2239752724414047638235296360419194553396e-61) },
{ SC_(12.1997470855712890625), SC_(1), SC_(0.1061491854672859805410277580039105082623e-65) },
{ SC_(12.4239101409912109375), SC_(1), SC_(0.4177140558891845034847722323657671701092e-68) },
{ SC_(13.54282093048095703125), SC_(1), SC_(0.9235451601555197945993611934762413642509e-81) },
{ SC_(14.22005176544189453125), SC_(1), SC_(0.6009313847910459672567608314935750835662e-89) },
{ SC_(14.22926807403564453125), SC_(1), SC_(0.4620339167397254212949689945484104460402e-89) },
{ SC_(14.359676361083984375), SC_(1), SC_(0.1100471801774583728133644248988374419641e-90) },
{ SC_(14.41039371490478515625), SC_(1), SC_(0.2548929323782609375991749296565683531577e-91) },
{ SC_(14.87335300445556640625), SC_(1), SC_(0.3198000452629152167848001696581299429735e-97) },
{ SC_(14.92373943328857421875), SC_(1), SC_(0.7101988862786309879894988884459001902733e-98) },
{ SC_(15.8191242218017578125), SC_(1), SC_(0.7438591168260150840237290305856485663443e-110) },
{ SC_(15.96480560302734375), SC_(1), SC_(0.7187861904421355163894524608883700422307e-112) },
{ SC_(15.99831295013427734375), SC_(1), SC_(0.2457896620902286177098546091913977024151e-112) },
{ SC_(16.7455272674560546875), SC_(1), SC_(0.5559992295828943910250640094814395579468e-123) },
{ SC_(17.008663177490234375), SC_(1), SC_(0.760237064211963037211163791564153667507e-127) },
{ SC_(17.2220897674560546875), SC_(1), SC_(0.5043169273534506801418127595237229711103e-130) },
{ SC_(17.757808685302734375), SC_(1), SC_(0.35565429074608249855471197796329792194e-138) },
{ SC_(17.802867889404296875), SC_(1), SC_(0.7145708921803004436285314631231014067581e-139) },
{ SC_(18.112152099609375), SC_(1), SC_(0.1053094819294519519788245447399920974245e-143) },
{ SC_(18.2649860382080078125), SC_(1), SC_(0.4020674492293458832133643654712400773494e-146) },
{ SC_(18.32352447509765625), SC_(1), SC_(0.4706809140073901333884996503518029500936e-147) },
{ SC_(18.4129180908203125), SC_(1), SC_(0.1755474923764976123532737166943228663005e-148) },
{ SC_(18.652309417724609375), SC_(1), SC_(0.2428091775485678872414439322587700295772e-152) },
{ SC_(18.9056758880615234375), SC_(1), SC_(0.1764835785229242910502507612159515936326e-156) },
{ SC_(19.1091136932373046875), SC_(1), SC_(0.7645206854732087495539968665185944859194e-160) },
{ SC_(19.1576213836669921875), SC_(1), SC_(0.1191626992794708978523133508616313098621e-160) },
{ SC_(19.31610870361328125), SC_(1), SC_(0.2657165206820982194424196529775105931442e-163) },
{ SC_(19.3672046661376953125), SC_(1), SC_(0.3671679040400985756060408739652361271147e-164) },
{ SC_(19.6346797943115234375), SC_(1), SC_(0.1067452532475426004914816798590685683097e-168) },
{ SC_(19.8862934112548828125), SC_(1), SC_(0.5060597273643268882175716699743699135461e-173) },
{ SC_(19.93419647216796875), SC_(1), SC_(0.7494327004502860500754429706601818608063e-174) },
{ SC_(20.2273464202880859375), SC_(1), SC_(0.5692529890798582547111055729709760376723e-179) },
{ SC_(20.242107391357421875), SC_(1), SC_(0.3130080167182599318145495989493729041355e-179) },
{ SC_(20.4949970245361328125), SC_(1), SC_(0.1037715327566096248596862690543722677311e-183) },
{ SC_(20.6639499664306640625), SC_(1), SC_(0.9828104968491392552509099594974133192176e-187) },
{ SC_(20.9242725372314453125), SC_(1), SC_(0.1928501126858728847552898327055431396084e-191) },
{ SC_(20.9607219696044921875), SC_(1), SC_(0.4182492638018175069922633264256087874033e-192) },
{ SC_(21.2989482879638671875), SC_(1), SC_(0.2552602767811562690060253249228934667833e-198) },
{ SC_(21.3341617584228515625), SC_(1), SC_(0.5679087385569991824361542895704294427451e-199) },
{ SC_(21.5831966400146484375), SC_(1), SC_(0.1280987506428470296014925421711821162698e-203) },
{ SC_(22.0373077392578125), SC_(1), SC_(0.3131661581007378806102060325912155502701e-212) },
{ SC_(22.2569446563720703125), SC_(1), SC_(0.1846614406013614928732974356509343390705e-216) },
{ SC_(22.9114551544189453125), SC_(1), SC_(0.2598259766741800523533570657530873506244e-229) },
{ SC_(23.0804386138916015625), SC_(1), SC_(0.108696918487531328017390687052866837422e-232) },
{ SC_(23.3235530853271484375), SC_(1), SC_(0.1355781333962075845012366321672254343728e-237) },
{ SC_(23.4473209381103515625), SC_(1), SC_(0.4129348514781646974836324488402049303682e-240) },
{ SC_(24.12081146240234375), SC_(1), SC_(0.4900590012091086604540120205982908317771e-254) },
{ SC_(24.3631992340087890625), SC_(1), SC_(0.382044899410099463972224844951303224334e-259) },
{ SC_(25.061580657958984375), SC_(1), SC_(0.379460392354870154626118964688104627376e-274) },
{ SC_(25.23714447021484375), SC_(1), SC_(0.5508622514289808668363975738198678197993e-278) },
{ SC_(25.3777942657470703125), SC_(1), SC_(0.4435055276360357438046878641441812378362e-281) },
{ SC_(25.813503265380859375), SC_(1), SC_(0.8969991006618404791166973289604328222239e-291) },
{ SC_(26.1247920989990234375), SC_(1), SC_(0.8433396822097075603573541828301520902564e-298) },
{ SC_(26.3525791168212890625), SC_(1), SC_(0.5380559555748413036380180439113786214843e-303) },
{ SC_(26.776111602783203125), SC_(1), SC_(0.8944111506115654515313274252719979616663e-313) },
{ SC_(26.8727970123291015625), SC_(1), SC_(0.4980346568584009068204868294049186460128e-315) },
{ SC_(27.6731243133544921875), SC_(1), SC_(0.5315985423107748521341095763480509306686e-334) },
{ SC_(27.6761074066162109375), SC_(1), SC_(0.4506400985060962000709584088621043872847e-334) },
{ SC_(27.96904754638671875), SC_(1), SC_(0.3715003445893695695072259525562685194324e-341) },
{ SC_(28.58887481689453125), SC_(1), SC_(0.2166518476138800933879816106005670654441e-356) },
{ SC_(28.742389678955078125), SC_(1), SC_(0.3244339622815072602163752228132919409512e-360) },
{ SC_(28.851139068603515625), SC_(1), SC_(0.6157273676049535809152624774082572414474e-363) },
{ SC_(28.9178009033203125), SC_(1), SC_(0.1305949729571576658796058283659336601413e-364) },
{ SC_(29.1156768798828125), SC_(1), SC_(0.1335911177834992334477211342269950231736e-369) },
{ SC_(29.3093738555908203125), SC_(1), SC_(0.1614718326165092385338896025176950706834e-374) },
{ SC_(29.5636444091796875), SC_(1), SC_(0.504780346276441675830815513402480460203e-381) },
{ SC_(29.631839752197265625), SC_(1), SC_(0.8890342529017924395163297463196226030207e-383) },
{ SC_(30.6340579986572265625), SC_(1), SC_(0.5049904008337056546410563604215235735623e-409) },
{ SC_(30.707683563232421875), SC_(1), SC_(0.5505904741434267060539220169867548888751e-411) },
{ SC_(30.8368549346923828125), SC_(1), SC_(0.1934000588075928658952471412237852868705e-414) },
{ SC_(31.179210662841796875), SC_(1), SC_(0.1150586385665917046799828457578881631925e-423) },
{ SC_(31.4387989044189453125), SC_(1), SC_(0.9951971607786623315295164065875436156955e-431) },
{ SC_(32.356414794921875), SC_(1), SC_(0.3647911693171115642349382796707730440408e-456) },
{ SC_(32.586200714111328125), SC_(1), SC_(0.1196854549366123742924784427293234502016e-462) },
{ SC_(32.75687408447265625), SC_(1), SC_(0.1707585732299349124939643284536648783473e-467) },
{ SC_(33.2696990966796875), SC_(1), SC_(0.3314340732586949021659796359200734182646e-482) },
{ SC_(33.519634246826171875), SC_(1), SC_(0.1851275204503437416978123025595612676848e-489) },
{ SC_(33.957134246826171875), SC_(1), SC_(0.276057351872287608387770565675906984022e-502) },
{ SC_(34.00215911865234375), SC_(1), SC_(0.1292839762753917184628820650991754160974e-503) },
{ SC_(35.2607574462890625), SC_(1), SC_(0.1723862426577913396207111099832970757108e-541) },
{ SC_(35.6440582275390625), SC_(1), SC_(0.2682942190174394220973041800979694793591e-553) },
{ SC_(35.898014068603515625), SC_(1), SC_(0.3427988522143486471852246306766064547166e-561) },
{ SC_(35.91162872314453125), SC_(1), SC_(0.128908321457486470920213918176837870702e-561) },
{ SC_(36.391139984130859375), SC_(1), SC_(0.1115677489279136454855597068297808612163e-576) },
{ SC_(36.69866943359375), SC_(1), SC_(0.1914841862056771258044968899947647500071e-586) },
{ SC_(36.778095245361328125), SC_(1), SC_(0.5580499602695800066261393252867262445483e-589) },
{ SC_(36.836078643798828125), SC_(1), SC_(0.7802735251877915942902082027097296754913e-591) },
{ SC_(36.926517486572265625), SC_(1), SC_(0.9862852517813094777393024048350874991345e-594) },
{ SC_(37.220302581787109375), SC_(1), SC_(0.3390210353535371981540883592991293306856e-603) },
{ SC_(37.62610626220703125), SC_(1), SC_(0.2161308855123068080619903224122596349173e-616) },
{ SC_(37.78128814697265625), SC_(1), SC_(0.1781872758239509973907000853718925676836e-621) },
{ SC_(39.196559906005859375), SC_(1), SC_(0.8334676760927633157297582502293215474801e-669) },
{ SC_(39.287792205810546875), SC_(1), SC_(0.6459479389166880954444837324458596842583e-672) },
{ SC_(39.3513031005859375), SC_(1), SC_(0.4369573452597126768250060965811055881436e-674) },
{ SC_(39.75826263427734375), SC_(1), SC_(0.4509483787208385166749854593762529916563e-688) },
{ SC_(39.86272430419921875), SC_(1), SC_(0.1098531610189679641881639506181744668225e-691) },
{ SC_(40.162616729736328125), SC_(1), SC_(0.4120302102977277191187506721340552814976e-702) },
{ SC_(40.170276641845703125), SC_(1), SC_(0.2226415732825465240782514517928537101293e-702) },
{ SC_(40.382472991943359375), SC_(1), SC_(0.8354572576931370443665770929403858031245e-710) },
{ SC_(40.696559906005859375), SC_(1), SC_(0.7225661474676652832663905782266313267167e-721) },
{ SC_(40.782176971435546875), SC_(1), SC_(0.673503764299797652470711537205502876345e-724) },
{ SC_(40.9482574462890625), SC_(1), SC_(0.8541553669484881480206884088881859451573e-730) },
{ SC_(41.145099639892578125), SC_(1), SC_(0.8156452609298646477772692892407567909292e-737) },
{ SC_(41.515956878662109375), SC_(1), SC_(0.3927474520057692651749738005168570105415e-750) },
{ SC_(41.838653564453125), SC_(1), SC_(0.8109391651273807861676399802649936141133e-762) },
{ SC_(42.584423065185546875), SC_(1), SC_(0.3614692055111044536160065200200925139014e-789) },
{ SC_(42.6111907958984375), SC_(1), SC_(0.3693115729392217140417024607374602650062e-790) },
{ SC_(42.6995391845703125), SC_(1), SC_(0.1964210029215776788610761375896332961826e-793) },
{ SC_(43.375934600830078125), SC_(1), SC_(0.1002957731076485676078330474511548731955e-818) },
{ SC_(43.761638641357421875), SC_(1), SC_(0.2518258316895643034341457105016197161517e-833) },
{ SC_(43.97068023681640625), SC_(1), SC_(0.2717687606713113972202367030042368252574e-841) },
{ SC_(43.977039337158203125), SC_(1), SC_(0.1553279441110419250099473836953698361303e-841) },
{ SC_(44.299617767333984375), SC_(1), SC_(0.662284188550331482050024128495832271562e-854) },
{ SC_(44.5380706787109375), SC_(1), SC_(0.4157106895546200361762199057481171702463e-863) },
{ SC_(44.7019195556640625), SC_(1), SC_(0.1849263581704522121134821381775513596569e-869) },
{ SC_(44.944408416748046875), SC_(1), SC_(0.6665835026232982550759602414166037648457e-879) },
{ SC_(45.39469146728515625), SC_(1), SC_(0.1423064152931413223321009373154837793895e-896) },
{ SC_(45.555110931396484375), SC_(1), SC_(0.6535595984749616464428461737502955522054e-903) },
{ SC_(45.922885894775390625), SC_(1), SC_(0.1587405585152606350596738044081514147077e-917) },
{ SC_(46.490032196044921875), SC_(1), SC_(0.2711887374954078187100515917478258475121e-940) },
{ SC_(46.700458526611328125), SC_(1), SC_(0.8220768482426773312423439218857395793096e-949) },
{ SC_(46.80968475341796875), SC_(1), SC_(0.300689768353676045411682389398910728652e-953) },
{ SC_(46.93021392822265625), SC_(1), SC_(0.3716830576798476782128277462132351948199e-958) },
{ SC_(47.80080413818359375), SC_(1), SC_(0.5560372820563731575239827056999357124531e-994) },
{ SC_(47.98065185546875), SC_(1), SC_(0.1829295366299049625367873244831792588204e-1001) },
{ SC_(48.160678863525390625), SC_(1), SC_(0.5544641890677600654790600067979757964649e-1009) },
{ SC_(48.228302001953125), SC_(1), SC_(0.8174825675757120829683639765764518487113e-1012) },
{ SC_(48.86585235595703125), SC_(1), SC_(0.1054147185420251960062940386161051253868e-1038) },
{ SC_(48.88062286376953125), SC_(1), SC_(0.2487429897424450019093445470126394812466e-1039) },
{ SC_(49.2615814208984375), SC_(1), SC_(0.1428662569339560177970591891033928074615e-1055) },
{ SC_(49.300342559814453125), SC_(1), SC_(0.3129115225209756198596637394420488168835e-1057) },
{ SC_(49.3912200927734375), SC_(1), SC_(0.3976507934443091883911509821945069748171e-1061) },
{ SC_(49.450878143310546875), SC_(1), SC_(0.1091595819414626077382205537328240830492e-1063) },
{ SC_(49.4884796142578125), SC_(1), SC_(0.2642659241845869227101266198364933762561e-1065) },
{ SC_(50.086460113525390625), SC_(1), SC_(0.3607878684331161959098857667661007215536e-1091) },
{ SC_(51.2444610595703125), SC_(1), SC_(0.3860548279363456071149897668546024070402e-1142) },
{ SC_(51.339717864990234375), SC_(1), SC_(0.2197789266327651540257336225175053590062e-1146) },
{ SC_(51.447040557861328125), SC_(1), SC_(0.354996685112096717011426990868690176895e-1151) },
{ SC_(51.52539825439453125), SC_(1), SC_(0.1110143282538327027879325761520351634781e-1154) },
{ SC_(51.782512664794921875), SC_(1), SC_(0.3217426516835935075931472670615112969831e-1166) },
{ SC_(52.144077301025390625), SC_(1), SC_(0.1532358547576965427522636443372608038782e-1182) },
{ SC_(52.820537567138671875), SC_(1), SC_(0.2202669107160275614166035168539425499729e-1213) },
{ SC_(52.8442840576171875), SC_(1), SC_(0.1790754358721238111167473370381879109436e-1214) },
{ SC_(52.871673583984375), SC_(1), SC_(0.9892522319813664639479190973985140674034e-1216) },
{ SC_(52.872089385986328125), SC_(1), SC_(0.9466912463849392521290423205053783831664e-1216) },
{ SC_(53.07733917236328125), SC_(1), SC_(0.3390908799279318246606852431264844551837e-1225) },
{ SC_(53.088535308837890625), SC_(1), SC_(0.1032764828225424213243462240852153489629e-1225) },
{ SC_(53.778041839599609375), SC_(1), SC_(0.1017002820918486891770554932818686415531e-1257) },
{ SC_(54.0477142333984375), SC_(1), SC_(0.2381751287333891734284837295419122638673e-1270) },
{ SC_(54.561374664306640625), SC_(1), SC_(0.139407502357667351124920158334676469294e-1294) },
{ SC_(54.6435394287109375), SC_(1), SC_(0.1765212687763302697244562949068373410255e-1298) },
{ SC_(55.047882080078125), SC_(1), SC_(0.9580050759351008955877580245822791128101e-1318) },
{ SC_(55.53577423095703125), SC_(1), SC_(0.3516341067901357169932495766343569323525e-1341) },
{ SC_(55.63845062255859375), SC_(1), SC_(0.3871072763485538347396913418646976027199e-1346) },
{ SC_(55.9916534423828125), SC_(1), SC_(0.289528812850324808187999318666603687985e-1363) },
{ SC_(55.991954803466796875), SC_(1), SC_(0.2799194648396030874187262104833020570154e-1363) },
{ SC_(56.6115570068359375), SC_(1), SC_(0.138610665425682272373334040969461433112e-1393) },
{ SC_(56.749294281005859375), SC_(1), SC_(0.2289081242224445766088406090902886148302e-1400) },
{ SC_(57.362518310546875), SC_(1), SC_(0.9220583307012274413074526609845212209396e-1431) },
{ SC_(57.5469818115234375), SC_(1), SC_(0.5725247795522802723716771177781160453318e-1440) },
{ SC_(58.515666961669921875), SC_(1), SC_(0.8387169924209196731842556332538391198272e-1489) },
{ SC_(58.8695220947265625), SC_(1), SC_(0.7612989272837028720721864253441810819973e-1507) },
{ SC_(59.008518218994140625), SC_(1), SC_(0.5818271285898335632169611265925278206909e-1514) },
{ SC_(59.44551849365234375), SC_(1), SC_(0.1907993812890002855694347258421797523393e-1536) },
{ SC_(59.853458404541015625), SC_(1), SC_(0.1386369169907035409186787094207373016361e-1557) },
{ SC_(60.46059417724609375), SC_(1), SC_(0.2591809034926289626577001708586017024727e-1589) },
{ SC_(60.804798126220703125), SC_(1), SC_(0.1921652566797868246807189497430043640543e-1607) },
{ SC_(60.9976654052734375), SC_(1), SC_(0.1202209001001935503022907284085976927471e-1617) },
{ SC_(61.63448333740234375), SC_(1), SC_(0.1443858912194400214601650177255810967138e-1651) },
{ SC_(61.718036651611328125), SC_(1), SC_(0.4818094804505875544021186960960583940739e-1656) },
{ SC_(61.749187469482421875), SC_(1), SC_(0.1028760000725124920333886117069810603088e-1657) },
{ SC_(61.7707366943359375), SC_(1), SC_(0.7180844057437257539436486908675040497688e-1659) },
{ SC_(62.129795074462890625), SC_(1), SC_(0.3411714823101512343643373517899997588934e-1678) },
{ SC_(62.415653228759765625), SC_(1), SC_(0.1172420264374634693794507306774825437228e-1693) },
{ SC_(63.656280517578125), SC_(1), SC_(0.1359202639129155863922014558394013590937e-1761) },
{ SC_(63.720615386962890625), SC_(1), SC_(0.3748863560151785919817454048142060747672e-1765) },
{ SC_(63.735622406005859375), SC_(1), SC_(0.5534848650018337136859100029355185261672e-1766) },
{ SC_(63.745220184326171875), SC_(1), SC_(0.1628046476475599666226420695090084595775e-1766) },
{ SC_(63.783538818359375), SC_(1), SC_(0.1227798051543007555849422132322321585877e-1768) },
{ SC_(63.87148284912109375), SC_(1), SC_(0.1632762187944705003794943454328122376037e-1773) },
{ SC_(64.515594482421875), SC_(1), SC_(0.1969332977981314849672526645022956975392e-1809) },
{ SC_(64.97594451904296875), SC_(1), SC_(0.2525310788037616742275863982689138714012e-1835) },
{ SC_(65.00909423828125), SC_(1), SC_(0.3394161846767033496272256639147831568993e-1837) },
{ SC_(65.32428741455078125), SC_(1), SC_(0.4872272181442093260036099253187279262469e-1855) },
{ SC_(65.8734893798828125), SC_(1), SC_(0.2462682463022898342795255163765824211512e-1886) },
{ SC_(65.895782470703125), SC_(1), SC_(0.1304674583839710679197974600800374601509e-1887) },
{ SC_(66.16791534423828125), SC_(1), SC_(0.3203747642032728309060331250397804757235e-1903) },
{ SC_(66.27771759033203125), SC_(1), SC_(0.1545497931044982506797819622759819541777e-1909) },
{ SC_(66.7202606201171875), SC_(1), SC_(0.4214693722661996667087731543216442503726e-1935) },
{ SC_(67.0804595947265625), SC_(1), SC_(0.4916509034440560388255363947533037583151e-1956) },
{ SC_(67.51879119873046875), SC_(1), SC_(0.1163704950246886518963746466814171576513e-1981) },
{ SC_(67.61028289794921875), SC_(1), SC_(0.4965812608096806464498341746692252789426e-1987) },
{ SC_(68.0894927978515625), SC_(1), SC_(0.2827017688141873952389885023460208246821e-2015) },
{ SC_(68.7330780029296875), SC_(1), SC_(0.1601703792022999521045114304499339964142e-2053) },
{ SC_(68.936859130859375), SC_(1), SC_(0.1045603435996106684348791239772064284538e-2065) },
{ SC_(69.3484344482421875), SC_(1), SC_(0.1990640753018030347229172891391208563692e-2090) },
{ SC_(69.4951629638671875), SC_(1), SC_(0.2821572392833612189407917583240153887473e-2099) },
{ SC_(69.6038970947265625), SC_(1), SC_(0.7606563437817722315286512269995042517896e-2106) },
{ SC_(69.8057861328125), SC_(1), SC_(0.4535113025492646420574078398459972783487e-2118) },
{ SC_(69.884307861328125), SC_(1), SC_(0.7806399428418380776194369203828958230443e-2123) },
{ SC_(70.090423583984375), SC_(1), SC_(0.2297973354469257356841567122165370429556e-2135) },
{ SC_(70.1346893310546875), SC_(1), SC_(0.4627340318338513849654024935557448249929e-2138) },
{ SC_(70.4619598388671875), SC_(1), SC_(0.4786946947734960725308155565435423870322e-2158) },
{ SC_(70.51854705810546875), SC_(1), SC_(0.1640745397943748179034151831339364278733e-2161) },
{ SC_(70.62750244140625), SC_(1), SC_(0.3431785975089560474469843416846358607766e-2168) },
{ SC_(70.77237701416015625), SC_(1), SC_(0.4345108777332364055904822498668881910844e-2177) },
{ SC_(71.46120452880859375), SC_(1), SC_(0.1213533316440842841172645481517647701339e-2219) },
{ SC_(71.54265594482421875), SC_(1), SC_(0.1059138463142173993761026331012035279463e-2224) },
{ SC_(71.8696136474609375), SC_(1), SC_(0.4560525021368102193256510775118687007107e-2245) },
{ SC_(71.89171600341796875), SC_(1), SC_(0.1900755308625425801959286367021480241643e-2246) },
{ SC_(72.96099853515625), SC_(1), SC_(0.1012288958237199779078623773782261227323e-2313) },
{ SC_(73.07500457763671875), SC_(1), SC_(0.5943790030417452214269807905148252301626e-2321) },
{ SC_(73.10594940185546875), SC_(1), SC_(0.6446581210317819300626283182106697992806e-2323) },
{ SC_(73.1313323974609375), SC_(1), SC_(0.1574358163400440570765391931676616457296e-2324) },
{ SC_(73.20639801025390625), SC_(1), SC_(0.2666631324666853271144728061565555980879e-2329) },
{ SC_(73.376953125), SC_(1), SC_(0.3692800481745944696527608913821150780197e-2340) },
{ SC_(73.430145263671875), SC_(1), SC_(0.1498451636616422925337939153598716367853e-2343) },
{ SC_(73.44467926025390625), SC_(1), SC_(0.1772057595578452829782717746213217866987e-2344) },
{ SC_(73.60561370849609375), SC_(1), SC_(0.9327165682410597575108877219484860075423e-2355) },
{ SC_(73.62299346923828125), SC_(1), SC_(0.7217309662507557984084259593722358671817e-2356) },
{ SC_(73.77313995361328125), SC_(1), SC_(0.1762441226759232140980568288616069877708e-2365) },
{ SC_(74.2175445556640625), SC_(1), SC_(0.4796668342626380739003100430828430758387e-2394) },
{ SC_(74.27039337158203125), SC_(1), SC_(0.1873022555292045249630763229328993092174e-2397) },
{ SC_(74.39823150634765625), SC_(1), SC_(0.1041846943079459800746159253005438318555e-2405) },
{ SC_(74.77135467529296875), SC_(1), SC_(0.6972625788619583784396293640501867635862e-2430) },
{ SC_(74.807342529296875), SC_(1), SC_(0.320164469944205443450167902957404361688e-2432) },
{ SC_(75.01886749267578125), SC_(1), SC_(0.5501656655265385463409067358984172337294e-2446) },
{ SC_(75.3089447021484375), SC_(1), SC_(0.6319468915000774061299279774718180641493e-2465) },
{ SC_(75.34217071533203125), SC_(1), SC_(0.4232650489503930895532015931831887522867e-2467) },
{ SC_(75.3960723876953125), SC_(1), SC_(0.1252103871082113384792176510455204354046e-2470) },
{ SC_(75.45360565185546875), SC_(1), SC_(0.2128736422560450047027718674310538561411e-2474) },
{ SC_(75.5235443115234375), SC_(1), SC_(0.5520057148754538352100449496414500231534e-2479) },
{ SC_(75.7169952392578125), SC_(1), SC_(0.1082452065927623584648516750055819887681e-2491) },
{ SC_(76.1279449462890625), SC_(1), SC_(0.8546877316832444989935075245988734481682e-2519) },
{ SC_(76.470703125), SC_(1), SC_(0.1638058714171406332549731275799690588823e-2541) },
{ SC_(76.938812255859375), SC_(1), SC_(0.1056702363179452330608841676726809135679e-2572) },
{ SC_(77.5743560791015625), SC_(1), SC_(0.2358904373500824632540699420486265405702e-2615) },
{ SC_(77.62860107421875), SC_(1), SC_(0.5201021650937707207333604556951161883551e-2619) },
{ SC_(77.94854736328125), SC_(1), SC_(0.1249443652740786709208083871965551047597e-2640) },
{ SC_(78.06497955322265625), SC_(1), SC_(0.1611056496774920949293225513029265281761e-2648) },
{ SC_(78.1817626953125), SC_(1), SC_(0.1913800020341339537443259258588625217145e-2656) },
{ SC_(78.7396087646484375), SC_(1), SC_(0.1826214635685593066183737049160168091905e-2694) },
{ SC_(79.23296356201171875), SC_(1), SC_(0.2578910365673578199346966028090255709301e-2728) },
{ SC_(79.28195953369140625), SC_(1), SC_(0.1091891461191934352451814384442219402849e-2731) },
{ SC_(79.53916168212890625), SC_(1), SC_(0.1977970219864078402856631374181827871126e-2749) },
{ SC_(79.89411163330078125), SC_(1), SC_(0.5214347553208988003055180927464712623108e-2774) },
{ SC_(80.03131103515625), SC_(1), SC_(0.1539244869801023794218894091743149755693e-2783) },
{ SC_(81.0540618896484375), SC_(1), SC_(0.4282424762803665933789596667679893825473e-2855) },
{ SC_(82.27494049072265625), SC_(1), SC_(0.1058661602699748027888078315752637932386e-2941) },
{ SC_(82.40390777587890625), SC_(1), SC_(0.6316127985700229083559360532999075433841e-2951) },
{ SC_(82.67310333251953125), SC_(1), SC_(0.3161239679691280797883924212187842089968e-2970) },
{ SC_(82.83135223388671875), SC_(1), SC_(0.1331877990458538379342065811181569680933e-2981) },
{ SC_(82.8936614990234375), SC_(1), SC_(0.4360382415173864210795784221294622630074e-2986) },
{ SC_(82.896820068359375), SC_(1), SC_(0.2582766043573584963841163098015327607626e-2986) },
{ SC_(83.0903167724609375), SC_(1), SC_(0.290013476198442869046820654577037968453e-3000) },
{ SC_(83.20987701416015625), SC_(1), SC_(0.6710637821460133939254155513062400075894e-3009) },
{ SC_(83.5117340087890625), SC_(1), SC_(0.930787700439063954052855467933526662801e-3031) },
{ SC_(84.054412841796875), SC_(1), SC_(0.2976066148553277399257428533933691648135e-3070) },
{ SC_(84.19962310791015625), SC_(1), SC_(0.7279769443639285050812101610482378417998e-3081) },
{ SC_(84.58744049072265625), SC_(1), SC_(0.2702912324282395041651536403393819660776e-3109) },
{ SC_(84.58887481689453125), SC_(1), SC_(0.2120514736394887571017949592511629200089e-3109) },
{ SC_(85.08606719970703125), SC_(1), SC_(0.4856698297979953595767807992015152776328e-3146) },
{ SC_(85.918212890625), SC_(1), SC_(0.761735048565653930137023626638747177308e-3208) },
{ SC_(86.31143951416015625), SC_(1), SC_(0.2931592864000316245471343335876130048243e-3237) },
{ SC_(86.48769378662109375), SC_(1), SC_(0.1734166482219001810675374526329398742724e-3250) },
{ SC_(86.51556396484375), SC_(1), SC_(0.1396184688760208541263525791606580135888e-3252) },
{ SC_(86.661895751953125), SC_(1), SC_(0.137591974249259342744647335702120081949e-3263) },
{ SC_(86.67838287353515625), SC_(1), SC_(0.7894924978682044731133080698270675959047e-3265) },
{ SC_(86.699005126953125), SC_(1), SC_(0.2210314800408904240090566206375166498669e-3266) },
{ SC_(86.875640869140625), SC_(1), SC_(0.1067393543048809336522125654614257792709e-3279) },
{ SC_(87.12085723876953125), SC_(1), SC_(0.3141588749441732230579799060940491765735e-3298) },
{ SC_(87.1272430419921875), SC_(1), SC_(0.1032456874487975042510718930756313489085e-3298) },
{ SC_(87.350982666015625), SC_(1), SC_(0.1145259102841530225822158676931062199611e-3315) },
{ SC_(87.4471588134765625), SC_(1), SC_(0.5719031848650119145301950377270835213481e-3323) },
{ SC_(87.5886077880859375), SC_(1), SC_(0.100944910275613191627060617308017176992e-3333) },
{ SC_(88.114166259765625), SC_(1), SC_(0.790369642782630853434920273428079682513e-3374) },
{ SC_(88.35390472412109375), SC_(1), SC_(0.3336629458423611349557710086599109785783e-3392) },
{ SC_(88.45099639892578125), SC_(1), SC_(0.1168446033182320025804519666787072055362e-3399) },
{ SC_(88.55356597900390625), SC_(1), SC_(0.1521829146954713302263784465478849666514e-3407) },
{ SC_(88.97168731689453125), SC_(1), SC_(0.8788241912132849825702219058327694185942e-3440) },
{ SC_(89.04711151123046875), SC_(1), SC_(0.129507473240771950228590714535613326805e-3445) },
{ SC_(89.05876922607421875), SC_(1), SC_(0.1623712240263443145358629211111315306735e-3446) },
{ SC_(89.41626739501953125), SC_(1), SC_(0.3153753084460525420724595238130726065242e-3474) },
{ SC_(89.51361846923828125), SC_(1), SC_(0.8577730193641580987437405819558340102121e-3482) },
{ SC_(89.68304443359375), SC_(1), SC_(0.5586301300368715269248196410139332100555e-3495) },
{ SC_(89.70983123779296875), SC_(1), SC_(0.4571434971968977143179977283713339395878e-3497) }
} };
#undef SC_
| [
"j.neuschaefer@gmx.net"
] | j.neuschaefer@gmx.net |
b0bfe9ad4e01a6e67c58dcd65edd3f9c693abd06 | 66f66b77fe04b6ee816bb5b395ac98776da40a61 | /src/gpucf/executable/CfRunner.h | ae7d5cbbf681c4241c471b13d4a76ef3a26ede3d | [] | no_license | fweig/gpucf | dfa278388043665f13cc6010754d62f0539342d1 | 83389c7df28d92303e21a47f73bd41bb3241390f | refs/heads/master | 2020-07-08T22:10:13.960899 | 2019-09-24T22:39:41 | 2019-09-24T22:39:41 | 203,793,366 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,064 | h | // Copyright CERN and copyright holders of ALICE O2. This software is
// distributed under the terms of the GNU General Public License v3 (GPL
// Version 3), copied verbatim in the file "COPYING".
//
// See http://alice-o2.web.cern.ch/license for full licensing information.
//
// In applying this license CERN does not waive the privileges and immunities
// granted to it by virtue of its status as an Intergovernmental Organization
// or submit itself to any jurisdiction.
#pragma once
#include <gpucf/common/ClEnv.h>
#include <gpucf/executable/CfCLIFlags.h>
#include <gpucf/executable/Executable.h>
namespace gpucf
{
class CfRunner : public Executable
{
public:
CfRunner();
protected:
void setupFlags(args::Group &, args::Group &) override;
int mainImpl() override;
private:
std::unique_ptr<ClEnv::Flags> envFlags;
std::unique_ptr<CfCLIFlags> cfflags;
OptStringFlag digitFile;
OptStringFlag clusterResultFile;
OptStringFlag peakFile;
OptFlag cpu;
};
} // namespace gpucf
// vim: set ts=4 sw=4 sts=4 expandtab:
| [
"felix.weiglhofer@gmail.com"
] | felix.weiglhofer@gmail.com |
5a91e139aca009e859fb4d4a3db877e653d7d52c | 96a6c4758ef996a9ae79fe8def1664aaf2ecdaae | /src/sky_module.cc | c203d950b7738ebf4c236af2830feffc22a91bad | [
"Apache-2.0"
] | permissive | ycq3/SkyAPM-php-sdk | 5c3f2202257862568aa59934104f31af1f8348cd | 0dc3ff97916f6d786001d0b7d3d7dd1553d5665e | refs/heads/master | 2023-05-03T13:45:25.049716 | 2021-05-17T16:47:04 | 2021-05-17T16:47:04 | 348,992,711 | 0 | 0 | Apache-2.0 | 2021-05-14T10:43:15 | 2021-03-18T08:16:29 | C++ | UTF-8 | C++ | false | false | 7,159 | cc | // contributor license agreements. See the NOTICE file distributed with
// this work for additional information regarding copyright ownership.
// The ASF 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.
#include <map>
#include <iostream>
#include "sky_module.h"
#include <boost/interprocess/ipc/message_queue.hpp>
#include <fstream>
#include "segment.h"
#include "sky_utils.h"
#include "sky_plugin_curl.h"
#include "sky_execute.h"
#include "manager.h"
#include "sky_plugin_error.h"
extern struct service_info *s_info;
extern void (*ori_execute_ex)(zend_execute_data *execute_data);
extern void (*ori_execute_internal)(zend_execute_data *execute_data, zval *return_value);
extern void (*orig_curl_exec)(INTERNAL_FUNCTION_PARAMETERS);
extern void (*orig_curl_setopt)(INTERNAL_FUNCTION_PARAMETERS);
extern void (*orig_curl_setopt_array)(INTERNAL_FUNCTION_PARAMETERS);
extern void (*orig_curl_close)(INTERNAL_FUNCTION_PARAMETERS);
void sky_module_init() {
ori_execute_ex = zend_execute_ex;
zend_execute_ex = sky_execute_ex;
ori_execute_internal = zend_execute_internal;
zend_execute_internal = sky_execute_internal;
if (SKYWALKING_G(error_handler_enable)) {
sky_plugin_error_init();
}
// bind curl
zend_function *old_function;
if ((old_function = SKY_OLD_FN("curl_exec")) != nullptr) {
orig_curl_exec = old_function->internal_function.handler;
old_function->internal_function.handler = sky_curl_exec_handler;
}
if ((old_function = SKY_OLD_FN("curl_setopt")) != nullptr) {
orig_curl_setopt = old_function->internal_function.handler;
old_function->internal_function.handler = sky_curl_setopt_handler;
}
if ((old_function = SKY_OLD_FN("curl_setopt_array")) != nullptr) {
orig_curl_setopt_array = old_function->internal_function.handler;
old_function->internal_function.handler = sky_curl_setopt_array_handler;
}
if ((old_function = SKY_OLD_FN("curl_close")) != nullptr) {
orig_curl_close = old_function->internal_function.handler;
old_function->internal_function.handler = sky_curl_close_handler;
}
ManagerOptions opt;
opt.version = SKYWALKING_G(version);
opt.code = SKYWALKING_G(app_code);
opt.grpc = SKYWALKING_G(grpc);
opt.grpc_tls = SKYWALKING_G(grpc_tls_enable);
opt.root_certs = SKYWALKING_G(grpc_tls_pem_root_certs);
opt.private_key = SKYWALKING_G(grpc_tls_pem_private_key);
opt.cert_chain = SKYWALKING_G(grpc_tls_pem_cert_chain);
opt.authentication = SKYWALKING_G(authentication);
try {
boost::interprocess::message_queue::remove("skywalking_queue");
boost::interprocess::message_queue(
boost::interprocess::create_only,
"skywalking_queue",
1024,
20480,
boost::interprocess::permissions(0666)
);
} catch (boost::interprocess::interprocess_exception &ex) {
php_error(E_WARNING, "%s %s", "[skywalking] create queue fail ", ex.what());
}
new Manager(opt, s_info);
}
void sky_request_init(zval *request, uint64_t request_id) {
array_init(&SKYWALKING_G(curl_header));
zval *carrier = nullptr;
zval *sw;
std::string header;
std::string uri;
std::string peer;
if (request != nullptr) {
zval *swoole_header = sky_read_property(request, "header", 0);
zval *swoole_server = sky_read_property(request, "server", 0);
if (SKYWALKING_G(version) == 8) {
sw = zend_hash_str_find(Z_ARRVAL_P(swoole_header), "sw8", sizeof("sw8") - 1);
} else {
sw = nullptr;
}
header = (sw != nullptr ? Z_STRVAL_P(sw) : "");
uri = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(swoole_server), "request_uri", sizeof("request_uri") - 1));
peer = Z_STRVAL_P(zend_hash_str_find(Z_ARRVAL_P(swoole_header), "host", sizeof("host") - 1));
} else {
zend_bool jit_initialization = PG(auto_globals_jit);
if (jit_initialization) {
zend_string *server_str = zend_string_init("_SERVER", sizeof("_SERVER") - 1, 0);
zend_is_auto_global(server_str);
zend_string_release(server_str);
}
carrier = zend_hash_str_find(&EG(symbol_table), ZEND_STRL("_SERVER"));
if (SKYWALKING_G(version) == 5) {
sw = zend_hash_str_find(Z_ARRVAL_P(carrier), "HTTP_SW3", sizeof("HTTP_SW3") - 1);
} else if (SKYWALKING_G(version) == 6 || SKYWALKING_G(version) == 7) {
sw = zend_hash_str_find(Z_ARRVAL_P(carrier), "HTTP_SW6", sizeof("HTTP_SW6") - 1);
} else if (SKYWALKING_G(version) == 8) {
sw = zend_hash_str_find(Z_ARRVAL_P(carrier), "HTTP_SW8", sizeof("HTTP_SW8") - 1);
} else {
sw = nullptr;
}
header = (sw != nullptr ? Z_STRVAL_P(sw) : "");
uri = get_page_request_uri();
peer = get_page_request_peer();
}
std::map<uint64_t, Segment *> *segments;
if (SKYWALKING_G(segment) == nullptr) {
segments = new std::map<uint64_t, Segment *>;
SKYWALKING_G(segment) = segments;
} else {
segments = static_cast<std::map<uint64_t, Segment *> *>SKYWALKING_G(segment);
}
auto *segment = new Segment(s_info->service, s_info->service_instance, SKYWALKING_G(version), header);
auto const result = segments->insert(std::pair<uint64_t, Segment *>(request_id, segment));
if (not result.second) {
result.first->second = segment;
}
auto *span = segments->at(request_id)->createSpan(SkySpanType::Entry, SkySpanLayer::Http, 8001);
span->setOperationName(uri);
span->setPeer(peer);
span->addTag("url", uri);
segments->at(request_id)->createRefs();
zval *request_method = zend_hash_str_find(Z_ARRVAL(PG(http_globals)[TRACK_VARS_SERVER]), ZEND_STRL("REQUEST_METHOD"));
if (request_method != NULL) {
span->addTag("http.method", Z_STRVAL_P(request_method));
}
}
void sky_request_flush(zval *response, uint64_t request_id) {
auto *segment = sky_get_segment(nullptr, request_id);
if (response == nullptr) {
segment->setStatusCode(SG(sapi_headers).http_response_code);
}
std::string msg = segment->marshal();
delete segment;
try {
boost::interprocess::message_queue mq(
boost::interprocess::open_only,
"skywalking_queue"
);
mq.send(msg.data(), msg.size(), 0);
} catch (boost::interprocess::interprocess_exception &ex) {
php_error(E_WARNING, "%s %s", "[skywalking] open queue fail ", ex.what());
}
}
| [
"noreply@github.com"
] | ycq3.noreply@github.com |
7aa0afb83dfc30e0aa9aadf286556b80fca85661 | a9685046b069dd987905f283f0325b02f4f424e9 | /ToonTanks/Source/ToonTanks/Actors/ProjectileBase.h | d5bbfcffb05b1878bdc716c58b1b162f55920783 | [] | no_license | galliume/unreal | 678fd8174ce4b64666762e0277d91f149f85fd98 | 5c74810940d7209ddcc8066066fd60e3f4fb5b45 | refs/heads/master | 2023-01-03T08:17:15.434232 | 2020-10-29T21:14:16 | 2020-10-29T21:14:16 | 273,072,934 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,102 | h | // Fill out your copyright notice in the Description page of Project Settings.
#pragma once
#include "CoreMinimal.h"
#include "GameFramework/Actor.h"
#include "Particles/ParticleSystemComponent.h"
#include "ProjectileBase.generated.h"
class UProjectileMovementComponent;
UCLASS()
class TOONTANKS_API AProjectileBase : public AActor
{
GENERATED_BODY()
public:
// Sets default values for this actor's properties
AProjectileBase();
protected:
// Called when the game starts or when spawned
virtual void BeginPlay() override;
private:
UPROPERTY(VisibleAnywhere, BluePrintReadOnly, Category = "Components", meta = (AllowPRivateAccess = "true"))
UProjectileMovementComponent* ProjectileMovement;
UPROPERTY(VisibleAnywhere, BluePrintReadOnly, Category = "Components", meta = (AllowPRivateAccess = "true"))
UStaticMeshComponent* ProjectileMesh;
UPROPERTY(VisibleAnywhere, BluePrintReadOnly, Category = "Components", meta = (AllowPRivateAccess = "true"))
UParticleSystemComponent* ParticleTrail;
UPROPERTY(EditDefaultsOnly, Category = "Damage", meta = (AllowPRivateAccess = "true"))
TSubclassOf<UDamageType> DamageType;
UPROPERTY(EditAnywhere, BluePrintReadWrite, Category = "Movement", meta = (AllowPRivateAccess = "true"))
float MovementSpeed = 1300.0f;
UPROPERTY(EditAnywhere, BluePrintReadWrite, Category = "Damage", meta = (AllowPRivateAccess = "true"))
float Damage = 50.0f;
UPROPERTY(EditAnywhere, BluePrintReadOnly, Category = "Effetcs", meta = (AllowPRivateAccess = "true"))
UParticleSystem* HitParticle;
UFUNCTION()
void OnHit(UPrimitiveComponent* HitComp, AActor* OtherActor, UPrimitiveComponent* OtherComp, FVector NormalImpulse, const FHitResult& Hit);
UPROPERTY(EditAnywhere, BluePrintReadOnly, Category = "Effetcs", meta = (AllowPRivateAccess = "true"))
USoundBase* HitSound;
UPROPERTY(EditAnywhere, BluePrintReadOnly, Category = "Effetcs", meta = (AllowPRivateAccess = "true"))
USoundBase* LaunchSound;
UPROPERTY(EditAnywhere, BluePrintReadOnly, Category = "Effetcs", meta = (AllowPRivateAccess = "true"))
TSubclassOf<UCameraShake> HitShake;
};
| [
"gcconantc@gmail.com"
] | gcconantc@gmail.com |
3ce6be645dd8a783cbca33dbc21987642c107fed | 52dc9080af88c00222cc9b37aa08c35ff3cafe86 | /0400/60/467b.cpp | aac9e83125e7d8113896114851863c65fca5010e | [
"Unlicense"
] | permissive | shivral/cf | 1c1acde25fc6af775acaeeb6b5fe5aa9bbcfd4d2 | d7be128c3a9adb014a231a399f1c5f19e1ab2a38 | refs/heads/master | 2023-03-20T01:29:25.559828 | 2021-03-05T08:30:30 | 2021-03-05T08:30:30 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 630 | cpp | #include <iostream>
#include <vector>
template <typename T>
std::istream& operator >>(std::istream& input, std::vector<T>& v)
{
for (T& a : v)
input >> a;
return input;
}
void answer(unsigned v)
{
std::cout << v << '\n';
}
void solve(const std::vector<unsigned>& x, size_t n, size_t k)
{
const size_t m = x.size() - 1;
unsigned c = 0;
for (size_t i = 0; i < m; ++i)
c += (__builtin_popcount(x[i] ^ x[m]) <= k);
answer(c);
}
int main()
{
size_t n, m, k;
std::cin >> n >> m >> k;
std::vector<unsigned> x(m+1);
std::cin >> x;
solve(x, n, k);
return 0;
}
| [
"5691735+actium@users.noreply.github.com"
] | 5691735+actium@users.noreply.github.com |
90ea5a8dfb2e0a1e949cfffd48ca353dea5b300d | b2c2140258c16cadd876afb31d33e3e7b97a6bfe | /src/include/common/rid.h | 0fa90c1c089ee5a9738ee5b6ffb5ef3eed6e5e69 | [] | no_license | hqnddw/CMU-15445-database | cebafbcbf5bb0ae4ed0fa8b62d5be13eab68aa79 | 9502dcd019696af10e9781f890ab22d658e04bf7 | refs/heads/master | 2020-09-29T20:21:33.501271 | 2020-09-08T06:16:57 | 2020-09-08T06:16:57 | 227,114,452 | 5 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,578 | h | /**
* rid.h
*/
#pragma once
#include <cstdint>
#include <sstream>
#include "common/config.h"
namespace cmudb {
class RID {
public:
RID() : page_id_(INVALID_PAGE_ID), slot_num_(-1) {}; // invalid rid
RID(page_id_t page_id, int slot_num)
: page_id_(page_id), slot_num_(slot_num) {};
RID(int64_t rid) : page_id_(rid >> 32), slot_num_(rid) {};
inline int64_t Get() const { return ((int64_t) page_id_) << 32 | slot_num_; }
inline page_id_t GetPageId() const { return page_id_; }
inline int GetSlotNum() const { return slot_num_; }
inline void Set(page_id_t page_id, int slot_num) {
page_id_ = page_id;
slot_num_ = slot_num;
}
inline std::string ToString() const {
std::stringstream os;
os << "page_id: " << page_id_;
os << " slot_num: " << slot_num_ << "\n";
return os.str();
}
friend std::ostream &operator<<(std::ostream &os, const RID &rid) {
os << rid.ToString();
return os;
}
bool operator==(const RID &other) const {
return (page_id_ == other.page_id_) && (slot_num_ == other.slot_num_);
}
private:
page_id_t page_id_;
int slot_num_; // logical offset from 0, 1...
};
} // namespace cmudb
namespace std {
template<>
struct hash<cmudb::RID> {
size_t operator()(const cmudb::RID &obj) const {
return hash<int64_t>()(obj.Get());
}
};
} // namespace std
| [
"173056013@qq.com"
] | 173056013@qq.com |
b0e3c44374d34c604cd866edda55679a5a4cd976 | 04b1803adb6653ecb7cb827c4f4aa616afacf629 | /chrome/browser/devtools/devtools_window_testing.h | a50c06e28af3140fd162c2fd5b06a183c2b9cef0 | [
"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 | 2,856 | h | // Copyright 2014 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 CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_
#define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_
#include "base/callback.h"
#include "base/macros.h"
#include "chrome/browser/devtools/devtools_window.h"
#include "ui/gfx/geometry/rect.h"
class Browser;
class Profile;
namespace content {
class DevToolsAgentHost;
class MessageLoopRunner;
class WebContents;
}
class DevToolsWindowTesting {
public:
virtual ~DevToolsWindowTesting();
// The following methods block until DevToolsWindow is completely loaded.
static DevToolsWindow* OpenDevToolsWindowSync(
content::WebContents* inspected_web_contents,
bool is_docked);
static DevToolsWindow* OpenDevToolsWindowSync(
Browser* browser, bool is_docked);
static DevToolsWindow* OpenDevToolsWindowSync(
Profile* profile,
scoped_refptr<content::DevToolsAgentHost> agent_host);
static DevToolsWindow* OpenDiscoveryDevToolsWindowSync(Profile* profile);
// Closes the window like it was user-initiated.
static void CloseDevToolsWindow(DevToolsWindow* window);
// Blocks until window is closed.
static void CloseDevToolsWindowSync(DevToolsWindow* window);
static DevToolsWindowTesting* Get(DevToolsWindow* window);
Browser* browser();
content::WebContents* main_web_contents();
content::WebContents* toolbox_web_contents();
void SetInspectedPageBounds(const gfx::Rect& bounds);
void SetCloseCallback(const base::Closure& closure);
void SetOpenNewWindowForPopups(bool value);
private:
friend class DevToolsWindow;
friend class DevToolsWindowCreationObserver;
explicit DevToolsWindowTesting(DevToolsWindow* window);
static void WaitForDevToolsWindowLoad(DevToolsWindow* window);
static void WindowClosed(DevToolsWindow* window);
static DevToolsWindowTesting* Find(DevToolsWindow* window);
DevToolsWindow* devtools_window_;
base::Closure close_callback_;
DISALLOW_COPY_AND_ASSIGN(DevToolsWindowTesting);
};
class DevToolsWindowCreationObserver {
public:
DevToolsWindowCreationObserver();
~DevToolsWindowCreationObserver();
using DevToolsWindows = std::vector<DevToolsWindow*>;
const DevToolsWindows& devtools_windows() { return devtools_windows_; }
DevToolsWindow* devtools_window();
void Wait();
void WaitForLoad();
void CloseAllSync();
private:
friend class DevToolsWindow;
void DevToolsWindowCreated(DevToolsWindow* devtools_window);
base::Callback<void(DevToolsWindow*)> creation_callback_;
DevToolsWindows devtools_windows_;
scoped_refptr<content::MessageLoopRunner> runner_;
DISALLOW_COPY_AND_ASSIGN(DevToolsWindowCreationObserver);
};
#endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_TESTING_H_
| [
"sunny.nam@samsung.com"
] | sunny.nam@samsung.com |
15312b6e731224d83bbe6eccf8fd116ea746325f | bc6b66123490d46a7a0407584134727a55035974 | /clang/test/AST/ast-dump-template-decls-json.cpp | f201f13dbdaa6f8a28e1c34c4ab24e5b73a5cd28 | [
"Apache-2.0",
"LLVM-exception",
"NCSA"
] | permissive | IBinary6/llvm-project | 4c9c7cbe4cc66a60118c0d72a17254394a72bf3e | f237c7d411fa1b8f55a6a0ece41ed5da936fb76e | refs/heads/master | 2020-06-07T03:27:06.967021 | 2019-06-20T09:58:58 | 2019-06-20T09:58:58 | 192,897,035 | 1 | 0 | null | 2019-06-20T10:07:09 | 2019-06-20T10:07:09 | null | UTF-8 | C++ | false | false | 77,512 | cpp | // RUN: %clang_cc1 -std=c++17 -triple x86_64-unknown-unknown -ast-dump=json %s | FileCheck -strict-whitespace %s
template <typename Ty>
void a(Ty);
template <typename... Ty>
void b(Ty...);
template <class Ty, typename Uy>
void c(Ty);
template <>
void c<float, int>(float);
template <typename Ty, template<typename> typename Uy>
void d(Ty, Uy<Ty>);
template <class Ty>
void e(Ty);
template <int N>
void f(int i = N);
template <typename Ty = int>
void g(Ty);
template <typename = void>
void h();
template <typename Ty>
struct R {};
template <>
struct R<int> {};
template <typename Ty, class Uy>
struct S {};
template <typename Ty>
struct S<Ty, int> {};
template <auto>
struct T {};
template <decltype(auto)>
struct U {};
template <typename Ty>
struct V {
template <typename Uy>
void f();
};
template <typename Ty>
template <typename Uy>
void V<Ty>::f() {}
// CHECK: "kind": "TranslationUnitDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TypedefDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "__int128_t",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__int128"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "BuiltinType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__int128"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TypedefDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "__uint128_t",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "unsigned __int128"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "BuiltinType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "unsigned __int128"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TypedefDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "__NSConstantString",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__NSConstantString_tag"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "RecordType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__NSConstantString_tag"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TypedefDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "__builtin_ms_va_list",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "char *"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "PointerType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "char *"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "BuiltinType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "char"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TypedefDecl",
// CHECK-NEXT: "loc": {},
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {},
// CHECK-NEXT: "end": {}
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "__builtin_va_list",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__va_list_tag [1]"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ConstantArrayType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__va_list_tag [1]"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "RecordType",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "__va_list_tag"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 3
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 3
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 3
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 3
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "a",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 4
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 6
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "b",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 23,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 6
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 6
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 23,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 6
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0,
// CHECK-NEXT: "isParameterPack": true
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "b",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty...)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 7
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty..."
// CHECK-NEXT: },
// CHECK-NEXT: "isParameterPack": true
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "c",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "class",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 30,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 21,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 30,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 9
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Uy",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 1
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "c",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 10
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "name": "c",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (float)"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 13
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 12
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 25,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 13
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "previousDecl": "0x{{.*}}",
// CHECK-NEXT: "name": "c",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (float)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "float"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 25,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 13
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 13
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 13
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "float"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "d",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTemplateParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 52,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 24,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 52,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Uy",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 1,
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 33,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 33,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 33,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 15
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 1,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "d",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty, Uy<Ty>)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 12,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 16
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Uy<Ty>"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 18
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "e",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 18
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 18
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 18
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "class",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "e",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 19
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 21
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "NonTypeTemplateParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 15,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 21
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 21
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 15,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 21
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "N",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: },
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (int)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 12,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 16,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "i",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: },
// CHECK-NEXT: "init": "c",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "DeclRefExpr",
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 16,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 16,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 22
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: },
// CHECK-NEXT: "valueCategory": "rvalue",
// CHECK-NEXT: "referencedDecl": {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "NonTypeTemplateParmDecl",
// CHECK-NEXT: "name": "N",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 24
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "g",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 24
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 24
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 25,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 24
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0,
// CHECK-NEXT: "defaultArg": {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "g",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void (Ty)"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ParmVarDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 25
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "Ty"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 28
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 27
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 28
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "h",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 27
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 27
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 22,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 27
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0,
// CHECK-NEXT: "defaultArg": {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 6,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 28
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 28
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 28
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "h",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void ()"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 30
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "R",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 30
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 30
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 30
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "R",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 31
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "R",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateSpecializationDecl",
// CHECK-NEXT: "name": "R"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateSpecializationDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 34
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 33
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 16,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 34
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "R",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "canPassInRegisters": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 34
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 34
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 34
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "R",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "S",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 30,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 24,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 30,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 36
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Uy",
// CHECK-NEXT: "tagUsed": "class",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 1
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "S",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 37
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "S",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplatePartialSpecializationDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 40
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 39
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 40
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "S",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "type-parameter-0-0"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "kind": "TemplateArgument",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "int"
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 39
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 39
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 39
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isReferenced": true,
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 40
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 40
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 40
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "S",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 42
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "T",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "NonTypeTemplateParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 15,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 42
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 42
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 42
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "auto"
// CHECK-NEXT: },
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "T",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 43
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "T",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 45
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "U",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "NonTypeTemplateParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 25,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 45
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 45
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 45
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "decltype(auto)"
// CHECK-NEXT: },
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "U",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 46
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "U",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "ClassTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 48
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 52
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "V",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 48
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 48
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 48
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Ty",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 0,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 52
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "V",
// CHECK-NEXT: "tagUsed": "struct",
// CHECK-NEXT: "completeDefinition": true,
// CHECK-NEXT: "definitionData": {
// CHECK-NEXT: "canConstDefaultInit": true,
// CHECK-NEXT: "copyAssign": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "copyCtor": {
// CHECK-NEXT: "hasConstParam": true,
// CHECK-NEXT: "implicitHasConstParam": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "defaultCtor": {
// CHECK-NEXT: "defaultedIsConstexpr": true,
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "isConstexpr": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "dtor": {
// CHECK-NEXT: "irrelevant": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "hasConstexprNonCopyMoveConstructor": true,
// CHECK-NEXT: "isAggregate": true,
// CHECK-NEXT: "isEmpty": true,
// CHECK-NEXT: "isLiteral": true,
// CHECK-NEXT: "isPOD": true,
// CHECK-NEXT: "isStandardLayout": true,
// CHECK-NEXT: "isTrivial": true,
// CHECK-NEXT: "isTriviallyCopyable": true,
// CHECK-NEXT: "moveAssign": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: },
// CHECK-NEXT: "moveCtor": {
// CHECK-NEXT: "exists": true,
// CHECK-NEXT: "needsImplicit": true,
// CHECK-NEXT: "simple": true,
// CHECK-NEXT: "trivial": true
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXRecordDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 49
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "isImplicit": true,
// CHECK-NEXT: "name": "V",
// CHECK-NEXT: "tagUsed": "struct"
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 51
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 3,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 50
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 51
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 22,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 50
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 50
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 22,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 50
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Uy",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 1,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXMethodDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 8,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 51
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 3,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 51
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 10,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 51
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void ()"
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "FunctionTemplateDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 55
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "parentDeclContext": "0x{{.*}}",
// CHECK-NEXT: "previousDecl": "0x{{.*}}",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "TemplateTypeParmDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 55
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 11,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 55
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 20,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 55
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "name": "Uy",
// CHECK-NEXT: "tagUsed": "typename",
// CHECK-NEXT: "depth": 1,
// CHECK-NEXT: "index": 0
// CHECK-NEXT: },
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CXXMethodDecl",
// CHECK-NEXT: "loc": {
// CHECK-NEXT: "col": 13,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: },
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 1,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 54
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: }
// CHECK-NEXT: },
// CHECK-NEXT: "parentDeclContext": "0x{{.*}}",
// CHECK-NEXT: "previousDecl": "0x{{.*}}",
// CHECK-NEXT: "name": "f",
// CHECK-NEXT: "type": {
// CHECK-NEXT: "qualType": "void ()"
// CHECK-NEXT: },
// CHECK-NEXT: "inner": [
// CHECK-NEXT: {
// CHECK-NEXT: "id": "0x{{.*}}",
// CHECK-NEXT: "kind": "CompoundStmt",
// CHECK-NEXT: "range": {
// CHECK-NEXT: "begin": {
// CHECK-NEXT: "col": 17,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: },
// CHECK-NEXT: "end": {
// CHECK-NEXT: "col": 18,
// CHECK-NEXT: "file": "{{.*}}",
// CHECK-NEXT: "line": 56
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
// CHECK-NEXT: ]
// CHECK-NEXT: }
| [
"aaron@aaronballman.com"
] | aaron@aaronballman.com |
1478b0a1b55c119140a07786e2d6575ce9405667 | 20aa6dae5425159bcbd008bf32e7040d1c7fcf9e | /plugin.cpp | e4ca44c7e36d4322136023df56a4ea996c7ed1f9 | [] | no_license | andydansby/photoreactor-SRR | c04a37c7b90be069e403c97e3837298fd8fa155f | 09aaf049ba7b774b5c1a6141c918b5f9bb48e51a | refs/heads/master | 2021-01-10T13:50:19.461260 | 2016-03-10T10:35:52 | 2016-03-10T10:35:52 | 53,576,331 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 19,044 | cpp | // plugin.cpp : Defines the entry point for the DLL application.
//
#include "stdafx.h"
#include "IPlugin.h"
#include <math.h>
#include <cmath>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>//to use cout
using namespace std;
////////////////////////////////////////////////////////////////////////
// A concrete plugin implementation
////////////////////////////////////////////////////////////////////////
// Photo-Reactor Plugin class
//****************************************************************************
//This code has been generated by the Mediachance photo reactor Code generator.
#define AddParameter(N,S,V,M1,M2,T,D) {strcpy (pParameters[N].m_sLabel,S);pParameters[N].m_dValue = V;pParameters[N].m_dMin = M1;pParameters[N].m_dMax = M2;pParameters[N].m_nType = T;pParameters[N].m_dSpecialValue = D;}
#define GetValue(N) (pParameters[N].m_dValue)
#define GetValueY(N) (pParameters[N].m_dSpecialValue)
#define SetValue(N,V) {pParameters[N].m_dValue = V;}
#define GetBOOLValue(N) ((BOOL)(pParameters[N].m_dValue==pParameters[N].m_dMax))
// if it is not defined, then here it is
//#define RGB(r,g,b) ((COLORREF)(((BYTE)(r)|((WORD)((BYTE)(g))<<8))|(((DWORD)(BYTE)(b))<<16)))
#define PARAM_RADIUS 0
#define PARAM_LAMBDA 1
#define NUMBER_OF_USER_PARAMS 2
#define MIN(a,b) (((a)<(b))?(a):(b))
#define MAX(a,b) (((a)>(b))?(a):(b))
class Plugin1 : public IPlugin
{
public:
//Plugin Icon:
//you can add your own icon by creating 160x100 png file, naming it the same as plugin dll and then placing it in the plugins folder
//otherwise a generic icon will be use
//this is the title of the box in workspace. it should be short
const char* GetTitle () const
{
return "Andy's SRR";
}
// this will appear in the help pane, you can put your credits and short info
const char* GetDescription () const
{
return "Andy's Spacial Range Reduction. This seperable spacial Edge preserving filter is simular to a bilateral filter, using the color distance between colors to determine an edge. If the pixel's color distance is larger than Lambda, then the pixel is skipped, otherwise it is summed up and averaged. Since this filter is seperable it runs fairly fast, however on larger radius, it will slow down.";
}
// BASIC PARAMETERS
// number of inputs 0,1 or 2
int GetInputNumber ()
{
return 1;
}
// number of outputs 0 or 1
int GetOutputNumber ()
{
return 1;
}
int GetBoxColor ()
{
return RGB(44,78,119);
}
int GetTextColor ()
{
return RGB(165,236,255);
}
// width of the box in the workspace
// valid are between 50 and 100
int GetBoxWidth ()
{
return 80;
}
// set the flags
// see the interface builder
// ex: nFlag = FLAG_FAST_PROCESS | FLAG_HELPER;
//FLAG_NONE same as zero Default, no other flags set
//FLAG_UPDATE_IMMEDIATELY It is very fast process that can update immediately. When user turns the sliders on UI the left display will update
// Use Update Immediately only for fast and single loop processes, for example Desaturate, Levels.
//FLAG_HELPER It is an helper object. Helper objects will remain visible in Devices and they can react to mouse messages. Example: Knob, Monitor, Bridge Pin
//FLAG_BINDING Binding object, attach to other objects and can change its binding value. It never goes to Process_Data functions. Example: Knob, Switch, Slider
//FLAG_DUMMY It is only for interface but never process any data. Never goes to Process_Data functions. Example: Text note
//FLAG_SKIPFINAL Process data only during designing, doesn't process during final export. Example: Monitor, Vectorscope
//FLAG_LONGPROCESS Process that takes > 1s to finish. Long Process will display the Progress dialog and will prevent user from changing values during the process.
//FLAG_NEEDSIZEDATA Process need to know size of original image, the zoom and what part of image is visible in the preview. When set the plugin will receive SetSizeData
//FLAG_NEEDMOUSE Process will receive Mouse respond data from the workplace. This is only if your object is interactive, for example Knob, Slider
int GetFlags ()
{
// it is fast process
int nFlag = FLAG_LONGPROCESS;
return nFlag;
}
// User Interface Build
// there is maximum 29 Parameters
int GetUIParameters (UIParameters* pParameters)
{
// label, value, min, max, type_of_control, special_value
// use the UI builder in the software to generate this
AddParameter( PARAM_RADIUS ,"Radius", 5.0, 1.0, 50.0, TYPE_SLIDER, 0.0);//inital min max/
AddParameter( PARAM_LAMBDA ,"Lambda", .09, 0.001, 0.5, TYPE_SLIDER, 0.0);//inital min max/
return NUMBER_OF_USER_PARAMS;
}
// Actual processing function for 1 input
//***************************************************************************************************
// Both buffers are the same size
// don't change the IN buffer or things will go bad for other objects in random fashion
// the pBGRA_out comes already with pre-copied data from pBGRA_in
// Note: Don't assume the nWidth and nHeight will be every run the same or that it contains the whole image!!!!
// This function receives buffer of the actual preview (it can be just a crop of image when zoomed in) and during the final calculation of the full buffer
// this is where the image processing happens
virtual void Process_Data (BYTE* pBGRA_out,BYTE* pBGRA_in, int nWidth, int nHeight, UIParameters* pParameters)
{
//List of Parameters
double dLambda = GetValue(PARAM_LAMBDA);// used to grab radius from control
double dRadius = GetValue(PARAM_RADIUS);
int size = int(dRadius + dRadius) + 1;// we want an odd sized kernel
double* temp=new double[nWidth * nHeight * 4]; // this is our tempory buffer to store image blurred horizonally.
double* inputimage=new double[nWidth * nHeight * 4]; //
double Rcolordistance;
double Gcolordistance;
double Bcolordistance;
double Rsum;
double Gsum;
double Bsum;
double fcolorspace = 255.0f;
//place our image in a seperate array in the 0-1 range, where 0 is darkest and 1 is lightest
for (int x = 0; x < nWidth; x++)
{
for (int y = 0; y < nHeight; y++)
{
int nIdx = x * 4 + y * 4 * nWidth;
double red = pBGRA_in[nIdx + CHANNEL_R] / fcolorspace;
double green = pBGRA_in[nIdx + CHANNEL_G] / fcolorspace;
double blue = pBGRA_in[nIdx + CHANNEL_B] / fcolorspace;
inputimage[nIdx + CHANNEL_R] = red;
inputimage[nIdx + CHANNEL_G] = green;
inputimage[nIdx + CHANNEL_B] = blue;
}
}
//blurs horizonally
for(int y=0;y<nHeight;y++)
{
for(int x=0;x<nWidth;x++)
{
//clear your variables to process the pixel
Rsum = 0;
Gsum = 0;
Bsum = 0;
double red = 0;//red
double green = 0;//green
double blue = 0;//blue
double redmin = 65535.0f;
double greenmin = 65535.0f;
double bluemin = 65535.0f;
double redmax = 0;
double greenmax = 0;
double bluemax = 0;
//accumulate colors
for(int i=max(0,x-size);i<=MIN(nWidth-1,x+size);i++)
{
// this stays in center of kernel
double redKernelCenter = inputimage[(x + y * nWidth) * 4 + CHANNEL_R];
double greenKernelCenter = inputimage[(x + y * nWidth) * 4 + CHANNEL_G];
double blueKernelCenter = inputimage[(x + y * nWidth) * 4 + CHANNEL_B];
// this stays in center of kernel
//this slides / moves along the kernel to collect the neighboring pixels
double redKernelSlider = inputimage[(i + y * nWidth) * 4 + CHANNEL_R];
double greenKernelSlider = inputimage[(i + y * nWidth) * 4 + CHANNEL_G];
double blueKernelSlider = inputimage[(i + y * nWidth) * 4 + CHANNEL_B];
//this slides / moves along the kernel to collect the neighboring pixels
if (redKernelSlider < redmin){redmin = redKernelSlider;}
if (greenKernelSlider < greenmin){greenmin = greenKernelSlider;}
if (blueKernelSlider < bluemin){bluemin = blueKernelSlider;}
if (redKernelSlider > redmax){redmax = redKernelSlider;}
if (greenKernelSlider > greenmax){greenmax = greenKernelSlider;}
if (blueKernelSlider > bluemax){bluemax = blueKernelSlider;}
Rcolordistance = abs(redKernelCenter - redKernelSlider);
Gcolordistance = abs(greenKernelCenter - greenKernelSlider);
Bcolordistance = abs(blueKernelCenter - blueKernelSlider);
if (Rcolordistance < dLambda)
{
red += redKernelSlider;
Rsum ++;
}
if (Gcolordistance < dLambda)
{
green += greenKernelSlider;
Gsum ++;
}
if (Bcolordistance < dLambda)
{
blue += blueKernelSlider;
Bsum ++;
}
}//end i
{//output
temp[(x + y * nWidth) * 4 + CHANNEL_R] = red / Rsum;
temp[(x + y * nWidth) * 4 + CHANNEL_G] = green / Gsum;
temp[(x + y * nWidth) * 4 + CHANNEL_B] = blue / Bsum;
//pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_R] = CLAMP255((red / Rsum) * fcolorspace);
//pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_G] = CLAMP255((green / Gsum) * fcolorspace);
//pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_B] = CLAMP255((blue / Bsum) * fcolorspace);
}//end output
}//end X
}//end Y
delete [] inputimage;//delete the array
#pragma region //test for proof that the image is in temp and blurred horizonally
//uncomment the routine to see horizontal blur, make sure to comment out the routine below
for (int x = 0; x< nWidth; x++)
{
for (int y = 0; y< nHeight; y++)
{
//int nIdx = x * 4 + y * 4 * nWidth;
//double nR = temp [nIdx + CHANNEL_R];
//double nG = temp [nIdx + CHANNEL_G];
//double nB = temp [nIdx + CHANNEL_B];
//pBGRA_out[nIdx + CHANNEL_R] = CLAMP255(nR * fcolorspace);
//pBGRA_out[nIdx + CHANNEL_G] = CLAMP255(nG * fcolorspace);
//pBGRA_out[nIdx + CHANNEL_B] = CLAMP255(nB * fcolorspace);
}
}
#pragma endregion
#pragma region //blurs vertically
for(int x=0;x<nWidth;x++)
{
for(int y=0;y<nHeight;y++)
{
//clear your variables to process the pixel
Rsum = 0;
Gsum = 0;
Bsum = 0;
double red = 0;//red
double green = 0;//green
double blue = 0;//blue
double redmin = 65535.0f;
double greenmin = 65535.0f;
double bluemin = 65535.0f;
double redmax = 0;
double greenmax = 0;
double bluemax = 0;
//accumulate colors
for(int i=max(0,y-size);i<=min(nHeight-1,y+size);i++)
{
// this stays in center of kernel
double redKernelCenter = temp[(x + y * nWidth) * 4 + CHANNEL_R];
double greenKernelCenter = temp[(x + y * nWidth) * 4 + CHANNEL_G];
double blueKernelCenter = temp[(x + y * nWidth) * 4 + CHANNEL_B];
// this stays in center of kernel
// this slides / moves along the kernel to collect the neighboring pixels
double redKernelSlider = temp[(x + i * nWidth) * 4 + CHANNEL_R];
double greenKernelSlider = temp[(x + i * nWidth) * 4 + CHANNEL_G];
double blueKernelSlider = temp[(x + i * nWidth) * 4 + CHANNEL_B];
//this slides / moves along the kernel to collect the neighboring pixels
if (redKernelSlider < redmin){redmin = redKernelSlider;}
if (greenKernelSlider < greenmin){greenmin = greenKernelSlider;}
if (blueKernelSlider < bluemin){bluemin = blueKernelSlider;}
if (redKernelSlider > redmax){redmax = redKernelSlider;}
if (greenKernelSlider > greenmax){greenmax = greenKernelSlider;}
if (blueKernelSlider > bluemax){bluemax = blueKernelSlider;}
Rcolordistance = abs(redKernelCenter - redKernelSlider);
Gcolordistance = abs(greenKernelCenter - greenKernelSlider);
Bcolordistance = abs(blueKernelCenter - blueKernelSlider);
if (Rcolordistance < dLambda)
{
red += redKernelSlider;
Rsum ++;
}
if (Gcolordistance < dLambda)
{
green += greenKernelSlider;
Gsum ++;
}
if (Bcolordistance < dLambda)
{
blue += blueKernelSlider;
Bsum ++;
}
}//end i
{//output
pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_R] = CLAMP255((red / Rsum) * fcolorspace);
pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_G] = CLAMP255((green / Gsum) * fcolorspace);
pBGRA_out[(x + y * nWidth) * 4 + CHANNEL_B] = CLAMP255((blue / Bsum) * fcolorspace);
}//end output
}//end Y
}//end X
#pragma endregion
delete [] temp;//delete the array
}
// actual processing function for 2 inputs
//********************************************************************************
// all buffers are the same size
// don't change the IN buffers or things will go bad
// the pBGRA_out comes already with copied data from pBGRA_in1
virtual void Process_Data2 (BYTE* pBGRA_out, BYTE* pBGRA_in1, BYTE* pBGRA_in2, int nWidth, int nHeight, UIParameters* pParameters)
{
}
//*****************Drawing functions for the BOX *********************************
//how is the drawing handled
//DRAW_AUTOMATICALLY the main program will fully take care of this and draw a box, title, socket and thumbnail
//DRAW_SIMPLE_A will draw a box, title and sockets and call CustomDraw
//DRAW_SIMPLE_B will draw a box and sockets and call CustomDraw
//DRAW_SOCKETSONLY will call CustomDraw and then draw sockets on top of it
// highlighting rectangle around is always drawn except for DRAW_SOCKETSONLY
virtual int GetDrawingType ()
{
int nType = DRAW_AUTOMATICALLY;
return nType;
}
// Custom Drawing
// custom drawing function called when drawing type is different than DRAW_AUTOMATICALLY
// it is not always in real pixels but scaled depending on where it is drawn
// the scale could be from 1.0 to > 1.0
// so you always multiply the position, sizes, font size, line width with the scale
virtual void CustomDraw (HDC hDC, int nX,int nY, int nWidth, int nHeight, float scale, BOOL bIsHighlighted, UIParameters* pParameters)
{
}
//************ Optional Functions *****************************************************************************************
// those functions are not necessary for normal effect, they are mostly for special effects and objects
// Called when FLAG_HELPER set.
// When UI data changed (user turned knob) this function will be called as soon as user finish channging the data
// You will get the latest parameters and also which parameter changed
// Normally for effects you don't have to do anything here because you will get the same parameters in the process function
// It is only for helper objects that may not go to Process Data
BOOL UIParametersChanged (UIParameters* pParameters, int nParameter)
{
return FALSE;
}
// when button is pressed on UI, this function will be called with the parameter and sub button (for multi button line)
BOOL UIButtonPushed (int nParam, int nSubButton, UIParameters* pParameters)
{
return TRUE;
}
// Called when FLAG_NEEDSIZEDATA set
// Called before each calculation (Process_Data)
// If your process depends on a position on a frame you may need the data to correctly display it because Process_Data receives only a preview crop
// Most normal effects don't depend on the position in frame so you don't need the data
// Example: drawing a circle at a certain position requires to know what is displayed in preview or the circle will be at the same size and position regardless of zoom
// Note: Even if you need position but you don't want to mess with the crop data, just ignore it and pretend the Process_Data are always of full image (they are not).
// In worst case this affects only preview when using zoom. The full process image always sends the whole data
// nOriginalW, nOriginalH - the size of the original - full image. If user sets Resize on input - this will be the resized image
// nPreviewW, nPreviewH - this is the currently processed preview width/height - it is the same that Process_Data will receive
// - in full process the nPreviewW, nPreviewH is equal nOriginalW, nOriginalH
// Crop X1,Y1,X2,Y2 - relative coordinates of preview crop rectangle in <0...1>, for full process they are 0,0,1,1 (full rectangle)
// dZoom - Zoom of the Preview, for full process the dZoom = 1.0
void SetSizeData(int nOriginalW, int nOriginalH, int nPreviewW, int nPreviewH, double dCropX1, double dCropY1, double dCropX2, double dCropY2, double dZoom)
{
// so if you need the position and zoom, this is the place to get it.
// Note: because of IBM wisdom the internal bitmaps are on PC always upside down, but the coordinates are not
}
// ***** Mouse handling on workplace ***************************
// only if FLAG_NEEDMOUSE is set
//****************************************************************
//this is for special objects that need to receive mouse, like a knob or slider on workplace
// normally you use this for FLAG_BINDING objects
// in coordinates relative to top, left corner of the object (0,0)
virtual BOOL MouseButtonDown (int nX, int nY, int nWidth, int nHeight, UIParameters* pParameters)
{
// return FALSE if not handled
// return TRUE if handled
return FALSE;
}
// in coordinates relative to top, left corner of the object (0,0)
virtual BOOL MouseMove (int nX, int nY, int nWidth, int nHeight, UIParameters* pParameters)
{
return FALSE;
}
// in coordinates relative to top, left corner of the object (0,0)
virtual BOOL MouseButtonUp (int nX, int nY, int nWidth, int nHeight, UIParameters* pParameters)
{
// Note: if we changed data and need to recalculate the flow we need to return TRUE
// return FALSE if not handled
// return TRUE if handled
return TRUE;
}
};
extern "C"
{
// Plugin factory function
__declspec(dllexport) IPlugin* Create_Plugin ()
{
//allocate a new object and return it
return new Plugin1 ();
}
// Plugin cleanup function
__declspec(dllexport) void Release_Plugin (IPlugin* p_plugin)
{
//we allocated in the factory with new, delete the passed object
delete p_plugin;
}
}
// this is the name that will appear in the object library
extern "C" __declspec(dllexport) char* GetPluginName()
{
return "Andy's SRR";
}
// This MUST be unique string for each plugin so we can save the data
extern "C" __declspec(dllexport) char* GetPluginID()
{
return "com.lumafilters.SRR";
}
// category of plugin, for now the EFFECT go to top library box, everything else goes to the middle library box
extern "C" __declspec(dllexport) int GetCategory()
{
return CATEGORY_EFFECT;
} | [
"andydansby@gmail.com"
] | andydansby@gmail.com |
579aee32328078ce3f2578c44567d2e5bb93c7de | c6b3e60a3db8e30270db498fa8cc72d25efb984e | /src/proj/projections/sterea.cpp | 6d500a3db7870480bdc7dc57b4aca2b617aebfca | [
"MIT"
] | permissive | mdsumner/libproj | 3aa1dc9d3cba9a4b083de0162c9e323b8bccf034 | b815df5411ae6a660fc0e99bd458d601c37c38f6 | refs/heads/master | 2023-08-19T04:20:38.102110 | 2021-10-06T11:54:25 | 2021-10-06T11:54:25 | 285,718,735 | 0 | 0 | null | 2020-08-07T02:32:32 | 2020-08-07T02:32:31 | null | UTF-8 | C++ | false | false | 3,754 | cpp | /*
** libproj -- library of cartographic projections
**
** Copyright (c) 2003 Gerald I. Evenden
*/
/*
** 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.
*/
#define PJ_LIB__
#include <errno.h>
#include "R-libproj/proj.h"
#include "R-libproj/proj_internal.h"
#include <math.h>
namespace { // anonymous namespace
struct pj_opaque {
double phic0;
double cosc0, sinc0;
double R2;
void *en;
};
} // anonymous namespace
PROJ_HEAD(sterea, "Oblique Stereographic Alternative") "\n\tAzimuthal, Sph&Ell";
static PJ_XY sterea_e_forward (PJ_LP lp, PJ *P) { /* Ellipsoidal, forward */
PJ_XY xy = {0.0,0.0};
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque);
double cosc, sinc, cosl, k;
lp = pj_gauss(P->ctx, lp, Q->en);
sinc = sin(lp.phi);
cosc = cos(lp.phi);
cosl = cos(lp.lam);
const double denom = 1. + Q->sinc0 * sinc + Q->cosc0 * cosc * cosl;
if( denom == 0.0 ) {
proj_errno_set(P, PROJ_ERR_COORD_TRANSFM_OUTSIDE_PROJECTION_DOMAIN);
return proj_coord_error().xy;
}
k = P->k0 * Q->R2 / denom;
xy.x = k * cosc * sin(lp.lam);
xy.y = k * (Q->cosc0 * sinc - Q->sinc0 * cosc * cosl);
return xy;
}
static PJ_LP sterea_e_inverse (PJ_XY xy, PJ *P) { /* Ellipsoidal, inverse */
PJ_LP lp = {0.0,0.0};
struct pj_opaque *Q = static_cast<struct pj_opaque*>(P->opaque);
double rho, c, sinc, cosc;
xy.x /= P->k0;
xy.y /= P->k0;
if ( (rho = hypot (xy.x, xy.y)) != 0.0 ) {
c = 2. * atan2 (rho, Q->R2);
sinc = sin (c);
cosc = cos (c);
lp.phi = asin (cosc * Q->sinc0 + xy.y * sinc * Q->cosc0 / rho);
lp.lam = atan2 (xy.x * sinc, rho * Q->cosc0 * cosc - xy.y * Q->sinc0 * sinc);
} else {
lp.phi = Q->phic0;
lp.lam = 0.;
}
return pj_inv_gauss(P->ctx, lp, Q->en);
}
static PJ *destructor (PJ *P, int errlev) {
if (nullptr==P)
return nullptr;
if (nullptr==P->opaque)
return pj_default_destructor (P, errlev);
free (static_cast<struct pj_opaque*>(P->opaque)->en);
return pj_default_destructor (P, errlev);
}
PJ *PROJECTION(sterea) {
double R;
struct pj_opaque *Q = static_cast<struct pj_opaque*>(calloc (1, sizeof (struct pj_opaque)));
if (nullptr==Q)
return pj_default_destructor (P, PROJ_ERR_OTHER /*ENOMEM*/);
P->opaque = Q;
Q->en = pj_gauss_ini(P->e, P->phi0, &(Q->phic0), &R);
if (nullptr==Q->en)
return pj_default_destructor (P, PROJ_ERR_OTHER /*ENOMEM*/);
Q->sinc0 = sin (Q->phic0);
Q->cosc0 = cos (Q->phic0);
Q->R2 = 2. * R;
P->inv = sterea_e_inverse;
P->fwd = sterea_e_forward;
P->destructor = destructor;
return P;
}
| [
"dewey@fishandwhistle.net"
] | dewey@fishandwhistle.net |
b1c9b84209b6c97ec87eebc6406ef8a4b5c90895 | da4a4b5461b5cb3ee7548686403d9329ee114148 | /database-objects/Post.h | 7a5c95bd877cac8f170343805be822169802aa94 | [] | no_license | sikorski-as/beeper | 87786efc84f8dddab4c5faad5e3c36c78e1be90c | 40fe7d3ebe8e5046aa3eb95bc5aec9f11209735d | refs/heads/dev | 2020-05-03T15:37:45.819391 | 2019-07-09T06:33:15 | 2019-07-09T06:33:15 | 178,706,895 | 2 | 0 | null | 2019-07-09T06:37:05 | 2019-03-31T15:32:06 | C | UTF-8 | C++ | false | false | 775 | h | //
// Created by hubertborkowski on 28.05.19.
//
#ifndef BEEPER_POST_H
#define BEEPER_POST_H
#include <string>
class Post
{
public:
Post(int id, int userId, const std::string& content) : id(id), userId(userId), content(content)
{}
Post(): userId(), content()
{
id = 0;
}
int getId() const
{
return id;
}
void setId(int id)
{
Post::id = id;
}
int getUserId() const
{
return userId;
}
void setUserId(int userId)
{
Post::userId = userId;
}
const std::string& getContent() const
{
return content;
}
void setContent(const std::string& content)
{
Post::content = content;
}
bool isEmpty()
{
return id == 0;
}
private:
int id;
int userId;
std::string content;
};
#endif //BEEPER_POST_H
| [
"hborkows@mion.elka.pw.edu.pl"
] | hborkows@mion.elka.pw.edu.pl |
61ec6ab3d355fb6aa5c30f7deaed002a58a201cf | 2488895229415ef17af60c53cbe9d513851afe00 | /Meerkat/inc/KernelDensity.hh | 6c6c9daa0c18e13a3da998b6db4e6609c7a69e1a | [] | no_license | alexpearce/CodePublic | 9ca16c6bdd0804308d73527808431f9781005841 | 159ad602fdb91e6b62ee544a32d3913b7c690249 | refs/heads/master | 2021-01-10T14:26:41.651075 | 2015-07-29T16:45:07 | 2015-07-29T16:45:07 | 43,753,902 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 2,946 | hh | #ifndef KERNEL_DENSITY
#define KERNEL_DENSITY
#include "AbsDensity.hh"
#include "AbsPhaseSpace.hh"
#include "TMath.h"
#include "TTree.h"
#include "TString.h"
#include "TRandom3.h"
#include <vector>
typedef std::vector<Double_t> TPhspVector;
typedef std::vector<TPhspVector> TCell;
/// Class that describes the unbinned kernel density.
class KernelDensity : public AbsDensity {
public:
KernelDensity(const char* pdfName,
AbsPhaseSpace* thePhaseSpace,
std::vector<Double_t> &width,
UInt_t approxSize,
AbsDensity* approxDensity = 0);
KernelDensity(const char* pdfName,
AbsPhaseSpace* thePhaseSpace,
UInt_t approxSize,
Double_t width1,
Double_t width2 = 0,
Double_t width3 = 0,
Double_t width4 = 0,
Double_t width5 = 0);
KernelDensity(const char* pdfName,
AbsPhaseSpace* thePhaseSpace,
UInt_t approxSize,
AbsDensity* approxDensity,
Double_t width1,
Double_t width2 = 0,
Double_t width3 = 0,
Double_t width4 = 0,
Double_t width5 = 0);
virtual ~KernelDensity();
void setWidth(std::vector<Double_t> &width);
Bool_t generateApproximation(UInt_t approxSize);
Bool_t readTuple(TTree* tree, std::vector<TString> &vars, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, const char* var2, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, const char* var2,
const char* var3, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, const char* var2,
const char* var3, const char* var4, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, const char* var2,
const char* var3, const char* var4,
const char* var5, UInt_t maxEvents = 0);
Bool_t readTuple(TTree* tree, const char* var1, const char* var2,
const char* var3, const char* var4,
const char* var5, const char* var6, UInt_t maxEvents = 0);
Double_t density(std::vector<Double_t> &x);
AbsPhaseSpace* phaseSpace() { return m_phaseSpace; }
private:
UInt_t numCells(void);
Int_t cellIndex(std::vector<Double_t> &x);
Double_t rawDensity(std::vector<Double_t> &x, std::vector<TCell> &vector);
AbsPhaseSpace* m_phaseSpace;
AbsDensity* m_approxDensity;
TPhspVector m_width;
std::vector<TCell> m_apprVector;
std::vector<TCell> m_dataVector;
};
#endif
| [
"dominik@Dominiks-MBP.home"
] | dominik@Dominiks-MBP.home |
ddfb56f3ed14e3b7a32b5be3032c7855390af09b | 4c39ed31fe1268302952bbe5c2cd456c8083281e | /LeetCode/swapPairs.cpp | bd3ede142b4aab7d916b72eda9f468ed2b7e44a7 | [] | no_license | Abhay4/Algorithm | 37e3b8bd3c9990b896d862f1aa20ad8312f20e75 | 50b157e027c7f0c085a8a15929422e75851fafc4 | refs/heads/master | 2020-12-11T01:37:58.200719 | 2018-01-24T18:24:05 | 2018-01-24T18:24:05 | 38,934,843 | 0 | 0 | null | 2015-07-11T17:46:17 | 2015-07-11T17:46:17 | null | UTF-8 | C++ | false | false | 1,058 | cpp | #include <iostream>
using namespace std;
struct ListNode {
int val;
ListNode *next;
ListNode(int x) : val(x), next(NULL) {}
};
class Solution {
public:
ListNode *swapPairs(ListNode *head) {
if (head == NULL || head->next == NULL) return head;
ListNode* root = head->next;
ListNode* cur = head;
ListNode* pre = NULL;
while (cur != NULL && cur->next != NULL) {
ListNode* n1 = cur->next;
ListNode* n2 = n1->next;
if (pre != NULL) pre->next = n1;
n1->next = cur;
cur->next = n2;
pre = cur;
cur = n2;
}
return root;
}
};
int main() {
ListNode n1 = ListNode(1);
ListNode n2 = ListNode(2);
n1.next = &n2;
ListNode n3 = ListNode(3);
n2.next = &n3;
ListNode n4 = ListNode(4);
n3.next = &n4;
Solution s = Solution();
ListNode* cur = s.swapPairs(&n1);
while (cur != NULL) {
cout << cur->val << endl;
cur = cur->next;
}
return 0;
}
| [
"dwb1983@gmail.com"
] | dwb1983@gmail.com |
bf28dd9aa859071a18a8ad36a112d4cb192ffdf1 | b737a40c57e87b5acc5bea57d371e30a489ac1dc | /C++/xiao_gu/try.cpp | 5de03849b39772e4a1c1466baaac94f62eb567af | [] | no_license | GG-yuki/bugs | b89a4a2cdfa082823beb90d9b4cb05916295d25b | bcd9e3b59f05203e0d02921a5f1dc13720dc7bbe | refs/heads/main | 2022-11-08T06:46:09.239289 | 2022-04-10T11:59:13 | 2022-04-10T11:59:13 | 480,004,488 | 2 | 1 | null | 2022-10-26T14:38:52 | 2022-04-10T12:01:48 | Python | UTF-8 | C++ | false | false | 2,198 | cpp | #include<bits/stdc++.h>
using namespace std;
#define max 20001
struct Node{
int to;//指向边的结点
int val;//边的权值
int next;//指向下一个结点的下标
} node[max];
int head[max],n,m,num = 0;
int infinite = 99999;
//建立邻接表
void add(int from,int to,int val){
num++;
node[num].to = to;
node[num].val = val;
node[num].next = head[from];
head[from] = num;//更新head的值,当再有从from连接的点 它的下一个为 num 坐标
}
//dij算法
void dijkstra(){
int dist[max];
fill(dist, dist + 20001, infinite);
int vis[max] = {0};
for(int i = head[0]; i != 0; i = node[i].next){//这里是选取源点为0的顶点,将和其相连边的权值存进去了
dist[node[i].to] = node[i].val; //比如:0到1:即 node[i].to = 1表示的是顶点, node[i].val = 1 表示0到1这条边的权值为1;dist[1] = 1
}
vis[0] = 1;
while(1){
int m = -1;
int min = infinite;
for(int i = 0; i < n; i++){
if(vis[i] != 1 && dist[i] < min){
min = dist[i];
m = i;
}
}
if(m == -1){//已经遍历完了所有结点
break;
}
vis[m] = 1;
//确定m这个顶点 接下来遍历 m这个结点的链表
for(int i = head[m]; i != 0; i = node[i].next){
if(vis[node[i].to] != 1 && min + node[i].val < dist[node[i].to]){//vis[node[i].to] != 1如果出现 1到2 和2到1这种情况,那么当1已经遍历过,在顶点为2的这个链表中就不用再遍历了
dist[node[i].to] = min + node[i].val;
}
}
}
for(int i = 0; i < n; i++){
if(dist[i] != infinite){
cout << dist[i] << ' ';
}
}
}
int main(){
memset(head,0,sizeof(head));
cin >> n >> m;
for(int i = 0; i < m; i++){
int from,to,val;
cin >> from >> to >> val;
add(from,to,val);
}
//测试邻接表的数据是否正确
// for(int i = 0; i < n; i++){
// cout << i << ' ';
// for(int j = head[i]; j != 0; j = node[j].next){
// cout << node[j].to << ' ' << node[j].val << ' ';
// }
// cout << endl;
// }
dijkstra();
}
//4 4
//0 1 1
//0 3 1
//1 3 1
//2 0 1
//邻接表输出的数据
//0 3 1 1 1
//1 3 1
//2 0 1
//3
//4 5
//0 1 1
//1 3 2
//0 3 4
//0 2 2
//2 3 3
| [
"qiwei_ji@outlook.com"
] | qiwei_ji@outlook.com |
bf9acee295780572801febd767d5efc52c985237 | da43fdc07f0d189fc61499e7aaf4f540404cb6de | /16 Algorithm STL/binary_lower_upper_bound.cpp | b0a301c4274a6834f82ef14cea5660217f5c5b5d | [] | no_license | sarimurrab/DS-Algo-ONCB | c5f062359b67ca000614b360bfd20b76014338e0 | a7fe7fa5c68ab27a376f11f75a81d34db756738c | refs/heads/master | 2023-01-20T14:57:25.374214 | 2020-11-17T18:49:12 | 2020-11-17T18:49:12 | 287,773,855 | 2 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 727 | cpp | #include <iostream>
#include <algorithm>
using namespace std;
int main()
{
int arr[] = {1, 2,3,3,3,3,3, 4, 5};
int n = 9;
int key = 3;
// 1--> binary_search(arr, arr+n, key)
bool is_present = binary_search(arr, arr + 5, key);
cout << is_present;
// 2--> Lower Bound ( 1st element match with > or equal to )
auto l_iter = lower_bound(arr, arr + n, key);
cout << endl
<< "Lower Bound " << (l_iter - arr);
// 3--> Upper Bound ( 1st element match with > )
auto u_iter = upper_bound(arr, arr + n, key);
cout << endl
<< "Upper Bound " << (u_iter - arr);
// Upper - Lower = Occurence of key
cout<<endl<<"Occurence of "<<key<<": "<<u_iter-l_iter;
} | [
"samurrab@gmail.com"
] | samurrab@gmail.com |
a2c63f228f69bacd67d445da3a422bcdbeba650a | 786de89be635eb21295070a6a3452f3a7fe6712c | /PSEnv/tags/V00-06-00/include/EnvObjectStore.h | 9353e5957c9be1d622a43e138702b7b7ab7b784b | [] | no_license | connectthefuture/psdmrepo | 85267cfe8d54564f99e17035efe931077c8f7a37 | f32870a987a7493e7bf0f0a5c1712a5a030ef199 | refs/heads/master | 2021-01-13T03:26:35.494026 | 2015-09-03T22:22:11 | 2015-09-03T22:22:11 | null | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 5,082 | h | #ifndef PSENV_ENVOBJECTSTORE_H
#define PSENV_ENVOBJECTSTORE_H
//--------------------------------------------------------------------------
// File and Version Information:
// $Id$
//
// Description:
// Class EnvObjectStore.
//
//------------------------------------------------------------------------
//-----------------
// C/C++ Headers --
//-----------------
#include <typeinfo>
#include <boost/shared_ptr.hpp>
#include <boost/utility.hpp>
//----------------------
// Base Class Headers --
//----------------------
//-------------------------------
// Collaborating Class Headers --
//-------------------------------
#include "pdsdata/xtc/Src.hh"
#include "PSEvt/DataProxy.h"
#include "PSEvt/EventKey.h"
#include "PSEvt/ProxyDictI.h"
#include "PSEvt/Source.h"
//------------------------------------
// Collaborating Class Declarations --
//------------------------------------
// ---------------------
// -- Class Interface --
// ---------------------
namespace PSEnv {
/**
* @ingroup PSEnv
*
* @brief Class to store environment data objects (such as configuration
* or calibration) corresponding to event data objects.
*
* This class is very similar to PSEvt::Event class (and is implemented
* on top of the same proxy dictionary classes) but it has more specialized
* interface. In particular it does not support additional string keys as
* it is expected that there will be only one version of the configuration
* or calibrations objects.
*
* This software was developed for the LCLS project. If you use all or
* part of it, please give an appropriate acknowledgment.
*
* @see Env
*
* @version \$Id: EnvObjectStore.h -1$
*
* @author Andrei Salnikov
*/
class EnvObjectStore : boost::noncopyable {
public:
/// Special class used for type-less return from get()
struct GetResultProxy {
/// Convert the result of get() call to smart pointer to object
template<typename T>
operator boost::shared_ptr<T>() {
boost::shared_ptr<void> vptr = m_dict->get(&typeid(const T), m_source, std::string(), m_foundSrc);
return boost::static_pointer_cast<T>(vptr);
}
boost::shared_ptr<PSEvt::ProxyDictI> m_dict; ///< Proxy dictionary containing the data
PSEvt::Source m_source; ///< Data source address
Pds::Src* m_foundSrc; ///< Pointer to where to store the exact address of found object
};
/**
* @brief Standard constructor takes proxy dictionary object
*
* @param[in] dict Pointer to proxy dictionary
*/
EnvObjectStore(const boost::shared_ptr<PSEvt::ProxyDictI>& dict) : m_dict(dict) {}
// Destructor
~EnvObjectStore() {}
/**
* @brief Add one more proxy object to the store
*
* @param[in] proxy Proxy object for type T.
* @param[in] source Source detector address.
*/
template <typename T>
void putProxy(const boost::shared_ptr<PSEvt::Proxy<T> >& proxy, const Pds::Src& source)
{
PSEvt::EventKey key(&typeid(const T), source, std::string());
if ( m_dict->exists(key) ) {
m_dict->remove(key);
}
m_dict->put(boost::static_pointer_cast<PSEvt::ProxyI>(proxy), key);
}
/**
* @brief Add one more object to the store.
*
* If there is already an object with the same type and address it
* will be replaced.
*
* @param[in] data Object to store in the event.
* @param[in] source Source detector address.
*/
template <typename T>
void put(const boost::shared_ptr<T>& data, const Pds::Src& source)
{
boost::shared_ptr<PSEvt::ProxyI> proxyPtr(new PSEvt::DataProxy<T>(data));
PSEvt::EventKey key(&typeid(const T), source, std::string());
if ( m_dict->exists(key) ) {
m_dict->remove(key);
}
m_dict->put(proxyPtr, key);
}
/**
* @brief Get an object from store.
*
* @param[in] source Source detector address.
* @return Shared pointer (or object convertible to it) which can be zero when object is not found.
*/
GetResultProxy get(const Pds::Src& source)
{
GetResultProxy pxy = { m_dict, PSEvt::Source(source) };
return pxy;
}
/**
* @brief Get an object from store.
*
* @param[in] source Source detector address.
* @param[out] foundSrc If pointer is non-zero then pointed object will be assigned
* with the exact source address of the returned object.
* @return Shared pointer (or object convertible to it) which can be zero when object is not found.
*/
GetResultProxy get(const PSEvt::Source& source, Pds::Src* foundSrc=0)
{
GetResultProxy pxy = { m_dict, source, foundSrc};
return pxy;
}
/**
* @brief Get the list of keys for existing config objects
*
* @return list of the EventKey objects
*/
std::list<PSEvt::EventKey> keys() const
{
std::list<PSEvt::EventKey> result;
m_dict->keys(result);
return result;
}
protected:
private:
// Data members
boost::shared_ptr<PSEvt::ProxyDictI> m_dict; ///< Proxy dictionary object
};
} // namespace PSEnv
#endif // PSENV_ENVOBJECTSTORE_H
| [
"salnikov@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7"
] | salnikov@SLAC.STANFORD.EDU@b967ad99-d558-0410-b138-e0f6c56caec7 |
1adfe3ce8b3eebcd8555129ba4684de44dbc4a91 | 1b73515fb49ac64e0afa5ba7baf03170451d0e46 | /GameEngine/CoreEngine/CoreEngine/src/Vector3.cpp | 32289787446734402d271d99a8893b5819763085 | [
"Apache-2.0"
] | permissive | suddenly-games/SuddenlyGames | 2af48c0f31f61bad22e7c95124c0f91443ff2d54 | e2ff1c2771d4ca54824650e4f1a33a527536ca61 | refs/heads/develop | 2023-05-02T03:14:21.384819 | 2021-05-12T07:10:29 | 2021-05-12T07:10:29 | 330,379,384 | 1 | 0 | Apache-2.0 | 2021-03-21T03:12:52 | 2021-01-17T11:52:25 | C | UTF-8 | C++ | false | false | 3,787 | cpp | /*
Vector.Cpp
contains implimentation of Vector class functions
*/
#include "Vector3.h"
#include <iostream>
extern "C" {
#include <stdlib.h>
}
#include <sstream>
extern "C" {
#include <math.h>
}
// construct from coordinates
Vector3::Vector3(float x, float y, float z, float w)
{
Set(x, y, z, w);
}
// construct from 2D vector
/*Vector3::Vector3(Vector2 vector)
{
set(vector.X, vector.Y, 0, vector.W);
}*/
// set coordinates
Vector3& Vector3::Set(float x, float y, float z, float w)
{
this->X = x;
this->Y = y;
this->Z = z;
this->W = w;
return *this;
}
// normalizes the vector
Vector3& Vector3::Normalize()
{
float length = 1 / this->Length();
X *= length;
Y *= length;
Z *= length;
return *this;
}
float Vector3::Dot(const Vector3& other) const
{
return *this * other;
}
// calculates the cross product between two vectors
Vector3 Vector3::Cross(const Vector3& other) const
{
return Vector3(
Y * other.Z - Z * other.Y,
Z * other.X - X * other.Z,
X * other.Y - Y * other.X
);
}
Vector3 Vector3::Unit() const
{
return Vector3(*this).Normalize();
}
// returns the length of the vector
float Vector3::Length() const
{
return sqrtf(SquareLength());
}
// returns the square length of the vector
float Vector3::SquareLength() const
{
return X * X + Y * Y + Z * Z + W * W;
}
Vector3& Vector3::Scale(const Vector3 & other)
{
X *= other.X;
Y *= other.Y;
Z *= other.Z;
return *this;
}
Vector3& Vector3::Scale(float x, float y, float z)
{
X *= x;
Y *= y;
Z *= z;
return *this;
}
// negation
Vector3 Vector3::operator-() const
{
return Vector3(-X, -Y, -Z, -W);
}
// addition
Vector3 Vector3::operator+(const Vector3& other) const
{
return Vector3(X + other.X, Y + other.Y, Z + other.Z, W + other.W);
}
// subtraction
Vector3 Vector3::operator-(const Vector3& other) const
{
return Vector3(X - other.X, Y - other.Y, Z - other.Z, W - other.W);
}
// scalar multiplication
Vector3 Vector3::operator*(float scalar) const
{
return Vector3(scalar * X, scalar * Y, scalar * Z, scalar * W);
}
// dot product multiplication
float Vector3::operator*(const Vector3& other) const
{
return X * other.X + Y * other.Y + Z * other.Z + W * other.W;
}
// assignment
Vector3& Vector3::operator=(const Vector3& other)
{
X = other.X;
Y = other.Y;
Z = other.Z;
W = other.W;
return *this;
}
// addition assignment
Vector3& Vector3::operator+=(const Vector3& other)
{
*this = *this + other;
return *this;
}
// subtraction assignment
Vector3& Vector3::operator-=(const Vector3& other)
{
*this = *this - other;
return *this;
}
// multiplication assignment
Vector3& Vector3::operator*=(float scalar)
{
*this = *this * scalar;
return *this;
}
bool Vector3::Compare(float x, float y, float epsilon) const
{
return abs(x - y) < epsilon;
}
bool Vector3::operator==(const Vector3& other) const
{
float epsilon = 1e-5f;
return Compare(X, other.X, epsilon) && Compare(Y, other.Y, epsilon) && Compare(Z, other.Z, epsilon);
}
bool Vector3::operator!=(const Vector3& other) const
{
return !(*this == other);
}
float Vector3::operator[](int i) const
{
return ((const float*)(this))[i];
}
float& Vector3::operator[](int i)
{
return ((float*)(this))[i];
}
// rhs scalar multiplication
Vector3 operator*(float scalar, const Vector3& vector)
{
//use other scalar multiplication function
return vector * scalar;
}
Vector3::operator std::string() const
{
std::stringstream out;
out << *this;
return out.str();
}
// stream output
std::ostream& operator<<(std::ostream& out, const Vector3& vector)
{
if (vector.W < 0.99999 || vector.W > 1.00001)
out << "< " << vector.X << ", " << vector.Y << ", " << vector.Z << ", " << vector.W << " >";
else
out << "( " << vector.X << ", " << vector.Y << ", " << vector.Z << " )";
return out;
}
| [
"trevorb101@hotmail.com"
] | trevorb101@hotmail.com |
fe2b2a39b54597fc132df3c91c5bcdfb729668d4 | f6e7bf63d88ddcd43892f62850f8d7f03ba85da0 | /Source/WebKit/gtk/WebCoreSupport/ChromeClientGtk.cpp | 99f2b85ede08343fb482525b7b05b3965f673aed | [
"BSD-2-Clause"
] | permissive | frogbywyplay/appframeworks_qtwebkit | 6ddda6addf205fb1a498c3998ef6fc0f3a7d107f | 5a62a119d5d589ffbf8dd8afda9e5786eea27618 | refs/heads/master | 2021-07-09T14:55:57.618247 | 2021-04-28T13:58:39 | 2021-04-28T13:58:39 | 18,559,129 | 0 | 1 | null | null | null | null | UTF-8 | C++ | false | false | 35,171 | cpp | /*
* Copyright (C) 2007, 2008 Holger Hans Peter Freyther
* Copyright (C) 2007, 2008 Christian Dywan <christian@imendio.com>
* Copyright (C) 2008 Nuanti Ltd.
* Copyright (C) 2008 Alp Toker <alp@atoker.com>
* Copyright (C) 2008 Gustavo Noronha Silva <gns@gnome.org>
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
* Copyright (C) 2012 Igalia S. L.
*
* 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 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
*/
#include "config.h"
#include "ChromeClientGtk.h"
#include "Chrome.h"
#include "Console.h"
#include "DumpRenderTreeSupportGtk.h"
#include "Element.h"
#include "FileChooser.h"
#include "FileIconLoader.h"
#include "FileSystem.h"
#include "FloatRect.h"
#include "FocusController.h"
#include "FrameLoadRequest.h"
#include "FrameView.h"
#include "GtkUtilities.h"
#include "GtkVersioning.h"
#include "HTMLNames.h"
#include "HitTestResult.h"
#include "Icon.h"
#include "InspectorController.h"
#include "IntRect.h"
#include "KURL.h"
#include "NavigationAction.h"
#include "NotImplemented.h"
#include "PopupMenuClient.h"
#include "PopupMenuGtk.h"
#include "RefPtrCairo.h"
#include "SearchPopupMenuGtk.h"
#include "SecurityOrigin.h"
#include "WebKitDOMBinding.h"
#include "WebKitDOMHTMLElementPrivate.h"
#include "WindowFeatures.h"
#include "webkitfilechooserrequestprivate.h"
#include "webkitgeolocationpolicydecision.h"
#include "webkitgeolocationpolicydecisionprivate.h"
#include "webkitnetworkrequest.h"
#include "webkitsecurityoriginprivate.h"
#include "webkitviewportattributesprivate.h"
#include "webkitwebframeprivate.h"
#include "webkitwebview.h"
#include "webkitwebviewprivate.h"
#include "webkitwebwindowfeaturesprivate.h"
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <wtf/MathExtras.h>
#include <wtf/text/CString.h>
#include <wtf/text/WTFString.h>
#if ENABLE(SQL_DATABASE)
#include "DatabaseTracker.h"
#endif
using namespace WebCore;
namespace WebKit {
ChromeClient::ChromeClient(WebKitWebView* webView)
: m_webView(webView)
, m_adjustmentWatcher(webView)
, m_closeSoonTimer(0)
, m_displayTimer(this, &ChromeClient::paint)
, m_forcePaint(false)
, m_lastDisplayTime(0)
, m_repaintSoonSourceId(0)
{
ASSERT(m_webView);
}
void ChromeClient::chromeDestroyed()
{
if (m_closeSoonTimer)
g_source_remove(m_closeSoonTimer);
if (m_repaintSoonSourceId)
g_source_remove(m_repaintSoonSourceId);
delete this;
}
FloatRect ChromeClient::windowRect()
{
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
if (widgetIsOnscreenToplevelWindow(window)) {
gint left, top, width, height;
gtk_window_get_position(GTK_WINDOW(window), &left, &top);
gtk_window_get_size(GTK_WINDOW(window), &width, &height);
return IntRect(left, top, width, height);
}
return FloatRect();
}
void ChromeClient::setWindowRect(const FloatRect& rect)
{
IntRect intrect = IntRect(rect);
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
g_object_set(webWindowFeatures,
"x", intrect.x(),
"y", intrect.y(),
"width", intrect.width(),
"height", intrect.height(),
NULL);
gboolean autoResizeWindow;
WebKitWebSettings* settings = webkit_web_view_get_settings(m_webView);
g_object_get(settings, "auto-resize-window", &autoResizeWindow, NULL);
if (!autoResizeWindow)
return;
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
if (widgetIsOnscreenToplevelWindow(window)) {
gtk_window_move(GTK_WINDOW(window), intrect.x(), intrect.y());
if (!intrect.isEmpty())
gtk_window_resize(GTK_WINDOW(window), intrect.width(), intrect.height());
}
}
static IntRect getWebViewRect(WebKitWebView* webView)
{
GtkAllocation allocation;
gtk_widget_get_allocation(GTK_WIDGET(webView), &allocation);
return IntRect(allocation.x, allocation.y, allocation.width, allocation.height);
}
FloatRect ChromeClient::pageRect()
{
return getWebViewRect(m_webView);
}
void ChromeClient::focus()
{
gtk_widget_grab_focus(GTK_WIDGET(m_webView));
}
void ChromeClient::unfocus()
{
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
if (widgetIsOnscreenToplevelWindow(window))
gtk_window_set_focus(GTK_WINDOW(window), NULL);
}
Page* ChromeClient::createWindow(Frame* frame, const FrameLoadRequest& frameLoadRequest, const WindowFeatures& coreFeatures, const NavigationAction&)
{
WebKitWebView* webView = 0;
g_signal_emit_by_name(m_webView, "create-web-view", kit(frame), &webView);
if (!webView)
return 0;
GRefPtr<WebKitWebWindowFeatures> webWindowFeatures(adoptGRef(kitNew(coreFeatures)));
g_object_set(webView, "window-features", webWindowFeatures.get(), NULL);
return core(webView);
}
void ChromeClient::show()
{
webkit_web_view_notify_ready(m_webView);
}
bool ChromeClient::canRunModal()
{
notImplemented();
return false;
}
void ChromeClient::runModal()
{
notImplemented();
}
void ChromeClient::setToolbarsVisible(bool visible)
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
g_object_set(webWindowFeatures, "toolbar-visible", visible, NULL);
}
bool ChromeClient::toolbarsVisible()
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
gboolean visible;
g_object_get(webWindowFeatures, "toolbar-visible", &visible, NULL);
return visible;
}
void ChromeClient::setStatusbarVisible(bool visible)
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
g_object_set(webWindowFeatures, "statusbar-visible", visible, NULL);
}
bool ChromeClient::statusbarVisible()
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
gboolean visible;
g_object_get(webWindowFeatures, "statusbar-visible", &visible, NULL);
return visible;
}
void ChromeClient::setScrollbarsVisible(bool visible)
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
g_object_set(webWindowFeatures, "scrollbar-visible", visible, NULL);
}
bool ChromeClient::scrollbarsVisible()
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
gboolean visible;
g_object_get(webWindowFeatures, "scrollbar-visible", &visible, NULL);
return visible;
}
void ChromeClient::setMenubarVisible(bool visible)
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
g_object_set(webWindowFeatures, "menubar-visible", visible, NULL);
}
bool ChromeClient::menubarVisible()
{
WebKitWebWindowFeatures* webWindowFeatures = webkit_web_view_get_window_features(m_webView);
gboolean visible;
g_object_get(webWindowFeatures, "menubar-visible", &visible, NULL);
return visible;
}
void ChromeClient::setResizable(bool)
{
// Ignored for now
}
static gboolean emitCloseWebViewSignalLater(WebKitWebView* view)
{
gboolean isHandled;
g_signal_emit_by_name(view, "close-web-view", &isHandled);
return FALSE;
}
void ChromeClient::closeWindowSoon()
{
// We may not have a WebView as create-web-view can return NULL.
if (!m_webView)
return;
if (m_closeSoonTimer) // Don't call close-web-view more than once.
return;
// We need to remove the parent WebView from WebViewSets here, before it actually
// closes, to make sure that JavaScript code that executes before it closes
// can't find it. Otherwise, window.open will select a closed WebView instead of
// opening a new one <rdar://problem/3572585>.
m_webView->priv->corePage->setGroupName("");
// We also need to stop the load to prevent further parsing or JavaScript execution
// after the window has torn down <rdar://problem/4161660>.
webkit_web_view_stop_loading(m_webView);
// Clients commonly destroy the web view during the close-web-view signal, but our caller
// may need to send more signals to the web view. For instance, if this happened in the
// onload handler, it will need to call FrameLoaderClient::dispatchDidHandleOnloadEvents.
// Instead of firing the close-web-view signal now, fire it after the caller finishes.
// This seems to match the Mac/Windows port behavior.
m_closeSoonTimer = g_timeout_add(0, reinterpret_cast<GSourceFunc>(emitCloseWebViewSignalLater), m_webView);
}
bool ChromeClient::canTakeFocus(FocusDirection)
{
return gtk_widget_get_can_focus(GTK_WIDGET(m_webView));
}
void ChromeClient::takeFocus(FocusDirection)
{
unfocus();
}
void ChromeClient::focusedNodeChanged(Node*)
{
}
void ChromeClient::focusedFrameChanged(Frame*)
{
}
bool ChromeClient::canRunBeforeUnloadConfirmPanel()
{
return true;
}
bool ChromeClient::runBeforeUnloadConfirmPanel(const WTF::String& message, WebCore::Frame* frame)
{
return runJavaScriptConfirm(frame, message);
}
void ChromeClient::addMessageToConsole(WebCore::MessageSource source, WebCore::MessageType type, WebCore::MessageLevel level, const WTF::String& message, unsigned int lineNumber, const WTF::String& sourceId)
{
gboolean retval;
g_signal_emit_by_name(m_webView, "console-message", message.utf8().data(), lineNumber, sourceId.utf8().data(), &retval);
}
void ChromeClient::runJavaScriptAlert(Frame* frame, const String& message)
{
gboolean retval;
g_signal_emit_by_name(m_webView, "script-alert", kit(frame), message.utf8().data(), &retval);
}
bool ChromeClient::runJavaScriptConfirm(Frame* frame, const String& message)
{
gboolean retval;
gboolean didConfirm;
g_signal_emit_by_name(m_webView, "script-confirm", kit(frame), message.utf8().data(), &didConfirm, &retval);
return didConfirm == TRUE;
}
bool ChromeClient::runJavaScriptPrompt(Frame* frame, const String& message, const String& defaultValue, String& result)
{
gboolean retval;
gchar* value = 0;
g_signal_emit_by_name(m_webView, "script-prompt", kit(frame), message.utf8().data(), defaultValue.utf8().data(), &value, &retval);
if (value) {
result = String::fromUTF8(value);
g_free(value);
return true;
}
return false;
}
void ChromeClient::setStatusbarText(const String& string)
{
CString stringMessage = string.utf8();
g_signal_emit_by_name(m_webView, "status-bar-text-changed", stringMessage.data());
}
bool ChromeClient::shouldInterruptJavaScript()
{
notImplemented();
return false;
}
KeyboardUIMode ChromeClient::keyboardUIMode()
{
bool tabsToLinks = true;
if (DumpRenderTreeSupportGtk::dumpRenderTreeModeEnabled())
tabsToLinks = DumpRenderTreeSupportGtk::linksIncludedInFocusChain();
return tabsToLinks ? KeyboardAccessTabsToLinks : KeyboardAccessDefault;
}
IntRect ChromeClient::windowResizerRect() const
{
notImplemented();
return IntRect();
}
static gboolean repaintEverythingSoonTimeout(ChromeClient* client)
{
client->paint(0);
return FALSE;
}
static void clipOutOldWidgetArea(cairo_t* cr, const IntSize& oldSize, const IntSize& newSize)
{
cairo_move_to(cr, oldSize.width(), 0);
cairo_line_to(cr, newSize.width(), 0);
cairo_line_to(cr, newSize.width(), newSize.height());
cairo_line_to(cr, 0, newSize.height());
cairo_line_to(cr, 0, oldSize.height());
cairo_line_to(cr, oldSize.width(), oldSize.height());
cairo_close_path(cr);
cairo_clip(cr);
}
static void clearEverywhereInBackingStore(WebKitWebView* webView, cairo_t* cr)
{
// The strategy here is to quickly draw white into this new canvas, so that
// when a user quickly resizes the WebView in an environment that has opaque
// resizing (like Gnome Shell), there are no drawing artifacts.
if (!webView->priv->transparent) {
cairo_set_source_rgb(cr, 1, 1, 1);
cairo_set_operator(cr, CAIRO_OPERATOR_SOURCE);
} else
cairo_set_operator(cr, CAIRO_OPERATOR_CLEAR);
cairo_paint(cr);
}
void ChromeClient::widgetSizeChanged(const IntSize& oldWidgetSize, IntSize newSize)
{
#if USE(ACCELERATED_COMPOSITING)
AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get();
if (compositingContext->enabled()) {
m_webView->priv->acceleratedCompositingContext->resizeRootLayer(newSize);
return;
}
#endif
// Grow the backing store by at least 1.5 times the current size. This prevents
// lots of unnecessary allocations during an opaque resize.
WidgetBackingStore* backingStore = m_webView->priv->backingStore.get();
if (backingStore && oldWidgetSize == newSize)
return;
if (backingStore) {
const IntSize& oldSize = backingStore->size();
if (newSize.width() > oldSize.width())
newSize.setWidth(std::max(newSize.width(), static_cast<int>(oldSize.width() * 1.5)));
if (newSize.height() > oldSize.height())
newSize.setHeight(std::max(newSize.height(), static_cast<int>(oldSize.height() * 1.5)));
}
// If we did not have a backing store before or if the backing store is growing, we need
// to reallocate a new one and set it up so that we don't see artifacts while resizing.
if (!backingStore
|| newSize.width() > backingStore->size().width()
|| newSize.height() > backingStore->size().height()) {
OwnPtr<WidgetBackingStore> newBackingStore =
WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), newSize);
RefPtr<cairo_t> cr = adoptRef(cairo_create(newBackingStore->cairoSurface()));
clearEverywhereInBackingStore(m_webView, cr.get());
// Now we copy the old backing store image over the new cleared surface to prevent
// annoying flashing as the widget grows. We do the "real" paint in a timeout
// since we don't want to block resizing too long.
if (backingStore) {
cairo_set_source_surface(cr.get(), backingStore->cairoSurface(), 0, 0);
cairo_rectangle(cr.get(), 0, 0, backingStore->size().width(), backingStore->size().height());
cairo_fill(cr.get());
}
m_webView->priv->backingStore = newBackingStore.release();
backingStore = m_webView->priv->backingStore.get();
} else if (oldWidgetSize.width() < newSize.width() || oldWidgetSize.height() < newSize.height()) {
// The widget is growing, but we did not need to create a new backing store.
// We should clear any old data outside of the old widget region.
RefPtr<cairo_t> cr = adoptRef(cairo_create(backingStore->cairoSurface()));
clipOutOldWidgetArea(cr.get(), oldWidgetSize, newSize);
clearEverywhereInBackingStore(m_webView, cr.get());
}
// We need to force a redraw and ignore the framerate cap.
m_lastDisplayTime = 0;
m_dirtyRegion.unite(IntRect(IntPoint(), backingStore->size()));
// WebCore timers by default have a lower priority which leads to more artifacts when opaque
// resize is on, thus we use g_timeout_add here to force a higher timeout priority.
if (!m_repaintSoonSourceId)
m_repaintSoonSourceId = g_timeout_add(0, reinterpret_cast<GSourceFunc>(repaintEverythingSoonTimeout), this);
}
static void coalesceRectsIfPossible(const IntRect& clipRect, Vector<IntRect>& rects)
{
const unsigned int cRectThreshold = 10;
const float cWastedSpaceThreshold = 0.75f;
bool useUnionedRect = (rects.size() <= 1) || (rects.size() > cRectThreshold);
if (!useUnionedRect) {
// Attempt to guess whether or not we should use the unioned rect or the individual rects.
// We do this by computing the percentage of "wasted space" in the union. If that wasted space
// is too large, then we will do individual rect painting instead.
float unionPixels = (clipRect.width() * clipRect.height());
float singlePixels = 0;
for (size_t i = 0; i < rects.size(); ++i)
singlePixels += rects[i].width() * rects[i].height();
float wastedSpace = 1 - (singlePixels / unionPixels);
if (wastedSpace <= cWastedSpaceThreshold)
useUnionedRect = true;
}
if (!useUnionedRect)
return;
rects.clear();
rects.append(clipRect);
}
static void paintWebView(WebKitWebView* webView, Frame* frame, Region dirtyRegion)
{
if (!webView->priv->backingStore)
return;
Vector<IntRect> rects = dirtyRegion.rects();
coalesceRectsIfPossible(dirtyRegion.bounds(), rects);
RefPtr<cairo_t> backingStoreContext = adoptRef(cairo_create(webView->priv->backingStore->cairoSurface()));
GraphicsContext gc(backingStoreContext.get());
gc.applyDeviceScaleFactor(frame->page()->deviceScaleFactor());
for (size_t i = 0; i < rects.size(); i++) {
const IntRect& rect = rects[i];
gc.save();
gc.clip(rect);
if (webView->priv->transparent)
gc.clearRect(rect);
frame->view()->paint(&gc, rect);
gc.restore();
}
gc.save();
gc.clip(dirtyRegion.bounds());
frame->page()->inspectorController()->drawHighlight(gc);
gc.restore();
}
void ChromeClient::performAllPendingScrolls()
{
if (!m_webView->priv->backingStore)
return;
// Scroll all pending scroll rects and invalidate those parts of the widget.
for (size_t i = 0; i < m_rectsToScroll.size(); i++) {
IntRect& scrollRect = m_rectsToScroll[i];
m_webView->priv->backingStore->scroll(scrollRect, m_scrollOffsets[i]);
gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), scrollRect.x(), scrollRect.y(), scrollRect.width(), scrollRect.height());
}
m_rectsToScroll.clear();
m_scrollOffsets.clear();
}
void ChromeClient::paint(WebCore::Timer<ChromeClient>*)
{
static const double minimumFrameInterval = 1.0 / 60.0; // No more than 60 frames a second.
double timeSinceLastDisplay = currentTime() - m_lastDisplayTime;
double timeUntilNextDisplay = minimumFrameInterval - timeSinceLastDisplay;
if (timeUntilNextDisplay > 0 && !m_forcePaint) {
m_displayTimer.startOneShot(timeUntilNextDisplay);
return;
}
Frame* frame = core(m_webView)->mainFrame();
if (!frame || !frame->contentRenderer() || !frame->view())
return;
frame->view()->updateLayoutAndStyleIfNeededRecursive();
performAllPendingScrolls();
paintWebView(m_webView, frame, m_dirtyRegion);
HashSet<GtkWidget*> children = m_webView->priv->children;
HashSet<GtkWidget*>::const_iterator end = children.end();
for (HashSet<GtkWidget*>::const_iterator current = children.begin(); current != end; ++current) {
if (static_cast<GtkAllocation*>(g_object_get_data(G_OBJECT(*current), "delayed-allocation"))) {
gtk_widget_queue_resize_no_redraw(GTK_WIDGET(m_webView));
break;
}
}
const IntRect& rect = m_dirtyRegion.bounds();
gtk_widget_queue_draw_area(GTK_WIDGET(m_webView), rect.x(), rect.y(), rect.width(), rect.height());
m_dirtyRegion = Region();
m_lastDisplayTime = currentTime();
m_repaintSoonSourceId = 0;
// We update the IM context window location here, because we want it to be
// synced with cursor movement. For instance, a text field can move without
// the selection changing.
Frame* focusedFrame = core(m_webView)->focusController()->focusedOrMainFrame();
if (focusedFrame && focusedFrame->editor()->canEdit())
m_webView->priv->imFilter.setCursorRect(frame->selection()->absoluteCaretBounds());
}
void ChromeClient::forcePaint()
{
#if USE(ACCELERATED_COMPOSITING)
if (m_webView->priv->acceleratedCompositingContext->enabled())
return;
#endif
m_forcePaint = true;
paint(0);
m_forcePaint = false;
}
void ChromeClient::invalidateRootView(const IntRect&, bool immediate)
{
}
void ChromeClient::invalidateContentsAndRootView(const IntRect& updateRect, bool immediate)
{
#if USE(ACCELERATED_COMPOSITING)
AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
if (acContext->enabled()) {
acContext->setNonCompositedContentsNeedDisplay(updateRect);
return;
}
#endif
if (updateRect.isEmpty())
return;
m_dirtyRegion.unite(updateRect);
m_displayTimer.startOneShot(0);
}
void ChromeClient::invalidateContentsForSlowScroll(const IntRect& updateRect, bool immediate)
{
m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
#if USE(ACCELERATED_COMPOSITING)
AcceleratedCompositingContext* acContext = m_webView->priv->acceleratedCompositingContext.get();
if (acContext->enabled()) {
acContext->setNonCompositedContentsNeedDisplay(updateRect);
return;
}
#endif
invalidateContentsAndRootView(updateRect, immediate);
}
void ChromeClient::scroll(const IntSize& delta, const IntRect& rectToScroll, const IntRect& clipRect)
{
m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
#if USE(ACCELERATED_COMPOSITING)
AcceleratedCompositingContext* compositingContext = m_webView->priv->acceleratedCompositingContext.get();
if (compositingContext->enabled()) {
ASSERT(!rectToScroll.isEmpty());
ASSERT(delta.width() || delta.height());
compositingContext->scrollNonCompositedContents(rectToScroll, delta);
return;
}
#endif
m_rectsToScroll.append(rectToScroll);
m_scrollOffsets.append(delta);
// The code to calculate the scroll repaint region is originally from WebKit2.
// Get the part of the dirty region that is in the scroll rect.
Region dirtyRegionInScrollRect = intersect(rectToScroll, m_dirtyRegion);
if (!dirtyRegionInScrollRect.isEmpty()) {
// There are parts of the dirty region that are inside the scroll rect.
// We need to subtract them from the region, move them and re-add them.
m_dirtyRegion.subtract(rectToScroll);
// Move the dirty parts.
Region movedDirtyRegionInScrollRect = intersect(translate(dirtyRegionInScrollRect, delta), rectToScroll);
// And add them back.
m_dirtyRegion.unite(movedDirtyRegionInScrollRect);
}
// Compute the scroll repaint region. We ensure that we are not subtracting areas
// that we've scrolled from outside the viewport from the repaint region.
IntRect onScreenScrollRect = rectToScroll;
onScreenScrollRect.intersect(IntRect(IntPoint(), enclosingIntRect(pageRect()).size()));
Region scrollRepaintRegion = subtract(rectToScroll, translate(onScreenScrollRect, delta));
m_dirtyRegion.unite(scrollRepaintRegion);
m_displayTimer.startOneShot(0);
}
IntRect ChromeClient::rootViewToScreen(const IntRect& rect) const
{
return IntRect(convertWidgetPointToScreenPoint(GTK_WIDGET(m_webView), rect.location()), rect.size());
}
IntPoint ChromeClient::screenToRootView(const IntPoint& point) const
{
IntPoint widgetPositionOnScreen = convertWidgetPointToScreenPoint(GTK_WIDGET(m_webView), IntPoint());
IntPoint result(point);
result.move(-widgetPositionOnScreen.x(), -widgetPositionOnScreen.y());
return result;
}
PlatformPageClient ChromeClient::platformPageClient() const
{
return GTK_WIDGET(m_webView);
}
void ChromeClient::contentsSizeChanged(Frame* frame, const IntSize& size) const
{
if (m_adjustmentWatcher.scrollbarsDisabled())
return;
// We need to queue a resize request only if the size changed,
// otherwise we get into an infinite loop!
GtkWidget* widget = GTK_WIDGET(m_webView);
GtkRequisition requisition;
#if GTK_CHECK_VERSION(2, 20, 0)
gtk_widget_get_requisition(widget, &requisition);
#else
requisition = widget->requisition;
#endif
if (gtk_widget_get_realized(widget)
&& (requisition.height != size.height())
|| (requisition.width != size.width()))
gtk_widget_queue_resize_no_redraw(widget);
// If this was a main frame size change, update the scrollbars.
if (frame != frame->page()->mainFrame())
return;
m_adjustmentWatcher.updateAdjustmentsFromScrollbarsLater();
}
void ChromeClient::scrollbarsModeDidChange() const
{
WebKitWebFrame* webFrame = webkit_web_view_get_main_frame(m_webView);
if (!webFrame)
return;
g_object_notify(G_OBJECT(webFrame), "horizontal-scrollbar-policy");
g_object_notify(G_OBJECT(webFrame), "vertical-scrollbar-policy");
gboolean isHandled;
g_signal_emit_by_name(webFrame, "scrollbars-policy-changed", &isHandled);
if (isHandled)
return;
GtkWidget* parent = gtk_widget_get_parent(GTK_WIDGET(m_webView));
if (!parent || !GTK_IS_SCROLLED_WINDOW(parent))
return;
GtkPolicyType horizontalPolicy = webkit_web_frame_get_horizontal_scrollbar_policy(webFrame);
GtkPolicyType verticalPolicy = webkit_web_frame_get_vertical_scrollbar_policy(webFrame);
// ScrolledWindow doesn't like to display only part of a widget if
// the scrollbars are completely disabled; We have a disparity
// here on what the policy requested by the web app is and what we
// can represent; the idea is not to show scrollbars, only.
if (horizontalPolicy == GTK_POLICY_NEVER)
horizontalPolicy = GTK_POLICY_AUTOMATIC;
if (verticalPolicy == GTK_POLICY_NEVER)
verticalPolicy = GTK_POLICY_AUTOMATIC;
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(parent),
horizontalPolicy, verticalPolicy);
}
void ChromeClient::mouseDidMoveOverElement(const HitTestResult& hit, unsigned modifierFlags)
{
// check if the element is a link...
bool isLink = hit.isLiveLink();
if (isLink) {
KURL url = hit.absoluteLinkURL();
if (!url.isEmpty() && url != m_hoveredLinkURL) {
TextDirection dir;
CString titleString = hit.title(dir).utf8();
CString urlString = url.string().utf8();
g_signal_emit_by_name(m_webView, "hovering-over-link", titleString.data(), urlString.data());
m_hoveredLinkURL = url;
}
} else if (!isLink && !m_hoveredLinkURL.isEmpty()) {
g_signal_emit_by_name(m_webView, "hovering-over-link", 0, 0);
m_hoveredLinkURL = KURL();
}
if (Node* node = hit.innerNonSharedNode()) {
Frame* frame = node->document()->frame();
FrameView* view = frame ? frame->view() : 0;
m_webView->priv->tooltipArea = view ? view->contentsToWindow(node->pixelSnappedBoundingBox()) : IntRect();
} else
m_webView->priv->tooltipArea = IntRect();
}
void ChromeClient::setToolTip(const String& toolTip, TextDirection)
{
webkit_web_view_set_tooltip_text(m_webView, toolTip.utf8().data());
}
void ChromeClient::print(Frame* frame)
{
WebKitWebFrame* webFrame = kit(frame);
gboolean isHandled = false;
g_signal_emit_by_name(m_webView, "print-requested", webFrame, &isHandled);
if (isHandled)
return;
webkit_web_frame_print(webFrame);
}
#if ENABLE(SQL_DATABASE)
void ChromeClient::exceededDatabaseQuota(Frame* frame, const String& databaseName)
{
guint64 defaultQuota = webkit_get_default_web_database_quota();
DatabaseTracker::tracker().setQuota(frame->document()->securityOrigin(), defaultQuota);
WebKitWebFrame* webFrame = kit(frame);
WebKitSecurityOrigin* origin = webkit_web_frame_get_security_origin(webFrame);
WebKitWebDatabase* webDatabase = webkit_security_origin_get_web_database(origin, databaseName.utf8().data());
g_signal_emit_by_name(m_webView, "database-quota-exceeded", webFrame, webDatabase);
}
#endif
void ChromeClient::reachedMaxAppCacheSize(int64_t spaceNeeded)
{
// FIXME: Free some space.
notImplemented();
}
void ChromeClient::reachedApplicationCacheOriginQuota(SecurityOrigin*, int64_t)
{
notImplemented();
}
void ChromeClient::runOpenPanel(Frame*, PassRefPtr<FileChooser> prpFileChooser)
{
GRefPtr<WebKitFileChooserRequest> request = adoptGRef(webkit_file_chooser_request_create(prpFileChooser));
webkitWebViewRunFileChooserRequest(m_webView, request.get());
}
void ChromeClient::loadIconForFiles(const Vector<WTF::String>& filenames, WebCore::FileIconLoader* loader)
{
loader->notifyFinished(Icon::createIconForFiles(filenames));
}
void ChromeClient::dispatchViewportPropertiesDidChange(const ViewportArguments& arguments) const
{
// Recompute the viewport attributes making it valid.
webkitViewportAttributesRecompute(webkit_web_view_get_viewport_attributes(m_webView));
}
void ChromeClient::setCursor(const Cursor& cursor)
{
// [GTK] Widget::setCursor() gets called frequently
// http://bugs.webkit.org/show_bug.cgi?id=16388
// Setting the cursor may be an expensive operation in some backends,
// so don't re-set the cursor if it's already set to the target value.
GdkWindow* window = gtk_widget_get_window(platformPageClient());
if (!window)
return;
GdkCursor* currentCursor = gdk_window_get_cursor(window);
GdkCursor* newCursor = cursor.platformCursor().get();
if (currentCursor != newCursor)
gdk_window_set_cursor(window, newCursor);
}
void ChromeClient::setCursorHiddenUntilMouseMoves(bool)
{
notImplemented();
}
bool ChromeClient::selectItemWritingDirectionIsNatural()
{
return false;
}
bool ChromeClient::selectItemAlignmentFollowsMenuWritingDirection()
{
return true;
}
bool ChromeClient::hasOpenedPopup() const
{
notImplemented();
return false;
}
PassRefPtr<WebCore::PopupMenu> ChromeClient::createPopupMenu(WebCore::PopupMenuClient* client) const
{
return adoptRef(new PopupMenuGtk(client));
}
PassRefPtr<WebCore::SearchPopupMenu> ChromeClient::createSearchPopupMenu(WebCore::PopupMenuClient* client) const
{
return adoptRef(new SearchPopupMenuGtk(client));
}
#if ENABLE(VIDEO)
bool ChromeClient::supportsFullscreenForNode(const Node* node)
{
return node->hasTagName(HTMLNames::videoTag);
}
void ChromeClient::enterFullscreenForNode(Node* node)
{
webViewEnterFullscreen(m_webView, node);
}
void ChromeClient::exitFullscreenForNode(Node* node)
{
webViewExitFullscreen(m_webView);
}
#endif
#if ENABLE(FULLSCREEN_API)
bool ChromeClient::supportsFullScreenForElement(const WebCore::Element* element, bool withKeyboard)
{
return !withKeyboard;
}
static gboolean onFullscreenGtkKeyPressEvent(GtkWidget* widget, GdkEventKey* event, ChromeClient* chromeClient)
{
switch (event->keyval) {
case GDK_KEY_Escape:
case GDK_KEY_f:
case GDK_KEY_F:
chromeClient->cancelFullScreen();
return TRUE;
default:
break;
}
return FALSE;
}
void ChromeClient::cancelFullScreen()
{
ASSERT(m_fullScreenElement);
m_fullScreenElement->document()->webkitCancelFullScreen();
}
void ChromeClient::enterFullScreenForElement(WebCore::Element* element)
{
gboolean returnValue;
GRefPtr<WebKitDOMHTMLElement> kitElement(adoptGRef(kit(reinterpret_cast<HTMLElement*>(element))));
g_signal_emit_by_name(m_webView, "entering-fullscreen", kitElement.get(), &returnValue);
if (returnValue)
return;
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
if (!widgetIsOnscreenToplevelWindow(window))
return;
g_signal_connect(window, "key-press-event", G_CALLBACK(onFullscreenGtkKeyPressEvent), this);
m_fullScreenElement = element;
element->document()->webkitWillEnterFullScreenForElement(element);
m_adjustmentWatcher.disableAllScrollbars();
gtk_window_fullscreen(GTK_WINDOW(window));
element->document()->webkitDidEnterFullScreenForElement(element);
}
void ChromeClient::exitFullScreenForElement(WebCore::Element*)
{
// The element passed into this function is not reliable, i.e. it could
// be null. In addition the parameter may be disappearing in the future.
// So we use the reference to the element we saved above.
ASSERT(m_fullScreenElement);
gboolean returnValue;
GRefPtr<WebKitDOMHTMLElement> kitElement(adoptGRef(kit(reinterpret_cast<HTMLElement*>(m_fullScreenElement.get()))));
g_signal_emit_by_name(m_webView, "leaving-fullscreen", kitElement.get(), &returnValue);
if (returnValue)
return;
GtkWidget* window = gtk_widget_get_toplevel(GTK_WIDGET(m_webView));
ASSERT(widgetIsOnscreenToplevelWindow(window));
g_signal_handlers_disconnect_by_func(window, reinterpret_cast<void*>(onFullscreenGtkKeyPressEvent), this);
m_fullScreenElement->document()->webkitWillExitFullScreenForElement(m_fullScreenElement.get());
gtk_window_unfullscreen(GTK_WINDOW(window));
m_adjustmentWatcher.enableAllScrollbars();
m_fullScreenElement->document()->webkitDidExitFullScreenForElement(m_fullScreenElement.get());
m_fullScreenElement.clear();
}
#endif
#if USE(ACCELERATED_COMPOSITING)
void ChromeClient::attachRootGraphicsLayer(Frame* frame, GraphicsLayer* rootLayer)
{
AcceleratedCompositingContext* context = m_webView->priv->acceleratedCompositingContext.get();
bool turningOffCompositing = !rootLayer && context->enabled();
bool turningOnCompositing = rootLayer && !context->enabled();
context->setRootCompositingLayer(rootLayer);
if (turningOnCompositing) {
m_displayTimer.stop();
m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), IntSize(1, 1));
}
if (turningOffCompositing) {
m_webView->priv->backingStore = WebCore::WidgetBackingStore::create(GTK_WIDGET(m_webView), getWebViewRect(m_webView).size());
RefPtr<cairo_t> cr = adoptRef(cairo_create(m_webView->priv->backingStore->cairoSurface()));
clearEverywhereInBackingStore(m_webView, cr.get());
}
}
void ChromeClient::setNeedsOneShotDrawingSynchronization()
{
m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush();
}
void ChromeClient::scheduleCompositingLayerFlush()
{
m_webView->priv->acceleratedCompositingContext->scheduleLayerFlush();
}
ChromeClient::CompositingTriggerFlags ChromeClient::allowedCompositingTriggers() const
{
if (!platformPageClient())
return false;
#if USE(CLUTTER)
// Currently, we only support CSS 3D Transforms.
return ThreeDTransformTrigger;
#else
return AllTriggers;
#endif
}
#endif
}
| [
"dcaleca@wyplay.com"
] | dcaleca@wyplay.com |
935897b00584b30f7c540b977e7ad274c2004c2a | 4967b0f02627ca9d56eb3d9046bd546ff8ea4db6 | /Windows_Assignment1/Create_Read_File_4/CreateReadFile.cpp | e0766b98bf06d78a0b5db4e8695d0bc0e1cc8db6 | [] | no_license | himamsuvavil/NCRworks | 6c6c9e31337ea9a901c3b1e92dd1c4b117e086e4 | 4f83ad31c0b38001591edbf08d68c5e9478d14d8 | refs/heads/master | 2020-04-20T19:04:20.361398 | 2019-03-21T11:22:56 | 2019-03-21T11:22:56 | 169,039,210 | 0 | 0 | null | null | null | null | UTF-8 | C++ | false | false | 1,529 | cpp | #include<iostream>
#include<windows.h>
#include<tchar.h>
#define BUFFER_SIZE 15
using namespace std;
int _tmain(int argc, TCHAR *argv[])
{
if (argc == 1) //Check if File name is given at command line arguments are not
{
cout << "No File is mentioned at command line arguments" << endl;
return 0;
}
else
{
HANDLE FileHandle;
FileHandle = CreateFile(argv[1], GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); //Open the file given at command line arguments
if (INVALID_HANDLE_VALUE == FileHandle) //If file cannot be opened CreateFile will returns "INVALID_HANDLE_VALUE"
{
cout << "File cann't be opened\n";
return 0;
}
else
{
cout << "File opened Successfully\n\n";
CHAR BUFFER[BUFFER_SIZE];
ZeroMemory(BUFFER, BUFFER_SIZE); //Initilaize BUFFER data with zeros
int result;
DWORD ReachedEnd;
while (1) //Until we reach end of the file
{
result = ReadFile(FileHandle, BUFFER, BUFFER_SIZE, &ReachedEnd, NULL); //Redaing the 15 bytes of File data and storing in BUFFER
if (result == 0) //when data cannot be read
_tprintf(_T("Error occured during reading is :%s\n"), GetLastError());
else if (ReachedEnd == 0) //when file reaches end
{
cout << "Reached End of the File\n";
CloseHandle(FileHandle);
break;
}
else
{
for (int i = 0; i < ReachedEnd; i++) //printing every character stored in buffer
{
printf("%c", BUFFER[i]);
}
}
}
}
}
system("pause");
return 0;
} | [
"cdac@DESKTOP-SS5H7HT"
] | cdac@DESKTOP-SS5H7HT |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.