blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
4
201
content_id
stringlengths
40
40
detected_licenses
listlengths
0
85
license_type
stringclasses
2 values
repo_name
stringlengths
7
100
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
260 values
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
11.4k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
17 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
80 values
src_encoding
stringclasses
28 values
language
stringclasses
1 value
is_vendor
bool
1 class
is_generated
bool
2 classes
length_bytes
int64
8
9.86M
extension
stringclasses
52 values
content
stringlengths
8
9.86M
authors
listlengths
1
1
author
stringlengths
0
119
53561e1cb483b19f10337a5e912bc21d98c489de
d0c44dd3da2ef8c0ff835982a437946cbf4d2940
/cmake-build-debug/programs_tiling/function14457/function14457_schedule_8/function14457_schedule_8.cpp
446c4f1731bcb50b82abda5735f7900ac9821181
[]
no_license
IsraMekki/tiramisu_code_generator
8b3f1d63cff62ba9f5242c019058d5a3119184a3
5a259d8e244af452e5301126683fa4320c2047a3
refs/heads/master
2020-04-29T17:27:57.987172
2019-04-23T16:50:32
2019-04-23T16:50:32
176,297,755
1
2
null
null
null
null
UTF-8
C++
false
false
1,105
cpp
#include <tiramisu/tiramisu.h> using namespace tiramisu; int main(int argc, char **argv){ tiramisu::init("function14457_schedule_8"); constant c0("c0", 4096), c1("c1", 64), c2("c2", 256); var i0("i0", 0, c0), i1("i1", 0, c1), i2("i2", 0, c2), i100("i100", 2, c0 - 2), i101("i101", 2, c1 - 2), i102("i102", 2, c2 - 2), i01("i01"), i02("i02"), i03("i03"), i04("i04"), i05("i05"), i06("i06"); input input0("input0", {i0, i1, i2}, p_int32); computation comp0("comp0", {i100, i101, i102}, (input0(i100, i101, i102) - input0(i100 + 1, i101, i102) + input0(i100 + 2, i101, i102) - input0(i100 - 1, i101, i102) - input0(i100 - 2, i101, i102))); comp0.tile(i100, i101, i102, 32, 32, 128, i01, i02, i03, i04, i05, i06); comp0.parallelize(i01); buffer buf00("buf00", {4096, 64, 256}, p_int32, a_input); buffer buf0("buf0", {4096, 64, 256}, p_int32, a_output); input0.store_in(&buf00); comp0.store_in(&buf0); tiramisu::codegen({&buf00, &buf0}, "../data/programs/function14457/function14457_schedule_8/function14457_schedule_8.o"); return 0; }
[ "ei_mekki@esi.dz" ]
ei_mekki@esi.dz
2c8508d037cba8d5b106b2acbfba08dd4625e04d
08cf73a95743dc3036af0f31a00c7786a030d7c0
/Editor source/OtE/Edgewalker/EWScript/ScriptParser.h
407f082c664d2ea3d8880e0c6458e42c38b2daf7
[ "MIT" ]
permissive
errantti/ontheedge-editor
a0779777492b47f4425d6155e831df549f83d4c9
678d2886d068351d7fdd68927b272e75da687484
refs/heads/main
2023-03-04T02:52:36.538407
2021-01-23T19:42:22
2021-01-23T19:42:22
332,293,357
0
0
null
null
null
null
ISO-8859-1
C++
false
false
2,043
h
// On the Edge Editor // // Copyright © 2004-2021 Jukka Tykkyläinen // // 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. #ifndef __SCRIPTPARSER_H__ #define __SCRIPTPARSER_H__ #include "ScriptEngineDefines.h" #include "Script.h" #include <string> class CScriptParser { public: CScriptParser(CScriptEngine *scriptEngine) : m_scriptEngine(scriptEngine), m_current(0) {} ~CScriptParser(); void BeginParse(std::string scriptName); void BeginParse(CScript *script); bool ParseLine(const char *line); CScript *EndParse(); void InterruptParse(); CScript *ParseFile(const char *filename, const char *scriptName); private: CScript *m_current; CScriptEngine *m_scriptEngine; bool m_bParsingExternalScript; bool GetWord(const char *line, int wordIndex, char *output); bool ExtractAttribute(char *word, CScript::SAttribute &att, char *type); bool VerifyVariableNameSyntax(char *name); bool VerifyStringSyntax(char *str); void ReportError(std::string errormsg); }; #endif // #ifndef __SCRIPTPARSER_H__
[ "jukka.tykkylainen@gmail.com" ]
jukka.tykkylainen@gmail.com
ce41682682a0a59e31f372099cc17b1de8f95d0f
9dfe64c1777c505e6b66921bab73c07081133734
/wpilibc/src/main/native/include/frc/controller/PIDController.h
7bffbc01f7b885f61d98e4b609b06863f9cc48fe
[ "BSD-3-Clause" ]
permissive
nathanmutin/allwpilib
5d7c20509345efbcd4babce28d3445cc321494ef
3ff2c45e4559df7d6a28bac905ad92d0640c95ac
refs/heads/master
2020-07-03T14:59:17.349060
2019-09-25T17:17:35
2019-09-25T17:17:35
201,944,873
0
0
NOASSERTION
2019-08-24T13:36:50
2019-08-12T14:18:55
C++
UTF-8
C++
false
false
8,244
h
/*----------------------------------------------------------------------------*/ /* Copyright (c) 2018-2019 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include <functional> #include <limits> #include "frc/smartdashboard/SendableBase.h" namespace frc2 { /** * Implements a PID control loop. */ class PIDController : public frc::SendableBase { public: enum class Tolerance { kAbsolute, kPercent }; /** * Allocates a PIDController with the given constants for Kp, Ki, and Kd. * * @param Kp The proportional coefficient. * @param Ki The integral coefficient. * @param Kd The derivative coefficient. * @param period The period between controller updates in seconds. The * default is 0.02 seconds. */ PIDController(double Kp, double Ki, double Kd, double period = 0.02); ~PIDController() override = default; PIDController(const PIDController&) = default; PIDController& operator=(const PIDController&) = default; PIDController(PIDController&&) = default; PIDController& operator=(PIDController&&) = default; /** * Sets the PID Controller gain parameters. * * Sets the proportional, integral, and differential coefficients. * * @param Kp Proportional coefficient * @param Ki Integral coefficient * @param Kd Differential coefficient */ void SetPID(double Kp, double Ki, double Kd); /** * Sets the proportional coefficient of the PID controller gain. * * @param Kp proportional coefficient */ void SetP(double Kp); /** * Sets the integral coefficient of the PID controller gain. * * @param Ki integral coefficient */ void SetI(double Ki); /** * Sets the differential coefficient of the PID controller gain. * * @param Kd differential coefficient */ void SetD(double Kd); /** * Gets the proportional coefficient. * * @return proportional coefficient */ double GetP() const; /** * Gets the integral coefficient. * * @return integral coefficient */ double GetI() const; /** * Gets the differential coefficient. * * @return differential coefficient */ double GetD() const; /** * Gets the period of this controller. * * @return The period of the controller. */ double GetPeriod() const; /** * Returns the current controller output. * * This is always centered around zero and constrained to the min and max * outputs. * * @return The latest calculated output. */ double GetOutput() const; /** * Sets the setpoint for the PIDController. * * @param setpoint The desired setpoint. */ void SetSetpoint(double setpoint); /** * Returns the current setpoint of the PIDController. * * @return The current setpoint. */ double GetSetpoint() const; /** * Returns true if the error is within tolerance of the setpoint. * * This will return false until at least one input value has been computed. * * @param tolerance The maximum allowable error. * @param deltaTolerance The maximum allowable change in error. * @param toleranceType The type of tolerances specified. */ bool AtSetpoint( double tolerance, double deltaTolerance = std::numeric_limits<double>::infinity(), Tolerance toleranceType = Tolerance::kAbsolute) const; /** * Returns true if the error is within the tolerance of the error. * * Currently this just reports on target as the actual value passes through * the setpoint. Ideally it should be based on being within the tolerance for * some period of time. * * This will return false until at least one input value has been computed. */ bool AtSetpoint() const; /** * Sets the PID controller to consider the input to be continuous. * * Rather then using the max and min input range as constraints, it considers * them to be the same point and automatically calculates the shortest route * to the setpoint. * * @param continuous true turns on continuous, false turns off continuous */ void SetContinuous(bool continuous = true); /** * Sets the minimum and maximum values expected from the input. * * @param minimumInput The minimum value expected from the input. * @param maximumInput The maximum value expected from the input. */ void SetInputRange(double minimumInput, double maximumInput); /** * Sets the minimum and maximum values to write. * * @param minimumOutput the minimum value to write to the output * @param maximumOutput the maximum value to write to the output */ void SetOutputRange(double minimumOutput, double maximumOutput); /** * Sets the absolute error which is considered tolerable for use with * AtSetpoint(). * * @param tolerance Error which is tolerable. * @param deltaTolerance Change in error per second which is tolerable. */ void SetAbsoluteTolerance( double tolerance, double deltaTolerance = std::numeric_limits<double>::infinity()); /** * Sets the percentage error which is considered tolerable for use with * AtSetpoint(). * * @param tolerance Percent error which is tolerable. * @param deltaTolerance Change in percent error per second which is * tolerable. */ void SetPercentTolerance( double tolerance, double deltaTolerance = std::numeric_limits<double>::infinity()); /** * Returns the difference between the setpoint and the measurement. * * @return The error. */ double GetError() const; /** * Returns the change in error per second. */ double GetDeltaError() const; /** * Returns the next output of the PID controller. * * @param measurement The current measurement of the process variable. */ double Calculate(double measurement); /** * Returns the next output of the PID controller. * * @param measurement The current measurement of the process variable. * @param setpoint The new setpoint of the controller. */ double Calculate(double measurement, double setpoint); /** * Reset the previous error, the integral term, and disable the controller. */ void Reset(); void InitSendable(frc::SendableBuilder& builder) override; protected: /** * Wraps error around for continuous inputs. The original error is returned if * continuous mode is disabled. * * @param error The current error of the PID controller. * @return Error for continuous inputs. */ double GetContinuousError(double error) const; private: // Factor for "proportional" control double m_Kp; // Factor for "integral" control double m_Ki; // Factor for "derivative" control double m_Kd; // The period (in seconds) of the control loop running this controller double m_period; // |maximum output| double m_maximumOutput = 1.0; // |minimum output| double m_minimumOutput = -1.0; // Maximum input - limit setpoint to this double m_maximumInput = 0; // Minimum input - limit setpoint to this double m_minimumInput = 0; // input range - difference between maximum and minimum double m_inputRange = 0; // Do the endpoints wrap around? eg. Absolute encoder bool m_continuous = false; // The error at the time of the most recent call to calculate() double m_currError = 0; // The error at the time of the second-most-recent call to calculate() (used // to compute velocity) double m_prevError = std::numeric_limits<double>::infinity(); // The sum of the errors for use in the integral calc double m_totalError = 0; Tolerance m_toleranceType = Tolerance::kAbsolute; // The percentage or absolute error that is considered at setpoint. double m_tolerance = 0.05; double m_deltaTolerance = std::numeric_limits<double>::infinity(); double m_setpoint = 0; double m_output = 0; }; } // namespace frc2
[ "johnson.peter@gmail.com" ]
johnson.peter@gmail.com
1cd8cb61535f05ff9974f4279b27aa31dd4daf0a
318f4c88ea77251660e7dbee9182ca138d7b95d9
/Cplusplus/floodFill.cpp
c3f88c72397e1353262ac929df7487eb9b1438e4
[]
no_license
Sahil12S/LeetCode
b1548aec56c7eb30139b0f2975329c6ed9034379
5a9916827e969cd4adbc394779e1bb3ba576f6e2
refs/heads/master
2021-06-02T07:39:00.503814
2020-09-23T03:21:53
2020-09-23T03:21:53
145,740,842
0
0
null
null
null
null
UTF-8
C++
false
false
2,151
cpp
/** * An image is represented by a 2-D array of integers, * each integer representing the pixel value of the image (from 0 to 65535). * * Given a coordinate (sr, sc) representing the starting pixel (row and column) of the flood fill, * and a pixel value newColor, "flood fill" the image. * To perform a "flood fill", consider the starting pixel, * plus any pixels connected 4-directionally to the starting pixel of the same color as the starting pixel, * plus any pixels connected 4-directionally to those pixels (also with the same color as the starting pixel), * and so on. Replace the color of all of the aforementioned pixels with the newColor. * * At the end, return the modified image. */ #include <iostream> #include <vector> #include <queue> #define FORI(s, n) for (int i = s; i < n; i++) #define FORJ(s, n) for (int j = s; j < n; j++) using VI = std::vector<int>; using VVI = std::vector<VI>; VVI floodFill(VVI &image, int sr, int sc, int newColor); int main() { VVI image = {{1, 1, 1}, {1, 1, 0}, {1, 0, 1}}; int sr = 1; int sc = 1; int newColor = 2; auto ans = floodFill(image, sr, sc, newColor); for (auto vec : ans) { for (int val : vec) { std::cout << val << " "; } std::cout << '\n'; } return 0; } VVI floodFill(VVI &image, int sr, int sc, int newColor) { if (image.empty()) { return image; } int rows = image.size(); int cols = image[0].size(); std::queue<std::pair<int, int>> q; q.push({sr, sc}); int startPixel = image[sr][sc]; image[sr][sc] = newColor; VVI dirs = {{-1, 0}, {1, 0}, {0, -1}, {0, 1}}; while (!q.empty()) { std::pair<int, int> point = q.front(); q.pop(); FORI(0, 4) { int nr = point.first + dirs[i][0]; int nc = point.second + dirs[i][1]; if (nr >= 0 && nr < rows && nc >= 0 && nc < cols && image[nr][nc] == startPixel && image[nr][nc] != newColor) { q.push({nr, nc}); image[nr][nc] = newColor; } } } return image; }
[ "sahil.sharma@sjsu.edu" ]
sahil.sharma@sjsu.edu
b8720259568a2d8bee58982e29579a1cc2316ef0
3e4d068a10a7d2e9718f7ea9546f292eff637d40
/section2.1/castle.cpp
bb27a6cfb2460b35ed3733a657a34d0e87c701da
[]
no_license
ravichoudhary33/usaco
abfc465eb8ff9facadd9f21d1437b137e41c5920
5d786ea767cd4a09a9ba5511a9d50ea3dc05e9b4
refs/heads/master
2020-12-24T06:08:37.736600
2014-05-02T16:27:03
2014-05-02T16:27:03
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,539
cpp
/* SECTION: 2.1 NUMBER: 1 ID: voxsim2 PROG: castle LANG: C++ */ #include <iostream> #include <fstream> using namespace std; unsigned int N; unsigned int M; unsigned int walls[50][50]; unsigned int rooms[50][50]; unsigned int visit[50][50]; unsigned int labels[2500]; unsigned int label; void fill(unsigned int i, unsigned int j) { if(visit[i][j] == 1) return; visit[i][j] = 1; labels[rooms[i][j]-1]++; // West wall if((walls[i][j] & 1) == 0 && j > 0) { rooms[i][j-1] = rooms[i][j]; fill(i, j-1); } // North wall if((walls[i][j] & 2) == 0 && i > 0) { rooms[i-1][j] = rooms[i][j]; fill(i-1, j); } // East wall if((walls[i][j] & 4) == 0 && j < M-1) { rooms[i][j+1] = rooms[i][j]; fill(i, j+1); } // South wall if((walls[i][j] & 8) == 0 && i < N-1) { rooms[i+1][j] = rooms[i][j]; fill(i+1, j); } } int main() { ifstream fin ("castle.in"); ofstream fout ("castle.out"); fin >> M >> N; for(unsigned int i=0; i<N; i++) { for(unsigned int j=0; j<M; j++) { fin >> walls[i][j]; } } label = 1; // Mark every square with the label room for(unsigned int i=0; i<N; i++) { for(unsigned int j=0; j<M; j++) { if(rooms[i][j] == 0) { rooms[i][j] = label; label++; fill(i, j); } } } for(unsigned int i=0; i<N; i++) { for(unsigned int j=0; j<M; j++) { cout << rooms[i][j] << " "; } cout << endl; } // Get the size of the largest room unsigned int maxRoom = 0; for(unsigned int i=0; i<label; i++) { if(maxRoom < labels[i]) { maxRoom = labels[i]; } } unsigned int ci = 0; unsigned int cj = 0; char d = 'E'; unsigned int maxRoomCreat = 0; // Found the wall to remove to have the largest room creatable for(unsigned int i=0; i<N; i++) { for(unsigned int j=0; j<M; j++) { // Choose N instead of E // North wall if((walls[i][j] & 2) == 2 && i > 0) { if(rooms[i-1][j] != rooms[i][j]) { unsigned int maxRoomCreatL = labels[rooms[i-1][j]-1] + labels[rooms[i][j]-1]; // if tied if(maxRoomCreat == maxRoomCreatL) { // choose the nearest at west if(j < cj-1) { ci = i+1; cj = j+1; d = 'N'; } // choose the nearest at south if(j == cj-1 && i > ci-1) { ci = i+1; cj = j+1; d = 'N'; } } if(maxRoomCreat < maxRoomCreatL){ maxRoomCreat = maxRoomCreatL; ci = i+1; cj = j+1; d = 'N'; } } } // East wall if((walls[i][j] & 4) == 4 && j < M-1) { if(rooms[i][j+1] != rooms[i][j]) { unsigned int maxRoomCreatL = labels[rooms[i][j+1]-1] + labels[rooms[i][j]-1]; // if tied if(maxRoomCreat == maxRoomCreatL) { // choose the nearest at west if(j < cj-1) { ci = i+1; cj = j+1; d = 'E'; } // choose the nearest at south if(j == cj-1 && i > ci-1) { ci = i+1; cj = j+1; d = 'E'; } } if(maxRoomCreat < maxRoomCreatL){ maxRoomCreat = maxRoomCreatL; ci = i+1; cj = j+1; d = 'E'; } } } } } fout << label-1 << endl; fout << maxRoom << endl; fout << maxRoomCreat << endl; fout << ci << " " << cj << " " << d << endl; return 0; }
[ "voxsim@gmail.com" ]
voxsim@gmail.com
928dc69f244322d8293dc9972cb80324fd2f5d04
5788dd99c205e9912c0d1394df2aff76d064f5f2
/Paint/PolygonLineFactory.h
a00c501f41f0836e878d34deadf469317a87492f
[]
no_license
AlexSauchuk/Paint_OSISP_LAB1
c6e491b01090bc4889bf5ade8718c7f62ca517c3
3c2007f372bc2256caeec9d7e4158386d1f7810f
refs/heads/master
2021-06-03T02:01:35.397048
2016-09-15T09:22:15
2016-09-15T09:22:15
null
0
0
null
null
null
null
UTF-8
C++
false
false
169
h
#pragma once class PolygonLineFactory : public ShapeFactory { public: PolygonLineFactory(); ~PolygonLineFactory(); Shape* CreateShape(COLORREF,int,COLORREF); };
[ "alexandrsavchuk.97@gmail.com" ]
alexandrsavchuk.97@gmail.com
b1fbea40efb28a1f06d719427891e994e0a616c0
68b53a376791427281d38f4d5a6762da4cad88ed
/test/include/iterable.hpp
5b8f4bf91fb9ef8fcbba37e89cfa16aada9f31d6
[]
no_license
de-passage/properties.cpp
892e7c5810dec99e8e47cd154ee6dce7027b64f6
cc962a3330f5472357349f4a859e84d6b1fca299
refs/heads/master
2021-05-04T12:31:47.238220
2018-04-21T17:50:05
2018-04-21T17:50:05
120,296,477
0
0
null
null
null
null
UTF-8
C++
false
false
76
hpp
#ifndef TEST_ITERABLE #define TEST_ITERABLE void test_iterable(); #endif
[ "maisbiensurqueoui@gmail.com" ]
maisbiensurqueoui@gmail.com
9fb49938acb740a4c6f44cad3a4102e78ae9fee6
c491e9f1fa6fc4013a3529046338a1d7a8922c1c
/codeforces/1352C.cpp
86404f8708cffd0f16f9aedad7c1e1fa2aaba281
[]
no_license
dpmittal/competitive_programming
d55ab3d86fbd5ba20cbb8a21eaae23d436753427
564a66e24d8edd5cdf328877cf5636c86bb7cc38
refs/heads/master
2021-08-07T13:16:10.935638
2020-07-14T07:43:13
2020-07-14T07:43:13
74,385,801
0
6
null
2020-07-14T07:40:47
2016-11-21T17:01:22
C++
UTF-8
C++
false
false
240
cpp
#include<bits/stdc++.h> #define ll long long using namespace std; int main(){ int itr; cin>>itr; while(itr--){ ll n, k; cin>>n>>k; ll ans = ((k-1)/(n-1))+ k; cout<<ans<<endl; } return 0; }
[ "divyaprakashmittal@gmail.com" ]
divyaprakashmittal@gmail.com
323bf6f4a60d53bbb489cb7a8a09bebdef671add
050ebbbc7d5f89d340fd9f2aa534eac42d9babb7
/grupa2/pgraska/zd.02/nwd.cpp
c02075bc638597c4e091104628d2a119cb10c4de
[]
no_license
anagorko/zpk2015
83461a25831fa4358366ec15ab915a0d9b6acdf5
0553ec55d2617f7bea588d650b94828b5f434915
refs/heads/master
2020-04-05T23:47:55.299547
2016-09-14T11:01:46
2016-09-14T11:01:46
52,429,626
0
13
null
2016-03-22T09:35:25
2016-02-24T09:19:07
C++
UTF-8
C++
false
false
426
cpp
#include <iostream> using namespace std; int NWD(int a, int b) { int r = a % b; while (r != 0) { a = b; b = r; r = a%b; } return b; } int main() { int n; int n_w_d; cin >> n; int* t = new int [n]; for (int i = 0; i < n; i++){ cin >> t[i]; } n_w_d = t[0]; for (int i = 1; i < n-1; i++) { n_w_d = NWD(t[i], n_w_d); } cout << n_w_d << endl; system("pause"); delete[] t; cin.get(); return 0; }
[ "piotrgraska@gmail.com" ]
piotrgraska@gmail.com
e03d4d768eca26265f2b2e809572254916461b8d
777a75e6ed0934c193aece9de4421f8d8db01aac
/src/Providers/UNIXProviders/tests/UNIXProviders.Tests/UNIX_ElementInConnectorFixture.h
d5dc60cb62b32686b933a0818dc72f906caa4ada
[ "MIT" ]
permissive
brunolauze/openpegasus-providers-old
20fc13958016e35dc4d87f93d1999db0eae9010a
b00f1aad575bae144b8538bf57ba5fd5582a4ec7
refs/heads/master
2021-01-01T20:05:44.559362
2014-04-30T17:50:06
2014-04-30T17:50:06
19,132,738
1
0
null
null
null
null
UTF-8
C++
false
false
1,887
h
//%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 "CIMFixtureBase.h" class UNIX_ElementInConnectorFixture : public CIMFixtureBase { public: UNIX_ElementInConnectorFixture(); ~UNIX_ElementInConnectorFixture(); virtual void Run(); };
[ "brunolauze@msn.com" ]
brunolauze@msn.com
148465b8c6867e1a63a4a2f0862276cdd6b3607d
315fd47690450e7a0530bf4b3596cc9448c88929
/aoj/13/test.cpp
0f618ff91091d0a216e4cc06d94be34959c9d9ee
[]
no_license
1119-2916/competitive-programming
8d59f2c3c36de719d665307fcaa138cc03845573
356b66d2f93bf6e28f04af8968e0f1f6ae4d7bae
refs/heads/master
2021-06-08T14:33:14.620002
2020-04-26T14:01:44
2020-04-26T14:01:44
108,534,522
3
0
null
null
null
null
UTF-8
C++
false
false
12,463
cpp
#include <bits/stdc++.h> using namespace std; #define INF 1001000100010001000 #define MOD 1000000007 #define EPS 1e-10 #define int long long #define rep(i, N) for (int i = 0; i < N; i++) #define Rep(i, N) for (int i = 1; i < N; i++) #define For(i, a, b) for (int i = (a); i < (b); i++) #define pb push_back #define eb emplace_back #define mp make_pair #define pii pair<int, int> #define vi vector<int> #define vvi vector<vi > #define vb vector<bool> #define vvb vector<vb > #define vp vector< pii > #define all(a) (a).begin(), (a).end() #define Int(x) int x; cin >> x; #define int2(x, y) Int(x); Int(y); #define int3(x, y, z) Int(x); int2(y, z); #define in(x, a, b) ((a) <= (x) && (x) < (b)) #define fir first #define sec second #define ffir first.first #define fsec first.second #define sfir second.first #define ssec second.second #define Decimal fixed << setprecision(10) //int dxy[5] = {0, 1, 0, -1, 0}; // 01Trie BIT CHT DFT FFT avl cmd cusum dijkstra dinic geo2 gin graph kruskal lca lcm matrix ncm next_combination ppuf segtree st tmp topcoder uf vi //#define double long double const double EPS = 1e-8; const double PI = acos(-1); #define equals(a,b) (fabs((a)-(b)) < EPS) #define next(P,i) P[(i+1)%P.size()] #define prev(P,i) P[(i+P.size()-1)%P.size()] struct Point { double x, y; Point() {} Point(double x, double y) :x(x), y(y) {} Point &operator+=(const Point &p) { x += p.x; y += p.y; return *this; } Point &operator-=(const Point &p) { x -= p.x; y -= p.y; return *this; } Point &operator*=(double a) { x *= a; y *= a; return *this; } Point &operator/=(double a) { x /= a; y /= a; return *this; } double abs() { return sqrt(norm()); } double norm() { return x*x + y*y; } }; Point operator+(const Point &p1, const Point &p2) { return Point(p1) += p2; } Point operator-(const Point &p1, const Point &p2) { return Point(p1) -= p2; } Point operator*(const Point &p, double a) { return Point(p) *= a; } Point operator/(const Point &p, double a) { return Point(p) /= a; } bool operator==(const Point &p1, const Point &p2) { return equals(p1.x, p2.x) && equals(p1.y, p2.y); } bool operator<(const Point &p1, const Point &p2) { //return p1.y != p2.y ? p1.y < p2.y : p1.x < p2.x; //y昇順 -> x昇順 return p1.x != p2.x ? p1.x < p2.x : p1.y < p2.y; //x昇順 -> y昇順 } bool operator>(const Point &p1, const Point &p2) { return p2 < p1; } inline istream &operator >> (istream &is, Point &p) { double x, y; is >> x >> y; p = Point(x, y); return is; } inline ostream &operator << (ostream &os, const Point &p) { os << p.x << ' ' << p.y; return os; } struct Vector :public Point { using Point::Point; Vector() {} Vector(const Point &P) { x = P.x; y = P.y; } Vector rotate(double rad) { return Vector(x*cos(rad) - y*sin(rad), x*sin(rad) + y*cos(rad)); } Vector unit() { return *this / abs(); } }; //内積 dot product double dot(Vector a, Vector b) { return a.x*b.x + a.y*b.y; } //外積 cross product の大きさ(正負あり) double cross(Vector a, Vector b) { return a.x*b.y - a.y*b.x; } struct Line { Point p1, p2; Line() {} Line(Point p1, Point p2) :p1(p1), p2(p2) {} }; struct Segment :public Line { using Line::Line; Segment() {} Segment(const Line &L) { p1 = L.p1; p2 = L.p2; } Vector vec() { return p2 - p1; } }; struct Circle { Point c; //center double r; //radius Circle() {} Circle(Point c, double r) :c(c), r(r) {} }; using Polygon = vector<Point>; //degree to radian double rad(double deg) { return PI*deg / 180; } //radian to degree double deg(double rad) { return rad / PI * 180; } //偏角 argument double arg(Vector p) { return atan2(p.y, p.x); } //極形式 polar form Vector polar(double r, double a) { return Point(cos(a)*r, sin(a)*r); } //2つのベクトルの角度 double angle(Vector a, Vector b) { double lena = a.abs(), lenb = b.abs(); if (lena == 0 || lenb == 0)return 0; //解なし double costheta = dot(a, b) / (lena*lenb); if (equals(costheta, 1))costheta = 1; //誤差対策 return acos(costheta); } bool inrange(Point p, double x1, double y1, double x2, double y2) { return x1 <= p.x&&p.x <= x2&&y1 <= p.y&&p.y <= y2; } //直交判定 bool is_orthogonal(Vector a, Vector b) { return equals(dot(a, b), 0.0); } bool is_orthogonal(Segment s1, Segment s2) { return equals(dot(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); } //平行判定 bool is_parallel(Vector a, Vector b) { return equals(cross(a, b), 0.0); } bool is_parallel(Segment s1, Segment s2) { return equals(cross(s1.p2 - s1.p1, s2.p2 - s2.p1), 0.0); } //射影 Point project(Segment s, Point p) { Vector base = s.p2 - s.p1; double r = dot(p - s.p1, base) / base.norm(); return s.p1 + base*r; } //反射 Point reflect(Segment s, Point p) { return p + (project(s, p) - p)*2.0; } //線分(p0,p1)に対するp2の位置関係 enum { ONLINE_FRONT = -2, CLOCKWISE, ON_SEGMENT, COUNTER_CLOCKWISE, ONLINE_BACK }; int ccw(Point p0, Point p1, Point p2) { Vector a = p1 - p0, b = p2 - p0; if (cross(a, b) > EPS)return COUNTER_CLOCKWISE; if (cross(a, b) < -EPS)return CLOCKWISE; if (dot(a, b) < -EPS)return ONLINE_BACK; //p2 p0 p1 if (a.norm() < b.norm())return ONLINE_FRONT; //p0 p1 p2 return ON_SEGMENT; } int ccw(Vector a, Vector b) { if (cross(a, b) > EPS)return COUNTER_CLOCKWISE; if (cross(a, b) < -EPS)return CLOCKWISE; if (dot(a, b) < -EPS)return ONLINE_BACK; //p2 p0 p1 if (a.norm() < b.norm())return ONLINE_FRONT; //p0 p1 p2 return ON_SEGMENT; } //直線と直線の交差判定 bool intersect(Segment a, Segment b) { Point p1 = a.p1, p2 = a.p2, p3 = b.p1, p4 = b.p2; return (ccw(p1, p2, p3)*ccw(p1, p2, p4) <= 0 && ccw(p3, p4, p1)*ccw(p3, p4, p2) <= 0); } //(交差判定続く) //2点間の距離 double get_distance(Point a, Point b) { return (a - b).abs(); } //直線と点の距離 double get_distance(Line l, Point p) { return abs(cross(l.p2 - l.p1, p - l.p1) / (l.p2 - l.p1).abs()); } //線分と点の距離 double get_distance(Segment s, Point p) { if (dot(s.p2 - s.p1, p - s.p1) < 0.0)return (p - s.p1).abs(); if (dot(s.p1 - s.p2, p - s.p2) < 0.0)return (p - s.p2).abs(); return get_distance(Line(s), p); } //線分と線分の距離 double get_distance(Segment s1, Segment s2) { if (intersect(s1, s2))return 0.0; return min( min(get_distance(s1, s2.p1), get_distance(s1, s2.p2)), min(get_distance(s2, s1.p1), get_distance(s2, s1.p2)) ); } //円と直線の交差判定 bool intersect(Circle c, Line l) { return get_distance(l, c.c) <= c.r + EPS; } //円と円の交差判定 共通接線の数 int intersect(Circle c1, Circle c2) { double d = get_distance(c1.c, c2.c); if (d > c1.r + c2.r)return 4; if (d == c1.r + c2.r)return 3; if (d + c1.r == c2.r || d + c2.r == c1.r)return 1; if (d + c1.r < c2.r || d + c2.r < c1.r)return 0; return 2; } //線分と線分の交点 Point get_cross_point(Segment a, Segment b) { assert(intersect(a, b)); Vector base = b.p2 - b.p1; double area1 = abs(cross(base, a.p1 - b.p1)); double area2 = abs(cross(base, a.p2 - b.p1)); double t = area1 / (area1 + area2); return a.p1 + (a.p2 - a.p1)*t; } //円と直線の交点 pair<Point, Point> get_cross_points(Circle c, Line l) { assert(intersect(c, l)); Vector pr = project(l, c.c); Vector e = (l.p2 - l.p1) / (l.p2 - l.p1).abs(); double base = sqrt(c.r*c.r - (pr - c.c).norm()); return make_pair(pr + e*base, pr - e*base); } //円と円の交点 pair<Point, Point> get_cross_points(Circle c1, Circle c2) { int m = intersect(c1, c2); assert(m != 4 && m != 0); double d = (c1.c - c2.c).abs(); double a = acos((c1.r*c1.r - c2.r*c2.r + d*d) / (2 * c1.r*d)); double t = arg(c2.c - c1.c); return make_pair(c1.c + polar(c1.r, t + a), c1.c + polar(c1.r, t - a)); } //点の内包 enum { OUT = 0, ON, IN }; int contains(const Polygon &pl, Point p) { int n = pl.size(); bool x = false; for (int i = 0; i < n; i++) { Point a = pl[i] - p, b = pl[(i + 1) % n] - p; if (abs(cross(a, b)) < EPS&&dot(a, b) < EPS)return ON; if (a.y > b.y)swap(a, b); if (a.y < EPS&&EPS<b.y&&cross(a, b)>EPS)x = !x; } return (x ? IN : OUT); } int contains(Circle c, Point p) { double d = get_distance(c.c, p); if (equals(d, c.r))return ON; if (d < c.r)return IN; return OUT; } //多角形の面積 double area(const Polygon &p) { double a = 0; for (size_t i = 0; i < p.size(); i++) a += cross(p[i], p[(i + 1) % p.size()]); return fabs(a / 2.0); } //凸性判定(反時計回り) bool is_convex(Polygon g) { for (size_t i = 0; i < g.size(); i++) if (ccw(g[i], g[(i + 1) % g.size()], g[(i + 2) % g.size()]) == CLOCKWISE) return false; return true; } //凸包 //Graham scan https://en.wikipedia.org/wiki/Graham_scan //辺上の点を含めない Polygon convex_hull(Polygon P) { sort(P.begin(), P.end()); Polygon up; for (Point &p : P) { while (up.size() > 1 && ccw(up[up.size() - 2], up[up.size() - 1], p) != CLOCKWISE)up.pop_back(); up.emplace_back(p); } Polygon down; for (Point &p : P) { while (down.size() > 1 && ccw(down[down.size() - 2], down[down.size() - 1], p) != COUNTER_CLOCKWISE)down.pop_back(); down.emplace_back(p); } reverse(up.begin(), up.end()); //反時計回りに down.insert(down.end(), up.begin() + 1, up.end() - 1); return down; } //凸包 //Graham scan https://en.wikipedia.org/wiki/Graham_scan //辺上の点を含む Polygon convex_hull_with_points_online(Polygon P) { sort(P.begin(), P.end()); Polygon up; for (Point &p : P) { int _ccw; while (up.size() > 1 && (_ccw = ccw(up[up.size() - 2], up[up.size() - 1], p)) != CLOCKWISE &&_ccw != ONLINE_FRONT) up.pop_back(); up.emplace_back(p); } Polygon down; for (Point &p : P) { int _ccw; while (down.size() > 1 && (_ccw = ccw(down[down.size() - 2], down[down.size() - 1], p)) != COUNTER_CLOCKWISE && _ccw != ONLINE_FRONT) down.pop_back(); down.emplace_back(p); } reverse(up.begin(), up.end()); //反時計回りに down.insert(down.end(), up.begin() + 1, up.end() - 1); return down; } //凸多角形の最遠頂点対間距離 //calipers https://en.wikipedia.org/wiki/Rotating_calipers double diameter(Polygon P) { P = convex_hull(P); auto mima = minmax_element(P.begin(), P.end()); int I = mima.first - P.begin(); int J = mima.second - P.begin(); double maxd = get_distance(P[I], P[J]); int maxi, maxj, i, j; i = maxi = I; j = maxj = J; do { if (ccw(next(P, i) - P[i], next(P, j) - P[j]) == COUNTER_CLOCKWISE) j = (j + 1) % P.size(); else i = (i + 1) % P.size(); if (maxd < get_distance(P[i], P[j])) { maxd = get_distance(P[i], P[j]); maxi = i, maxj = j; } } while (!(i == I&&j == J)); return maxd; } //多角形を(0,0)を中心として回転 Polygon rotate(const Polygon &P, double rad) { Polygon ret; for (auto &p : P) ret.emplace_back(p.x*cos(rad) - p.y*sin(rad), p.x*sin(rad) + p.y*cos(rad)); return ret; } //Heron's formula double area(double a, double b, double c) { double s = (a + b + c) / 2; return sqrt(s*(s - a)*(s - b)*(s - c)); } //多角形の重心 Point center(const Polygon &P) { Point ret(0, 0); for (auto &p : P)ret = ret + p; ret = ret / P.size(); return ret; } //垂直二等分線 Line get_bisection(const Point &p1, const Point &p2) { Circle c1(p1, INF), c2(p2, INF); //INF だと誤差が酷い auto ps = get_cross_points(c1, c2); return Line(ps.first, ps.second); } //3点から距離が等しい点 (3点を円周上に持つ円の中心) Point get_center(const Point &p1, const Point &p2, const Point &p3) { Line l1 = get_bisection(p1, p2), l2 = get_bisection(p2, p3); return get_cross_point(l1, l2); } //点pを通る円cの接線における接点 pair<Point, Point> get_tangent(const Circle &c, const Point &p) { double d = get_distance(c.c, p); Circle c2((c.c + p) / 2, d / 2); return get_cross_points(c, c2); } signed main() { std::ios::sync_with_stdio(false); std::cin.tie(0); return 0; }
[ "ti11192916@gmail.com" ]
ti11192916@gmail.com
8a51a82b9f6d4baf480d36b80effa1f4105316a6
5f5ddba450f687c43eb80b3b5cf5cb0f580bb9e7
/tree.cpp
35df6e59a46cb3653cccf6b7ce79c6a4a2c6c14e
[]
no_license
Paul26/tree
8489f74c03826a24dc95067504337043b7ece75f
7afbfe804bedbe7535da80e0172851a2893bc748
refs/heads/master
2021-08-16T12:53:28.002262
2017-11-19T22:32:55
2017-11-19T22:32:55
111,337,545
0
0
null
null
null
null
UTF-8
C++
false
false
903
cpp
#include <iostream> using namespace std; int main() { int coneHeight; cout << "Please enter a tree height between 2 and 16: "; cin >> coneHeight; if (coneHeight < 3 || coneHeight > 15) { cout << "Height is out of bounds." << endl; exit(0); } /* Tree Cone */ for (int level = 0; level <= coneHeight - 1; level++) { for (int space = 0; space < coneHeight - level - 1; space++) { cout << " "; } cout << "/"; for (int coneSpaces = 1; coneSpaces < 2 * level + 1; coneSpaces++) { cout << " "; } cout << "\\"; cout << endl; } /* Tree Base */ for (int base = 0; base < 2 * coneHeight; base++) { cout << "-"; } /* Tree Trunk */ for (int trunkLevel = 1; trunkLevel <= coneHeight / 2; trunkLevel++) { cout << endl; for (int trunk = 0; trunk < coneHeight - 1; trunk++) { cout << " "; } cout << "||"; } //system("pause"); return 0; }
[ "paulsheets26@gmail.com" ]
paulsheets26@gmail.com
06558ebdf3e01b6d6cc7b5af42df1f2f61496b76
2a684fca63f3a09f40af0a3c75b3d8d7a5f96ba3
/lab5/PA5/PA5/normals.cpp
e44730b95828d963d9b060a6eefad977b47c680e
[]
no_license
Nic-Bush/Computer-Graphics
16993c72adea071231d448e62d9811f2429206fb
a48c23d69ae384c4d490d14d27b8caa10471d079
refs/heads/master
2020-05-21T20:46:40.798828
2016-12-27T16:39:00
2016-12-27T16:39:00
61,387,999
0
0
null
null
null
null
UTF-8
C++
false
false
4,360
cpp
# include "normals.h" normals::normals() { _numpoints = 0; } void normals::init(const GlProgram& prog) { // Define buffers needed: set_program(prog); gen_vertex_arrays(1); // will use 1 vertex array gen_buffers(2); // will use 2 buffers: one for coordinates and one for colors uniform_locations(2); // will send 2 variables: the 2 matrices below uniform_location(0, "vTransf"); uniform_location(1, "vProj"); rhand.load("rhand.m"); rlowerarm.load("rlowerarm.m"); rupperarm.load("rupperarm.m"); } void normals::buildupperarm(double nfaces, int normtype) { double scale = 2.0; if (normtype == 0) { for (int i = 0; i < rupperarm.vsize; i++) { N.push_back(rupperarm.V[i] / scale); N.push_back((rupperarm.V[i] / scale + (rupperarm.N[i] / 10 / scale))); C.push_back(GsColor::red); C.push_back(GsColor::red); } } else { for (int i = 0; i < rupperarm.fsize; i++) { GsVec a = (rupperarm.V[rupperarm.F[i].va] + rupperarm.V[rupperarm.F[i].vb] + rupperarm.V[rupperarm.F[i].vc]) / 3; N.push_back(a / scale); N.push_back(a / scale + (rupperarm.N[rupperarm.F[i].na]) / (10 * scale)); C.push_back(GsColor::red); C.push_back(GsColor::red); } } glBindBuffer(GL_ARRAY_BUFFER, buf[0]); glBufferData(GL_ARRAY_BUFFER, N.size() * 3 * sizeof(float), &N[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, buf[1]); glBufferData(GL_ARRAY_BUFFER, C.size() * 4 * sizeof(gsbyte), &C[0], GL_STATIC_DRAW); // save size so that we can free our buffers and later just draw the OpenGL arrays: _numpoints = N.size(); // free non-needed memory: N.resize(0); C.resize(0); } void normals::buildlowerarm(double nfaces, int normtype) { double scale = 2.0; if (normtype == 0) { for (int i = 0; i < rlowerarm.vsize; i++) { N.push_back(rlowerarm.V[i] / scale); N.push_back((rlowerarm.V[i] / scale + (rlowerarm.N[i] / 10 / scale))); C.push_back(GsColor::red); C.push_back(GsColor::red); } } else { for (int i = 0; i < rlowerarm.fsize; i++) { GsVec a = (rlowerarm.V[rlowerarm.F[i].va] + rlowerarm.V[rlowerarm.F[i].vb] + rlowerarm.V[rlowerarm.F[i].vc]) / 3; N.push_back(a / scale); N.push_back(a / scale + (rlowerarm.N[rlowerarm.F[i].na]) / (10 * scale)); C.push_back(GsColor::red); C.push_back(GsColor::red); } } glBindBuffer(GL_ARRAY_BUFFER, buf[0]); glBufferData(GL_ARRAY_BUFFER, N.size() * 3 * sizeof(float), &N[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, buf[1]); glBufferData(GL_ARRAY_BUFFER, C.size() * 4 * sizeof(gsbyte), &C[0], GL_STATIC_DRAW); // save size so that we can free our buffers and later just draw the OpenGL arrays: _numpoints = N.size(); // free non-needed memory: N.resize(0); C.resize(0); } void normals::buildhand(double nfaces, int normtype) { double scale = 2.0; if (normtype == 0) { for (int i = 0; i < rhand.vsize; i++) { N.push_back(rhand.V[i] / scale); N.push_back((rhand.V[i] / scale + (rhand.N[i] / 10 / scale))); C.push_back(GsColor::red); C.push_back(GsColor::red); } } else { for (int i = 0; i < rhand.fsize; i++) { GsVec a = (rhand.V[rhand.F[i].va] + rhand.V[rhand.F[i].vb] + rhand.V[rhand.F[i].vc]) / 3; N.push_back(a / scale); N.push_back(a/scale + (rhand.N[rhand.F[i].na]) / (10 *scale)); C.push_back(GsColor::red); C.push_back(GsColor::red); } } // send data to OpenGL buffers: glBindBuffer(GL_ARRAY_BUFFER, buf[0]); glBufferData(GL_ARRAY_BUFFER, N.size() * 3 * sizeof(float), &N[0], GL_STATIC_DRAW); glBindBuffer(GL_ARRAY_BUFFER, buf[1]); glBufferData(GL_ARRAY_BUFFER, C.size() * 4 * sizeof(gsbyte), &C[0], GL_STATIC_DRAW); // save size so that we can free our buffers and later just draw the OpenGL arrays: _numpoints = N.size(); // free non-needed memory: N.resize(0); C.resize(0); } void normals::draw(GsMat& tr, GsMat& pr) { // Draw Lines: glUseProgram(prog); glBindVertexArray(va[0]); glBindBuffer(GL_ARRAY_BUFFER, buf[0]); // positions glEnableVertexAttribArray(0); glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, 0, 0); glBindBuffer(GL_ARRAY_BUFFER, buf[1]); // colors glEnableVertexAttribArray(1); glVertexAttribPointer(1, 4, GL_UNSIGNED_BYTE, GL_FALSE, 0, 0); glUniformMatrix4fv(uniloc[0], 1, GL_FALSE, tr.e); glUniformMatrix4fv(uniloc[1], 1, GL_FALSE, pr.e); glDrawArrays(GL_LINES, 0, _numpoints); //draw the things }
[ "nbush@ucmerced.edu" ]
nbush@ucmerced.edu
e66ac24d2991a08de21de9cbd7278374476793f8
dc37e235701de22d0609d47fab3687ef6dfa2eca
/minionsDOP/sdl/Renderer.h
32ad146d65ccb94223239ee88878a18a7b726c51
[]
no_license
zhivkopetrov/CacheFriendlyCode
ae3295e9806d9271fa16bf6cb1e54cb7370902e6
45d6593274979846b74d9a1c8827e3b1860404d2
refs/heads/master
2021-04-06T11:27:28.635505
2019-09-30T19:12:44
2019-09-30T19:12:44
124,690,897
0
0
null
null
null
null
UTF-8
C++
false
false
3,431
h
/* * Renderer.h * * Created on: 6 Feb 2018 * Author: Zhivko Petrov */ #ifndef SDL_RENDERER_H_ #define SDL_RENDERER_H_ //C system headers //C++ system headers #include <cstdint> #include <cstring> //Other libraries headers //Own components headers #include "TextureContainer.h" #include "sdl/DrawParams.h" //Forward declarations struct SDL_Window; struct SDL_Renderer; #define MAX_WIDGET_COUNT 100 class Renderer { public: Renderer(); //forbid the copy and move constructors Renderer(const Renderer & other) = delete; Renderer(Renderer && other) = delete; //forbid the copy and move assignment operators Renderer & operator=(const Renderer & other) = delete; Renderer & operator=(Renderer && other) = delete; ~Renderer() = default; /** @brief used to initialise actual renderer * * @param const int32_t - monitor X coordinate * @param const int32_t - monitor Y coordinate * @param const int32_t - monitor width * @param const int32_t - monitor height * * @returns int32_t - error code * */ int32_t init(const int32_t windowX, const int32_t windowY, const int32_t windowWidth, const int32_t windowHeight); /** @brief used to destroy renderer and window * */ void deinit(); //===================================================================== /** @brief Every frame should start with this function call * */ void clearScreen(); /** All the drawing functions calls should be encapsulated * between clearScreen() and finishFrame() functions * */ /** @brief Every frame should end with this function call * */ void finishFrame(); //===================================================================== inline TextureContainer * getTextureContainer() { return &_textureContainer; } /** @brief transfer draw specific data from Textures to renderer * * @param DrawParams * - draw specific data for a single Texture * */ inline void drawTexture(DrawParams * drawParams) { _widgets[_currWidgetCounter] = *drawParams; ++_currWidgetCounter; } /** @brief transfer draw specific data from Textures to renderer * * @param DrawParams ** - draw specific data for a Texture array * @param const int32_t - size of the array * */ inline void drawTextureArr(DrawParams drawParamsArr[], const int32_t size) { memcpy(&_widgets[_currWidgetCounter], drawParamsArr, sizeof(DrawParams) * size); _currWidgetCounter += size; } private: //The window we'll be rendering to SDL_Window * _window; //The Hardware Accelerated Renderer SDL_Renderer * _sdlRenderer; //container holding all the graphical textures TextureContainer _textureContainer; //counter for Textures in each individual frame int32_t _currWidgetCounter; DrawParams _widgets[MAX_WIDGET_COUNT]; }; #endif /* SDL_RENDERER_H_ */
[ "noreply@github.com" ]
noreply@github.com
e07f389890ae5c191185fb680cb6e75e0f3fb63d
839681e71bc03f4cdf3ce6691acf69219106d95a
/xlib/xlib/realcall.h
a9c368c5f36246f8a41e94ad04361f40d718b548
[]
no_license
kmichalk/xlib
512828c8e9ca9e36258b5380a73c9e282a1362a9
3d56fe223a2f6e089fac880e83c652307c2daafc
refs/heads/master
2021-01-20T18:28:35.449793
2017-04-28T14:59:00
2017-04-28T14:59:00
59,895,964
0
0
null
null
null
null
UTF-8
C++
false
false
551
h
#ifndef REALCALL_H #define REALCALL_H #include "vamacros.h" #include "autoref.h" #define enable_if std::enable_if_t #define realcall(...) CAT(_realcall_, NARGS(__VA_ARGS__))(__VA_ARGS__) #define _realcall_2(_obj, _fn) (x::deref(_obj).std::remove_cv_t<std::remove_pointer_t<std::remove_reference_t<decltype(_obj)>>> :: _fn) #define _realcall_1(_obj) (x::deref(_obj). std::remove_cv_t<std::remove_pointer_t<std::remove_reference_t<decltype(_obj)>>> :: operator()) #define direct_call(...) realcall(__VA_ARGS__) #undef enable_if #endif //REALCALL_H
[ "kmichalkiewicz.95@gmail.com" ]
kmichalkiewicz.95@gmail.com
ce18e2124daff6f155669b04d8418386e0fe4c7c
aa75bbca0d604d998deaabe65ff543aacd60ff2b
/source/sprites/StringHelper.cpp
3e9325c2b6831057abf38e466a0dfe598420b166
[ "MIT" ]
permissive
xzrunner/sprite2
0aa2d81f99c3d7e92eeb29259a61eafd69091ed5
2d5d8c6b79a63871bdd6cfdcd4805946fde95921
refs/heads/master
2021-01-12T12:00:50.408133
2018-03-23T03:47:21
2018-03-23T03:47:21
68,875,579
0
0
null
null
null
null
UTF-8
C++
false
false
170
cpp
#include "sprite2/StringHelper.h" namespace s2 { CU_STR StringHelper::FromChar(const char* c_str) { CU_STR str; if (c_str) { str.assign(c_str); } return str; } }
[ "zhuguang@ejoy.com" ]
zhuguang@ejoy.com
258ffd6335f4227cb530c1c4b70bca27fca68cfa
7f1e542049915c4ed6319165dba7dc45b74446b9
/杨辉三角.cpp
fca1479b09f3cd392fc8cb531983526f4b2cfb93
[]
no_license
GarrettXUPT/leetCode
f5a3d6441d3386a4552720d5cc36bef32372d35b
ea9af3056801cdce6474c7d305fb9afd66dbefe1
refs/heads/master
2023-02-23T13:47:23.428645
2021-01-27T14:46:28
2021-01-27T14:46:28
317,227,416
0
0
null
null
null
null
UTF-8
C++
false
false
623
cpp
#include<iostream> #include<vector> using namespace std; vector<vector<int>> generate(int numRows) { if (numRows == 0) { return {}; } vector<vector<int>> vec(numRows, {1,1}); vec[0].pop_back(); for (int i = 1; i < numRows; ++i) { if (vec[i].size() == i + 1) { continue; } for (int j = 0; j < i - 1; ++j) { int tmp = vec[i - 1][j] + vec[i - 1][j + 1]; vec[i].insert(vec[i].begin() + j + 1, tmp); } } return vec; } int main() { auto res = generate(1); for (auto& ele : res) { for (auto& elem : ele) { cout << elem << " "; } cout << endl; } return 0; }
[ "13546043646@163.com" ]
13546043646@163.com
0ee5129c0f401aacbed08448ae25558224b0d302
fb913f54c5082cf25c15c905b339188f22b5750c
/manager.cpp
441d036f82ccf735d90c0d33b1590995a6d5f0bd
[]
no_license
THUzxj/Qt-Homework-Tcp-Chess-Game
67f53f4b854e4f48ab26c2cda80d1116ac2fa760
95cea01c97458a2a91e205898f85b5c15523ce6e
refs/heads/master
2020-07-22T03:08:56.403106
2020-06-12T10:01:32
2020-06-12T10:01:32
207,056,760
1
0
null
null
null
null
UTF-8
C++
false
false
21,869
cpp
#include "manager.h" #include "mainwindow.h" #include "ui_mainwindow.h" #include "enterwindow.h" #include "grid.h" #include "piece.h" #include "network.h" #include <QGraphicsItem> #include <QFileDialog> #include <QMessageBox> #include <QDebug> #include <QDialog> #include <QRandomGenerator> #include <QDialogButtonBox> QString Manager::colorName[2] = {"white","black"}; QString Manager::pieceName[6] = {"king","queen","rook","bishop","knight","pawn"}; Manager::Manager(MainWindow* w,EnterWindow* ew):_w(w),_ew(ew) { _scene = new QGraphicsScene; w->view->setScene(_scene); w->view->setSceneRect(QRectF(-_gridLenth*0.2,-_gridLenth*0.2,_gridLenth*8.4,_gridLenth*8.4)); w->view->resize(_gridLenth*8.5,_gridLenth*8.5); w->view->move(0,30); w->resize(_gridLenth*8.5+150,_gridLenth*9+30); _background = new QGraphicsRectItem; _background->setPen(Qt::NoPen); _background->setBrush(QColor(205,110,52)); _background->setRect(QRectF(-_gridLenth*0.2,-_gridLenth*0.2,_gridLenth*8.4,_gridLenth*8.4)); setGrids(); w->ui->startButton->setEnabled(false); w->ui->saveButton->setEnabled(false); w->ui->resignButton->setEnabled(false); connect(&_timer,&QTimer::timeout,this,&Manager::timeChange); connect(w->ui->newButton,&QPushButton::clicked,this,&Manager::newGame); connect(w->ui->actionxin,&QAction::triggered,this,&Manager::newGame); connect(w->ui->resignButton,&QPushButton::clicked,this,&Manager::resign); connect(w->ui->actionrenshu,&QAction::triggered,this,&Manager::resign); //connect(w->ui->sueButton,&QPushButton::clicked,this,&Manager::); connect(w->ui->saveButton,&QPushButton::clicked,this,&Manager::saveEndGame); connect(w->ui->actionbao,&QAction::triggered,this,&Manager::saveEndGame); connect(w->ui->loadButton,&QPushButton::clicked,this,&Manager::loadEndGame); connect(w->ui->actionzai,&QAction::triggered,this,&Manager::loadEndGame); connect(w->ui->startButton,&QPushButton::clicked,this,&Manager::start); connect(w->ui->actionkaishi,&QAction::triggered,this,&Manager::start); connect(ew,&EnterWindow::getClient,this,&Manager::setClient); connect(ew,&EnterWindow::getServer,this,&Manager::setServer); } qreal Manager::getPointX(int x) { if(_meBlack){ return _gridLenth*(8-x); }else{ return _gridLenth*(x-1); } } qreal Manager::getPointY(int y) { if(_meBlack){ return _gridLenth*(y-1); }else{ return _gridLenth*(8-y); } } void Manager::gridSelect(int x, int y) { if(!_isOngame ||_currentTurn!=_meBlack){//不是本方回合 return ; } if(_selectedPiece){ //if(!_meCheck || (_meCheck && _selectedPiece==king[_meBlack])){ if(_selectedPiece->name()=="king"){ int flag = static_cast<King*>(_selectedPiece)->canMove2(x,y); if(flag==0){ if(_grids[x][y]->hasPiece() && _grids[x][y]->pieceColor()==_meBlack){//select a another piece; _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); _grids[x][y]->select(); _selectedPiece=_grids[x][y]->piece(); }else{//cancel the select _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); _selectedPiece = nullptr; } }else if(flag==1){ QList<int> args; args.push_back(_selectedPiece->x()); args.push_back(_selectedPiece->y()); _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); if(_grids[x][y]->hasPiece()){ _grids[x][y]->piece()->ate(); removePiece(_grids[x][y]->piece()); } _selectedPiece->move(x,y);//此时x,y已经修改 _selectedPiece = nullptr; args.push_back(x); args.push_back(y); writeMessage("move",args); youTurn(); return ; }else{ //_grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); _selectedPiece = nullptr;//取消选择 return; } }else{ if(_selectedPiece->canMove(x,y)){//move the piece QList<int> args; args.push_back(_selectedPiece->x()); args.push_back(_selectedPiece->y()); _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); if(_grids[x][y]->hasPiece()){ _grids[x][y]->piece()->ate(); removePiece(_grids[x][y]->piece()); } _selectedPiece->move(x,y);//此时x,y已经修改 _selectedPiece = nullptr; args.push_back(x); args.push_back(y); writeMessage("move",args); youTurn(); return ; }else{ if(_grids[x][y]->hasPiece() && _grids[x][y]->pieceColor()==_meBlack){//select a another piece; _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); _grids[x][y]->select(); _selectedPiece=_grids[x][y]->piece(); }else{//cancel the select _grids[_selectedPiece->x()][_selectedPiece->y()]->deselect(); _selectedPiece = nullptr; } } } }else{//select a piece if(_grids[x][y]->hasPiece() && _grids[x][y]->pieceColor()==_meBlack){ _selectedPiece = _grids[x][y]->piece(); _grids[x][y]->select(); } } } void Manager::readMessage(QString str, QList<int> args){ qDebug()<<str; for(int i:args){ qDebug()<<i; } if(str=="move"){ passive_move(args); }else if(str=="start"){ passive_start(); }else if(str=="new game"){ passive_newGame(args[0]); }else if(str=="load"){ passive_loadEndGame(args); }else if(str=="resign OK"){ passive_resignOK(); }else if(str=="resign cancel"){ passive_resignCancel(); }else if(str=="resign"){ passive_resignSelect(); }else if(str=="time out"){ passive_timeOut(); }else if(str=="translocation"){ passive_translocation(args); }else if(str=="end"){ passive_checkMate(args[0]); }else if(str=="stalemate"){ stalemate(); }else if(str=="pawn promotion"){ passive_pawnPromotion(args); } } void Manager::writeMessage(QString str, QList<int> args){ if(_networkMode){ _client->sendMessage(str,args); }else{ _server->sendMessage(str,args); } } void Manager::writeMessage(QString str){ if(_networkMode){ _client->sendMessage(str); }else{ _server->sendMessage(str); } } void Manager::meTurn(){ _timer.stop(); updateYouCheck(); updateMeCheck(); if(isNoWay()){ if(_meCheck){//将死 checkMate(_meBlack); }else{//逼和 writeMessage("stalemate"); stalemate(); } } _currentTurn = _meBlack; _w->ui->radioButton->setChecked(false); _w->ui->radioButton_2->setChecked(true); resetLCD(); _timer.start(1000); } void Manager::youTurn(){ qDebug()<<"youturn0"; _timer.stop(); updateMeCheck(); qDebug()<<"youturn1"; updateYouCheck(); qDebug()<<"youturn2"; _currentTurn = !_meBlack; _w->ui->radioButton->setChecked(true); _w->ui->radioButton_2->setChecked(false); resetLCD(); _timer.start(1000); } void Manager::timeChange(){ if(!_isOngame)return; if(_currentTurn == _meBlack){ if(_meTime>0){ _meTime--; _w->ui->meLCD->display(_meTime); }else{ timeOut(); } }else{ if(_youTime>0){ _youTime--; _w->ui->youLCD->display(_youTime); } } } void Manager::clearPieces(){ for(Piece* p : pieces[0]){ p->clean(); } for(Piece* p : pieces[1]){ p->clean(); } pieces[0].clear(); pieces[1].clear(); } void Manager::clearGrids(){ if(_grids[1][1]==nullptr){ qDebug()<<"delete no grid"; return ; } for(int i=1;i<=8;i++){ for(int j=1;j<=8;j++){ delete _grids[i][j]; } } } void Manager::setGrids(){ for(int i=1;i<=8;i++){ for(int j=1;j<=8;j++){ _grids[i][j] = new Grid(i,j,_gridLenth,this); } } for(int i=1;i<=8;i++){ for(int j=1;j<=8;j++){ connect(_grids[i][j],&Grid::gridClicked,this,&Manager::gridSelect); } } } void Manager::updateMeCheck(){ _meCheck = _grids[king[_meBlack]->x()][king[_meBlack]->y()]->isAttacked(_meBlack); if(_meCheck == 0){ _w->ui->radioButton_2->setText("ME"); }else{ _w->ui->radioButton_2->setText("CHECK"); /* if(isKingNoWay()){ checkMate(_meBlack); }*/ } } void Manager::updateYouCheck(){ _youCheck = _grids[king[!_meBlack]->x()][king[!_meBlack]->y()]->isAttacked(!_meBlack); if(_youCheck == 0){ _w->ui->radioButton->setText("OPPONENT"); }else{ _w->ui->radioButton->setText("CHECK"); } } bool Manager::isKingNoWay(){ return _grids[king[_meBlack]->x()][king[_meBlack]->y()]->isKingNoWay(); } bool Manager::isNoWay(){ for(auto p : pieces[_meBlack]){ for(int i = 1;i<9;i++){ for(int j=1;j<9;j++){ if(p->canMove(i,j)){ return false; } } } } return true; } void Manager::removePiece(Piece *p){ pieces[p->color()].removeOne(p); } void Manager::resetLCD(){ _meTime = 60; _w->ui->meLCD->display(_meTime); _youTime = 60; _w->ui->youLCD->display(_youTime); } void Manager::newGame(){ bool oppositeBlack = QRandomGenerator::global()->bounded(0,1); QList<int> l; l.push_back(oppositeBlack); _meBlack = !oppositeBlack; _currentTurn = 0; clearGrids(); setGrids(); clearPieces(); Piece::setNewGamePieces(this,pieces); _w->ui->startButton->setEnabled(true); _w->ui->saveButton->setEnabled(true); writeMessage("new game",l); } void Manager::start(){ _isOngame = 1; updateMeCheck(); updateYouCheck(); if(_currentTurn == _meBlack){ _w->ui->radioButton->setChecked(false); _w->ui->radioButton_2->setChecked(true); }else{ _w->ui->radioButton->setChecked(true); _w->ui->radioButton_2->setChecked(false); } resetLCD(); _w->ui->resignButton->setEnabled(true); _timer.start(1000); writeMessage("start"); } void Manager::resign(){ if(QMessageBox::question(nullptr,"认输","确定要认输吗?")==QMessageBox::Yes){ writeMessage("resign"); QMessageBox::about(_w,"认输","认输请求已发送"); } } void Manager::timeOut(){ _isOngame = 0; writeMessage("time out"); QMessageBox::critical(_w,"超时","你已超时!你输了。"); _timer.stop(); } void Manager::checkMate(int color){ _isOngame = 0; _timer.stop(); QList<int> l; l.push_back(color); writeMessage("end",l); if(color == _meBlack){ QMessageBox::about(_w,"结束","你输了。"); }else{ QMessageBox::about(_w,"结束","你赢了!"); } } void Manager::setPawnPromotion(int x0,int y0,int x, int y, int color, int targetID){ _grids[x][y]->piece()->ate(); removePiece(_grids[x][y]->piece()); Piece* p; switch(targetID){ case 1: p = new Queen(x,y,color,this);break; case 2: p = new Rook(x,y,color,this);break; case 3: p = new Bishop(x,y,color,this);break; case 4: p = new Knight(x,y,color,this);break; } pieces[color].push_back(p); _grids[x][y]->setPiece(p); QList<int> args; args.push_back(x0); args.push_back(y0); args.push_back(x); args.push_back(y); args.push_back(targetID); writeMessage("pawn promotion",args); } void Manager::translocation(int x,int y,int x3,int k){ QList<int> args; args.push_back(x); args.push_back(y); args.push_back(x3); args.push_back(k); _grids[x][y]->piece()->move(x+2*k,y); _grids[x3][y]->piece()->move(x+k,y); _grids[x][y]->deselect(); _selectedPiece = nullptr; youTurn(); writeMessage("translocation",args); qDebug()<<"trans6"; } void Manager::stalemate(){ _isOngame = 0; _timer.stop(); QMessageBox::about(_w,"结束","逼和。"); } template<class T> void Manager::addPiece(QTextStream& in,int nowColor,QList<int>& a){//用于loadEndGame int num; in>>num; for(int i=0;i<num;i++){ QString loc; in>>loc; int x = loc[0].toLatin1()-'a'+1; int y = loc[1].toLatin1()-'0'; Piece* p = new T(x,y,nowColor,this); pieces[nowColor].push_back(p); _grids[x][y]->setPiece(p); a.push_back(x); a.push_back(y); a.push_back(p->abstractID()); a.push_back(nowColor); } } void Manager::loadEndGame(){ QString path = QFileDialog::getOpenFileName(_w,"读入残局",".","文本文档(*.txt)"); if(!path.isEmpty()){ QFile file(path); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QMessageBox::warning(nullptr, tr("读入残局"), tr("无法打开文件:\n%1").arg(path)); return; } _w->ui->startButton->setEnabled(true); _w->ui->saveButton->setEnabled(true); clearPieces(); _isOngame = 0; QTextStream in(&file); QString ct; QList<int> args; int nowColor; in>>ct; if(ct=="black"){ _currentTurn = 1; _meBlack = 1; nowColor = 1; args.push_back(0);//对方执白 }else if(ct=="white"){ _currentTurn = 0; _meBlack = 0; nowColor = 0; args.push_back(1); }else { qDebug()<<"no white black"; return ; } clearGrids(); setGrids(); while(!in.atEnd()){ QString command; in>>command; if(command=="black"){ nowColor=1; }else if(command=="white"){ nowColor=0; }else if(command=="king"){ int num; in>>num; for(int i=0;i<num;i++){ QString loc; in>>loc; int x = loc[0].toLatin1()-'a'+1; int y = loc[1].toLatin1()-'0'; Piece* p = new King(x,y,nowColor,this); king[nowColor] = p; pieces[nowColor].push_back(p); _grids[x][y]->setPiece(p); args.push_back(x); args.push_back(y); args.push_back(p->abstractID()); args.push_back(nowColor); } }else if(command=="queen"){ addPiece<Queen>(in,nowColor,args); }else if(command=="rook"){ addPiece<Rook>(in,nowColor,args); }else if(command=="bishop"){ addPiece<Bishop>(in,nowColor,args); }else if(command=="knight"){ addPiece<Knight>(in,nowColor,args); }else if(command=="pawn"){ addPiece<Pawn>(in,nowColor,args); } } file.close(); writeMessage("load",args); } } void Manager::saveEndGame(){ QString path = QFileDialog::getSaveFileName(_w,"保存残局",".","文本文档(*.txt)"); if(!path.isEmpty()){ QFile file(path); if(!file.open(QIODevice::WriteOnly)){ QMessageBox::critical(nullptr,"错误",QString("创建文件失败:\n%1").arg(path)); return; } QTextStream out(&file); int a,i,k; if(_currentTurn==0){ a=1; i=0; k=0; }else{ a=-1; i=1; k=0; } for(;k<2;i+=a,k++){ out<<colorName[i]<<"\n"; QList<Piece*> pieceAll = pieces[i]; QList<Piece*> pieceKind[6]; for(int j = 0;j<6;j++){ for(Piece* p :pieceAll){ if(p->name()==pieceName[j]){ pieceKind[j].push_back(p); } } } for(int j=0;j<6;j++){ if(pieceKind[j].isEmpty()){ continue; } out<<pieceName[j]<<" "<<pieceKind[j].size()<<" "; for(Piece* p:pieceKind[j]){ char px = 'a'+ p->x()-1; out<<px<<p->y()<<" "; } out<<endl; } } file.close(); } } void Manager::passive_newGame(int m){ _meBlack = m; _currentTurn = 0; clearGrids(); setGrids(); clearPieces(); Piece::setNewGamePieces(this,pieces); _w->ui->startButton->setEnabled(true); _w->ui->saveButton->setEnabled(true); } void Manager::passive_start(){ _isOngame = 1; _meTime = 60; _w->ui->meLCD->display(_meTime); _youTime = 60; _w->ui->youLCD->display(_youTime); _w->ui->resignButton->setEnabled(true); if(_currentTurn == _meBlack){ _w->ui->radioButton->setChecked(false); _w->ui->radioButton_2->setChecked(true); }else{ _w->ui->radioButton->setChecked(true); _w->ui->radioButton_2->setChecked(false); } _timer.start(1000); } void Manager::passive_loadEndGame(QList<int> args){ _w->ui->startButton->setEnabled(true); _w->ui->saveButton->setEnabled(true); _meBlack = args[0]; _currentTurn = !args[0]; clearGrids(); setGrids(); clearPieces(); _isOngame = 0; for(int i=1;i<args.size();i+=4){ int x = args[i],y = args[i+1], kind = args[i+2],color = args[i+3]; Piece* p; switch(kind){ case 0: p = new King(x,y,color,this);king[color] = p;break; case 1: p = new Queen(x,y,color,this);break; case 2: p = new Rook(x,y,color,this);break; case 3: p = new Bishop(x,y,color,this);break; case 4: p = new Knight(x,y,color,this);break; case 5: p = new Pawn(x,y,color,this);break; } pieces[color].push_back(p); _grids[x][y]->setPiece(p); } } void Manager::passive_resignOK(){ _isOngame = 0; _timer.stop(); QMessageBox::about(_w,"结束","你输了。"); } void Manager::passive_resignCancel(){ QMessageBox::about(_w,"认输","对方拒绝了你的认输请求。"); } void Manager::passive_resignSelect(){ auto reply = QMessageBox::question(_w,"认输","对手请求认输,是否同意?"); if(reply == QMessageBox::Yes){ _isOngame = 0; _timer.stop(); writeMessage("resign OK"); QMessageBox::about(_w,"结束","你赢了!"); }else if(reply == QMessageBox::No){ writeMessage("resign cancel"); } } void Manager::passive_timeOut(){ _isOngame = 0; QMessageBox::critical(_w,"超时","对手超时!你赢了!"); _timer.stop(); } void Manager::passive_move(QList<int> args){ int x1 = args[0],y1=args[1],x2=args[2],y2=args[3]; Piece* thePiece = _grids[x1][y1]->piece(); if(_grids[x2][y2]->hasPiece()){ _grids[x2][y2]->piece()->ate(); removePiece(_grids[x2][y2]->piece()); } thePiece->move(x2,y2); meTurn(); } void Manager::passive_translocation(QList<int> arg){ int x = arg[0],y=arg[1],x3=arg[2],k=arg[3]; _grids[x][y]->piece()->move(x+2*k,y); _grids[x3][y]->piece()->move(x+k,y); meTurn(); } void Manager::passive_checkMate(int color){ _isOngame = 0; _timer.stop(); if(color == _meBlack){ QMessageBox::about(_w,"结束","你输了。"); }else{ QMessageBox::about(_w,"结束","你赢了!"); } } void Manager::passive_pawnPromotion(QList<int> args){ int x0 = args[0]; int y0 = args[1]; int x = args[2]; int y = args[3]; int targetID = args[4]; Piece* thePiece = _grids[x0][y0]->piece(); if(_grids[x][y]->hasPiece()){ _grids[x][y]->piece()->ate(); removePiece(_grids[x][y]->piece()); } thePiece->move(x,y); int color = _grids[x][y]->piece()->color(); _grids[x][y]->piece()->ate(); removePiece(_grids[x][y]->piece()); Piece* p; switch(targetID){ case 1: p = new Queen(x,y,color,this);break; case 2: p = new Rook(x,y,color,this);break; case 3: p = new Bishop(x,y,color,this);break; case 4: p = new Knight(x,y,color,this);break; } pieces[color].push_back(p); _grids[x][y]->setPiece(p); meTurn(); } void Manager::setClient(Client *c){ _client = c; _networkMode = 1; connect(_client,&Client::getMessage,this,&Manager::readMessage); connect(_client,&Client::readyNewNetGame,this,&Manager::initNewBoard); } void Manager::setServer(Server *s){ _server = s; _networkMode = 0; connect(_server,&Server::getMessage,this,&Manager::readMessage); connect(_server,&Server::readyNewNetGame,this,&Manager::initNewBoard); } void Manager::initNewBoard(){//bool clientBlack //_meBlack = (clientBlack == _networkMode); _w->show(); _ew->close(); } Grid* Manager::grid(int x,int y){ return _grids[x][y]; } bool Manager::meBlack(){ return _meBlack; } bool Manager::meCheck(){ return _meCheck; } Piece* Manager::meKing(){ return king[_meBlack]; }
[ "1312144019@qq.com" ]
1312144019@qq.com
dc6fceb21e0bffae06b2beed72865055159e8e83
7dd5a61a6570bbdcebe5c69b6141b48b10493576
/src/NJSBigIntListCallback.cpp
bd7ee0c60f095fc0da94c019bb27c348f55ac90f
[]
no_license
LedgerHQ/lib-ledger-core-node-bindings
34af75b6f378445ae16e0437f038ec8859addc9d
ced62d392eff27ab153e8a5f330c92e9cd72b92c
refs/heads/master
2022-05-01T03:09:43.393318
2021-09-30T14:15:34
2021-09-30T14:15:34
133,928,033
14
32
null
2022-04-10T09:12:52
2018-05-18T08:45:23
C++
UTF-8
C++
false
false
3,772
cpp
// AUTOGENERATED FILE - DO NOT MODIFY! // This file generated by Djinni from callback.djinni #include "NJSBigIntListCallback.hpp" #include "NJSObjectWrapper.hpp" #include "NJSHexUtils.hpp" using namespace v8; using namespace node; using namespace std; void NJSBigIntListCallback::onCallback(const std::experimental::optional<std::vector<std::shared_ptr<::ledger::core::api::BigInt>>> & result, const std::experimental::optional<::ledger::core::api::Error> & error) { Nan::HandleScope scope; //Wrap parameters Local<Value> arg_0; if(result) { auto arg_0_optional = (result).value(); Local<Array> arg_0_tmp = Nan::New<Array>(); for(size_t arg_0_tmp_id = 0; arg_0_tmp_id < arg_0_optional.size(); arg_0_tmp_id++) { auto arg_0_tmp_elem = NJSBigInt::wrap(arg_0_optional[arg_0_tmp_id]); Nan::Set(arg_0_tmp, (int)arg_0_tmp_id,arg_0_tmp_elem); } arg_0 = arg_0_tmp; } Local<Value> arg_1; if(error) { auto arg_1_optional = (error).value(); auto arg_1_tmp = Nan::New<Object>(); auto arg_1_tmp_1 = Nan::New<Integer>((int)arg_1_optional.code); Nan::DefineOwnProperty(arg_1_tmp, Nan::New<String>("code").ToLocalChecked(), arg_1_tmp_1); auto arg_1_tmp_2 = Nan::New<String>(arg_1_optional.message).ToLocalChecked(); Nan::DefineOwnProperty(arg_1_tmp, Nan::New<String>("message").ToLocalChecked(), arg_1_tmp_2); arg_1 = arg_1_tmp; } auto local_resolver = Nan::New<Promise::Resolver>(pers_resolver); if(error) { auto rejected = local_resolver->Reject(Nan::GetCurrentContext(), arg_1); rejected.FromJust(); } else { auto resolve = local_resolver->Resolve(Nan::GetCurrentContext(), arg_0); resolve.FromJust(); } } NAN_METHOD(NJSBigIntListCallback::New) { //Only new allowed if(!info.IsConstructCall()) { return Nan::ThrowError("NJSBigIntListCallback function can only be called as constructor (use New)"); } auto resolver = v8::Promise::Resolver::New(Nan::GetCurrentContext()).ToLocalChecked(); auto node_instance = std::make_shared<NJSBigIntListCallback>(resolver); djinni::js::ObjectWrapper<NJSBigIntListCallback>::Wrap(node_instance, info.This()); info.GetReturnValue().Set(info.This()); } Nan::Persistent<ObjectTemplate> NJSBigIntListCallback::BigIntListCallback_prototype; Local<Object> NJSBigIntListCallback::wrap(const std::shared_ptr<ledger::core::api::BigIntListCallback> &object) { Nan::EscapableHandleScope scope; Local<ObjectTemplate> local_prototype = Nan::New(BigIntListCallback_prototype); Local<Object> obj; if(!local_prototype.IsEmpty()) { obj = local_prototype->NewInstance(Nan::GetCurrentContext()).ToLocalChecked(); djinni::js::ObjectWrapper<ledger::core::api::BigIntListCallback>::Wrap(object, obj); } else { Nan::ThrowError("NJSBigIntListCallback::wrap: object template not valid"); } return scope.Escape(obj); } void NJSBigIntListCallback::Initialize(Local<Object> target) { Nan::HandleScope scope; Local<FunctionTemplate> func_template = Nan::New<FunctionTemplate>(NJSBigIntListCallback::New); Local<ObjectTemplate> objectTemplate = func_template->InstanceTemplate(); objectTemplate->SetInternalFieldCount(1); func_template->SetClassName(Nan::New<String>("NJSBigIntListCallback").ToLocalChecked()); Nan::SetPrototypeMethod(func_template,"New", New); //Set object prototype BigIntListCallback_prototype.Reset(objectTemplate); //Add template to target Nan::Set(target, Nan::New<String>("NJSBigIntListCallback").ToLocalChecked(), Nan::GetFunction(func_template).ToLocalChecked()); }
[ "khalil.bellakrid@ledger.fr" ]
khalil.bellakrid@ledger.fr
b92a69124c8f5ec484c7a3844d1fed44efb43de8
1302a788aa73d8da772c6431b083ddd76eef937f
/WORKING_DIRECTORY/frameworks/rs/rsProgramRaster.cpp
c9a24bf68f11e11612c4d407d549db1ebf1af333
[]
no_license
rockduan/androidN-android-7.1.1_r28
b3c1bcb734225aa7813ab70639af60c06d658bf6
10bab435cd61ffa2e93a20c082624954c757999d
refs/heads/master
2021-01-23T03:54:32.510867
2017-03-30T07:17:08
2017-03-30T07:17:08
86,135,431
2
1
null
null
null
null
UTF-8
C++
false
false
3,336
cpp
/* * Copyright (C) 2009 The Android Open Source Project * * 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 "rsContext.h" #include "rsProgramRaster.h" using namespace android; using namespace android::renderscript; ProgramRaster::ProgramRaster(Context *rsc, bool pointSprite, RsCullMode cull) : ProgramBase(rsc) { memset(&mHal, 0, sizeof(mHal)); mHal.state.pointSprite = pointSprite; mHal.state.cull = cull; rsc->mHal.funcs.raster.init(rsc, this); } void ProgramRaster::preDestroy() const { for (uint32_t ct = 0; ct < mRSC->mStateRaster.mRasterPrograms.size(); ct++) { if (mRSC->mStateRaster.mRasterPrograms[ct] == this) { mRSC->mStateRaster.mRasterPrograms.removeAt(ct); break; } } } ProgramRaster::~ProgramRaster() { mRSC->mHal.funcs.raster.destroy(mRSC, this); } void ProgramRaster::setup(const Context *rsc, ProgramRasterState *state) { if (state->mLast.get() == this && !mDirty) { return; } state->mLast.set(this); mDirty = false; rsc->mHal.funcs.raster.setActive(rsc, this); } void ProgramRaster::serialize(Context *rsc, OStream *stream) const { } ProgramRaster *ProgramRaster::createFromStream(Context *rsc, IStream *stream) { return nullptr; } ProgramRasterState::ProgramRasterState() { } ProgramRasterState::~ProgramRasterState() { } void ProgramRasterState::init(Context *rsc) { mDefault.set(ProgramRaster::getProgramRaster(rsc, false, RS_CULL_BACK).get()); } void ProgramRasterState::deinit(Context *rsc) { mDefault.clear(); mLast.clear(); } ObjectBaseRef<ProgramRaster> ProgramRaster::getProgramRaster(Context *rsc, bool pointSprite, RsCullMode cull) { ObjectBaseRef<ProgramRaster> returnRef; ObjectBase::asyncLock(); for (uint32_t ct = 0; ct < rsc->mStateRaster.mRasterPrograms.size(); ct++) { ProgramRaster *existing = rsc->mStateRaster.mRasterPrograms[ct]; if (existing->mHal.state.pointSprite != pointSprite) continue; if (existing->mHal.state.cull != cull) continue; returnRef.set(existing); ObjectBase::asyncUnlock(); return returnRef; } ObjectBase::asyncUnlock(); ProgramRaster *pr = new ProgramRaster(rsc, pointSprite, cull); returnRef.set(pr); ObjectBase::asyncLock(); rsc->mStateRaster.mRasterPrograms.push(pr); ObjectBase::asyncUnlock(); return returnRef; } namespace android { namespace renderscript { RsProgramRaster rsi_ProgramRasterCreate(Context * rsc, bool pointSprite, RsCullMode cull) { ObjectBaseRef<ProgramRaster> pr = ProgramRaster::getProgramRaster(rsc, pointSprite, cull); pr->incUserRef(); return pr.get(); } } }
[ "duanliangsilence@gmail.com" ]
duanliangsilence@gmail.com
eebc9871a99c96c013eede6e1f705b8fd62ce697
7b4c4749490f183cbbba0eeffc68f7926e1fbbe5
/codeforces/1485D.cpp
db8ef3e078089b1f12ed2404df07404386bafa44
[]
no_license
zizhong/algorithm-training
6fbf4aa7a416d630eb265914a6c5538a66f38cac
3258f3c0bf7161282cbed28f807434e05cc62ee5
refs/heads/master
2022-08-13T07:08:37.695623
2022-08-10T07:04:04
2022-08-10T07:04:04
46,722,394
0
0
null
null
null
null
UTF-8
C++
false
false
5,937
cpp
// Constructive // LCM #include <vector> #include <cstdio> #include <cstring> #include <iostream> #include <algorithm> #include <string> #include <map> #include <deque> #include <set> #include <functional> #include <unordered_map> #include <unordered_set> #include <cassert> #include <ctime> #include <queue> #include <stack> #include <iomanip> #include <sstream> #include <cmath> #include <fstream> #include <bitset> #include <complex> #include <numeric> //#include "utils/haha.h" //#include "utils/max_flow.h" using namespace std; typedef pair<int, int> PII; typedef pair<string, string> PSS; typedef pair<string, int> PSI; typedef pair<int, PII> PIP; typedef long long ll; typedef pair<int, ll> PIL; typedef pair<ll, ll> PLL; typedef pair<double, double> PDD; typedef pair<ll, PII> PLP; template<typename T> inline T read_by_char() { T s = 0, f = 1; char ch = getchar(); while (!isdigit(ch)) { if (ch == '-') f = -1; ch = getchar(); } while (isdigit(ch)) { s = (s << 3) + (s << 1) + ch - 48; ch = getchar(); } return s * f; } #define ri() read_by_char<int>() #define rl() read_by_char<ll>() #define CLS(x, v) (memset((x), (v), sizeof((x)))) template<class TH> void _dbg(const char *sdbg, TH h) { cerr << sdbg << '=' << h << endl; } template<class TH, class... TA> void _dbg(const char *sdbg, TH h, TA... a) { while (*sdbg != ',')cerr << *sdbg++; cerr << '=' << h << ','; _dbg(sdbg + 1, a...); } template<class T> ostream &operator<<(ostream &os, set<T> V) { os << "["; for (auto vv : V) os << vv << ","; return os << "]"; } template<class T> ostream &operator<<(ostream &os, unordered_set<T> V) { os << "["; for (auto vv : V) os << vv << ","; return os << "]"; } template<class T> ostream &operator<<(ostream &os, vector<T> V) { os << "["; for (auto vv : V) os << vv << ","; return os << "]"; } template<class L, class R> ostream &operator<<(ostream &os, pair<L, R> P) { return os << "(" << P.first << "," << P.second << ")"; } #ifdef _zzz_ #define debug(...) _dbg(#__VA_ARGS__, __VA_ARGS__) #else #define debug(...) (__VA_ARGS__) #define cerr if(0)cout #endif template<class T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template<class T> using max_heap = priority_queue<T>; //const int N = 1e6 + 1e5 + 10; ll gcd(ll a, ll b) { return b ? gcd(b, a % b) : a; } struct PairHash { template<typename T1, typename T2> std::size_t operator()(const pair<T1, T2> &p) const { return hash<T1>()(p.first) ^ hash<T2>()(p.second); } }; template<unsigned MOD_> struct ModInt { static constexpr unsigned MOD = MOD_; unsigned x; void undef() { x = (unsigned) -1; } bool isnan() const { return x == (unsigned) -1; } inline int geti() const { return (int) x; } ModInt() { x = 0; } ModInt(const ModInt &y) { x = y.x; } ModInt(int y) { if (y < 0 || (int) MOD <= y) y %= (int) MOD; if (y < 0) y += MOD; x = y; } ModInt(unsigned y) { if (MOD <= y) x = y % MOD; else x = y; } ModInt(long long y) { if (y < 0 || MOD <= y) y %= MOD; if (y < 0) y += MOD; x = y; } ModInt(unsigned long long y) { if (MOD <= y) x = y % MOD; else x = y; } ModInt &operator+=(const ModInt y) { if ((x += y.x) >= MOD) x -= MOD; return *this; } ModInt &operator-=(const ModInt y) { if ((x -= y.x) & (1u << 31)) x += MOD; return *this; } ModInt &operator*=(const ModInt y) { x = (unsigned long long) x * y.x % MOD; return *this; } ModInt &operator/=(const ModInt y) { x = (unsigned long long) x * y.inv().x % MOD; return *this; } ModInt operator-() const { return (x ? MOD - x : 0); } ModInt inv() const { return pow(MOD - 2); } ModInt pow(long long y) const { ModInt b = *this, r = 1; if (y < 0) { b = b.inv(); y = -y; } for (; y; y >>= 1) { if (y & 1) r *= b; b *= b; } return r; } friend ModInt operator+(ModInt x, const ModInt y) { return x += y; } friend ModInt operator-(ModInt x, const ModInt y) { return x -= y; } friend ModInt operator*(ModInt x, const ModInt y) { return x *= y; } friend ModInt operator/(ModInt x, const ModInt y) { return x *= y.inv(); } friend bool operator<(const ModInt x, const ModInt y) { return x.x < y.x; } friend bool operator==(const ModInt x, const ModInt y) { return x.x == y.x; } friend bool operator!=(const ModInt x, const ModInt y) { return x.x != y.x; } }; const unsigned int mod = 1e9 + 7; typedef ModInt<mod> mod_int; void update(int &v, int nv) { if (v < 0 || v > nv) v = nv; } void solve(int ncase) { int lcm = 1; for (int i = 1; i <= 16; i++) { lcm = lcm * i / gcd(lcm, i); } int n, m; cin >> n >> m; vector<vector<int>> v(n, vector<int>(m)); for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cin >> v[i][j]; if ((i + j) % 2 == 1) { v[i][j] = lcm; } else { v[i][j] = lcm + v[i][j] * v[i][j] * v[i][j] * v[i][j]; } } } for (int i = 0; i < n; i++) { for (int j = 0; j < m; j++) { cout << v[i][j] << (" \n"[j == m - 1]); } } } void solve_all_cases() { int T = 1; //scanf("%d", &T); //cin >> T; //T = ri(); int ncase = 0; // pre_calc(); while (T--) { solve(++ncase); } } int main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cout << std::fixed; cout << setprecision(9); #ifdef _zzz_ //ios_base::sync_with_stdio(true); freopen("C:\\Users\\grain\\Desktop\\in.txt", "r", stdin); //auto x = freopen("C:\\Users\\grain\\Desktop\\out.txt", "w", stdout); //cerr << x << " " << errno << endl; auto start_time = clock(); #endif //pre_calc(); solve_all_cases(); //test(); #ifdef _zzz_ cout << (clock() - start_time) * 1.0 / CLOCKS_PER_SEC << " seconds" << endl; #endif } /* stuff you should look for * int overflow, array bounds * special cases (n=1?) * do smth instead of nothing and stay organized * WRITE STUFF DOWN */
[ "noreply@github.com" ]
noreply@github.com
e9e8311cd23b3ebf92a0031c71193687a621a700
0c0c4d14b6bf9a181c859db119433e97ce76edc9
/test/algorithms-range/alg.sorting/alg.binary.search/upper.bound/upper_bound_comp.pass.cpp
2d1ea85935cb7308fc71e0ff7c6764cee332855c
[ "MIT", "NCSA" ]
permissive
marcinz/libcxx-ranges
d0e748574798ba4926ffad353ac0f254d0294648
ee4ebf99147da4bbb5356b6ab0e7a79a1bfa0704
refs/heads/master
2020-05-19T07:17:43.541160
2013-03-01T18:35:48
2013-03-01T18:35:48
8,189,114
3
0
null
null
null
null
UTF-8
C++
false
false
1,839
cpp
//===----------------------------------------------------------------------===// // // The LLVM Compiler Infrastructure // // This file is dual licensed under the MIT and the University of Illinois Open // Source Licenses. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// // <algorithm> // template<ForwardIterator Iter, class T, Predicate<auto, T, Iter::value_type> Compare> // requires CopyConstructible<Compare> // Iter // upper_bound(Iter first, Iter last, const T& value, Compare comp); #include <algorithm-range> #include <functional> #include <vector-range> #include <cassert> #include "test_ranges.h" template <class Range, class T> void test(Range r, const T& value) { Range i = std::upper_bound(r, value, std::greater<int>()); for (Range j = r.begin_begin(i); !j.empty(); j.pop_front()) assert(!std::greater<int>()(value, j.front())); for (Range j = i; !j.empty(); j.pop_front()) assert(std::greater<int>()(value, j.front())); } template <class Range> void test() { const unsigned N = 1000; const unsigned M = 10; std::vector<int> v(N); int x = 0; for (int i = 0; i < v.size(); ++i) { v[i] = x; if (++x == M) x = 0; } std::sort(std::make_iter_range(v.begin(), v.end()), std::greater<int>()); for (x = 0; x <= M; ++x) test(Range(std::make_iter_range(v.data(), v.data()+v.size())), x); } int main() { int d[] = {3, 2, 1, 0}; for (int* e = d; e <= d+4; ++e) for (int x = -1; x <= 4; ++x) test(std::make_iter_range(d, e), x); test<forward_range<std::iter_range<const int*> > >(); test<bidirectional_range<std::iter_range<const int*> > >(); test<random_access_range<std::iter_range<const int*> > >(); }
[ "marcin.zalewski@gmail.com" ]
marcin.zalewski@gmail.com
4cc4fd4877ae7d0333b64d5445c4efb291885e01
b057d0be436f39b0d76307bdae988d21d0e20bdd
/Competitions/maycook3.cpp
75d7fe24fb5afc3efd2e1af1a50142f7813968ce
[]
no_license
risabhsinha8/CompetitiveCoding
0a2d7ef8772225ceb1851b6100290293c91d759f
1c5179eebd4360842ef07956ba4ac4481608a918
refs/heads/master
2023-05-09T03:04:22.850776
2021-06-01T08:57:39
2021-06-01T08:57:39
372,769,946
0
0
null
null
null
null
UTF-8
C++
false
false
1,863
cpp
//Question #include<bits/stdc++.h> using namespace std; #define all(x) x.begin(), x.end() #define fo(i,n) for(int i=0;i<n;i++) #define ff first #define ss second #define int long long #define pb push_back #define mp make_pair #define pii pair<int,int> #define vi vector<int> #define si set<int> #define mii map<int,int> #define maxpq priority_queue<int> #define minpq priority_queue<int,vi,greater<int> > #define setbits(x) __builtin_popcountll(x) #define zrobits(x) __builtin_ctzll(x) #define mod 1000000007 #define inf 1e18 #define ps(x,y) fixed<<setprecision(y)<<x #define mk(arr,n,type) type *arr=new type[n]; #define w(x) int x; cin>>x; while(x--) bool prime[10000001]; vi v(10000001); void solve() { int n; cin>>n; int ans=1+v[n]-v[n/2]; if(n==2) ans=1; else if(n==3) ans=2; cout<<ans<<endl; } int32_t main() { ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); int n=1e7; memset(prime, true, sizeof(prime)); for (int p = 2; p * p <= n; p++) { // If prime[p] is not changed, // then it is a prime if (prime[p] == true) { // Update all multiples // of p greater than or // equal to the square of it // numbers which are multiple // of p and are less than p^2 // are already been marked. for (int i = p * p; i <= n; i += p) prime[i] = false; } } fo(i,10000001) { if(i==1||i==0) { v[i]=0; continue; } if(prime[i]) { v[i]=v[i-1]+1; } else v[i]=v[i-1]; } w(t) solve(); return 0; }
[ "risabhsinha8@gmail.com" ]
risabhsinha8@gmail.com
35953987c70c2cbbf01932e860aecab3c0d136cf
1a4aebcb67a731a7676fef6fa7ffc23e9a409b51
/460/T
88ca135f85b0c12394c690866fce045de6bbdbfb
[]
no_license
spaul1995/nanopore_voltage
8bd6768c44e662293b25298d617c494921cd0543
e5d32a5bf9021c1296c18335d1bd2f51d3a8dd74
refs/heads/master
2020-03-30T19:03:45.366817
2018-10-04T08:20:33
2018-10-04T08:20:33
151,525,959
0
0
null
null
null
null
UTF-8
C++
false
false
87,394
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 5.0 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "460"; object T; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 1 0 0 0]; internalField nonuniform List<scalar> 5796 ( -0.355590731484 -4.08754566774 4.08749624707 4.09498886463 -4.09501700734 3.99746419113 -3.99743146736 0.586188288405 1.35202786524 0.632914728771 0.254854218099 0.0254179236593 -0.159168575558 -0.516252241627 4.08273634788 -4.08279124555 0.141614742723 2.74225007147 4.10348019336 -4.10348080585 4.10780861149 -4.10780726834 -0.275633284333 3.96262886631 -3.96239282398 -3.24629566544 -0.907550371443 3.81406101466 -3.80582320449 -3.56699961268 -4.06076782189 4.06070275137 4.09880371841 -4.09881914785 4.10840798099 -4.10840799088 4.08441609805 -4.08447075664 1.27396264531 -2.93812448555 4.10578712992 -4.10578469435 0.728193609806 -2.57369975065 -0.0349133578303 0.00550856932111 3.56127996819 0.327534136814 4.10893319934 -4.1089341243 3.98161565507 -3.9815106838 4.01297941311 -4.01299267602 4.0905604603 -4.09060321362 4.05334291486 -4.05340643118 0.506305258659 -3.70946569638 3.76919868581 1.09174578144 -3.46645152283 1.55529983365 3.09818501402 -2.38837698202 4.10152260404 -4.10152933727 -0.610827239172 3.63718669957 1.72849111585 4.10812517144 -4.1081244662 4.10703662772 -4.1070347065 -3.10170205331 2.5553000476 3.24692252591 4.07212555782 -4.07218656056 -3.76175602776 -0.433315659522 4.0667607468 -4.06682413167 3.87751212493 -3.8755711595 4.10430935647 -4.10430805301 4.10867110309 -4.10867172278 3.69872408747 4.10255962874 -4.10256310601 4.1098179079 -4.10981816811 4.04492777025 -4.044985497 3.90486349548 -3.90375930398 -1.04887850958 0.197361219627 -1.72134339885 2.15973068108 -1.95683787463 0.0894887198023 2.32585295609 -1.54225779934 1.91440453551 4.1074327458 -4.10743105249 0.867315862802 4.10921229805 -4.10921322352 4.09702340904 -4.0970447714 3.37516101057 -0.215460767641 -0.104545049243 3.94043447317 -3.93995986698 4.10520835155 -4.10520598289 0.401189791516 -2.75757936145 -1.3815656 -2.13618710791 -0.788975201056 4.07694240043 -4.07700091729 4.09290022678 -4.09293571227 4.02840837998 -4.02844806067 4.10646023228 -4.10645811632 -1.19099515033 -3.64500404186 2.92858120174 4.10955661381 -4.10955722527 0.974916873136 -0.694996679465 -3.36756049579 3.48022791418 4.10030157831 -4.10031238639 3.84792473607 -3.84432462111 4.0365244516 -4.0365737395 3.81035347451 -3.809623218 -2.81086151594 -3.09598829657 -4.10028261758 4.10027440428 -1.12078628288 3.82622082829 -1.06659786953 -2.76259205293 1.76584232325 -4.01525288528 4.01523665923 3.90523817114 -3.90436715355 1.28960270097 1.80590126202 -3.45750269834 0.0714006895044 2.19349563183 -0.334890863148 -0.812617398455 0.0775444100074 0.0717474314477 -0.496066615705 -4.10095021362 4.10094422547 -0.83617968024 0.662684960262 -0.0204454374121 -0.32100798672 -0.435121540095 1.31504616619 -0.0459594047843 3.57856763508 0.384643613067 -0.0480721672507 -4.01729750657 4.01726956626 4.1088357925 -4.10883672185 0.685493991539 -0.352062104542 -3.8191670015 -0.937137780785 -0.509037020785 -0.463770478732 2.56894055799 -4.10647086437 4.10647366548 0.267757000428 2.38336169925 0.672531592061 0.0282923049865 -3.98852609851 3.98843055321 -3.60881918931 -0.0269675522327 -4.10600436259 4.10600747113 -4.05654489484 4.05649625584 0.459940475996 4.10697442095 -4.10697232202 -0.339551933547 -0.244550230681 0.0931000789205 -3.88990925046 3.88748942907 -0.0199274498264 -3.72647367689 1.31890432805 0.571123833361 0.342833883468 -3.15035595913 4.09774135208 -4.09776021996 -2.20490153883 4.10177576381 -4.10178120862 3.40231112867 3.42325103929 0.429399099918 -0.644209931113 -0.230373908763 -4.05011019641 4.05005885538 0.267079582814 0.0185310613592 -0.115920388112 2.71006633719 -0.291236828403 0.114615681088 3.79093984384 -2.91712523105 -3.85527543648 0.473080991547 2.99827176975 -4.10497486723 4.10497688396 2.98727467788 -4.10460546203 4.10460743382 -4.0598304811 4.05978007495 4.0847715775 -4.08482010502 -0.571348824701 -0.540738498891 0.551768556192 -3.39840018365 -3.30354953164 0.458373083258 -3.85143770444 3.5357350682 0.199128060515 0.785415396538 0.239958814749 3.5254929887 -3.16493649802 -0.239326443125 3.39591529643 -2.55260165085 4.10908969409 -4.10909067729 4.10907531781 -4.10907632798 0.408689197409 4.10968124248 -4.10968190338 -0.0100459127599 0.0209380212044 0.244122335145 0.0120853849226 3.69134059908 -3.75664669693 -3.57351567009 1.28225651668 3.87618943087 -3.87481373089 -1.63216743095 3.72171691461 -0.221049583276 0.839840607701 2.36356508082 3.91747821969 -3.91684673523 -0.183636033855 -4.09165902396 4.09162589644 0.196068018932 -0.529022515415 0.501724960112 -4.0929611944 4.09293077393 0.068485209921 3.13348018862 -4.06533004404 4.06527793917 0.26706477229 -1.80001455186 4.10942361592 -4.10942482037 -0.397863580562 0.225393879948 0.473598469077 -3.96177236266 3.96164832407 0.669895525483 0.654647511286 4.09652108838 -4.09654163197 -4.09652699186 4.09650643139 0.28388472259 -3.80743131082 -4.10792048473 4.10792115625 -0.999733334179 -0.130710903816 -3.00012541977 0.0454724750694 0.414185307045 -0.636738096157 -3.88643077502 3.88694866356 4.10932018875 -4.10932169347 0.769490848043 1.26579251707 -4.04030048622 4.04024019446 -0.0669050793804 0.387559041945 -0.182591525406 -0.576053175522 -4.05115948134 4.05110939462 0.112564472541 0.500551468858 3.80702060747 3.22748717942 -0.761164880475 1.2756374913 -0.0297645004591 3.19910248929 -0.0359089887095 0.0321812985102 -4.10856144685 4.1085602619 1.69437262669 0.129338852783 -4.08371600812 4.08366831673 -3.94544293916 3.94471165527 -0.230533834339 4.09802530218 -4.09804340086 0.0208813304147 1.33115826467 -0.0282515851578 0.123390885061 -4.10282235176 4.10282130184 4.10935667106 -4.10935816146 0.0108711781226 -0.22197678856 -0.0672342952761 2.65506738254 -4.09983318371 4.09982352926 -0.0566458338496 -0.0777791257496 -4.00494688423 4.00492969262 4.10710034932 -4.10709847704 3.59360369154 0.673989759158 -0.265480412098 -1.20617049931 1.43579037858 -0.145610161763 4.1087965676 -4.10879797141 -1.25671234605 4.10877198187 -4.10877295623 0.455172628561 2.90905503134 -0.0735510628152 -4.0872307709 4.08718643456 -4.10875478225 4.10875343609 0.443122885136 -0.492631052422 -0.0105167659206 1.2628843708 -0.537151943371 -4.10703936314 4.10704210471 0.70732395287 4.10186647479 -4.10187141558 0.155435780475 0.0543780512205 -0.19192376592 -0.674606155807 -0.304918420097 -4.00246844487 4.00244630535 -3.50840054235 0.562569504149 -0.397709900218 -2.09748334287 -3.39074822944 0.0635079015609 0.322012482365 -0.349283861441 0.0447029710674 -0.571859298157 -1.715036962 -0.82954790408 -0.209542245051 4.10961973517 -4.10962051119 -4.09755868962 4.0975411004 1.7725934085 2.28968459441 1.43414767858 -0.428619143217 0.0995278498698 -3.2173094373 -0.0314702933611 -0.755659887975 -3.90140439235 3.89799541323 -1.21455128135 1.44882450377 -0.97090758507 -4.06624720269 4.06619455071 -4.10987029922 4.10987000641 0.480958277648 -2.83869108462 4.10763667108 -4.10763546136 0.773147361532 0.515725463386 0.273194103775 -0.270061255718 -0.281873535495 0.335071766408 -0.237852291914 -3.32619767683 -0.907069512139 -0.0299805974987 0.514706459589 0.272229536895 -4.08120460145 4.08114966388 0.0137761619688 -4.05933306895 4.05927499724 3.256191712 -4.10256079589 4.1025587113 4.09704308587 -4.09706200425 -1.90885725077 -0.0221487179761 3.18812122149 -3.89152478102 3.89259859842 0.264598292097 -4.10857176068 4.10857061373 -0.0291778468314 3.04682959248 -0.723663402448 0.117549480002 -0.259922650004 0.416222285863 0.0521208266857 -4.04283922122 4.04278252751 -0.569819825835 -4.06309648596 4.06304371402 -0.0326689074122 0.0299186543077 -0.988989032091 3.79410615795 -0.0473482159848 -0.568375871865 4.09703451649 -4.09705575781 -4.03402699861 4.03397563698 0.474168279405 0.124158868718 0.872273645133 -4.04341082127 4.04335077782 1.16861960892 -0.115538224923 -3.97424790719 3.97436340996 4.10935599294 -4.10935741933 0.274415470376 3.32719316454 -1.48768509582 -2.46538511498 4.10897980709 -4.1089808095 -3.44936011795 -2.61405771864 -4.09813152233 4.09811587655 0.354532150397 4.09910708933 -4.09912179612 0.385524482098 0.14686547743 2.67417483284 -4.10220228649 4.10219968958 3.53278377866 3.32875467135 0.310045097741 -0.0850475594812 0.296539700559 1.33562250393 4.09684183508 -4.09686178927 -0.659349496381 0.0284689780543 0.42351520558 -1.03873606452 3.86428670123 3.83120363251 2.74204870483 3.3718525954 2.63849130671 3.56507436073 -0.11529920261 0.812258326511 3.37962555384 3.32842156019 0.609396357999 -4.10858675416 4.10858552616 3.62290312968 -4.10318594414 4.10318538528 -3.45761517145 0.0763825675724 0.0729811304068 -4.10836588853 4.10836509956 -0.412707132656 -0.0733431187351 -2.31880176272 0.173904756808 0.499884670637 -0.575182331796 0.00280924304456 -0.0678857189871 0.0495199952622 4.10217362324 -4.10217785337 0.0425112974041 0.115841579148 0.226868717216 -3.95738166017 3.95745788296 -0.0624179961474 -0.619125873297 0.193999398909 -0.205106189811 0.350661149893 -0.0549466802215 0.224532377737 -4.10776072747 4.10776186835 0.63850002753 -0.546135809366 0.124643864422 0.231360241743 0.126038533596 -2.48041695641 0.256332890393 -4.10819419536 4.10819405065 0.431257686017 -1.18236825517 0.0314857460995 4.10894677247 -4.10894833632 -4.10673211983 4.10673483933 -4.06961390677 4.0695608739 0.738897697915 0.3242075407 -0.0589109852553 -4.09498207158 4.09495656401 -1.73664974015 3.84972282155 1.46375943197 1.19019991481 4.10642259607 -4.10641990751 0.873585934495 0.127199197195 -0.478304296228 -0.453820643771 0.920917696098 -0.451660279265 3.67471388783 -3.95160455415 3.95071343093 -4.07863895227 4.07858174723 -4.09719525429 4.0971764463 0.0505694329768 -2.86057860924 2.02136959338 -4.10197804661 4.10197472851 0.0485519167857 0.0413562128418 4.10904571835 -4.10904737283 -1.64517744941 -0.348690309099 -0.447825111276 -1.02396597397 0.0533131573653 -0.267313831444 3.11353840681 -2.57844811937 -0.223049306211 0.0375966202787 -0.505693198839 -4.03880403995 4.03874302946 -4.07086659345 4.07080810218 -0.0375999394507 0.261911163117 0.0368511947554 0.0210803650185 -0.0336649946047 -3.86918462473 0.196550129745 3.14114840262 -3.82926427198 -0.312965469411 -4.10282460616 4.10282321123 -0.111488342265 -0.218596336586 1.63316252358 -0.313387983475 0.14389332961 0.0161373693837 -4.08415748564 4.08411135597 -0.88747033674 0.290441064026 -0.168933232504 0.871793080012 -1.5691211883 0.732978031039 -4.07592081714 4.07586575108 4.10931386964 -4.10931525218 0.411657411837 3.36539828589 0.5621896621 -1.10584310424 -4.04179142925 4.04173049984 0.341797484461 0.499370722747 0.335788604562 -4.02845394166 4.02841016365 -3.52655322419 -4.10993619173 4.1099360463 -2.93542232972 3.00907367099 0.0492787167765 -1.75781131237 4.10742046791 -4.10741896478 0.17335796473 3.51540715013 -0.0270308716211 -0.619733017071 -2.26401918665 -4.07840819068 4.07835709887 0.0547984537363 0.0622945672707 -2.97748233021 4.10660530058 -4.10660311493 4.10772848653 -4.10772729142 3.6110732055 -0.389128487313 0.638249616023 0.0517494457718 -3.08676742278 4.10920421906 -4.10920516787 0.303775018073 2.86228133282 -1.02573833644 -0.254623544852 -1.2674765754 0.427130408915 3.794916927 0.482767001898 0.296012378388 -0.458321889902 3.30596164493 -1.45735119979 0.439826766269 -3.23117488944 -4.06421398098 4.06415073124 -0.262859724341 -1.06078348283 -0.164794910086 4.10902914423 -4.10903076576 -1.61040815427 -0.079692274963 -3.70492135262 -0.171351409549 -0.253831854252 1.80173615775 3.55360313056 0.29080669288 -1.69837465056 -3.37037811614 0.0459794243818 -4.10492377056 4.10492630542 -3.60153321324 0.132114240084 -2.78458930487 -0.186507651415 0.145717095986 3.57535520849 4.03938356699 -4.03943655584 0.537173827227 -3.21406997579 2.37432623684 0.117602980566 0.194280728529 0.50379728091 -0.469900377286 3.15131275355 0.130193613286 -0.239598140754 -4.1085636829 4.10856256576 -0.212626699546 0.954400669365 -1.07902883149 -4.0783923358 4.07834053413 0.804956084216 3.57255007733 0.0498723265822 2.99675373874 2.96989515047 -1.21467280304 -3.33895379615 3.2317477992 -4.10829815289 4.10829769135 -3.50132691327 -0.247404225454 4.09370553593 -4.09373746541 -0.255609909204 0.252074209844 0.0633967936739 0.0384695703962 -4.08543097115 4.08538680702 0.0828703747786 -0.0535600914271 3.84985012765 0.25511074961 -0.52776387964 -3.814149332 -4.04781935853 4.04775775 4.10686986447 -4.10686787549 -1.56696402908 -0.495253864563 -0.634916433815 -0.050426988156 0.551491322803 -0.355390172053 -0.766777023291 -0.0801027948659 0.177444970351 -3.9759515915 3.97579808233 0.824087231614 -4.10800701619 4.10800740613 -0.333979972786 -0.0406797075111 -4.10851043242 4.10850945097 0.288829022205 -3.01784859106 0.0508072091777 -3.25648363665 0.185518883337 -0.228810944585 4.10896095208 -4.10896261439 1.10919468523 -0.23057626012 0.985218645041 3.44255882238 -0.428971872482 0.44895085739 4.10886867364 -4.10887026489 -0.428749403423 0.492984752103 0.13518665705 -4.10280460864 4.10280369285 1.33898957245 0.0219837867978 0.906507323404 0.60385914812 -1.23812435733 3.59576972264 -0.12589291915 -3.63718107357 1.47500876945 -0.177820263946 0.124521237593 4.09248928178 -4.09252483133 -0.0136757014603 0.559935520345 -0.291958964872 -4.06086510323 4.06080565719 -1.88327421401 0.80448692344 0.0791302946161 -0.958566306778 -3.7318738879 3.60017112493 -4.10850987604 4.10850888323 0.895095898368 -0.796847070886 4.10868107568 -4.10868244699 -0.654416303255 -0.766838257267 -0.060595257635 0.181956813155 -0.662616539305 0.103160382342 0.90215021722 -2.62344311009 -3.29816723676 -0.519847636827 -4.10617248452 4.10617592697 -0.812756677674 1.52548383001 4.10432267302 -4.10432104453 4.04467157532 -4.0447298766 -0.382731501854 -0.0781850008383 -0.318971149276 -2.29980287759 4.09987032865 -4.09988258417 -0.376445669688 -0.022560251421 0.087868263868 -3.77824082666 -4.02129298026 4.02124585962 -0.0431368041151 0.908423780673 -1.56251447875 3.77610538857 0.0896778455029 -0.217336041343 2.41423853141 -0.446942748369 0.389908028015 0.168395543748 0.195686640785 -0.275001978606 0.19085520961 -0.363399361572 -0.527276238843 -0.0408570651474 -0.83219425617 -0.419034436229 -4.02325988765 4.02320562287 2.7469303436 -0.286682116289 -3.94858750301 3.9484113413 0.0722306062263 0.0132078980331 -0.76619977571 0.696423009002 -1.50839944225 -0.892851735748 -1.60669805052 -0.146377543235 -0.465630457302 -4.10858217869 4.10858107306 -0.829718471915 2.42794863882 -3.26285822253 0.0268382619775 -0.075716992966 0.630026114878 2.47387492547 0.174297597681 4.10867526904 -4.1086766139 0.763764594234 -0.158487671682 -4.09175019394 4.09171745066 3.35796730746 0.413312238329 -4.0436194312 4.04356999123 -0.191210361287 -0.477951206085 -0.0055124883548 1.80052099737 0.305757429506 3.89593275112 -3.89511805395 0.0953293090216 -0.0258852575488 4.09956629242 -4.09957782428 0.359734433562 -3.93429939246 3.93460306118 3.69819095114 -3.99834934617 3.99826700315 -0.108207512412 0.104496915328 -0.141409093318 -0.67908714221 0.107764649709 -1.05591809599 4.0970413734 -4.09706259498 0.459794039656 -4.1061312183 4.10613425175 0.155017752832 0.947320622093 3.81627977479 -0.0656603446854 -4.10717571718 4.10717825987 4.07167842506 -4.07173889973 -4.10720102899 4.10720342237 0.406654476285 -0.0726125540759 1.23274698052 -4.07207748214 4.07202507755 3.82351298432 -3.8209046805 3.26965955677 -1.55235635952 -4.10484520525 4.10484735537 -0.0996624198474 4.1088987223 -4.10889976723 -4.10795160524 4.10795193769 -1.62851773707 3.65445767957 -4.06320996786 4.06315639974 3.90680542458 -3.90650783367 0.105230421879 0.145193921801 0.209937942608 -4.03079416384 4.03073976619 -4.01992869745 4.01991358153 -1.54506462184 -0.531658657363 1.13189588952 -0.0611087079659 -3.95340839428 3.95332213412 -4.05179965868 4.05175251827 -0.457927590745 0.737109757088 -0.343602751519 0.83493306799 -4.0994696036 4.09945714961 3.8271592127 -0.731734842143 3.78929464149 -4.10530841051 4.10531068277 0.183926249258 -0.106446046666 4.09211606292 -4.09215217158 4.10912532377 -4.10912685942 4.10859426635 -4.10859532584 -0.498997790169 4.09928027172 -4.09929254158 -0.757447167562 -4.05741128741 4.05734892229 0.578766045952 2.11182026027 -0.229455856996 0.402188626407 1.73716010293 -3.15066876849 0.492355975134 -4.08719199177 4.08715008663 -4.10386645243 4.10386712443 -0.376270880729 -2.70365342803 -4.08519814731 4.08515257573 -4.07887569592 4.07882253822 0.308568665999 -0.0944352518868 -0.572484790574 3.55108191245 -3.32506222703 0.538557940544 -0.831362173207 -0.0435986762672 -4.04577093481 4.04573028699 0.0335003600172 0.013412586675 -4.04760688557 4.04756189113 1.82082599773 -0.010713512412 4.10847415457 -4.10847501389 -0.118502382473 3.86080558078 -0.239984235531 -4.06887998298 4.06882820929 -1.05887087057 -4.10706828069 4.10707055096 0.195582637717 3.68452437786 4.1065935333 -4.10659104495 -0.278280946068 -0.848563294147 -0.721955927788 -3.98605220139 3.9859804753 0.879440482478 -4.08076084443 4.08070728993 0.29183391671 4.10877751254 -4.1087788481 0.326719687445 -3.98409521265 3.98397917767 3.86753797562 -3.86490806351 -0.0968423542545 0.193650792115 -3.57477851953 0.30830726359 0.105828614099 -1.95266271334 -0.325189933587 -0.326449541294 -3.25760766543 -4.10855571517 4.10855462754 -0.180155321494 -2.16045015854 -3.22429405001 0.328522909 0.182222552849 -1.78975618893 0.363199260482 0.966869169277 -0.451462922788 0.139463690612 -0.0768520575083 -0.587507936512 -0.135956357678 -0.556825517093 0.571300762149 -0.493237234821 1.77548572851 4.08280431946 -4.08285821419 0.906757479947 -4.02561955745 4.02557626082 -0.926691967753 -3.96434676543 3.96424524186 -3.47963447496 -4.10849773469 4.10849668864 0.0571690962776 -4.09887599045 4.09886267622 -3.54534009343 0.981897552351 -4.10714267796 4.10714510222 0.0853397682041 -3.65375926872 0.957894117267 -0.265759902447 0.512620668063 3.63776883579 -3.58920625099 -0.134947686477 -0.225199706884 -3.22343165721 -3.84996419615 3.85543308856 -0.128308876765 3.24967407336 0.318276084236 -3.96776671833 3.96796823296 -4.045053688 4.0449989901 1.03037783808 0.0194814706182 -4.09593639395 4.09591356862 4.10948062673 -4.10948171495 -0.818243561724 3.29687578895 -0.574133180763 4.10882808781 -4.10882961133 -0.469632418918 0.330276044228 -0.444116754452 0.430571658014 -0.538868180752 0.0142404094436 0.244278785316 0.0736668424507 0.587849976677 -0.236751045175 4.10895591417 -4.10895738345 -4.05178535829 4.05172964002 4.10310733737 -4.10310875984 1.50620440105 0.0492961754698 -0.227411355856 0.0366387278784 -0.209402597834 2.76656956647 3.53035588009 0.187550962682 0.101181039885 4.10904184506 -4.10904294273 -1.33526269346 -2.27970779115 0.445531809457 3.32268459056 -4.08370644767 4.08365951736 0.921231838546 0.30517531996 -3.83846434083 3.8347098203 0.164315881948 -3.84474430928 3.84310027062 -3.72153651692 3.86286008351 -3.86145986774 0.971725847483 -0.396732275125 0.32557193278 0.303026544126 -0.331868561097 4.09805471628 -4.09807271427 0.697845925279 0.488682385684 0.170779652937 3.93820284117 -3.9377599669 -3.74734530212 1.53286209424 0.58001541044 -4.09707465654 4.09705576236 -4.08798169318 4.08794089216 -1.17068918274 -0.376794048235 2.94926449802 0.178380227944 0.205182944927 -3.82342266785 0.659398944186 -0.506446526293 0.398212751907 0.0585852375551 -0.543029263395 -0.0918570537476 -4.01009312107 4.01007032962 -0.2493391155 1.6129299448 -4.08014875961 4.08009898888 -3.53996274255 3.05374152974 -4.10802509397 4.10802533558 0.231437606824 -4.10557297805 4.10557618425 -0.189322225581 -0.339080980249 4.10805158438 -4.10805084568 -4.10851415441 4.10851316345 -0.239630895059 0.0841161279431 -3.16436372042 0.309436111797 0.422497083643 0.934726022044 4.10918149636 -4.10918250442 0.0262257139074 -0.278492689221 2.61013211899 3.33310458775 -4.10770200717 4.10770334834 -2.08188470368 0.234788658359 -0.412532214605 1.04623704287 0.117364027639 2.14896036376 -0.40549554711 3.75184236852 -1.25507980756 2.14707606092 -3.86794385208 -0.0949947071354 2.62543105058 1.62227375289 0.774239963626 -2.20226013828 3.33048364752 3.02898032775 -1.60839014349 -0.648879342526 -0.281877963686 -0.438669586406 -0.225275444705 3.74028268084 3.24087072051 -2.2820113755 -4.07951131711 4.07945564348 0.609606467666 0.0664421451965 0.973965642686 -4.08783386862 4.08779280179 -0.564282075131 0.433522604913 2.35322708245 0.0572637428139 -4.03956416506 4.03950930354 -0.419447231022 3.41610253744 -0.813682266151 -3.45277902434 4.10905520195 -4.10905674463 2.1350208644 -0.769501064503 -3.63222327481 0.294216282828 -3.406383071 -1.84640749808 -0.417165885311 0.133663386163 -0.636740395699 -0.0261938795888 -4.083982761 4.0839366733 -3.89051164403 3.88945523899 -0.456241651278 4.10797414557 -4.10797333608 4.10925322968 -4.10925414033 3.58256836924 -0.504424079475 2.56618583832 -0.44039353418 -3.73263423488 -0.260627561717 -0.619588505427 3.78464731228 -0.302169915025 -0.531609347524 0.125675167516 0.75220682028 0.300807132031 -3.62796710472 0.154342114567 -0.115344309875 0.103673559473 -4.04663803106 4.0465921702 1.29636492243 0.00527955359956 -0.54754434303 -0.0014517903448 0.0187465976781 -3.07753563678 0.396861579851 -4.08385415637 4.08380817884 -4.06085137008 4.0608001645 0.180252434741 -0.0466238143851 3.65672742305 0.341235187763 3.65652543133 4.09697480428 -4.09699576677 -0.610727932312 -0.337730531437 -3.9125917108 3.91357599567 -3.54709553017 0.0347434586565 3.59764107588 -0.33634466887 4.10834607514 -4.10834613447 3.2412047316 -3.96637122728 3.96639922001 -0.837690006664 -0.640342323887 4.09484725186 -4.09487548471 -4.06813971705 4.06808210924 -0.430144362863 -1.8273195776 0.149970706911 1.6749062315 0.0616005325964 -0.783441784409 3.6825167289 0.249236122492 0.0910522381363 -1.77791356819 -3.17594272134 -1.7178329636 -4.06683268537 4.06677811386 -4.02218684631 4.0221234102 -2.75023010359 -4.10863214323 4.10863094007 0.474717772807 -2.86923597676 -0.384814680646 -0.0705035845135 -0.270865338262 -0.751995308036 0.592673752967 0.527401394514 -1.17949034774 -4.10577904464 4.10578144376 -0.192847787794 3.12220834578 0.207519328159 -3.72610973139 -0.357655298506 -1.81770929968 -4.09106529412 4.09103123612 -3.92369791975 3.92418135501 0.00940045570935 4.07020171798 -4.0702634185 0.58321030104 3.62999005143 -4.05340876468 4.05335434411 -0.632297288032 3.64719172023 -0.0605124381402 -0.0919648208636 -4.02725275943 4.02722866988 -3.66818957954 -4.10943310785 4.10943204786 0.216978617406 0.127710988226 3.60568185839 -4.02309393843 4.0230827494 -0.0128009831974 -0.907422654887 0.239197151875 0.113233665973 -0.108540764806 -0.816660350775 3.4621250394 0.307417732412 -0.352321194021 -3.56242510466 -0.534464179711 3.6171564472 0.197258657793 -4.10954545427 4.1095448816 -0.932237852246 -0.14580533212 0.00650931517035 -0.460529543482 -4.04180083728 4.0417645031 -3.14077113319 -4.09442805104 4.09440126739 1.04471281924 0.0827090874651 1.27954167618 2.66432143985 1.27908655272 3.39029439112 1.79079629496 2.93300456063 -3.05148966871 -3.56992686093 0.0830357228306 4.10881270378 -4.10881407657 0.11667101256 0.260879285027 4.10912039503 -4.10912197707 0.10110813806 -4.08899430301 4.08894844966 -0.45227563497 -4.07929229411 4.07923655749 0.444219184953 -3.42794750344 3.95051863248 -3.95020346861 -0.041247301767 0.100339335995 -0.103558042512 -1.12151879105 -3.87160910708 3.87388926609 0.733339484148 0.12314211358 -0.307332442044 4.10352431802 -4.10352445764 0.0101467340335 -0.529778982285 3.68517482174 0.01392247743 0.575633407119 -1.19166159232 0.504160388512 -0.142852043189 3.80536447821 -3.80253912875 -4.10374755603 4.10374809936 -1.85568502618 0.0769146445277 -3.31925644173 -3.75525173559 -0.147580682078 -0.445119634195 -0.367603871705 0.0780241288227 0.396778229865 0.0452021051707 -2.85130651357 0.399329348129 -0.00822854065246 -3.97871596534 3.97879153208 -4.0739156468 4.07385827099 -4.10753844639 4.10754022235 -4.01587729448 4.01581117397 -1.14520740838 -0.376970629707 -0.527272841738 -0.883971011096 -0.842781941865 3.55734806486 -0.0136133465159 -0.0693942885904 4.09638994879 -4.09641343025 -0.0751848210761 -4.07629118725 4.07623249486 -0.10200961302 0.392124587993 0.0398457762957 -0.654128765145 1.01213876278 -0.710236121942 -0.179392774285 -4.1071420754 4.10714414327 0.988164561128 -0.728477405949 -4.10586550814 4.10586890269 0.976781828234 -0.923440809906 1.03055192149 -2.83058842523 4.10459761604 -4.10459555314 -4.10368161978 4.10368197699 0.766650246404 -0.218535583598 -0.0357695900205 4.10904935536 -4.10905077953 -0.426615932734 -0.418201876635 -0.189603271315 -0.200743308351 0.393541393491 -2.03040748928 0.583327405273 0.0307640375222 0.260835004905 -1.79820755093 -0.394668115384 -4.10829231035 4.1082918238 -3.53887530888 -3.7460011445 -0.367361378253 -3.76573676666 3.81185739342 -4.10984850922 4.10984819382 3.48934530251 -0.595877632517 -4.10970829124 4.10970768153 -0.146176873639 -4.04139405919 4.04133864443 1.91398878855 0.620770430961 4.10588662028 -4.1058842236 -4.10873607661 4.10873479526 -1.19419048484 -0.101382745888 -0.52054539037 -1.94798895942 -3.62829208955 4.10886157747 -4.10886310416 -1.40571468155 0.50378968466 0.342905312759 0.334097806161 -3.71739782361 -0.600613548659 -0.295705330624 0.693455285609 0.459890012363 0.113776881888 -0.391615842471 2.93879461584 3.90260549583 -3.90157658037 2.1563094898 0.361451417036 0.0381830708875 -2.13986650755 2.69250952851 -0.899442186934 -0.573534853784 0.249920182384 -0.95714614506 -4.08560829009 4.08556395231 -0.190457830885 -4.10859668249 4.10859553124 2.14730931317 0.521110178803 -2.23933852422 0.597962286598 -0.850540083847 -0.393891424539 -0.21070124145 0.555029983223 -0.00885161919812 -4.10842921272 4.10842844766 1.6580919109 0.373953555434 0.312565441183 3.38482544726 -4.10966364366 4.10966291769 0.32983364946 1.5482104295 -0.774091623488 0.484218681563 -4.10248215441 4.10247934528 0.156377190027 -0.00909630775693 -3.99233347237 3.99228283958 -0.152352159283 1.48077372122 0.47302478085 -3.84851612732 3.85440637864 0.585306886941 0.0948638540207 0.0888539645688 3.67734448102 0.064125836278 -0.211802536351 2.76946465246 -3.35215501305 0.943675041388 -2.19920378012 0.203751676195 -0.130375723749 4.09988343966 -4.09989527829 0.767625914591 -0.172694387861 4.10851956246 -4.10851999672 -0.541833555153 -0.210413144992 -4.02417573512 4.02414028782 0.124938173902 0.779761691082 -3.53520639881 -4.10024969442 4.10023978803 2.51893512893 -1.80156983186 3.35390067508 4.1091501982 -4.10915187589 -4.07501302043 4.07495410644 -1.03312505337 -0.10243649345 0.483828522641 0.00710454306199 3.60646597785 0.0825263675071 -4.02919129406 4.02914871852 -4.10820450391 4.1082043851 3.76829087119 0.142432678702 -0.0883547671193 0.860216692704 0.578960235513 3.53208262563 3.55765287636 -4.10821183627 4.10821165989 0.806161874485 -0.0366301102348 0.357888373841 -0.410025026768 -3.97329377074 3.97322683911 -0.382884743009 0.864635549853 -4.1074221531 4.10742421724 -0.636723009879 -4.09287835792 4.09284738415 0.566061220824 -1.45347541796 -0.208437716148 4.10536531837 -4.10536283844 0.335957402925 4.09814518178 -4.0981608251 -0.38100562538 -0.0104005855754 0.143714160347 4.09780853917 -4.09782589539 -0.106735173762 -0.477731500613 -0.114999607999 -4.09848602098 4.09847154156 -4.03395092197 4.03389431901 0.587306331075 0.675138424855 3.91082580107 -3.9105309114 3.71612970802 0.175898344597 -4.01322596736 4.01318063268 4.08605667285 -4.08610739403 -0.09643220645 0.862622599673 -3.74900113298 0.048740603648 3.39796006511 0.312338635568 -0.483170555161 3.43469293331 -0.0352003346936 -1.85544588955 -2.77116724336 -4.10823444926 4.1082339301 -0.132467740232 -0.0634649695272 -4.05909959332 4.05903650043 0.607751517941 -0.208926737072 0.295129184203 -3.77456211645 0.361382679744 0.322288033579 -3.36128265237 -0.289015320792 -0.144708757413 0.966384616923 -0.157071690601 0.139636472414 -4.10411404701 4.1041153581 0.141311350181 0.296124763523 -4.06693181581 4.06687635323 4.10652052107 -4.10651837311 0.50281796515 0.212531912605 4.10776571798 -4.10776482804 -3.97359877279 3.97359498893 -4.10810927897 4.10810925611 -4.10740182012 4.10740310687 -2.19229042151 -0.486151251578 -0.115018204244 -0.0950616270722 -4.10966410522 4.10966328774 -0.193843838114 -4.06623755575 4.06618564243 -0.732655234344 0.557945640949 -4.07547097944 4.07541202973 -4.05672389491 4.05666297642 -4.10740349986 4.10740486071 0.0318803340811 -0.157349653906 0.894934961397 4.10386042838 -4.10385954867 2.24963425802 -1.55334873103 0.0852444724878 0.426301990205 -0.962039951843 -1.70925842664 0.741324397851 0.985743724896 -0.141961839855 0.612502159797 -3.99531473527 3.99522809761 -3.83656350279 3.83921633893 4.10923160876 -4.10923274048 -1.77352933732 -3.28494134174 -0.029149950155 4.10896057717 -4.1089621448 -0.909587848572 -2.17224031342 1.069368064 0.175366666333 -0.0815896197585 0.334504822085 0.470380588522 0.261096400944 0.589287441326 2.36730864013 -1.89069573297 -0.0244860999012 0.389913163954 -4.09992629277 4.09991629816 -4.10992137065 4.10992122611 3.548156784 -3.85358808754 3.85827468466 0.211647491441 4.09901959369 -4.09903459213 -0.478608940795 0.481007525999 -2.92119964042 0.0192647425393 0.560004730252 4.10287956173 -4.10288179633 -0.79011591807 -4.10439704035 4.10439851669 -4.10792538895 4.10792566692 -0.0574368870405 3.67278120665 4.10562779989 -4.10562527485 0.559864763203 0.369888672052 3.00757022973 3.4942641077 -0.334219224534 2.24181834023 3.85143893354 -3.84972843979 1.33299171878 3.60694271126 -4.10476701035 4.10476948679 -0.0761776834636 0.236754401054 -0.0404947122548 0.152250029345 0.895013955878 0.227911951115 -0.0347973069012 4.10984503176 -4.1098453377 4.10992134665 -4.10992150618 -0.626207696133 1.07187034439 -4.06109286434 4.0610355246 -3.93505601622 3.93519659249 -0.666753891748 -1.02433444833 4.09598306048 -4.09600718687 0.22730958676 -2.4521200571 -4.10781155437 4.10781260355 -3.9921208814 3.99217133384 4.10916390418 -4.1091653484 4.10760522212 -4.10760425459 0.0793719467223 -0.125177664293 0.572590571008 0.169146303582 -4.10504270551 4.10504557979 -0.147691939208 -3.56734758389 4.10554609934 -4.10554369532 1.99976973067 -0.153569165901 3.93288689898 -3.93243916586 -3.95936682022 3.95962771647 0.502447232878 -3.88269531173 3.88466532342 3.05144528898 3.67870678025 0.242780211489 3.66993520967 -1.81952998699 -4.10604463451 4.10604709214 -3.83178131741 3.83478684928 0.239356360059 -3.86199179176 3.86234416512 4.10809449929 -4.10809412368 4.10907882945 -4.10907981236 1.01676496361 -2.38195151204 0.813936192915 -0.222028937075 -4.05945682341 4.0593949828 0.17648938386 -2.93589605204 -1.91770962196 4.10933952445 -4.10934033687 4.10873739028 -4.10873879955 -3.51212562457 4.10759884802 -4.10759734571 0.580509970151 3.89660073789 -3.89620701393 -0.564989383627 -0.268177279073 -3.66758036713 0.839511408137 0.911922504827 -0.37628921003 0.6198433906 0.132313625086 -0.561964036836 0.535453144383 4.10625246831 -4.10625016259 1.08837282422 -0.4941609634 4.06698396094 -4.06704692269 1.13839530847 0.0755424215465 -4.10394468198 4.10394592659 -4.08321990848 4.08317310653 -3.78000314245 -4.10822171802 4.10822125931 1.34757310352 -4.05575123133 4.05570123644 2.74085187066 -0.534816171546 0.229007056159 0.183321026258 -0.232020008318 -0.0402742049986 -1.53280780038 1.88842298598 -3.71819864081 -4.08560200612 4.08555773677 0.265276332493 -4.1020866374 4.10208329368 -0.150989333433 4.10959960511 -4.10960010865 -0.400369091269 -1.03194180934 3.438734584 0.0830510492706 -0.0804795308806 -4.10868084564 4.1086795833 -1.9850422134 -4.00739931944 4.0074182209 0.2443491737 -0.0660863711157 -4.10663859509 4.10664181748 -0.621369646333 -4.10974792317 4.10974734412 -0.383230008928 1.11482137212 4.1078275513 -4.10782705883 -0.125036905763 -4.06472279862 4.06466545363 -4.10295128851 4.10295025944 -0.566849453873 0.00833045445375 0.444226900494 -4.05154676191 4.05148489248 -0.62548306159 -4.08786590099 4.08782534577 -2.0641645327 -0.395663493028 -0.564025732407 -0.247698352891 -0.315322584697 0.990192720216 0.49037265154 -1.98659200465 -0.0955534385668 3.76688416161 -4.06362972926 4.06356546018 -0.109569303169 0.300952749079 -4.1094436782 4.10944248636 -1.28241295519 -4.02947021813 4.02940986397 -4.10799952844 4.10799970072 3.44427408888 0.961482774183 0.0699494764614 -0.180614592269 1.11416890985 -1.48349405972 -3.61980542876 3.71324859261 -3.53959398669 -3.61452014555 -3.44627838263 0.898985058479 -4.10753237776 4.10753345455 -1.40955723661 0.247222154224 -4.10834218499 4.10834141928 0.0843666001162 -2.5839057879 -0.278470691223 4.09799003449 -4.09800807192 1.03757868892 -1.29339845267 -4.10819092722 4.10819065936 3.43020824399 -0.305463586252 -4.08135747925 4.08130331509 3.53894194322 -2.37858210484 0.339622113121 -0.408411237906 -1.14547383129 1.6361204772 4.10806799294 -4.10806766476 0.189752167436 4.10824491375 -4.10824457303 -3.45316342639 -4.10901822437 4.10901692462 4.10385091233 -4.1038502038 0.173844129549 -0.761611429169 -4.03098495207 4.03092621225 2.82470039542 -0.239942848288 0.165632714405 -4.10875127072 4.10874995464 -1.0583210983 0.459862053678 -0.0679331027 0.17040380021 -4.10536020533 4.1053632048 -0.107268138853 -4.10414983371 4.10415103791 0.153728197164 1.3403325054 -1.2429173807 3.82916290621 -3.82709492039 -0.250509756492 -0.634484240038 0.522877080614 -0.567283566925 -3.60724797869 -0.0180762170329 -3.53541853954 -0.196575942039 -0.122032690387 -4.1081083365 4.10810825668 -0.156061266415 0.108695335827 -0.227865754732 4.10493108164 -4.10492864743 0.348238971977 0.370502611283 4.10470562926 -4.10470346665 -3.84288181714 3.84629929976 3.57873710768 -4.10833424983 4.10833373731 -0.068869578553 -4.04653525042 4.04649332111 1.99612294844 -0.164117402159 -0.00526427463284 2.57178767873 0.628344344131 0.0355034514482 -4.07444277434 4.07438734798 -4.00717973093 4.00713979935 -0.663466533623 -0.707989780335 -3.04349865068 -0.665111128343 0.0736870997758 3.77999962952 2.12972277636 -0.544121529876 -0.16248006622 0.0103389618411 4.10793366429 -4.10793311738 0.352700670713 3.62109243227 -4.10555012741 4.10555308589 0.0452776106093 -3.90109561427 3.90237597693 -3.61301644374 -2.95172100181 1.45251090014 0.517999559827 -3.96904057823 3.9689895836 0.136602171929 -2.77998665726 0.0421985554219 1.70340621051 -1.0773445509 0.158676661403 -4.10813125494 4.10813132712 0.461811034686 3.98514035838 -3.9851554456 0.264130953121 -0.184015410396 -0.665797569854 -1.33187181743 -0.295263613964 -4.06530131998 4.06523726396 -4.10745980269 4.1074612271 0.675767117831 -0.67378057011 -0.689688565033 -4.07570810435 4.07565424991 -4.0950384796 4.09501368394 3.33817611526 0.224254684681 0.49054827493 0.076898893632 0.022544120422 0.578217023273 -0.747993183824 -3.41249879522 -0.732512769424 0.0818535513322 4.08419100627 -4.08424136913 0.34193337475 0.39212014104 -3.65132208191 4.10879184866 -4.10879327432 -3.68811147181 0.0223982610054 -2.97186749933 -0.118667307263 -4.1079745572 4.10797495473 0.355994823862 2.56461351814 -4.06815920042 4.0681002636 -4.08105014975 4.08100014118 1.98889110444 -3.75104950875 -1.09103565956 0.154978053511 -0.975239767574 -4.10215113056 4.10214875125 3.46104960476 0.101519861474 -2.16693096504 0.0145612220716 4.10929753695 -4.10929872358 -4.00508991005 4.00510256902 -3.97587240513 3.97572993563 3.73511818417 0.0284293994885 -3.44354249518 0.000166925176278 -2.18132101939 -3.57618724492 0.116449250608 3.25781592739 0.223702552255 0.19174379408 0.167112409447 -4.1087508354 4.10874954276 -4.1068920501 4.10689400578 2.99604985227 0.0748182045917 0.238040841512 3.77792202327 4.09894395538 -4.09895782525 0.0279606475418 -4.10826351812 4.10826303075 0.65160399458 -2.03353624293 0.0755820443169 -3.78001299556 0.350381647669 -0.449752325725 -4.01166085352 4.01167087744 -1.46167508516 1.46985668141 -4.10781057858 4.10781106578 -3.75661575673 3.872090527 -3.8703217181 2.61843549577 0.679124772798 0.0243593279675 2.55902978337 1.20326994052 0.390490682609 -3.70475084312 -0.611023771436 -4.10151369043 4.10150958402 1.87218222932 0.43069273778 4.10888868898 -4.10889026248 4.10925023806 -4.10925160401 4.1089326523 -4.10893373554 0.753041643956 4.10615960914 -4.10615720262 -4.08301751052 4.0829666118 -0.945790975891 3.69708546814 -0.0106626475154 -3.81974597669 3.8211359773 1.07503232492 -1.35265631467 -0.581631621139 0.787945073491 -0.243280114713 0.00143359303034 -1.08437815937 -0.510866719212 -3.03420226414 0.405609750309 -4.10356559058 4.10356587054 -0.00181757192165 -4.09417210928 4.09414411153 3.37141875931 0.609052528939 -0.349676002747 0.0888796818272 3.69958064615 -3.4572051085 0.332117663796 0.63114441489 3.53532166854 0.268488345955 3.90034579768 -3.8996114477 -3.87519454213 3.87743721626 -0.103750004084 4.09695350519 -4.09697418389 -0.835013747158 0.236052336728 2.89849574544 -3.74009790198 -4.10864288668 4.10864167872 0.352590332683 0.014033394623 -0.138093841443 3.65671454474 -0.124299879105 0.292936218749 -0.407728142583 -0.288246828553 -0.183717010429 -2.34453673446 1.29552562407 0.232492146272 1.15633573698 0.124538417822 0.555685661156 -2.11439821288 0.623603836863 -0.876142784688 2.7040057259 -0.606002489064 0.247548147461 -4.06466484698 4.06460877893 -4.0572691977 4.05720897002 -1.02473781369 2.04830580397 0.915226807256 4.00462580167 -4.00462520847 -0.23761586858 4.1062868557 -4.10628447538 3.71431050928 -0.17358173579 0.0847695907933 -2.48821882312 -0.848407240363 -0.0422077082721 0.101578451835 -4.02147494799 4.02143779626 -0.643880796579 0.0257484604587 0.0872481072116 -1.22511320354 -0.156235847257 3.69341189604 0.114894877483 -1.12021027791 1.26526672037 -4.10832867108 4.10832816137 4.10908791305 -4.10908959557 0.270116604999 3.22573894972 -0.66528836549 -4.10734402036 4.10734618756 0.159023911895 0.190632626115 0.348925868875 -0.137923952439 -4.05709779016 4.05703284006 -0.755788876682 0.0716299352091 3.68436338614 1.41724503393 0.453545729288 -0.406548461962 -0.926378274333 3.36728894174 1.22249366152 3.07736174929 1.34406706592 -0.0304987829314 4.10125952822 -4.10126641844 -0.216767597097 -4.09236556463 4.09233450126 -0.687056873672 -0.0149410829802 2.78256487421 0.40442045318 2.35331286305 4.10190823733 -4.10191351744 0.85476835591 -0.00308351541384 0.413572567117 -0.373246164607 4.09603890549 -4.09606323394 1.68472749479 -2.90361082924 0.446712420732 0.748581522116 -4.07922254382 4.07917278417 0.123036458227 -3.91695061414 3.91631004902 1.95635780305 0.123670076288 1.80497006144 1.03308832349 -4.02852481732 4.0284630613 -3.75166069066 -2.87187768915 0.038302813438 0.949890328288 -1.37765366034 -1.72608203063 -0.0368119608747 -4.07106633584 4.07100484963 1.10872036642 0.045613345203 -0.673337309471 3.28053710122 0.618361486131 0.00425649837318 -0.909179254098 0.119089207972 0.212500195103 -3.85091495734 3.85069236806 1.53718600414 -4.10833865572 4.10833819466 0.81089006075 -0.173354121024 -4.10449100988 4.10449259013 -2.00967874338 4.10969427385 -4.10969505088 0.087935192486 -2.8518389279 -1.94443619023 -0.0595389099157 -4.07804128859 4.07799172664 1.07795681492 -0.216004641313 4.10970903227 -4.10970947506 1.05387191761 -0.381129560018 4.10225399376 -4.10225825319 -0.0613710749694 -0.543242496745 -0.576998586519 -3.20147358199 -4.10012318486 4.10011372965 1.82272801179 -3.99876930125 3.99880269372 -0.162694319262 4.00286057291 -4.00291158672 -0.0790861275651 0.943852084778 -0.577724212533 -4.0805043591 4.08045567176 0.916133426919 -0.499430664984 -4.1088692412 4.10886796047 0.132780918851 -0.0089331088806 3.75422439666 3.11151280986 -0.166611676206 -2.05281472107 -4.07973405243 4.07968100549 -0.361463924339 1.38460101783 -4.00099410526 4.00091442712 1.19088512577 0.0588989741679 -0.220901373491 -3.88157861216 3.87709717172 -0.158085405548 4.08755952553 -4.08760795287 -3.78904209866 0.207178983569 3.62883985008 0.0166989777171 -0.0171461356049 1.04581083831 0.555867218319 -0.000178603233259 -0.266775069319 -0.0103503251814 4.10769812312 -4.10769728317 -0.56047158983 4.10909000988 -4.10909121351 3.7369058509 -0.740483763377 0.143208844082 3.61951701305 -4.1038233799 4.10382433035 -0.096232605045 -0.700581998237 0.195175293589 -4.0322819717 4.03222053379 0.705624176013 -3.75631212206 0.198086160862 -0.346518112276 -0.0428369487241 -0.0697154444139 0.468122937525 -4.0988738412 4.09886075308 -4.01886827946 4.0188307612 0.226168361604 -3.95006494808 3.95043018864 -3.13481379761 0.774723023614 -1.5113329977 -4.03731017427 4.03725079773 -0.651591205302 -0.0563594480911 -1.2446573112 3.28665396151 -4.04901216396 4.04895047834 0.212129723092 0.468987904398 3.88971498597 -3.88834715346 -0.205781536614 2.77508799344 -4.10807059097 4.10807047752 3.65246073917 0.0193498229249 -0.191780994217 4.1006198791 -4.1006292547 0.25647212085 -1.15447877207 -3.20171814461 -0.318028998969 4.09479433558 -4.09482237065 0.224926250237 0.134464172957 -0.0632896469952 0.816375801288 2.37155491439 0.246599478065 -0.134990954274 -0.023220832117 4.10923738698 -4.10923885657 1.33930744004 4.07808593431 -4.0781435025 -4.10638304701 4.10638646135 0.361341291757 0.448268048977 0.689620907001 1.41475275776 3.09519169231 1.57790179645 -4.10534531132 4.10534848656 -0.557539567916 -0.18189545602 -4.10067134564 4.10066342335 4.10968441627 -4.1096848381 2.87211951085 4.09578332483 -4.09580712112 -3.9435534363 3.94360136699 0.272125663775 0.0942321411709 -0.903773648859 -3.54274178128 1.11612848693 3.00936830381 0.913572186285 0.328907108458 1.43480972582 -0.0203501738589 -0.0987162770016 0.278816312251 -2.54522540522 -4.1075364801 4.10753768785 -3.62413984239 -0.453863434835 0.252130273866 -0.133790397095 -4.06356437151 4.0635014001 -1.48117462512 -4.0555078413 4.05545648938 0.104246335491 0.832989375197 -0.335978591741 -0.171285839115 -0.438087728221 3.45979843767 0.1077482414 3.87130801023 -3.86985142204 -0.194481824331 -0.210566411666 0.429126898818 -0.516661364016 -4.10752606803 4.10752711401 1.03759766309 0.228138301517 2.6119487526 -0.0545186852616 -0.0946751074264 0.119513243809 -2.70770893108 0.224750577816 0.0349871168683 -0.310112539115 -0.0438494960698 -3.50104388435 1.24826828751 3.9840312327 -3.98398751584 -0.280920641762 0.205374510548 -3.65581404669 -3.28409938619 -4.1032141919 4.10321395026 0.554459265527 -4.06903838941 4.06897628932 3.15254544778 1.13368937685 0.517272251673 0.459688733033 3.78464707768 -4.10684042027 4.10684339408 0.653421806065 -0.514993895546 0.656674987379 -0.522990370132 -4.00632644125 4.00632564723 -0.612508483734 1.29163276602 0.649871898972 3.99044790161 -3.99040991845 0.125226652646 -0.122230845477 0.164266772922 0.836263953445 0.250288280458 0.134280443719 0.392387928029 -3.92085722297 3.92149741937 4.0911868877 -4.09122389548 -3.41085502608 -0.0205158630189 -3.98911152425 3.98911137845 0.420602256053 4.10933503942 -4.10933654429 -4.060253456 4.06019847803 -4.10732636406 4.10732775277 1.85574904361 -0.309021849037 0.201312754192 -4.10678519659 4.10678830887 -4.10867370698 4.10867246109 0.105289915904 -3.43059877331 -0.0667875303535 -3.08674226211 -4.10993216945 4.10993201273 0.997992069254 4.10876836515 -4.10876955539 0.650040423517 -3.90405960464 3.9027546736 4.10718555095 -4.10718388272 0.646590577483 -0.0467684464213 -3.69356815342 0.509823968278 -4.10722909321 4.10723125759 0.147611947941 -4.09626373853 4.09624187592 -4.00887954879 4.00882277456 -1.0649909004 -0.242670861845 -0.616187977074 -0.141883154106 -4.10364718215 4.10364801401 -4.0582150531 4.05815948144 1.06366946132 -4.10680625926 4.10680907783 -1.09413408381 4.10953520071 -4.10953636396 -0.151768534259 -0.366913931621 3.45482112468 0.104194143065 0.84979370082 -4.10791888962 4.10791924938 3.72566885978 0.576889951075 2.97733225524 -0.451691947009 -0.920431027936 -4.00118347568 4.00121900159 -0.248385106126 -0.478173618073 -0.141534839068 -4.0182192035 4.01821555566 -0.125620543149 -0.196756061483 -0.101391538333 1.81254558799 1.80320485601 0.867553098243 -4.10591378982 4.10591726681 -1.08986348943 0.741360231681 0.950573327074 0.29662144097 -0.0102641696346 -0.183671218893 -0.418413101293 -0.583744139432 -3.87956574678 3.88133389656 0.00434962607651 3.65291980079 -4.08767322391 4.08763044753 1.1301064132 0.213743696468 -4.09193871015 4.09190546573 -0.978249470535 0.631649575173 -0.856610384038 0.121058100137 -4.0716536453 4.07160201818 -0.383651236325 -4.08891552841 4.0888762003 2.47848619509 -0.161501397666 3.72389441007 -0.0387437381043 4.10928792285 -4.10928890601 -0.00512112749926 -0.205781643216 -3.70763083533 3.68814238079 -0.358571281471 -1.09270473534 0.313543299486 0.455889629361 1.02673295111 -0.252857297986 -0.442940021687 -4.00213391215 4.00210907034 0.362440657701 -0.187118692383 -3.67641609213 3.43549116653 4.09497882096 -4.09500500567 -3.92089647752 3.92099620473 0.16576285504 4.10267666751 -4.10267928056 -4.0535675446 4.05350453876 -4.10713352457 4.1071352547 -3.99980315548 3.99973722904 -0.0848424985407 -0.877490071714 3.71676553716 -0.189926887179 0.881736618482 -3.14036181373 0.00579324151315 4.10909437596 -4.10909602653 -3.70588395978 -0.376188501452 0.836576400166 -3.78287280705 0.659223785797 0.101052388958 -0.148156258854 -0.111644578681 -4.05280361576 4.05275698902 0.637711318071 -0.136518744727 -1.51096266863 0.192897652402 3.79847996028 -3.89914000839 3.90035704152 1.63703247309 -0.100764704889 0.492942608909 -3.04841553695 -1.88163876892 -0.811988270667 0.163159604975 3.71757303861 4.10917328375 -4.10917498138 -2.5665872867 -0.246773860746 -4.03045931159 4.03043447661 0.323788386323 -1.00319906258 -0.0921454643578 -4.05970088322 4.0596495012 -3.97558389621 3.97573014864 -4.10667580899 4.10667884539 3.09715721504 0.121925510049 -0.398908211637 0.0560529476602 0.0124824321757 -0.61017834836 -3.62896541208 -3.87131188405 3.87107078843 -4.08821915068 4.08817856595 1.64297702862 0.138916125767 1.96493308895 -3.71609282616 -4.05424840326 4.05419086572 4.10640706522 -4.10640467997 4.10650163782 -4.10649951813 1.88868216731 0.677649492321 -3.35742012803 4.10945733184 -4.10945868377 0.216939125588 -0.636016171267 -4.10438793172 4.10438995223 -0.0994143543188 -4.10950417663 4.10950327517 2.88244096596 -4.08976930845 4.08973092719 0.464948875803 -3.96791565394 3.9677609303 -2.53740043625 0.561484005187 -0.999151595958 0.248248297943 -4.08842012458 4.08838038932 -0.161091201206 0.911324854623 0.378075482409 -0.163809640356 -4.09565651299 4.0956327981 -0.308444705091 -0.192857055321 1.56454863585 -0.650403424268 3.14414617058 -0.651113066216 -0.146876991989 -3.33983602467 -0.542265093542 1.07346041423 -4.10762041573 4.10762192013 3.86050464138 -3.85809602171 -4.08186768391 4.08182019261 -1.42671056792 3.45721777377 -0.483712315573 -0.122748873286 0.533138898582 0.238886802434 0.373675574392 -4.10866203613 4.10866076889 0.189432543821 4.10694299948 -4.10694104744 -2.66740641871 -0.293141600086 4.10073345468 -4.10074262598 -4.10164227532 4.10163774033 1.11549352626 0.0282165666715 0.37539717285 0.672614060421 1.92033680288 4.08559058661 -4.08563967231 -3.73165892402 0.173549953338 -4.08999945747 4.08996289258 0.820139991429 0.307401427076 -0.0964007602805 0.46939698423 -3.58197623565 -0.0201384212141 3.78333211147 -0.189213994957 3.7377956319 0.165356714077 -4.07098880258 4.07093216517 -3.4458644719 -1.05147814938 -4.10398822764 4.10398911944 1.08372284541 -3.21825587664 -4.10411273818 4.1041143721 -0.282087982409 -0.37770660925 -2.94258145847 -4.08362023592 4.08357175125 4.10963068917 -4.10963128785 0.449298902904 0.494393270167 -0.080816098765 3.77621721006 -3.86895987493 3.87076796408 4.10929232371 -4.10929385031 -0.181747981971 3.55757861333 -1.36963823936 -3.94497965823 3.94525699342 4.10922415604 -4.10922512602 0.362402257498 -3.95178857202 3.95152446001 -0.321961894957 0.549546826701 -3.73592087781 -4.10258035613 4.10257848591 -4.0750324898 4.07498054747 0.366466418649 -0.0303994564944 -4.0509763243 4.05093030989 0.399649174623 -4.09409911921 4.09407084322 4.10661010728 -4.10660788499 -0.451773214871 1.46547745332 -4.07609636432 4.07604587215 -3.75009304151 0.438371854629 3.70484645726 3.47565388301 -1.24177115294 0.234327828978 -0.735312424148 -3.68909938169 0.29588295876 -4.09211568484 4.09207766088 -1.17093380903 -4.10506963009 4.10507179017 -3.89003039438 3.89164278314 -3.83238857882 3.83811926709 -0.00478777987408 -4.08860615422 4.08856697093 -4.03308830627 4.0330626809 1.72894155659 1.61899216697 4.10858480851 -4.10858533678 -0.391163023547 -0.615800448455 -0.974050864701 -0.183696316091 0.22731589702 2.7286037148 1.03378626334 3.94352219311 -3.9432413916 -3.47153208794 -1.15741624537 0.355922339345 -2.02952541588 -0.805796317973 0.223324021758 0.200355614746 -0.000995949847243 -3.9234028679 3.92414618175 -1.20226737821 3.91697919817 -3.91646476904 0.236368439534 -0.0456408642444 0.24432912273 -0.474582435792 0.449047799453 0.054652612047 0.394472699086 -0.195145412929 3.15692736847 3.44931715163 -1.78090178209 -0.660688227591 -1.05024982264 -0.191845841236 -0.159711568047 -3.42399952169 -4.1004895181 4.10048019496 2.03267058777 -4.03840974384 4.0383519352 1.18261607314 -3.56574875782 0.650155554614 3.65380703817 3.67661558633 -3.99364625419 3.99358880359 0.670412657224 0.391212624448 -0.541643726022 -4.00924639308 4.00918630058 -0.844266164866 1.09153992391 3.7002997446 3.34648156169 -0.0153950793118 -0.325324729761 -3.08346489894 -0.0135973084307 -1.04068980203 1.12299064725 0.00625467420249 -0.897391792664 -4.05846056443 4.05839606132 0.547153052472 3.84149566571 -3.83903886643 -4.10363820973 4.10363854699 -4.10476489011 4.10476676912 0.24724314071 -4.10818487879 4.10818451376 -0.721660013099 -0.991115919503 -4.03304911322 4.03299576079 0.200880731113 -0.389487477128 -4.07672700224 4.07666941463 4.10762794603 -4.10762690701 -3.7930854054 -0.0438679371884 -4.09912788306 4.09911561564 -3.5220324234 0.229110470807 -1.23537403731 -0.245912996953 -4.09321000374 4.09317946532 0.19011746898 4.09774678694 -4.09776490174 1.29104634516 0.0214034298974 -0.0548873234663 0.673710509357 0.326594101119 -3.9221982609 3.92174801782 -0.93643533112 -3.99644529802 3.9964979343 2.03692056024 -3.94110312593 3.94156893006 -0.654866261939 -4.10469810613 4.10470000688 3.51520901057 -3.97943806254 3.97932844003 -0.133716418661 0.223146066232 -4.10295693638 4.10295552308 0.12390788738 -3.67983376774 1.11757345048 2.01806012722 1.82298039835 0.301961457797 -3.48461527979 -0.0168015884331 0.735543378314 3.59347537281 0.958376356873 0.27759427153 1.67643767955 -0.560824557394 0.242155311512 -4.10342713836 4.10342713271 -0.360076188973 0.126960778417 1.18207392439 -0.126698563109 3.68742495306 -4.10825004367 4.10824976872 0.483073660983 -0.364903025911 -4.10962481095 4.10962411371 -0.709761025262 -0.0395549568992 4.1089154892 -4.10891696618 -4.10405305305 4.10405402641 0.23430891675 -3.60056886818 -0.094281437504 -0.0457333284303 -4.09350250648 4.09346942171 0.635685976437 -3.69673321485 -0.0768703352953 0.28909684922 0.900511986412 -3.36332040856 0.356420696001 1.16279825542 -0.0938189918675 -0.11650235746 -4.09197751349 4.09194472266 -4.08677736903 4.08673475333 -3.74744666394 -2.17328805642 0.187578360561 -4.09862167621 4.09860762135 -4.10480966617 4.10481233877 -0.403141078942 0.824774193536 -0.319279235522 -0.31445028302 4.10863635929 -4.10863727773 1.16787603546 4.10122516712 -4.10123281327 -0.49479534709 -4.07670939444 4.07665841494 -3.2095589977 -3.78114155187 -0.806065457422 -2.0213830151 -3.01433905235 -3.89640670553 3.89345979894 -4.08585630154 4.08581066333 4.10945314633 -4.1094538706 -0.667748786414 -0.48038257553 3.07997917595 -0.0229185526444 0.508905734474 0.549996593827 4.1095715135 -4.10957206423 -0.437229076291 -2.93675113934 -0.169575707488 4.10624992101 -4.10624757772 -4.10111016947 4.10110385217 -0.1352219377 -1.64643570987 0.125165373352 0.848422565389 -0.0140990606398 -4.10719447618 4.1071969932 -1.59314887963 0.567819866192 -4.10615693542 4.10616019582 0.113856633335 -1.23470094097 -4.10955221084 4.10955114485 -4.10755882596 4.10756043428 1.20489689191 -0.620096070399 -0.697548797957 -0.911243084801 0.0518365293836 -0.679927827091 0.0972629663847 3.31724061824 0.125222832604 -3.79631541655 -1.43084569185 -2.25876547731 -3.96361437013 3.96338548608 0.182207707472 1.03485497894 -4.06107067377 4.06100660524 0.303658255584 -3.72234109629 -0.155685706595 3.94203731244 -3.94182617251 -3.76848989783 0.712624426674 -3.25650435681 -4.02848837243 4.02846883821 -1.37928948146 0.487943687518 0.172444111313 0.152965326944 -2.42795862946 -0.753518362647 4.1009954881 -4.10100363346 -0.159987814742 0.535363056051 -4.10223118611 4.10222903446 -0.216629607376 -4.04170691395 4.04165543827 0.0248266996614 0.912715123361 0.169743935175 -0.260633715885 -0.247808351606 0.663052233144 -0.129022278565 -3.11735495144 -0.0307088616376 0.691284761722 4.10872036638 -4.10872171795 -0.00315455187333 0.739242263708 0.318121009234 3.31987077031 0.0313337132382 -3.94625421362 3.94658880153 -4.00699687105 4.00692631874 1.2913792168 4.10698175076 -4.1069798421 -3.75674006156 3.83950291688 -3.83384429914 3.43685733277 -1.04040545236 0.160763268555 -4.05949213557 4.05943866082 -0.812236298929 0.151826869884 0.179807107683 -3.92764621971 3.92659384557 -4.08995930649 4.08992187024 -0.342671349873 -3.11259047143 -0.338824034091 -3.41783289868 -0.0811907622638 4.10892815815 -4.10892968882 0.392536922346 -0.722847528573 -0.00939066899591 3.2058208037 4.10828254519 -4.10828255943 -1.2002944072 -0.25137814435 3.196347593 -3.98389311998 3.98381771859 4.10941825636 -4.10941908449 0.484842068581 1.75973310501 0.195511543932 -4.08018351876 4.08013498139 -0.00746021152056 -4.10171759814 4.10171323212 -0.790334025044 -3.77821114172 -0.23604790082 -0.029455105672 1.33928581815 0.531508693834 -4.10301316917 4.10301213181 -0.839686381516 -4.10371672643 4.1037177337 -0.0646055442344 -3.66860480183 3.88652735928 -3.88537678626 2.86118107433 0.757738368339 0.67250354911 0.27862348556 1.11742359324 -0.175102987776 -4.05159602642 4.05153316032 -4.09033039231 4.09029361827 -1.58974839824 1.58472495452 -0.749460051605 -0.0310577105672 -0.220618503568 1.50739095504 0.658878815733 -4.04791052515 4.0478494375 1.20898619459 -2.79070322063 -0.908989975586 0.789561994504 -3.88952764084 3.89063040032 1.10277963244 -0.350710215759 3.54341683515 3.63675986907 -1.93753211631 3.18617005634 2.44610418079 -4.03307421681 4.03301445205 0.486245984406 -3.78556849982 1.12513838998 -0.188834094541 0.260715120257 0.320309474509 -3.98483291266 3.98483991677 -0.012685164594 -3.62070303154 0.417553098138 -0.108215039291 4.1008814988 -4.10089033443 -3.14692111937 0.340517664486 0.689691125382 -4.09295765418 4.092927947 -4.09432806285 4.09430172868 -0.188697895166 4.10716821608 -4.1071664309 0.208393602155 1.00176854217 -0.221042213869 0.575655118959 -4.10814656573 4.10814660408 -3.97715379412 3.97718851676 0.416287296625 0.532713021625 3.50869281523 0.113831214137 -0.352258930675 2.41598390513 2.46514245716 -4.07534977229 4.07529729902 -4.09908305208 4.09907044414 -3.63597749498 0.0840809002417 -3.50853727759 4.10694730486 -4.10694536326 0.20228481794 -0.157156062923 -4.07561541446 4.07556451606 0.631343781867 0.0685543481742 -0.922230172421 -4.01648241161 4.01647778449 2.84968437085 -0.263066881344 -4.06382271701 4.06376140968 3.88486350282 -3.88383457267 4.10873578659 -4.10873668453 4.09219152274 -4.09222622458 -3.45365141277 1.01044067028 3.22243168775 1.32556411042 0.240530562162 -0.302170953644 2.25838654132 0.298302241183 4.09595144946 -4.09597602615 -4.10360385303 4.10360405338 -3.86333907954 3.86490213675 -4.10704133826 4.10704412628 0.168060024284 -0.662635995987 2.99555335992 0.275712395388 -0.362350643969 -0.732930512352 -3.87825827905 3.88033381528 3.72307397053 -4.10983081933 4.10983060172 -0.378159617638 -0.0581448596662 0.364183728122 -4.09698403369 4.0969646845 3.71654138653 -0.44710937861 3.77378080633 3.51724242323 0.471082570755 -0.402947083773 0.662373296042 1.8951870265 -0.327700101197 2.9621068266 -0.286581427331 -0.791895715682 -4.10310143454 4.10310122671 3.76332960101 3.7594939381 -4.10762463507 4.10762597122 -0.0725359243817 0.262331766781 -3.99839798357 3.99841025657 -0.307449878531 0.829183218173 -0.136577513408 3.7462006589 -4.10793982452 4.10794001934 -3.77113585286 0.0571787845513 -3.32668014989 3.15899721542 -0.164381030203 -1.22626144474 0.503681885378 -0.894723337072 0.534264748751 1.57832603814 -0.330991679155 4.10870621057 -4.10870712956 4.08858425434 -4.08862649102 -3.57305792629 -3.25822231703 -3.74996190735 -0.40798372719 -4.10086665086 4.1008590981 -0.316591661772 -3.81408367553 -4.06440562868 4.06434596719 4.1051315976 -4.10512912698 -0.0238755579692 -2.60643252348 -4.06096409488 4.06089964491 -1.67575830474 -4.08757469413 4.08753274211 3.75622385561 4.10738127132 -4.10737981938 -2.42031690003 -0.1056462569 -3.81661684063 -0.0133484543295 0.0390685139218 -4.08841701218 4.08837721814 -2.6519097181 -4.06307427207 4.06302295425 0.219078053024 3.18953131776 -0.871067809711 0.123943432352 -1.43608812028 -0.738651220943 0.0698019194107 -0.040578700021 -3.39157414264 1.09068886825 0.929381337584 1.18392983324 4.10112359927 -4.10113079157 -0.135889020012 4.10897095283 -4.10897246964 0.2925904377 -4.10100583957 4.10099904376 -2.93967973276 0.0747905809464 -4.09873912244 4.09872401237 0.844341216796 3.73751872562 -1.68801337676 -0.271721661577 -4.10993201715 4.10993192451 -4.07298906257 4.07293459697 -2.47960634906 -4.10529772701 4.10530030516 0.869986560932 -0.211756839513 -0.144555623706 -0.124062118989 0.424565868928 -0.484877678657 -3.49538135651 -0.0300444663396 0.0425258385937 0.312953874042 -3.05927456292 3.62137952131 -4.064392205 4.06432832257 -4.08223732779 4.08218915435 -4.03442095474 4.03437821619 0.05275347051 1.90974837453 -3.61263281862 1.18230926724 4.10864341057 -4.10864437905 3.48766466568 -0.0524754989247 4.10847765123 -4.1084782515 0.520167105233 -3.33626693774 -4.10307470387 4.10307389087 0.00328010439029 -4.0906077965 4.09057172734 -3.93928097731 3.93973881817 0.076838627654 1.02724100382 -1.35259489445 -3.58133047159 -0.279762513446 4.10003928808 -4.10005108731 -3.12297363107 -4.10868110216 4.10867985749 3.09939387218 -0.291617220916 -3.8861517243 3.88716389174 -0.717801154902 -0.232204829925 -3.45548832829 -4.10840238753 4.10840166094 -3.83466993677 3.83844335228 1.82007609824 -2.70433227651 0.630283665981 -3.96335527318 3.96341317654 0.414927532626 3.70940171461 0.561884817306 -1.42204349751 1.25302251896 -4.1079095149 4.10790976739 2.93811049274 0.112228794632 0.394732375555 0.333631390983 -4.01244938918 4.01238309057 -0.103030159473 -0.258776182208 0.147211351736 0.46757788639 0.158805664357 0.67271353164 -0.0975335173012 2.81021702168 -0.24390655609 0.444267879686 3.66382999276 -0.350939726785 -0.112746968267 0.395240023649 0.426696363976 -0.797145399798 0.671883648434 0.814353800279 -0.953195929792 -4.07270319468 4.07265139525 0.220549110604 -4.09105020978 4.09101493554 4.1043221109 -4.10432028262 -2.49990417052 -3.40633237297 -3.79379533666 3.7939304012 0.0785767591004 2.4310801828 -1.88431506224 -4.04405165747 4.04399289954 -2.39777431486 0.492614735804 0.185290731347 1.53987173373 -4.0493950092 4.04935119415 -1.50502570227 3.46068787467 0.108544366009 -0.147846481883 -4.07657462726 4.07651637068 -3.67172730565 -0.3153635731 0.0177367324128 -4.10211827953 4.10211519487 0.339659595855 -0.35127766953 -3.33216447123 -4.10126898015 4.10126315566 -0.589094600837 -3.53500374801 0.698550249152 3.64949644623 -4.05923192882 4.05916655459 -0.352251268496 1.18609140308 4.10945057758 -4.10945178995 -0.440332904551 0.0513424037921 -0.312628868801 -0.724083312213 -4.10602792487 4.10603062132 0.375692858622 -4.10561583588 4.10561915471 0.480906024881 -0.0159728520747 1.06190252861 -3.99495677558 3.99492139909 -4.0860302141 4.08598509231 2.94146349795 -4.10954227528 4.10954123306 -0.387571868396 1.55163978895 0.349935679014 3.92971610898 -3.92943825929 -0.261885174157 -3.94043488145 3.94029293135 -4.10254122937 4.10253989438 -4.10452911459 4.10453080016 3.26466626722 -0.716727645154 0.415165241673 3.76742997143 0.684874983787 -0.200999376126 -1.41971999702 -0.747852663382 0.512636379132 4.10849136124 -4.10849208406 -0.891297272448 3.46884642872 -0.790569791701 2.15617485378 -0.208441516203 -4.09526229105 4.09523728711 1.27330092387 0.123407963587 -1.88000342827 4.07403887071 -4.07409931517 3.24673301839 -0.2927158021 0.0679665387154 -1.22594076697 0.451291314039 3.41730282991 -0.381858184118 -0.434610509453 -0.170013122696 -0.696117576804 0.775419121867 -3.68479962674 -2.17198689036 0.0726011030098 1.4818257308 -0.00558630743342 -3.72594868635 -4.1098843363 4.10988404565 -0.701615828029 -1.396818684 -0.795742699841 0.0469261116903 0.0485103064142 1.6588277329 0.202729694264 -0.00656591275814 0.953243740494 -4.10841160299 4.10841084468 0.367616827495 1.38814018718 -4.06581201342 4.06575154066 -4.01780914583 4.01775056228 0.435325842206 0.222520824574 -4.03193642888 4.0318906197 3.02191006563 -1.58638681087 -0.0100645332335 1.49592411195 -3.54811389703 1.30331572532 0.346059972713 0.0361435723874 4.10886082791 -4.10886226564 0.738326195315 -0.29031032781 -2.94938466375 -3.81755789273 -0.216939921666 -3.978354899 3.97847184075 -4.10245457827 4.1024519765 -0.276354232944 -1.38926279853 -1.66651230675 0.0881111089004 3.65061227866 -0.116616739488 0.394260400563 0.549247277425 -0.412841762247 0.110738502477 -0.861501906265 0.175143557576 -1.5993330638 -0.671432308484 -4.01075364656 4.01071986418 0.999892083172 4.09266958473 -4.09270366536 -4.09515225437 4.09512817695 -0.460091370312 -3.25360805259 -2.81011634183 -3.50119160056 -0.318023632869 -0.22164518488 0.124567563578 -3.84537595835 3.84829277411 -1.32849496749 2.21730154962 3.45969331977 1.24837078745 0.842758369059 -0.0514742866726 -2.70209132951 -4.1068453729 4.10684737204 -3.95761961012 3.95786773255 0.695644215287 -3.926514048 3.92714055557 0.307559685383 -0.103667944838 1.51278054409 2.87634068106 0.044339177706 -0.384822914962 -3.96318650847 3.96336314856 -2.9924024394 1.17104854234 -2.65272486393 -0.19323915709 -0.396266306034 -0.77482041794 3.23164953512 -4.01581742866 4.01577095674 -1.1306918273 -0.222416127409 0.295972956018 -4.09978431464 4.09977430789 -0.154126622001 -0.6409083398 -3.66477651769 -0.624226528878 0.0184603863711 1.04985847418 -1.35263447558 3.48118530496 3.78414284832 -1.49139590074 3.75544747329 -1.93946893179 0.689510995586 2.82941633183 0.587534058474 3.62889060402 0.821396991037 0.720156530528 -0.307879388098 -3.52078309703 0.403067225812 -3.70717758103 0.254080998081 -3.61273773428 3.09537332951 0.479191613642 -4.10707087716 4.10707264017 2.79716249327 3.6945400112 -4.09318999332 4.09315988343 1.14884991754 4.10979264691 -4.1097931773 3.72537646281 -4.108048841 4.10804917334 0.395105918127 -0.0978001677791 -3.3184375028 0.0681756656687 -0.202040675563 -0.168620633133 0.082334291021 -0.818596181931 0.877823208714 -0.324060901148 -0.96278819022 1.41804227511 -3.77132824291 0.416744529036 0.287953535345 3.70225639483 -4.08196566076 4.08191478293 -0.351087426035 4.10928437465 -4.10928598549 -0.144586024212 -1.90927779054 0.98600251825 -3.67431786518 4.10629725938 -4.10629488244 -4.0154725215 4.01541266727 0.231509065391 -1.1063853819 -0.159286373067 -0.172227414764 -0.290105000092 -2.58851161754 -4.1096569343 4.10965613426 0.564739112419 -0.851343451382 -1.69514620591 0.322846123001 -2.04916398722 3.53712887216 3.9734472906 -3.97334995935 0.672336796026 -1.26703564113 -0.178580482725 -4.07380206653 4.07375100316 0.0674338603724 -0.157441284904 4.10971498804 -4.10971536071 -4.03735659542 4.03732531805 -0.13050818421 0.22567809249 0.272380209381 -0.205103153759 0.673362072208 0.967913303111 1.19805463412 -4.02060038453 4.02055576336 -0.50179623009 -3.34334146035 2.82779962573 -3.49537691802 1.18489615746 -0.148012750091 -0.976883748626 -4.09885839023 4.09884340356 -0.0817421002604 3.1677938205 3.93315125013 -3.9330797348 0.174978659431 4.07531486892 -4.07537480973 -3.24116803521 -4.10524054275 4.10524279691 -0.0109251596944 3.31266152255 0.369641705802 -4.03477672561 4.03472659099 0.286067127432 -4.03985815892 4.03981327579 -1.68888591257 0.0964325787279 1.6012904402 -3.98295006004 3.98305901575 -4.10337065086 4.10337097117 -1.35640779308 -3.72098245553 0.0344690959139 0.539150327097 0.324303093462 3.65250330902 -3.37773348562 -3.66261304312 -4.08990551496 4.08986827582 -0.447443622911 -3.7239210088 0.788363621798 3.8169941946 -0.240611491879 1.5722422901 -3.6776016544 -3.93246077369 3.93306177823 0.60276160088 -4.1098565042 4.10985628724 -3.60178493938 1.29994928947 3.47297131985 -0.816021809902 -4.00976091791 4.00976915427 1.48542727178 -1.60471877889 0.493146183873 0.141621213938 -4.10844139936 4.10844044064 0.328776827601 1.15896320192 2.88759134862 0.10363686527 3.77181501744 -1.2033238663 -1.74198781466 -4.10642202803 4.10642522955 -0.245229631178 0.713246847701 0.121253422842 1.32869201018 -3.96529003094 3.96512085235 -3.42287806673 0.961069759327 -4.09015608601 4.09011960816 -0.117475375532 -0.382296449869 4.09292155659 -4.09295312941 0.851045199879 -4.07084564165 4.07078996063 -3.86818095988 3.87057065263 0.445504886006 3.78279927718 -4.10549226942 4.1054948565 -0.256653888479 4.10953900218 -4.10953961894 -0.177963614275 0.175227922345 0.274494573274 -3.92887982173 3.92861122447 0.345026350538 -3.66618604493 -0.0511387611601 0.820624406867 1.37707321867 0.509413428191 -0.180509800924 -2.1986724248 0.107001645993 0.20745356973 -0.0406732872544 -4.08116869821 4.08111809681 4.10489979053 -4.10489755142 -1.3112959981 -0.128360559648 -1.2968459931 -0.403562715097 -1.34167435573 -0.276571782596 0.0241285952409 0.338711070268 0.380306616436 3.17604387407 -4.10778724802 4.10778812763 0.332105268995 0.144744439792 4.09055961908 -4.09059754203 -3.31923780031 -0.527756085032 3.56615468917 4.10720109742 -4.10719933718 -1.5239537826 1.64815506132 -0.337636743358 -0.0986699154679 1.42565289624 0.0885069573936 -0.270077110713 -4.10995960885 4.10995950383 -4.10251650111 4.10251432884 -1.10774278899 -2.95916312438 0.79049789917 4.1093679702 -4.10936875949 0.425079524234 0.757232731926 0.517830138278 -2.62648270743 -0.969676547707 -0.117313431491 0.0989701404495 2.32318056477 0.195632694223 -3.8157970405 0.272587625437 -0.731951023923 4.1097017099 -4.10970246596 -4.09058540763 4.09054990296 2.43735651997 0.23669912517 1.36561730283 -1.08555034544 0.715431417939 3.05117889262 0.723737655918 1.45249589439 -0.00831566969529 3.20414366746 -4.04401510931 4.04395554106 2.51422721414 1.57723646905 -4.09782253634 4.09780581725 -1.74038104151 -0.935256767091 0.104744683389 1.61316358259 3.4494217209 -0.839544766977 -0.27305192309 3.52668319571 0.268398177638 -0.00726922459652 3.76895762008 0.269061086733 -1.93292972939 -0.752272248672 -0.491917748203 -2.25584812744 0.0267677836624 -3.37280103678 0.138904988405 0.386193980127 3.57759137276 -0.471243553517 -3.90592411254 3.90684712094 1.21729589238 -4.10303003255 4.10302967674 3.74210876294 -1.55615435228 -4.08567282547 4.0856284207 0.416895136965 -3.98622192603 3.98619992376 0.672370865527 3.50875115752 -1.15737205257 -3.32269598096 -3.07375975993 2.78975410482 -4.01984433227 4.01979063054 -0.13114723599 4.10678579913 -4.10678378726 -2.05027136423 -3.50337201439 -0.309946141042 -4.10822535062 4.10822492849 -3.36960091935 -0.708853137655 0.159179530711 -4.10270565813 4.10270399102 -1.00483711377 2.56420311442 0.0969587257103 4.10885873761 -4.10886019811 -3.9404590244 3.94026914354 -3.85952624104 3.86244601249 -0.0101490376057 0.270936449827 4.10933815322 -4.10933953872 -0.28328816438 0.048541038804 3.75756562562 1.75575435246 -0.337631597869 -0.0611049201557 -3.03638253626 1.27997501595 -4.09445467736 4.09442806364 1.22344798831 0.0034589689012 0.0214158935344 -3.16164657248 -3.65740421952 1.93881333816 -4.09182688898 4.09179413026 0.147852076489 -1.35570714558 -1.20624232697 -3.676814093 -0.830442424878 -0.0641707825793 3.63753619363 -0.0355172755429 -1.14136279441 -0.552910523359 0.73828923106 2.19894082445 -2.33280405231 0.173172865102 -0.0257157794336 0.942594167235 -0.450581349208 0.103505705125 0.185307344942 0.270989332056 0.0229648678796 3.552551378 3.35120097922 -4.10994318263 4.10994310803 4.10540590193 -4.10540334214 3.3692044021 0.0147276784995 -3.58378085213 -1.10277073143 -3.53081184986 -1.12812973087 -0.0756693960554 2.86402554657 3.95770564951 -3.95747691014 0.721464371638 -0.848297310181 -0.472446669088 0.600618968394 -0.244582025929 3.76443397626 3.8016561507 1.69432418982 0.108853007522 3.61434207808 3.21117704413 -3.28751607155 0.190363252372 1.0471949975 -1.3618544553 0.217525665605 3.27993470276 0.273891236178 -3.92542720891 3.92517348899 0.745511782769 -1.49758123947 -4.08926640317 4.08922770162 -3.68937851394 4.09332108346 -4.09335263029 -0.190619108615 -3.85794685549 3.86070486023 -0.0572791177641 -0.749927249459 -0.0538901872348 -0.479945970348 -4.07297223263 4.07291841566 -2.99988144686 0.207817203299 0.745447524602 4.108489611 -4.10849043387 -0.956712933681 -2.31530916383 0.252300225549 4.10920637632 -4.10920794456 0.770361320343 -0.660170453877 -4.03365098995 4.03360424872 0.0750248804628 4.10965738321 -4.10965786506 0.130285735149 -0.629959729184 -4.07456482584 4.07450674336 1.04628529784 4.10962482953 -4.10962581163 1.19704073371 -4.10774311713 4.10774380104 -1.06479740888 3.75553868592 -0.302683344634 -0.332818098563 -4.06682542294 4.06676239126 0.185667160144 -1.41332983489 0.793962184183 4.08516463573 -4.08521745402 0.977675954105 0.138267473873 -3.34876215764 -0.728587736608 -0.908489310484 0.515864225589 0.180409703519 -0.227685596904 0.540709519776 -3.58265593867 -3.98855400282 3.98859803792 4.09376221149 -4.09379303951 1.0481082455 -3.68597820144 -0.463467455599 4.1085951308 -4.10859580721 -0.744064139581 -0.284374039985 0.288026952498 0.222682604769 3.92616437105 -3.9258925934 -0.567143172232 1.64967034072 3.1414633332 0.779562002789 1.00788081872 -0.28433170673 0.702690473943 -4.09354343943 4.0935136204 0.471925552254 0.0518065414239 -1.02624253141 0.709093813939 2.79523837103 -0.425996533128 -3.73764865637 0.670829205669 1.55055698678 0.0854857536342 -4.10983700486 4.1098367953 -2.81652504754 -0.991590872513 -3.72017295784 3.8237265494 -0.33471307827 -4.1060752358 4.10607862406 0.161412686434 4.10874664256 -4.10874747927 0.841561501264 -0.477911124779 -3.63609061945 0.421905948047 0.130235064816 -1.34476080656 -3.27672880284 -0.276653386962 0.957552015065 0.0310048817095 -1.45120510823 0.0750237171729 0.247924140256 -0.35354935559 -4.0967133153 4.09669293822 0.721191675199 -3.00123584458 -4.10838878075 4.10838802321 -4.03955963374 4.03952311906 4.10655636228 -4.10655414137 -3.63109162548 0.735436269297 -0.191369035505 0.0836406476741 -3.32212574907 0.257333919861 0.473774102411 0.655728910438 -4.10486065759 4.10486265032 4.01126460587 -4.01128219485 3.74405491985 0.720270826459 1.48145786196 -0.475485000746 3.48488498544 -3.68787297789 -0.694857205436 -0.236987896792 -0.0807189688792 3.49612397091 4.10733057662 -4.10732885205 4.09018199884 -4.09022477541 -1.42673908016 0.621780507704 -0.0762480348622 -3.49026185964 4.10928655538 -4.10928804075 4.1087801477 -4.10878124925 -3.47021061486 -3.63558829975 -0.0959462720523 0.0291099438486 -0.0904246578331 0.648579716673 1.0228231668 0.358480019904 3.34264851294 -3.50144177319 1.42779305926 0.29436308341 -0.0855002703076 0.302757289305 -1.39334384615 3.6027365247 -1.47402790956 -2.35011137311 3.95485300772 -3.95464934606 0.211652199144 0.019124412376 0.378556091193 -4.0273692488 4.02731764653 0.16123704529 -0.763834718019 -0.420523233128 -4.10871760875 4.10871632972 -3.10777802353 -4.10129429055 4.1012892729 -4.04950310421 4.04944395396 0.758877860087 1.4805079124 0.922246882742 -0.310819004966 -0.0911767353651 -4.02663699262 4.02658184137 0.133457856125 3.51706680342 -0.123153081246 -0.390199112391 0.750764664664 -3.60078371204 -0.12733343067 -4.09454625779 4.09452057397 4.10565721266 -4.10565468076 3.73673298035 -3.79896313444 1.41683701719 1.15430901335 -0.239994313455 -0.273496979384 -0.0467222478444 -2.47933948217 -4.1053018211 4.10530420195 0.0717154640793 4.08329848864 -4.08335252935 -0.359773489814 -3.05956897272 -0.282151361519 1.62041425075 0.058516224484 4.10657486457 -4.10657261029 -1.18597336375 -4.10834577994 4.10834523191 -3.69087928101 -4.10190359685 4.1018997666 -3.62220401907 -4.07920869354 4.07915374853 0.12294950891 4.10879249294 -4.10879402221 0.76392253053 -4.10173744213 4.1017331672 -3.18122602653 4.10950371862 -4.10950436345 -4.03628412496 4.03625278588 -0.358568247065 0.0665469161414 0.299214414533 -3.94413088549 3.94393565809 -0.153561355797 4.10857472642 -4.10857546266 -2.83657680217 0.38677785464 3.51399525141 -1.28508877824 -4.10735354806 4.10735575399 0.0929616352 0.0783780784117 -0.0296128591666 -1.21520425232 -4.10165091182 4.10164612119 -3.91902355653 3.91710833942 1.41767380389 -3.44066945303 0.593317981801 0.14720524174 4.09368943844 -4.09371962372 -0.524084407499 -4.09324129868 4.09321232421 -4.10776396971 4.10776455833 -4.04975088574 4.04968881604 -0.106564181271 0.823988769066 -2.71488487141 4.10975162435 -4.10975196613 -4.10871253313 4.10871126978 0.80314656734 -0.44760646774 -0.292219131478 -4.09027430108 4.09023849282 -3.24845819661 1.46523795373 -3.77944903715 -1.95940176608 -1.55614413863 -3.93306526311 3.93306833921 4.08483482481 -4.08488675545 4.10178724106 -4.10179192371 -3.80620021313 3.80730893788 1.75661517246 -0.356943873821 1.96267952327 0.687571977309 0.18088845685 3.08369244099 1.73856573952 0.0224592984638 0.891047725578 0.0694634800475 -4.07583875692 4.07578200227 -2.37255428039 -1.23865583138 0.181882389452 1.79675446147 4.09104777949 -4.0910839556 -3.57119808922 -0.253657868216 3.98485811134 -3.98478391062 -1.66229698999 -4.09625882326 4.0962377339 1.17736919179 -4.09967059669 4.09965824321 -0.129254267891 -0.0742163584853 0.238071037486 -4.10952370913 4.10952258043 0.584380179962 -4.10874090048 4.10873956809 0.0454405615471 -4.06994543895 4.06988457551 0.162833744706 2.0166567131 -2.24213250061 -0.179160337327 -0.314274153494 1.09920638963 0.664352190284 4.10878114287 -4.10878267145 0.603673254091 -0.0875304738861 0.452830851162 -3.95562064587 3.9557841832 -4.10548464631 4.10548704729 -4.10670997839 4.10671314106 0.149381312559 0.840196474547 -0.000637426986754 2.18503970615 -4.08753721008 4.08749598901 2.14685915702 -0.103458722125 0.250980854788 -1.3784743439 0.0906652078703 -0.102097554332 3.27078339029 -0.177714197461 0.208191465962 0.188070903973 0.130337772141 -4.05328860319 4.05322437044 -0.714200833745 -4.09868079848 4.09866702431 -0.912822135143 -0.319236553785 0.14819899244 0.124321342145 0.174059446947 -0.444341198918 0.189425742216 -1.28051975345 -0.144109535245 3.96906749632 -3.96891996178 -0.101341801507 -3.68447240528 -0.306246623321 3.97472521032 -3.97459728403 0.7357450212 -0.799413944178 -0.73481194975 0.369303392011 -4.10584537356 4.1058481599 -0.296626943256 -0.0325899329426 -1.11492182739 -0.0883680727565 0.253719164581 -4.07679503648 4.0767377727 -4.10795382737 4.10795444555 -4.10439099844 4.10439307267 -0.0539665105295 0.887377215444 3.90924630194 -3.90853845705 -3.946918733 3.9469319143 -0.00721402616905 -4.05752979741 4.05746614732 -0.813649100711 1.07070963568 -4.08721263056 4.08717023176 0.147436408831 -4.10990067973 4.10990042546 0.174830807305 -0.415862683123 -4.08364482702 4.08359550496 2.30062214194 1.24996620901 -0.74646045196 -3.77964136109 -1.29120609747 0.41259749105 -4.10778443211 4.10778519592 -4.09776079855 4.09774384334 3.67313854092 -4.10645815605 4.10646145506 -0.0831179896149 0.142317687123 0.237362530554 0.0156061668547 -4.07978176739 4.07972785185 -2.70562401506 0.54130729251 1.33283766272 0.173038225618 0.561039763819 0.601352834249 3.80923095806 -0.228257427609 -1.31835668013 -0.0210880964577 1.38898938754 -3.01026146756 1.67383865328 4.1082111837 -4.10821125581 0.615963807799 4.1083330092 -4.10833329141 0.167822035779 4.1095024162 -4.10950320166 0.00158275900488 -0.241306806465 3.05579210677 -3.40906513661 4.10916846997 -4.10917004896 -4.10634028443 4.1063435811 1.0265301411 0.150647819034 -0.496687467925 4.10544300249 -4.1054403756 1.89800036564 0.0546287903023 -2.57358383985 -4.0543042674 4.0542403693 -4.03119618128 4.03116381652 3.96316618484 -3.96304413162 -4.10883847617 4.10883708393 0.106380236062 3.51393163495 -4.10746798705 4.10746960175 3.48022578558 0.383330786811 0.265307108132 0.415047301625 -3.80478017157 0.161302347982 -0.914138496728 -4.09753091826 4.09751322196 -3.79920433688 0.801349387918 3.53957459983 3.72607943535 -1.33056010582 -0.820227714069 0.0582123558101 0.395437603798 4.10921296091 -4.10921460154 3.82375619152 0.135706800482 4.08831028381 -4.08835585022 0.716926830997 0.0439612220871 1.74936778174 -0.234108893552 -0.42305469616 -3.66281324565 -0.376233911433 0.196698386145 -0.349498533932 0.23888390925 2.14566244763 0.427863657245 -4.09209126927 4.09205823395 -4.1009525854 4.10094635363 3.10747702775 -3.64656541074 0.44063936001 -0.0619480945187 -1.07814259509 -4.10036437932 4.10035591325 2.61388487354 -4.10871057183 4.10870920387 -1.01311490402 -1.16070224034 0.347274483593 -1.12700738962 -2.05083818133 -4.04392869539 4.04388825837 -4.00029573735 4.00029356669 -4.10850628975 4.10850524767 0.220616057952 -0.868254212574 -4.10747967156 4.1074815915 -4.01623933598 4.01621385419 0.273609215868 4.10594397475 -4.10594155128 -1.36465960614 -0.206164944645 -0.490687751737 -0.198203917414 3.2820323031 -0.457715178132 -0.728814947408 -3.48123185328 -4.10026656274 4.10025806795 -3.7894476328 0.187374968919 -3.99196394398 3.99198121119 3.85235400354 -3.85099306516 0.285961650294 2.00263944029 -3.63462269518 -0.280180819767 -0.297927123817 0.10124001328 -0.201893975591 3.36151589288 0.0821014246264 -4.08180041763 4.081748946 -0.0581939177199 0.386286351735 1.90784799767 2.27471570857 -3.3523989796 -4.09148079138 4.09144143293 -4.10986462693 4.10986444076 -4.09509993062 4.0950755552 -2.69248672162 -4.10755763801 4.10755895481 -3.58635615723 -0.364047234861 4.10940463123 -4.10940536348 0.26605958168 -3.4047234583 0.0443015775497 -0.257957972598 -4.08873251166 4.08868955164 0.264751287093 -0.108312131548 -0.319562756715 -0.0379496511975 1.05166038033 3.17569164628 0.822888363747 4.10406034889 -4.10405925987 -0.0514776920345 0.72924837057 0.156155880689 3.84354437923 -3.84159290958 -4.10186387938 4.10186055528 1.51201092993 0.0161270544056 3.72940971848 -0.712521643916 -4.02967613891 4.02964000335 -4.07015869234 4.07009683434 -1.36991690142 -0.0572668093 4.1060147369 -4.10601222878 -0.13070472858 0.299071171605 3.50457227533 -1.28365281776 -4.10584831475 4.10585086853 -2.75221952111 -0.647335511796 -4.10844994906 4.10844897637 3.39811897958 -4.05324053824 4.05318164655 -3.97969658209 3.97964818712 -3.78514524228 0.2270171888 -4.10855453931 4.10855335796 0.242479661572 -4.10807717359 4.10807702409 -4.07160760469 4.07154776382 -3.80342238457 3.80188004996 -3.80887430241 0.307151185999 -2.86245053156 0.652765094459 0.218083458733 1.30897522246 -0.152006921832 -1.06354954908 0.00882819173419 -0.0877705685365 4.103027472 -4.10302885445 -0.117461558522 2.18749146066 -2.44350101634 -1.16650043185 0.759057192388 0.401828245106 -1.4504792896 -1.22138896694 -4.10859042837 4.10858919245 -0.039095588949 -3.81791955292 0.0388139131033 4.10876813522 -4.10876960978 0.276202797254 -4.03770351502 4.03766612598 -1.6600627443 1.76660905509 -4.06964346439 4.06958953943 -4.10862091864 4.1086196116 4.10945527662 -4.1094565919 -2.70132071835 4.1052155642 -4.10521299939 1.12603332017 -3.7892857118 -1.118902027 -0.960926637072 -0.234185507358 2.25122654024 4.10514127686 -4.10513873077 0.517048064159 3.74452749884 2.23837792012 0.0944524164229 -0.168161626539 -3.8340594514 0.73739606088 -0.677729627277 -0.432197253371 -4.10799963444 4.10800011199 -0.0798306686637 0.285546042823 0.863068729023 -0.257984975144 0.775476476664 -2.85958760644 0.42730498463 -4.0875424845 4.08749649787 1.9518314352 -4.06585733925 4.06579533001 0.761988330451 3.44966718468 3.69452542182 -0.271004854641 -0.0918615889861 -3.7127248094 -0.367879744669 0.228525388152 0.787364760429 -1.46280541496 0.665871990643 -0.191838399315 -2.746251725 0.61923775253 -4.07817458732 4.07811956676 -0.783844503959 1.22134333932 2.71162991802 4.09501953589 -4.09504605686 4.10599271273 -4.10599019816 4.10572990427 -4.10572725729 1.17442824814 -3.98716469757 3.98724362142 -2.05962475894 -2.40527590216 -0.743490804167 -0.168750699791 2.33530423749 -2.28687863318 -3.67734452711 4.10978525084 -4.10978581562 -2.46291921441 -0.202037644811 0.429859064262 -2.36402948805 -0.175145385795 -4.09422502194 4.0941981898 -1.72052176715 -1.44968592843 -0.168286399802 -1.00689939997 -0.318074613923 0.460734211057 -0.0709193154103 -1.52137226168 -0.412011864818 0.430435366478 -0.459163275385 2.23502640789 0.0997562059673 -4.1010679867 4.10106180861 -0.238710778305 3.83548050471 -3.83405450442 -0.414757372411 -0.0637666044773 1.1838385864 4.10872346407 -4.10872491381 -2.55327081371 2.07791802625 3.81145255272 0.214005874124 -4.04150175964 4.04145871576 -0.988729656449 1.26445278524 -2.87449155586 0.270273114785 0.798205370232 0.911590753432 0.36467277077 2.84516243278 -4.09306181869 4.09303219955 0.608635207962 4.08978217918 -4.08982506108 0.371913275256 -0.151960417949 4.10347238439 -4.10347246631 1.65658842099 0.346164508679 -3.81145655363 1.47397490415 0.336960557029 0.717774444872 -0.405225568169 0.26017321215 0.320922784443 4.10438592757 -4.10438426362 -0.0584186025073 -3.42714354004 0.478894800685 0.146650396671 0.387647393812 3.26360402022 -0.122576273712 4.04624039176 -4.04630015829 2.06604938355 -3.69627358034 3.78853755914 -0.242406219366 -0.151069376868 -3.28824200311 3.86682897396 -3.8654879952 0.0728793666397 0.896796516696 0.495893623819 -4.04855603008 4.04849577255 -1.14525407101 0.84702609336 -0.155556865873 -3.54461934964 0.586205431787 -2.62636379447 3.7395414613 -3.66090727387 -4.10835442477 4.10835370038 0.302612245201 0.627260508416 -0.00263387706305 1.45037662372 1.12417465214 -0.0779066090033 0.36421353604 0.288851235002 0.0250990972391 -0.0157849125787 -1.36880911447 -3.51138676588 -3.98865606496 3.98873682948 0.329896090968 4.0901958672 -4.09023608326 -4.07187416472 4.07181304821 -3.69869729183 -0.450928972552 0.262849830116 -0.0944419494431 1.8943517833 4.10555159829 -4.10554895663 -0.0841603642454 1.90570181111 -3.9021951323 3.90298865487 2.8962392332 0.35171656543 -0.0208422340971 0.213010293019 -0.0478534646731 -4.06934446446 4.06928457589 0.349180216518 -0.24219631278 -3.78747677453 -2.43323462776 -0.0711949986573 -0.330980760658 -4.09994619228 4.09993648611 2.06698610939 0.16813439042 -3.7210216672 0.508541419458 -3.83453392425 0.979941562355 0.302776669293 -0.121103421512 -3.38030383612 -4.02224885371 4.0221879676 -0.269641403164 -0.124996355753 1.34972320681 0.283926698516 0.312408626839 0.630557660104 1.2122556956 4.10898756791 -4.10898926779 0.424273828911 0.386182960114 -3.7797309888 0.334586596541 -0.141114551094 3.38502774435 -0.037811786935 0.360573693097 -4.05189325072 4.05183208744 -0.130963103393 -2.55386990283 0.2542097013 -3.54479492293 -0.103820725833 1.50873385188 1.18135922474 0.191074879411 -4.10128566532 4.101280327 4.09062540603 -4.09066530352 2.0681959174 4.10888980741 -4.10889142964 -3.64454969842 -1.10613160004 -0.0573647214341 0.369384292219 0.560990800571 -0.107339821568 -3.95198746599 3.95207305741 1.97233556749 -3.9116516822 3.9123477008 1.98442917561 4.10580113317 -4.10579854877 0.602717892302 0.56075256652 4.08889497367 -4.08894166591 -0.312327596601 4.09605673921 -4.09608168731 1.39103730511 -0.0509556945098 0.0362454591251 4.00430399622 -4.00429747544 -0.847631197966 1.23135894639 0.661952988128 -0.392933454505 4.08189132386 -4.08194634181 -0.184051923947 4.10604429525 -4.10604198865 -0.0770688878799 0.763687089236 1.48008099801 -3.18518226251 -0.475114543911 1.15103149617 4.01852469365 -4.01855060219 0.167689297848 4.10306838326 -4.10307029454 0.361447778686 -2.50393351143 0.287183440683 -3.52382179856 2.663089818 4.1076571069 -4.10765551799 -0.565797741519 -3.7857409848 4.1090567133 -4.10905768908 -4.05762138269 4.05755637471 0.481096905634 -2.85705568743 -0.0071124395279 4.10628727981 -4.10628513602 4.10828265451 -4.10828235259 4.09804410355 -4.09806167977 3.91505718371 -3.91420340679 4.02454057246 -4.02457534956 0.225510406346 4.09182829883 -4.09186805367 4.08549475465 -4.08554807953 0.11633843683 2.8357282605 -2.33860058898 0.819335867898 4.1079926584 -4.1079916138 3.79876776183 -0.134808386599 3.75114583183 -0.242580895946 0.06555301 3.83422711729 -3.82691705544 -3.31153036142 4.0792367926 -4.07929327332 3.92872793279 -3.92810540225 4.10687650827 -4.10687448544 -3.61110319555 -3.03237175541 3.97178510687 -3.97162517538 4.06404249981 -4.06410763673 0.438665667413 -3.42150441932 -3.68329932925 4.04976581398 -4.04982806395 3.32030921737 3.02906423372 3.95294120767 -3.95262463712 3.98816891602 -3.98810058245 4.10459518979 -4.10459340922 4.09967882251 -4.09969177878 2.48729211303 4.10665167729 -4.10664959212 4.10101546963 -4.10102381515 4.09400429941 -4.09403538751 -0.977909602576 4.10383847263 -4.10383795516 4.07475707961 -4.07481753581 3.52462443686 1.03960750542 -3.74067322792 -0.655215791973 3.8636590571 -3.86100889774 4.10215463856 -4.10215936242 1.80913000878 3.59884383588 3.18651946758 4.104898524 -4.10489637463 4.10878491911 -4.10878578307 4.10931215317 -4.10931304635 4.04090226584 -4.04095622904 2.0887590095 -1.63943915512 3.71671360576 4.06966310828 -4.06972462244 4.10853992441 -4.10854026257 4.10992325714 -4.10992336976 -1.89966602614 -1.11556687484 -0.739519800701 3.66551189024 -2.22619985037 0.923634030496 3.43948787267 4.10943799346 -4.10943875776 1.6355606625 1.97559262153 2.38566933587 4.03311027273 -4.03315591445 -1.32764633122 -1.25298911192 -1.46649098336 -1.79697744967 -2.67658934343 4.10550370678 -4.10550112907 3.88934633411 -3.88786021949 4.10968841281 -4.10968885443 4.10729414171 -4.10729238392 -2.05774514734 2.24226149242 ) ; boundaryField { front { type wedge; } outlet { type fixedValue; value uniform -4.11; } inlet { type fixedValue; value uniform 4.11; } back { type wedge; } topfluid { type zeroGradient; } SiNxwalls { type zeroGradient; } } // ************************************************************************* //
[ "soumya.paul.deep@gmail.com" ]
soumya.paul.deep@gmail.com
921fde4a970b9452e222108d3f9c93a02fa45be7
da3c0b2772247e877a9b21a308acde5612af020d
/Restaurant2/branchstoremap.h
9ba0cf86e360d1e0afe181f0c1084f65b23aa73b
[]
no_license
End1-1/Resort-2
857ef7fdf26ce9eb7d5e1c11f1ee6959d8fbd21e
b99a39d4600213ac5affcf32ab8a9e4b8b07cdc2
refs/heads/master
2023-02-21T22:27:59.031695
2023-02-09T07:54:38
2023-02-09T07:54:38
151,714,828
1
0
null
null
null
null
UTF-8
C++
false
false
505
h
#ifndef BRANCHSTOREMAP_H #define BRANCHSTOREMAP_H #include <QObject> #include <QMap> #define storealias(x) BranchStoreMap::alias(x) #define setstorealias(x, y) BranchStoreMap::setAlias(x, y) class BranchStoreMap : public QObject { Q_OBJECT public: explicit BranchStoreMap(QObject *parent = nullptr); QMap<int, int> fStoreMap; static int alias(int store); static void setAlias(int store, int alias); private: static BranchStoreMap *fInstance; }; #endif // BRANCHSTOREMAP_H
[ "end1_1@yahoo.com" ]
end1_1@yahoo.com
0fcd05d566b34372277360d843a1d50ae48dc33b
b7ea1109bcd1f5d53f350e0a4e3745c7cb69d27d
/include/uiVolumeProcessing/uivolprochorinterfiller.h
4db0b4c9acde6a6762c37a1a4d4edffd7baabb3a
[]
no_license
TinyJie/OpendTect
1bcc7b6b71bdcb2146355c97b37587b25351c8bf
b856b2eda4f7ff8977e375bab232cb4df9da756b
refs/heads/master
2021-01-15T20:44:01.549445
2015-09-16T23:16:59
2015-09-16T23:16:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,452
h
#ifndef uivolprochorinterfiller_h #define uivolprochorinterfiller_h /*+ ________________________________________________________________________ (C) dGB Beheer B.V.; (LICENSE) http://opendtect.org/OpendTect_license.txt Author: Y.C. Liu Date: April 2007 RCS: $Id$ ________________________________________________________________________ -*/ #include "uivolumeprocessingmod.h" #include "uivolprocstepdlg.h" #include "volprochorinterfiller.h" class uiIOObjSel; class CtxtIOObj; namespace VolProc { mExpClass(uiVolumeProcessing) uiHorInterFiller : public uiStepDialog { mODTextTranslationClass(uiHorInterFiller) public: mDefaultFactoryInstanciationBase( VolProc::HorInterFiller::sFactoryKeyword(), VolProc::HorInterFiller::sFactoryDisplayName()) mDefaultFactoryInitClassImpl( uiStepDialog, createInstance ) protected: uiHorInterFiller(uiParent*,HorInterFiller*); ~uiHorInterFiller(); static uiStepDialog* createInstance(uiParent*,Step*); bool acceptOK(CallBacker*); void updateFlds(CallBacker*); HorInterFiller* horinterfiller_; CtxtIOObj* topctio_; CtxtIOObj* bottomctio_; uiGenInput* usetophorfld_; uiIOObjSel* tophorfld_; uiGenInput* topvalfld_; uiGenInput* usebottomhorfld_; uiIOObjSel* bottomhorfld_; uiGenInput* usegradientfld_; uiGenInput* gradientfld_; uiGenInput* bottomvalfld_; }; } // namespace VolProc #endif
[ "nanne.hemstra@dgbes.com" ]
nanne.hemstra@dgbes.com
1a7902b662785deb22f905bbc7782087fa141386
9a06328e1ebab3a094193f61dc7e0081ba0054bd
/Projekt PK4 Statki/Interface.cpp
e17a627b553d6eabe0f469bca4861c22189e5144
[]
no_license
sylwiamolitor/Statki-PK4
16c3261fe4c6616a973fdd455e4fde317e3b3251
5a10e5127a1c1294b713f71d872c1f0e9e3dddf5
refs/heads/master
2022-06-05T11:21:45.546651
2020-05-04T18:42:53
2020-05-04T18:42:53
257,845,317
0
0
null
null
null
null
UTF-8
C++
false
false
1,321
cpp
#include "Interface.h" Button::Button(std::string text, sf::Font& font, int characterSize, sf::Vector2f position) { Button::text.setString(text); Button::text.setFont(font); Button::text.setCharacterSize(characterSize); Button::text.setPosition(position.x+25, position.y+15); Button::frame.setPosition(position.x, position.y); Button::frame.setOutlineColor(sf::Color(250, 150, 100)); Button::frame.setFillColor(sf::Color(150, 50, 250)); Button::frame.setOutlineThickness(10); Button::frame.setSize(sf::Vector2f(500, 100)); } void Button::draw(sf::RenderTarget &target, sf::RenderStates states) const { states.transform *= getTransform(); target.draw(frame); target.draw(text); } Board::Board(sf::Font& font, sf::Vector2f position) { /*Board::text.setString("1 2 3 4 5 6 7 8 9 10"); Board::text.setFont(font); Board::text.setCharacterSize(20); Board::text.setPosition(position.x + 25, position.y + 15); */ Board::frame.setPosition(position.x+45, position.y+45); Board::frame.setOutlineColor(sf::Color::White); Board::frame.setFillColor(sf::Color::Transparent); Board::frame.setOutlineThickness(5); Board::frame.setSize(sf::Vector2f(400, 400)); } void Board::draw(sf::RenderTarget & target, sf::RenderStates states) const { target.draw(frame); }
[ "noreply@github.com" ]
noreply@github.com
3c502cb2ca3e32f3c83b4182b4fdf87079b06565
2a8eaaa87125d337d87c9ee56385cac061d22bf5
/etap2/zalazek/plugin/src/Interp4Move.cpp
7046721803d6236c23df0601d5fd4999e014261c
[]
no_license
Cassie051/ZMP
1a456d63ce653fb7a5edf5f32568d6156bb52929
c0ae80fc1cc6b167b59ef0c92f3a36c5dc717a45
refs/heads/master
2023-01-27T16:06:14.285247
2020-12-08T10:11:29
2020-12-08T10:11:29
307,773,395
0
0
null
null
null
null
UTF-8
C++
false
false
1,219
cpp
#include <iostream> #include "Interp4Move.hh" #include "MobileObj.hh" using std::cout; using std::endl; extern "C" { Interp4Command* CreateCmd(void); const char* GetCmdName() { return "Move"; } } /*! * \brief * * */ Interp4Command* CreateCmd(void) { return Interp4Move::CreateCmd(); } /*! * */ Interp4Move::Interp4Move(): _Speed_mmS(0), _PathLength_m(0) {} /*! * */ void Interp4Move::PrintCmd() const { /* * Tu trzeba napisać odpowiednio zmodyfikować kod poniżej. */ cout << GetCmdName() << " " << _Speed_mmS << " " << _PathLength_m << endl; } /*! * */ const char* Interp4Move::GetCmdName() const { return ::GetCmdName(); } /*! * */ bool Interp4Move::ExecCmd( MobileObj *pMobObj, int Socket) const { /* * Tu trzeba napisać odpowiedni kod. */ return true; } /*! * */ bool Interp4Move::ReadParams(std::istream& Strm_CmdsList) { Strm_CmdsList >> _Speed_mmS >> _PathLength_m; return !Strm_CmdsList.fail(); } /*! * */ Interp4Command* Interp4Move::CreateCmd() { return new Interp4Move(); } /*! * */ void Interp4Move::PrintSyntax() const { cout << " Move NazwaObiektu Szybkosc[m/s] DlugoscDrogi[m]" << endl; }
[ "kasiaczarna051@gmail.com" ]
kasiaczarna051@gmail.com
12347c0023f8e497e21d5f997aa52f6300a65e69
4af5535125e74f31fbc44816d0c3b907014578b1
/src/core/Time.cpp
108840f05cb979bc00beb99a98ee96c52b6ff837
[]
no_license
hazer-hazer/KnotGE
609aa081ad13361f5f3d2a56ddd0c073de58c874
a15205b912aa3cde89aff5d3b3e139481f3cab92
refs/heads/master
2021-04-07T12:32:49.563306
2020-04-13T13:10:01
2020-04-13T13:10:01
248,675,893
0
0
null
null
null
null
UTF-8
C++
false
false
620
cpp
#include "core/Time.h" double Time::Zero = glfwGetTime(); Time::Time(double time){ this->time = time; } Time Time::now(){ return Time( glfwGetTime() ); } double Time::seconds() const { return time; } int32_t Time::millis() const { return (int32_t)(time * 1e+3); } int64_t Time::micros() const { return (int64_t)(time * 1e+6); } Time & Time::operator = (const double & time){ this->time = time; return *this; } Time operator + (const Time & lt, const Time & rt){ return Time(lt.seconds() + rt.seconds()); } Time operator - (const Time & lt, const Time & rt){ return Time(lt.seconds() - rt.seconds()); }
[ "gordeev.john@gmail.com" ]
gordeev.john@gmail.com
0af53ddfccb628d442ad2a05f230f104bbc02d62
4e9177d8536384efb0a4c60e83f80b1549731e2e
/haxelib/native-bindings/src/AudioListener.cpp
41ea107e4a7723582a6018b8a6c691c75eebc513
[ "MIT" ]
permissive
aurodev/hx-gameplay
ed99dab6215b67db1f62f569417580122e9cead7
e7fe3d4e79e0e12d439b3f3c930d85d78f2eba8d
refs/heads/master
2021-05-31T17:08:12.611361
2016-06-20T23:38:51
2016-06-20T23:38:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
5,915
cpp
#include "HaxeAPI.h" // DECL: Camera* getCamera() const; value hx_AudioListener_getCamera(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return ReferenceToValue(_thisObj->getCamera(), true); } DEFINE_PRIM(hx_AudioListener_getCamera, 1); // DECL: float getGain() const; value hx_AudioListener_getGain(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return alloc_float(_thisObj->getGain()); } DEFINE_PRIM(hx_AudioListener_getGain, 1); // DECL: static AudioListener* getInstance(); value hx_AudioListener_static_getInstance() { return ObjectToValue(AudioListener::getInstance(), false); } DEFINE_PRIM(hx_AudioListener_static_getInstance, 0); // DECL: const float* getOrientation() const; value hx_AudioListener_getOrientation(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); const float *orient = _thisObj->getOrientation(); const value& result = alloc_array(6); val_array_set_i(result, 0, alloc_float(*orient++)); val_array_set_i(result, 1, alloc_float(*orient++)); val_array_set_i(result, 2, alloc_float(*orient++)); val_array_set_i(result, 3, alloc_float(*orient++)); val_array_set_i(result, 4, alloc_float(*orient++)); val_array_set_i(result, 5, alloc_float(*orient)); return result; } DEFINE_PRIM(hx_AudioListener_getOrientation, 1); // DECL: const Vector3& getOrientationForward() const; value hx_AudioListener_getOrientationForward(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return ObjectToValue(&_thisObj->getOrientationForward(), false); } DEFINE_PRIM(hx_AudioListener_getOrientationForward, 1); // DECL: const Vector3& getOrientationUp() const; value hx_AudioListener_getOrientationUp(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return ObjectToValue(&_thisObj->getOrientationUp(), false); } DEFINE_PRIM(hx_AudioListener_getOrientationUp, 1); // DECL: const Vector3& getPosition() const; value hx_AudioListener_getPosition(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return ObjectToValue(&_thisObj->getPosition(), false); } DEFINE_PRIM(hx_AudioListener_getPosition, 1); // DECL: const Vector3& getVelocity() const; value hx_AudioListener_getVelocity(value thisObj) { AudioListener *_thisObj; ValueToObject(thisObj, _thisObj); return ObjectToValue(&_thisObj->getVelocity(), false); } DEFINE_PRIM(hx_AudioListener_getVelocity, 1); // DECL: void setCamera(Camera* camera); void hx_AudioListener_setCamera(value thisObj, value camera) { AudioListener *_thisObj; Camera *_camera; ValueToObject(thisObj, _thisObj); ValueToObject(camera, _camera); _thisObj->setCamera(_camera); } DEFINE_PRIM(hx_AudioListener_setCamera, 2); // DECL: void setGain(float gain); void hx_AudioListener_setGain(value thisObj, value gain) { AudioListener *_thisObj; float _gain = ValueToFloat(gain); ValueToObject(thisObj, _thisObj); _thisObj->setGain(_gain); } DEFINE_PRIM(hx_AudioListener_setGain, 2); // DECL: void setOrientation(const Vector3& forward, const Vector3& up); void hx_AudioListener_setOrientation_V3X2(value thisObj, value forward, value up) { AudioListener *_thisObj; Vector3 *_forward, *_up; ValueToObject(thisObj, _thisObj); ValueToObject(forward, _forward); ValueToObject(up, _up); _thisObj->setOrientation(*_forward, *_up); } DEFINE_PRIM(hx_AudioListener_setOrientation_V3X2, 3); // DECL: void setOrientation(float forwardX, float forwardY, float forwardZ, float upX, float upY, float upZ); void hx_AudioListener_setOrientation_FltX6(value *args, int nargs) { const value& thisObj = *args++; const value& forwardX = *args++; const value& forwardY = *args++; const value& forwardZ = *args++; const value& upX = *args++; const value& upY = *args++; const value& upZ = *args; AudioListener *_thisObj; float _forwardX = ValueToFloat(forwardX); float _forwardY = ValueToFloat(forwardY); float _forwardZ = ValueToFloat(forwardZ); float _upX = ValueToFloat(upX); float _upY = ValueToFloat(upY); float _upZ = ValueToFloat(upZ); ValueToObject(thisObj, _thisObj); _thisObj->setOrientation(_forwardX, _forwardY, _forwardZ, _upX, _upY, _upZ); } DEFINE_PRIM_MULT(hx_AudioListener_setOrientation_FltX6); // DECL: void setPosition(const Vector3& position); void hx_AudioListener_setPosition_V3(value thisObj, value position) { AudioListener *_thisObj; Vector3 *_position; ValueToObject(thisObj, _thisObj); ValueToObject(position, _position); _thisObj->setPosition(*_position); } DEFINE_PRIM(hx_AudioListener_setPosition_V3, 2); // DECL: void setPosition(float x, float y, float z); void hx_AudioListener_setPosition_FltX3(value thisObj, value x, value y, value z) { AudioListener *_thisObj; float _x = ValueToFloat(x); float _y = ValueToFloat(y); float _z = ValueToFloat(z); ValueToObject(thisObj, _thisObj); _thisObj->setPosition(_x, _y, _z); } DEFINE_PRIM(hx_AudioListener_setPosition_FltX3, 4); // DECL: void setVelocity(const Vector3& velocity); void hx_AudioListener_setVelocity_V3(value thisObj, value velocity) { AudioListener *_thisObj; Vector3 *_velocity; ValueToObject(thisObj, _thisObj); ValueToObject(velocity, _velocity); _thisObj->setVelocity(*_velocity); } DEFINE_PRIM(hx_AudioListener_setVelocity_V3, 2); // DECL: void setVelocity(float x, float y, float z); void hx_AudioListener_setVelocity_FltX3(value thisObj, value x, value y, value z) { AudioListener *_thisObj; float _x = ValueToFloat(x); float _y = ValueToFloat(y); float _z = ValueToFloat(z); ValueToObject(thisObj, _thisObj); _thisObj->setVelocity(_x, _y, _z); } DEFINE_PRIM(hx_AudioListener_setVelocity_FltX3, 4); // END //
[ "sazert103@gmail.com" ]
sazert103@gmail.com
f365ab60b9033577fdfb2cc2def5fcdb3a764436
ea12fed4c32e9c7992956419eb3e2bace91f063a
/zombie/code/nebula2/src/precompiled/pchngrass_conjurer.cc
e35eedc1aa97de3edbd106fe7593cdda9c742f8e
[]
no_license
ugozapad/TheZombieEngine
832492930df28c28cd349673f79f3609b1fe7190
8e8c3e6225c2ed93e07287356def9fbdeacf3d6a
refs/heads/master
2020-04-30T11:35:36.258363
2011-02-24T14:18:43
2011-02-24T14:18:43
null
0
0
null
null
null
null
UTF-8
C++
false
false
43
cc
#include "precompiled/pchngrass_conjurer.h"
[ "magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91" ]
magarcias@c1fa4281-9647-0410-8f2c-f027dd5e0a91
2cc34ecac83dd1972c3e344cf19f0d1d8a09df33
4b221f6da04e251f82b18b50a5a5f2940cf95eaa
/yandex_cup/algorithm/q/B/main.cpp
6dca2f457f75a3eb4737ef45719eb293aca0dc2e
[]
no_license
dmikarpoff/CompetProg
793ea52d7cfc4ad04776caac2ea56be5fe791546
f95c88f91d31edbb61c92b5b923ce76fe19c6c8b
refs/heads/master
2023-06-09T11:33:11.456774
2023-06-02T22:40:46
2023-06-02T22:40:46
122,370,845
0
0
null
null
null
null
UTF-8
C++
false
false
715
cpp
#include <iostream> #include <vector> #include <algorithm> using namespace std; enum class Type { UPPER, LOWER, SPACE }; int main() { string s; getline(cin, s); int lower = 0; int upper = 2; for (auto c : s) { if (c == ' ') { ++lower; ++upper; continue; } int ll = lower; int uu = upper; if (c > 'Z') { lower = min(ll + 1, uu + 3); upper = min(uu + 2, ll + 3); } else { lower = min(ll + 2, uu + 3); upper = min(uu + 1, ll + 3); } // cout << lower << " " << upper << endl; } cout << min(lower, upper) << endl; return 0; }
[ "dmitry.karpov@wartsila.com" ]
dmitry.karpov@wartsila.com
c03d43ef174fc6135c480e0cd53c272eeebe20cd
b308bb06497a2a1eb789a19c31b417953b4495de
/include/components/eventloop.hpp
d27515834c544f087f9e58b75adc6b5459f7ea9b
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
Adam-K-P/polybar
eaad8d0a047e1686c70c4bdce584eeb9e058935b
566e386d1e916cf105baf83a5c0395d42c9ccdf3
refs/heads/master
2021-01-12T07:00:13.218600
2016-12-19T22:34:35
2016-12-19T22:42:32
76,890,604
0
0
null
2016-12-19T19:23:29
2016-12-19T19:23:29
null
UTF-8
C++
false
false
3,054
hpp
#pragma once #include <moodycamel/blockingconcurrentqueue.h> #include <chrono> #include <condition_variable> #include <mutex> #include <thread> #include "common.hpp" #include "events/signal_emitter.hpp" #include "events/signal_fwd.hpp" #include "events/signal_receiver.hpp" #include "utils/concurrency.hpp" POLYBAR_NS // fwd namespace modules { struct module_interface; } enum class alignment : uint8_t; class config; class logger; using namespace signals::eventloop; using module_t = unique_ptr<modules::module_interface>; using modulemap_t = std::map<alignment, vector<module_t>>; namespace chrono = std::chrono; using namespace std::chrono_literals; class eventloop : public signal_receiver<SIGN_PRIORITY_EVENTLOOP, process_quit, process_input, process_check, enqueue_event, enqueue_quit, enqueue_update, enqueue_input, enqueue_check> { public: enum class event_type : uint8_t { NONE = 0, UPDATE, CHECK, INPUT, QUIT, }; struct event { uint8_t type{static_cast<uint8_t>(event_type::NONE)}; bool flag{false}; }; template <typename EventType> using queue_t = moodycamel::BlockingConcurrentQueue<EventType>; public: using make_type = unique_ptr<eventloop>; static make_type make(); explicit eventloop(signal_emitter& emitter, const logger& logger, const config& config); ~eventloop(); void start(); void stop(); bool enqueue(event&& evt); bool enqueue(string&& input_data); void add_module(const alignment pos, module_t&& module); const modulemap_t& modules() const; size_t module_count() const; static event make_quit_evt(bool reload = false); static event make_update_evt(bool force = false); static event make_input_evt(); static event make_check_evt(); protected: void dispatch_modules(); void handle_inputdata(); bool on(const process_input& evt); bool on(const process_check& evt); bool on(const process_quit& evt); bool on(const enqueue_event& evt); bool on(const enqueue_quit& evt); bool on(const enqueue_update& evt); bool on(const enqueue_input& evt); bool on(const enqueue_check& evt); private: signal_emitter& m_sig; const logger& m_log; const config& m_conf; /** * @brief Event queue */ queue_t<event> m_queue; /** * @brief Loaded modules */ modulemap_t m_modules; /** * @brief Flag to indicate current run state */ stateflag m_running{}; /** * @brief Time to wait for subsequent events */ chrono::milliseconds m_swallow_update{10ms}; /** * @brief Maximum amount of subsequent events to swallow within timeframe */ size_t m_swallow_limit{5U}; /** * @brief Time to throttle input events */ chrono::milliseconds m_swallow_input{30ms}; /** * @brief Time of last handled input event */ chrono::time_point<chrono::system_clock, chrono::milliseconds> m_lastinput; /** * @brief Mutex used to guard input data */ std::mutex m_inputlock{}; /** * @brief Input data */ string m_inputdata; }; POLYBAR_NS_END
[ "c@rlberg.se" ]
c@rlberg.se
90bae90252ec63e3927e5ccf7544a90516c41883
41ddf2221a52c4014e541d0001232847a512529d
/Data Structures(Cs 212)/Hw 4/Zaman_Farhan_HW4_Q3.h
38c0aa9922f2aca9202437ad8b328dfe564a4299
[]
no_license
fzaman2258/C-Plus-Plus
7fe004c6c38cdbb7653b09d100833d22b1c596c4
9de4d827aff460abba3378074af6cdabe5f1e69a
refs/heads/master
2020-06-17T12:12:38.587933
2019-10-17T18:40:41
2019-10-17T18:40:41
195,724,037
0
0
null
null
null
null
UTF-8
C++
false
false
635
h
#ifndef __ZAMAN_FARHAN_HW4_Q3_H__ #define __ZAMAN_FARHAN_HW4_Q3_H__ #include <iostream> #include <cassert> using namespace std; template <class Item> class PriorityQueue { private: Item* data; int* priority; size_t first; size_t last; size_t count; size_t capacity; size_t nextIndex(size_t i) const {return(i+1)%capacity;} public: void sort(); PriorityQueue(size_t initsize=30); ~PriorityQueue(); void push(const Item& entry,int pr=0); void pop(); bool empty() const{return(count==0);} size_t size() const{return count;} Item top() const; void print(); }; #include "Zaman_Farhan_HW4_Q3.cpp" #endif
[ "fzaman2258@bths.edu" ]
fzaman2258@bths.edu
451914de0a140917c973add566c25f62f0e94afc
39f5ed1178375c65876323589a03ef5daf6e4739
/chrome/browser/offline_pages/android/offline_page_archive_publisher_impl.h
890b551cbe1f17cf883c27846c2c382966cc4b7c
[ "BSD-3-Clause" ]
permissive
berber1016/chromium
2718166c02fcb3aad24cc3bd326a4f8d2d7c0cae
9dc373d511536c916dec337b4ccc53106967d28d
refs/heads/main
2023-03-21T21:53:55.686443
2021-05-14T10:13:20
2021-05-14T10:13:20
367,332,075
1
0
BSD-3-Clause
2021-05-14T10:46:30
2021-05-14T10:46:29
null
UTF-8
C++
false
false
2,128
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 CHROME_BROWSER_OFFLINE_PAGES_ANDROID_OFFLINE_PAGE_ARCHIVE_PUBLISHER_IMPL_H_ #define CHROME_BROWSER_OFFLINE_PAGES_ANDROID_OFFLINE_PAGE_ARCHIVE_PUBLISHER_IMPL_H_ #include <cstdint> #include <string> #include "base/callback.h" #include "components/offline_pages/core/offline_page_archive_publisher.h" #include "components/offline_pages/core/offline_page_item.h" #include "components/offline_pages/core/offline_page_types.h" namespace base { class SequencedTaskRunner; } // namespace base namespace offline_pages { class ArchiveManager; class OfflinePageArchivePublisherImpl : public OfflinePageArchivePublisher { public: class Delegate { public: Delegate() = default; // Returns true if a system download manager is available on this platform. virtual bool IsDownloadManagerInstalled(); // Adds the archive to downloads. virtual PublishArchiveResult AddCompletedDownload( const OfflinePageItem& page); // Removes pages from downloads, returning the number of pages removed. virtual int Remove( const std::vector<int64_t>& android_download_manager_ids); private: Delegate(const Delegate&) = delete; Delegate& operator=(const Delegate&) = delete; }; explicit OfflinePageArchivePublisherImpl(ArchiveManager* archive_manager); ~OfflinePageArchivePublisherImpl() override; void SetDelegateForTesting(Delegate* delegate); // OfflinePageArchivePublisher implementation. void PublishArchive( const OfflinePageItem& offline_page, const scoped_refptr<base::SequencedTaskRunner>& background_task_runner, PublishArchiveDoneCallback publish_done_callback) const override; void UnpublishArchives( const std::vector<PublishedArchiveId>& publish_ids) const override; private: ArchiveManager* archive_manager_; Delegate* delegate_; }; } // namespace offline_pages #endif // CHROME_BROWSER_OFFLINE_PAGES_ANDROID_OFFLINE_PAGE_ARCHIVE_PUBLISHER_IMPL_H_
[ "commit-bot@chromium.org" ]
commit-bot@chromium.org
8921a1925cd64569340203bc113c7ede294afcea
f7bd9e84bca1f177f085a5f861ff541d0ecb9e7d
/PEfileInjectC++/getInfoOfFile.h
1b48f66913148e6d39ee25f3b9df77dd68bc7063
[]
no_license
vietnakid/ToolsForSecurity
850fd977bcc83f3b9660a5b853cf2c1dd6710d80
0d9e3f35a4c099b4a5b10c8a35f395f7c5c179c1
refs/heads/master
2020-03-16T01:25:30.666234
2018-06-19T10:18:03
2018-06-19T10:18:03
132,439,938
0
0
null
null
null
null
UTF-8
C++
false
false
436
h
#ifndef GET_INFO_OF_FILE_H #define GET_INFO_OF_FILE_H #include <map> #include "initializeValue.h" #include "getValueFromFile.h" using namespace std; extern vector<int> fileData; extern streampos sizeOfFile; void showHexOfFile(); int getValueOfField(string field, int baseOffset); void showInfoOfPEHeader(); void showInfoOfSection(); void showImports(); void showExports(); void showInfoOfFile(); void getImportSectionData(); #endif
[ "vietnase62219@fpt.edu.vn" ]
vietnase62219@fpt.edu.vn
2a39c66e4fd4213f034b36255380b89fc58c5b83
cc1ea36872e95190582813dc8235c8d4afbf4d78
/src/ray/raylet/scheduling/cluster_task_manager_test.cc
901595e8bf0e6dc310b712eaf4b80f243a49ff39
[ "MIT", "Apache-2.0" ]
permissive
tmct/ray
dfde69624742b6c24b27f0b5c6be5fd77d07c135
53206dd4401665ec599118241c236ac9e6f4852a
refs/heads/master
2023-05-30T18:25:23.838922
2021-06-30T10:32:11
2021-06-30T10:32:11
377,907,576
0
0
Apache-2.0
2021-06-17T17:14:18
2021-06-17T17:14:18
null
UTF-8
C++
false
false
54,245
cc
// Copyright 2017 The Ray 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. #include "ray/raylet/scheduling/cluster_task_manager.h" #include <memory> #include <string> #include "gmock/gmock.h" #include "gtest/gtest.h" #include "ray/common/id.h" #include "ray/common/task/scheduling_resources.h" #include "ray/common/task/task.h" #include "ray/common/task/task_util.h" #include "ray/common/test_util.h" #include "ray/raylet/scheduling/cluster_resource_scheduler.h" #include "ray/raylet/scheduling/scheduling_ids.h" #include "ray/raylet/test/util.h" #ifdef UNORDERED_VS_ABSL_MAPS_EVALUATION #include <chrono> #include "absl/container/flat_hash_map.h" #endif // UNORDERED_VS_ABSL_MAPS_EVALUATION namespace ray { namespace raylet { using ::testing::_; class MockWorkerPool : public WorkerPoolInterface { public: MockWorkerPool() : num_pops(0) {} std::shared_ptr<WorkerInterface> PopWorker(const TaskSpecification &task_spec) { num_pops++; const WorkerCacheKey env = {task_spec.OverrideEnvironmentVariables(), task_spec.SerializedRuntimeEnv()}; const int runtime_env_hash = env.IntHash(); std::shared_ptr<WorkerInterface> worker = nullptr; for (auto it = workers.begin(); it != workers.end(); it++) { // Skip if the runtime env doesn't match. if (runtime_env_hash != (*it)->GetRuntimeEnvHash()) { continue; } worker = std::move(*it); workers.erase(it); break; } return worker; } void PushWorker(const std::shared_ptr<WorkerInterface> &worker) { workers.push_front(worker); } std::list<std::shared_ptr<WorkerInterface>> workers; int num_pops; }; std::shared_ptr<ClusterResourceScheduler> CreateSingleNodeScheduler( const std::string &id) { std::unordered_map<std::string, double> local_node_resources; local_node_resources[ray::kCPU_ResourceLabel] = 8; local_node_resources[ray::kGPU_ResourceLabel] = 4; local_node_resources[ray::kMemory_ResourceLabel] = 128; auto scheduler = std::make_shared<ClusterResourceScheduler>( ClusterResourceScheduler(id, local_node_resources)); return scheduler; } Task CreateTask(const std::unordered_map<std::string, double> &required_resources, int num_args = 0, std::vector<ObjectID> args = {}, std::string serialized_runtime_env = "{}") { TaskSpecBuilder spec_builder; TaskID id = RandomTaskId(); JobID job_id = RandomJobId(); rpc::Address address; spec_builder.SetCommonTaskSpec( id, "dummy_task", Language::PYTHON, FunctionDescriptorBuilder::BuildPython("", "", "", ""), job_id, TaskID::Nil(), 0, TaskID::Nil(), address, 0, required_resources, {}, std::make_pair(PlacementGroupID::Nil(), -1), true, "", serialized_runtime_env); if (!args.empty()) { for (auto &arg : args) { spec_builder.AddArg(TaskArgByReference(arg, rpc::Address())); } } else { for (int i = 0; i < num_args; i++) { ObjectID put_id = ObjectID::FromIndex(RandomTaskId(), /*index=*/i + 1); spec_builder.AddArg(TaskArgByReference(put_id, rpc::Address())); } } rpc::TaskExecutionSpec execution_spec_message; execution_spec_message.set_num_forwards(1); return Task(spec_builder.Build(), TaskExecutionSpecification(execution_spec_message)); } class MockTaskDependencyManager : public TaskDependencyManagerInterface { public: MockTaskDependencyManager(std::unordered_set<ObjectID> &missing_objects) : missing_objects_(missing_objects) {} bool RequestTaskDependencies( const TaskID &task_id, const std::vector<rpc::ObjectReference> &required_objects) { RAY_CHECK(subscribed_tasks.insert(task_id).second); for (auto &obj_ref : required_objects) { if (missing_objects_.count(ObjectRefToId(obj_ref))) { return false; } } return true; } void RemoveTaskDependencies(const TaskID &task_id) { RAY_CHECK(subscribed_tasks.erase(task_id)); } bool TaskDependenciesBlocked(const TaskID &task_id) const { return blocked_tasks.count(task_id); } std::unordered_set<ObjectID> &missing_objects_; std::unordered_set<TaskID> subscribed_tasks; std::unordered_set<TaskID> blocked_tasks; }; class ClusterTaskManagerTest : public ::testing::Test { public: ClusterTaskManagerTest() : id_(NodeID::FromRandom()), scheduler_(CreateSingleNodeScheduler(id_.Binary())), is_owner_alive_(true), node_info_calls_(0), announce_infeasible_task_calls_(0), dependency_manager_(missing_objects_), task_manager_(id_, scheduler_, dependency_manager_, /* is_owner_alive= */ [this](const WorkerID &worker_id, const NodeID &node_id) { return is_owner_alive_; }, /* get_node_info= */ [this](const NodeID &node_id) { node_info_calls_++; return node_info_[node_id]; }, /* announce_infeasible_task= */ [this](const Task &task) { announce_infeasible_task_calls_++; }, pool_, leased_workers_, /* get_task_arguments= */ [this](const std::vector<ObjectID> &object_ids, std::vector<std::unique_ptr<RayObject>> *results) { for (auto &obj_id : object_ids) { if (missing_objects_.count(obj_id) == 0) { results->emplace_back(MakeDummyArg()); } else { results->emplace_back(nullptr); } } return true; }, /*max_pinned_task_arguments_bytes=*/1000) {} RayObject *MakeDummyArg() { std::vector<uint8_t> data; data.resize(default_arg_size_); auto buffer = std::make_shared<LocalMemoryBuffer>(data.data(), data.size()); return new RayObject(buffer, nullptr, {}); } void SetUp() {} void Shutdown() {} void AddNode(const NodeID &id, double num_cpus, double num_gpus = 0, double memory = 0) { std::unordered_map<std::string, double> node_resources; node_resources[ray::kCPU_ResourceLabel] = num_cpus; node_resources[ray::kGPU_ResourceLabel] = num_gpus; node_resources[ray::kMemory_ResourceLabel] = memory; scheduler_->AddOrUpdateNode(id.Binary(), node_resources, node_resources); rpc::GcsNodeInfo info; node_info_[id] = info; } void AssertNoLeaks() { ASSERT_TRUE(task_manager_.tasks_to_schedule_.empty()); ASSERT_TRUE(task_manager_.tasks_to_dispatch_.empty()); ASSERT_TRUE(task_manager_.waiting_tasks_index_.empty()); ASSERT_TRUE(task_manager_.waiting_task_queue_.empty()); ASSERT_TRUE(task_manager_.infeasible_tasks_.empty()); ASSERT_TRUE(task_manager_.executing_task_args_.empty()); ASSERT_TRUE(task_manager_.pinned_task_arguments_.empty()); ASSERT_EQ(task_manager_.pinned_task_arguments_bytes_, 0); ASSERT_TRUE(dependency_manager_.subscribed_tasks.empty()); } void AssertPinnedTaskArgumentsPresent(const Task &task) { const auto &expected_deps = task.GetTaskSpecification().GetDependencyIds(); ASSERT_EQ(task_manager_.executing_task_args_[task.GetTaskSpecification().TaskId()], expected_deps); for (auto &arg : expected_deps) { ASSERT_TRUE(task_manager_.pinned_task_arguments_.count(arg)); } } NodeID id_; std::shared_ptr<ClusterResourceScheduler> scheduler_; MockWorkerPool pool_; std::unordered_map<WorkerID, std::shared_ptr<WorkerInterface>> leased_workers_; std::unordered_set<ObjectID> missing_objects_; bool is_owner_alive_; int default_arg_size_ = 10; int node_info_calls_; int announce_infeasible_task_calls_; std::unordered_map<NodeID, boost::optional<rpc::GcsNodeInfo>> node_info_; MockTaskDependencyManager dependency_manager_; ClusterTaskManager task_manager_; }; TEST_F(ClusterTaskManagerTest, BasicTest) { /* Test basic scheduler functionality: 1. Queue and attempt to schedule/dispatch atest with no workers available 2. A worker becomes available, dispatch again. */ Task task = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 0); std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(node_info_calls_, 0); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, DispatchQueueNonBlockingTest) { /* Test that if no worker is available for the first task in a dispatch queue (because the runtime env in the task spec doesn't match any available worker), other tasks in the dispatch queue can still be scheduled. https://github.com/ray-project/ray/issues/16226 */ // Use the same required_resources for all tasks so they end up in the same queue. const std::unordered_map<std::string, double> required_resources = { {ray::kCPU_ResourceLabel, 4}}; std::string serialized_runtime_env_A = "mock_env_A"; Task task_A = CreateTask(required_resources, /*num_args=*/0, /*args=*/{}, serialized_runtime_env_A); rpc::RequestWorkerLeaseReply reply_A; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; std::string serialized_runtime_env_B = "mock_env_B"; Task task_B_1 = CreateTask(required_resources, /*num_args=*/0, /*args=*/{}, serialized_runtime_env_B); Task task_B_2 = CreateTask(required_resources, /*num_args=*/0, /*args=*/{}, serialized_runtime_env_B); rpc::RequestWorkerLeaseReply reply_B_1; rpc::RequestWorkerLeaseReply reply_B_2; auto empty_callback = [](Status, std::function<void()>, std::function<void()>) {}; // Ensure task_A is not at the front of the queue. task_manager_.QueueAndScheduleTask(task_B_1, &reply_B_1, empty_callback); task_manager_.QueueAndScheduleTask(task_A, &reply_A, callback); task_manager_.QueueAndScheduleTask(task_B_2, &reply_B_2, empty_callback); // Push a worker that can only run task A. const WorkerCacheKey env_A = {/*override_environment_variables=*/{}, serialized_runtime_env_A}; const int runtime_env_hash_A = env_A.IntHash(); std::shared_ptr<MockWorker> worker_A = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234, runtime_env_hash_A); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker_A)); ASSERT_EQ(pool_.workers.size(), 1); // Check we can schedule task A, even though task B is at the front of the queue // and no workers are available for task B. task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(node_info_calls_, 0); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task_A.GetTaskSpecification().TaskId()); // task_B_1 and task_B_2 remain in the dispatch queue, so don't call AssertNoLeaks(). // AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, BlockedWorkerDiesTest) { /* Tests the edge case in which a worker crashes while it's blocked. In this case, its CPU resources should not be double freed. */ Task task = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 0); std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(node_info_calls_, 0); // Block the worker. Which releases only the CPU resource. task_manager_.ReleaseCpuResourcesFromUnblockedWorker(worker); Task finished_task; // If a resource was double-freed, we will crash in this call. task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, BlockedWorkerDies2Test) { /* Same edge case as the previous test, but this time the block and finish requests happen in the opposite order. */ Task task = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 0); std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(node_info_calls_, 0); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); // Block the worker. Which releases only the CPU resource. task_manager_.ReleaseCpuResourcesFromUnblockedWorker(worker); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, NoFeasibleNodeTest) { std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::dynamic_pointer_cast<WorkerInterface>(worker)); Task task = CreateTask({{ray::kCPU_ResourceLabel, 999}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_called); ASSERT_EQ(leased_workers_.size(), 0); // Worker is unused. ASSERT_EQ(pool_.workers.size(), 1); ASSERT_EQ(node_info_calls_, 0); } TEST_F(ClusterTaskManagerTest, ResourceTakenWhileResolving) { /* Test the race condition in which a task is assigned to a node, but cannot run because its dependencies are unresolved. Once its dependencies are resolved, the node no longer has available resources. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); std::shared_ptr<MockWorker> worker2 = std::make_shared<MockWorker>(WorkerID::FromRandom(), 12345); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker2)); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); rpc::RequestWorkerLeaseReply reply; int num_callbacks = 0; int *num_callbacks_ptr = &num_callbacks; auto callback = [num_callbacks_ptr](Status, std::function<void()>, std::function<void()>) { (*num_callbacks_ptr) = *num_callbacks_ptr + 1; }; /* Blocked on dependencies */ auto task = CreateTask({{ray::kCPU_ResourceLabel, 5}}, 2); auto missing_arg = task.GetTaskSpecification().GetDependencyIds()[0]; missing_objects_.insert(missing_arg); std::unordered_set<TaskID> expected_subscribed_tasks = { task.GetTaskSpecification().TaskId()}; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 2); // It's important that we don't pop the worker until we need to. See // https://github.com/ray-project/ray/issues/13725. ASSERT_EQ(pool_.num_pops, 0); /* This task can run */ auto task2 = CreateTask({{ray::kCPU_ResourceLabel, 5}}, 1); task_manager_.QueueAndScheduleTask(task2, &reply, callback); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); AssertPinnedTaskArgumentsPresent(task2); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 1); ASSERT_EQ(pool_.num_pops, 1); /* First task is unblocked now, but resources are no longer available */ missing_objects_.erase(missing_arg); auto id = task.GetTaskSpecification().TaskId(); std::vector<TaskID> unblocked = {id}; task_manager_.TasksUnblocked(unblocked); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); AssertPinnedTaskArgumentsPresent(task2); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 1); ASSERT_EQ(pool_.num_pops, 1); /* Second task finishes, making space for the original task */ Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); leased_workers_.clear(); task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(dependency_manager_.subscribed_tasks.empty()); // Task2 is now done so task can run. AssertPinnedTaskArgumentsPresent(task); ASSERT_EQ(num_callbacks, 2); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(pool_.num_pops, 2); task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, TestSpillAfterAssigned) { /* Test the race condition in which a task is assigned to the local node, but it cannot be run because a different task gets assigned the resources first. The un-runnable task should eventually get spilled back to another node. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); auto remote_node_id = NodeID::FromRandom(); AddNode(remote_node_id, 5); int num_callbacks = 0; auto callback = [&](Status, std::function<void()>, std::function<void()>) { num_callbacks++; }; /* Blocked on starting a worker. */ auto task = CreateTask({{ray::kCPU_ResourceLabel, 5}}); rpc::RequestWorkerLeaseReply local_reply; task_manager_.QueueAndScheduleTask(task, &local_reply, callback); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); /* This task can run but not at the same time as the first */ auto task2 = CreateTask({{ray::kCPU_ResourceLabel, 5}}); rpc::RequestWorkerLeaseReply spillback_reply; task_manager_.QueueAndScheduleTask(task2, &spillback_reply, callback); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); // Two workers start. First task is dispatched now, but resources are no // longer available for the second. pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); // Check that both tasks got removed from the queue. ASSERT_EQ(num_callbacks, 2); // The first task was dispatched. ASSERT_EQ(leased_workers_.size(), 1); // The second task was spilled. ASSERT_EQ(spillback_reply.retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, TaskCancellationTest) { std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); Task task = CreateTask({{ray::kCPU_ResourceLabel, 1}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; // Task not queued so we can't cancel it. ASSERT_FALSE(task_manager_.CancelTask(task.GetTaskSpecification().TaskId())); task_manager_.QueueAndScheduleTask(task, &reply, callback); // Task is now in dispatch queue. callback_called = false; reply.Clear(); ASSERT_TRUE(task_manager_.CancelTask(task.GetTaskSpecification().TaskId())); task_manager_.ScheduleAndDispatchTasks(); // Task will not execute. ASSERT_TRUE(callback_called); ASSERT_TRUE(reply.canceled()); ASSERT_EQ(leased_workers_.size(), 0); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.QueueAndScheduleTask(task, &reply, callback); // Task is now running so we can't cancel it. callback_called = false; reply.Clear(); ASSERT_FALSE(task_manager_.CancelTask(task.GetTaskSpecification().TaskId())); // Task will not execute. ASSERT_FALSE(reply.canceled()); ASSERT_FALSE(callback_called); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(leased_workers_.size(), 1); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, TaskCancelInfeasibleTask) { /* Make sure cancelTask works for infeasible tasks */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); Task task = CreateTask({{ray::kCPU_ResourceLabel, 12}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); // Task is now queued so cancellation works. ASSERT_TRUE(task_manager_.CancelTask(task.GetTaskSpecification().TaskId())); task_manager_.ScheduleAndDispatchTasks(); // Task will not execute. ASSERT_TRUE(callback_called); ASSERT_TRUE(reply.canceled()); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); // Althoug the feasible node is added, task shouldn't be executed because it is // cancelled. auto remote_node_id = NodeID::FromRandom(); AddNode(remote_node_id, 12); task_manager_.ScheduleAndDispatchTasks(); ASSERT_TRUE(callback_called); ASSERT_TRUE(reply.canceled()); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, HeartbeatTest) { std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); { Task task = CreateTask({{ray::kCPU_ResourceLabel, 1}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_TRUE(callback_called); // Now {CPU: 7, GPU: 4, MEM:128} } { Task task = CreateTask({{ray::kCPU_ResourceLabel, 1}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_called); // No worker available. // Now {CPU: 7, GPU: 4, MEM:128} with 1 queued task. } { Task task = CreateTask({{ray::kCPU_ResourceLabel, 9}, {ray::kGPU_ResourceLabel, 5}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_called); // Infeasible. // Now there is also an infeasible task {CPU: 9}. } { Task task = CreateTask({{ray::kCPU_ResourceLabel, 10}, {ray::kGPU_ResourceLabel, 1}}); rpc::RequestWorkerLeaseReply reply; bool callback_called = false; bool *callback_called_ptr = &callback_called; auto callback = [callback_called_ptr](Status, std::function<void()>, std::function<void()>) { *callback_called_ptr = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_called); // Infeasible. // Now there is also an infeasible task {CPU: 10}. } { rpc::ResourcesData data; task_manager_.FillResourceUsage(data); auto load_by_shape = data.mutable_resource_load_by_shape()->mutable_resource_demands(); ASSERT_EQ(load_by_shape->size(), 3); std::vector<std::vector<unsigned int>> expected = { // infeasible, ready, CPU, GPU, size {1, 0, 10, 1, 2}, {1, 0, 9, 5, 2}, {0, 1, 1, 0, 1}}; for (auto &load : *load_by_shape) { bool found = false; for (unsigned int i = 0; i < expected.size(); i++) { auto expected_load = expected[i]; auto shape = *load.mutable_shape(); bool match = (expected_load[0] == load.num_infeasible_requests_queued() && expected_load[1] == load.num_ready_requests_queued() && expected_load[2] == shape["CPU"] && expected_load[4] == shape.size()); if (expected_load[3]) { match = match && shape["GPU"]; } // These logs are very useful for debugging. // RAY_LOG(ERROR) << "=========================="; // RAY_LOG(ERROR) << expected_load[0] << "\t" // << load.num_infeasible_requests_queued(); // RAY_LOG(ERROR) << expected_load[1] << "\t" << load.num_ready_requests_queued(); // RAY_LOG(ERROR) << expected_load[2] << "\t" << shape["CPU"]; // RAY_LOG(ERROR) << expected_load[3] << "\t" << shape["GPU"]; // RAY_LOG(ERROR) << expected_load[4] << "\t" << shape.size(); // RAY_LOG(ERROR) << "=========================="; // RAY_LOG(ERROR) << load.DebugString(); // RAY_LOG(ERROR) << "-----------------------------------"; found = found || match; } ASSERT_TRUE(found); } } } TEST_F(ClusterTaskManagerTest, BacklogReportTest) { /* Test basic scheduler functionality: 1. Queue and attempt to schedule/dispatch atest with no workers available 2. A worker becomes available, dispatch again. */ rpc::RequestWorkerLeaseReply reply; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; std::vector<TaskID> to_cancel; // Don't add these fist 2 tasks to `to_cancel`. for (int i = 0; i < 1; i++) { Task task = CreateTask({{ray::kCPU_ResourceLabel, 8}}); task.SetBacklogSize(10 - i); task_manager_.QueueAndScheduleTask(task, &reply, callback); } for (int i = 1; i < 10; i++) { Task task = CreateTask({{ray::kCPU_ResourceLabel, 8}}); task.SetBacklogSize(10 - i); task_manager_.QueueAndScheduleTask(task, &reply, callback); to_cancel.push_back(task.GetTaskSpecification().TaskId()); } ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(node_info_calls_, 0); { // No tasks can run because the worker pool is empty. rpc::ResourcesData data; task_manager_.FillResourceUsage(data); auto resource_load_by_shape = data.resource_load_by_shape(); auto shape1 = resource_load_by_shape.resource_demands()[0]; ASSERT_EQ(shape1.backlog_size(), 55); ASSERT_EQ(shape1.num_infeasible_requests_queued(), 0); ASSERT_EQ(shape1.num_ready_requests_queued(), 10); } // Push a worker so the first task can run. std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(worker); task_manager_.ScheduleAndDispatchTasks(); { rpc::ResourcesData data; task_manager_.FillResourceUsage(data); auto resource_load_by_shape = data.resource_load_by_shape(); auto shape1 = resource_load_by_shape.resource_demands()[0]; ASSERT_TRUE(callback_occurred); ASSERT_EQ(shape1.backlog_size(), 45); ASSERT_EQ(shape1.num_infeasible_requests_queued(), 0); ASSERT_EQ(shape1.num_ready_requests_queued(), 9); } // Cancel the rest. for (auto &task_id : to_cancel) { ASSERT_TRUE(task_manager_.CancelTask(task_id)); } RAY_LOG(ERROR) << "Finished cancelling tasks"; { rpc::ResourcesData data; task_manager_.FillResourceUsage(data); auto resource_load_by_shape = data.resource_load_by_shape(); ASSERT_EQ(resource_load_by_shape.resource_demands().size(), 0); while (!leased_workers_.empty()) { Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); leased_workers_.erase(leased_workers_.begin()); } AssertNoLeaks(); } } TEST_F(ClusterTaskManagerTest, OwnerDeadTest) { /* Test the race condition in which the owner of a task dies while the task is pending. This is the essence of test_actor_advanced.py::test_pending_actor_removed_by_owner */ Task task = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply; bool callback_occurred = false; bool *callback_occurred_ptr = &callback_occurred; auto callback = [callback_occurred_ptr](Status, std::function<void()>, std::function<void()>) { *callback_occurred_ptr = true; }; std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); is_owner_alive_ = false; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); is_owner_alive_ = true; task_manager_.ScheduleAndDispatchTasks(); ASSERT_FALSE(callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, TestInfeasibleTaskWarning) { /* Test if infeasible tasks warnings are printed. */ // Create an infeasible task. Task task = CreateTask({{ray::kCPU_ResourceLabel, 12}}); rpc::RequestWorkerLeaseReply reply; std::shared_ptr<bool> callback_occurred = std::make_shared<bool>(false); auto callback = [callback_occurred](Status, std::function<void()>, std::function<void()>) { *callback_occurred = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(announce_infeasible_task_calls_, 1); // Infeasible warning shouldn't be reprinted when the previous task is still infeasible // after adding a new node. AddNode(NodeID::FromRandom(), 8); std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); // Task shouldn't be scheduled yet. ASSERT_EQ(announce_infeasible_task_calls_, 1); ASSERT_FALSE(*callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); // Now we have a node that is feasible to schedule the task. Make sure the infeasible // task is spillbacked properly. auto remote_node_id = NodeID::FromRandom(); AddNode(remote_node_id, 12); task_manager_.ScheduleAndDispatchTasks(); // Make sure nothing happens locally. ASSERT_EQ(announce_infeasible_task_calls_, 1); ASSERT_TRUE(*callback_occurred); ASSERT_EQ(leased_workers_.size(), 0); ASSERT_EQ(pool_.workers.size(), 1); // Make sure the spillback callback is called. ASSERT_EQ(reply.retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, TestMultipleInfeasibleTasksWarnOnce) { /* Test infeasible warning is printed only once when the same shape is queued again. */ // Make sure the first infeasible task announces warning. Task task = CreateTask({{ray::kCPU_ResourceLabel, 12}}); rpc::RequestWorkerLeaseReply reply; std::shared_ptr<bool> callback_occurred = std::make_shared<bool>(false); auto callback = [callback_occurred](Status, std::function<void()>, std::function<void()>) { *callback_occurred = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(announce_infeasible_task_calls_, 1); // Make sure the same shape infeasible task won't be announced. Task task2 = CreateTask({{ray::kCPU_ResourceLabel, 12}}); rpc::RequestWorkerLeaseReply reply2; std::shared_ptr<bool> callback_occurred2 = std::make_shared<bool>(false); auto callback2 = [callback_occurred2](Status, std::function<void()>, std::function<void()>) { *callback_occurred2 = true; }; task_manager_.QueueAndScheduleTask(task2, &reply2, callback2); ASSERT_EQ(announce_infeasible_task_calls_, 1); } TEST_F(ClusterTaskManagerTest, TestAnyPendingTasks) { /* Check if the manager can correctly identify pending tasks. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); // task1: running Task task = CreateTask({{ray::kCPU_ResourceLabel, 6}}); rpc::RequestWorkerLeaseReply reply; std::shared_ptr<bool> callback_occurred = std::make_shared<bool>(false); auto callback = [callback_occurred](Status, std::function<void()>, std::function<void()>) { *callback_occurred = true; }; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_TRUE(*callback_occurred); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); // task1: running. Progress is made, and there's no deadlock. ray::Task exemplar; bool any_pending = false; int pending_actor_creations = 0; int pending_tasks = 0; ASSERT_FALSE(task_manager_.AnyPendingTasks(&exemplar, &any_pending, &pending_actor_creations, &pending_tasks)); // task1: running, task2: queued. Task task2 = CreateTask({{ray::kCPU_ResourceLabel, 6}}); rpc::RequestWorkerLeaseReply reply2; std::shared_ptr<bool> callback_occurred2 = std::make_shared<bool>(false); auto callback2 = [callback_occurred2](Status, std::function<void()>, std::function<void()>) { *callback_occurred2 = true; }; task_manager_.QueueAndScheduleTask(task2, &reply2, callback2); ASSERT_FALSE(*callback_occurred2); ASSERT_TRUE(task_manager_.AnyPendingTasks(&exemplar, &any_pending, &pending_actor_creations, &pending_tasks)); } TEST_F(ClusterTaskManagerTest, ArgumentEvicted) { /* Test the task's dependencies becoming local, then one of the arguments is evicted. The task should go from waiting -> dispatch -> waiting. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); rpc::RequestWorkerLeaseReply reply; int num_callbacks = 0; int *num_callbacks_ptr = &num_callbacks; auto callback = [num_callbacks_ptr](Status, std::function<void()>, std::function<void()>) { (*num_callbacks_ptr) = *num_callbacks_ptr + 1; }; /* Blocked on dependencies */ auto task = CreateTask({{ray::kCPU_ResourceLabel, 5}}, 2); auto missing_arg = task.GetTaskSpecification().GetDependencyIds()[0]; missing_objects_.insert(missing_arg); std::unordered_set<TaskID> expected_subscribed_tasks = { task.GetTaskSpecification().TaskId()}; task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); /* Task is unblocked now */ missing_objects_.erase(missing_arg); pool_.workers.clear(); auto id = task.GetTaskSpecification().TaskId(); task_manager_.TasksUnblocked({id}); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); /* Task argument gets evicted */ missing_objects_.insert(missing_arg); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(dependency_manager_.subscribed_tasks, expected_subscribed_tasks); ASSERT_EQ(num_callbacks, 0); ASSERT_EQ(leased_workers_.size(), 0); /* Worker available and arguments available */ missing_objects_.erase(missing_arg); task_manager_.TasksUnblocked({id}); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task.GetTaskSpecification().TaskId()); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, FeasibleToNonFeasible) { // Test the case, when resources changes in local node, the feasible task should // able to transfer to infeasible task std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); Task task1 = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply1; bool callback_occurred1 = false; task_manager_.QueueAndScheduleTask( task1, &reply1, [&callback_occurred1](Status, std::function<void()>, std::function<void()>) { callback_occurred1 = true; }); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_TRUE(callback_occurred1); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(task_manager_.tasks_to_schedule_.size(), 0); ASSERT_EQ(task_manager_.tasks_to_dispatch_.size(), 0); ASSERT_EQ(task_manager_.infeasible_tasks_.size(), 0); Task task2 = CreateTask({{ray::kCPU_ResourceLabel, 4}}); rpc::RequestWorkerLeaseReply reply2; bool callback_occurred2 = false; task_manager_.QueueAndScheduleTask( task2, &reply2, [&callback_occurred2](Status, std::function<void()>, std::function<void()>) { callback_occurred2 = true; }); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_FALSE(callback_occurred2); ASSERT_EQ(pool_.workers.size(), 0); ASSERT_EQ(task_manager_.tasks_to_schedule_.size(), 0); // This task is under scheduling ASSERT_EQ(task_manager_.tasks_to_dispatch_.size(), 1); ASSERT_EQ(task_manager_.infeasible_tasks_.size(), 0); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); ASSERT_EQ(finished_task.GetTaskSpecification().TaskId(), task1.GetTaskSpecification().TaskId()); // Delete cpu resource of local node, then task 2 should be turned into // infeasible. scheduler_->DeleteLocalResource(ray::kCPU_ResourceLabel); task_manager_.ScheduleAndDispatchTasks(); ASSERT_FALSE(callback_occurred2); ASSERT_EQ(task_manager_.tasks_to_schedule_.size(), 0); ASSERT_EQ(task_manager_.tasks_to_dispatch_.size(), 0); ASSERT_EQ(task_manager_.infeasible_tasks_.size(), 1); } TEST_F(ClusterTaskManagerTest, RleaseAndReturnWorkerCpuResources) { const NodeResources &node_resources = scheduler_->GetLocalNodeResources(); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 8); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 4); auto worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); // Check failed as the worker has no allocated resource instances. ASSERT_FALSE(task_manager_.ReleaseCpuResourcesFromUnblockedWorker(worker)); auto node_resource_instances = scheduler_->GetLocalResources(); auto available_resource_instances = node_resource_instances.GetAvailableResourceInstances(); auto allocated_instances = std::make_shared<TaskResourceInstances>(); const std::unordered_map<std::string, double> task_spec = {{"CPU", 1.}, {"GPU", 1.}}; ASSERT_TRUE(scheduler_->AllocateLocalTaskResources(task_spec, allocated_instances)); worker->SetAllocatedInstances(allocated_instances); // Check that the resoruces are allocated successfully. ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 7); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 3); // Check that the cpu resources are released successfully. ASSERT_TRUE(task_manager_.ReleaseCpuResourcesFromUnblockedWorker(worker)); // Check that only cpu resources are released. ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 8); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 3); // Mark worker as blocked. worker->MarkBlocked(); // Check failed as the worker is blocked. ASSERT_FALSE(task_manager_.ReleaseCpuResourcesFromUnblockedWorker(worker)); // Check nothing will be changed. ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 8); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 3); // Check that the cpu resources are returned back to worker successfully. ASSERT_TRUE(task_manager_.ReturnCpuResourcesToBlockedWorker(worker)); // Check that only cpu resources are returned back to the worker. ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 7); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 3); // Mark worker as unblocked. worker->MarkUnblocked(); ASSERT_FALSE(task_manager_.ReturnCpuResourcesToBlockedWorker(worker)); // Check nothing will be changed. ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::CPU].available, 7); ASSERT_EQ(node_resources.predefined_resources[PredefinedResources::GPU].available, 3); } TEST_F(ClusterTaskManagerTest, TestSpillWaitingTasks) { // Cases to check: // - resources available locally, task dependencies being fetched -> do not spill. // - resources available locally, task dependencies blocked -> spill. // - resources not available locally -> spill. std::vector<Task> tasks; std::vector<std::unique_ptr<rpc::RequestWorkerLeaseReply>> replies; int num_callbacks = 0; auto callback = [&](Status, std::function<void()>, std::function<void()>) { num_callbacks++; }; for (int i = 0; i < 5; i++) { Task task = CreateTask({{ray::kCPU_ResourceLabel, 8}}, /*num_args=*/1); tasks.push_back(task); replies.push_back(std::make_unique<rpc::RequestWorkerLeaseReply>()); // All tasks except the last one added are waiting for dependencies. if (i < 4) { auto missing_arg = task.GetTaskSpecification().GetDependencyIds()[0]; missing_objects_.insert(missing_arg); } task_manager_.QueueAndScheduleTask(task, replies[i].get(), callback); } ASSERT_EQ(num_callbacks, 0); auto remote_node_id = NodeID::FromRandom(); AddNode(remote_node_id, 16); // We are fetching dependencies for all waiting tasks and we have enough // resources available locally to schedule them. We should not spill from the // waiting queue. task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(num_callbacks, 0); // All waiting tasks are blocked due to lack of memory. We should only spill // up to the remote node's resource availability. for (auto &task : tasks) { dependency_manager_.blocked_tasks.insert(task.GetTaskSpecification().TaskId()); } task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(num_callbacks, 2); // Spill from the back of the waiting queue. ASSERT_EQ(replies[0]->retry_at_raylet_address().raylet_id(), ""); ASSERT_EQ(replies[1]->retry_at_raylet_address().raylet_id(), ""); ASSERT_EQ(replies[2]->retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); ASSERT_EQ(replies[3]->retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); ASSERT_FALSE(task_manager_.CancelTask(tasks[2].GetTaskSpecification().TaskId())); ASSERT_FALSE(task_manager_.CancelTask(tasks[3].GetTaskSpecification().TaskId())); // Do not spill back tasks ready to dispatch. ASSERT_EQ(replies[4]->retry_at_raylet_address().raylet_id(), ""); // Add a new node. All task dependencies are being fetched again, so no // spill. AddNode(remote_node_id, 8); dependency_manager_.blocked_tasks.clear(); task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(num_callbacks, 2); // Dispatch the ready task. Now we have no more resources available locally, // so we should spill one waiting task. std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::dynamic_pointer_cast<WorkerInterface>(worker)); task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(num_callbacks, 4); // One waiting task spilled. ASSERT_EQ(replies[0]->retry_at_raylet_address().raylet_id(), ""); ASSERT_EQ(replies[1]->retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); ASSERT_FALSE(task_manager_.CancelTask(tasks[1].GetTaskSpecification().TaskId())); // One task dispatched. ASSERT_EQ(replies[4]->worker_address().port(), 1234); // Spillback is idempotent. task_manager_.ScheduleAndDispatchTasks(); ASSERT_EQ(num_callbacks, 4); // One waiting task spilled. ASSERT_EQ(replies[0]->retry_at_raylet_address().raylet_id(), ""); ASSERT_EQ(replies[1]->retry_at_raylet_address().raylet_id(), remote_node_id.Binary()); ASSERT_FALSE(task_manager_.CancelTask(tasks[1].GetTaskSpecification().TaskId())); // One task dispatched. ASSERT_EQ(replies[4]->worker_address().port(), 1234); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); leased_workers_.clear(); ASSERT_TRUE(task_manager_.CancelTask(tasks[0].GetTaskSpecification().TaskId())); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, PinnedArgsMemoryTest) { /* Total memory required by executing tasks' args stays under the specified threshold. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); std::shared_ptr<MockWorker> worker2 = std::make_shared<MockWorker>(WorkerID::FromRandom(), 12345); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker2)); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); rpc::RequestWorkerLeaseReply reply; int num_callbacks = 0; int *num_callbacks_ptr = &num_callbacks; auto callback = [num_callbacks_ptr](Status, std::function<void()>, std::function<void()>) { (*num_callbacks_ptr) = *num_callbacks_ptr + 1; }; // This task can run. default_arg_size_ = 600; auto task = CreateTask({{ray::kCPU_ResourceLabel, 1}}, 1); task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 1); AssertPinnedTaskArgumentsPresent(task); // This task cannot run because it would put us over the memory threshold. auto task2 = CreateTask({{ray::kCPU_ResourceLabel, 1}}, 1); task_manager_.QueueAndScheduleTask(task2, &reply, callback); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 1); /* First task finishes, freeing memory for the second task */ Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); leased_workers_.clear(); task_manager_.ScheduleAndDispatchTasks(); AssertPinnedTaskArgumentsPresent(task2); ASSERT_EQ(num_callbacks, 2); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 0); task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); leased_workers_.clear(); AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, PinnedArgsSameMemoryTest) { /* * Two tasks that depend on the same object can run concurrently. */ std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); std::shared_ptr<MockWorker> worker2 = std::make_shared<MockWorker>(WorkerID::FromRandom(), 12345); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker2)); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); rpc::RequestWorkerLeaseReply reply; int num_callbacks = 0; int *num_callbacks_ptr = &num_callbacks; auto callback = [num_callbacks_ptr](Status, std::function<void()>, std::function<void()>) { (*num_callbacks_ptr) = *num_callbacks_ptr + 1; }; // This task can run. default_arg_size_ = 600; auto task = CreateTask({{ray::kCPU_ResourceLabel, 1}}, 1); task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); ASSERT_EQ(pool_.workers.size(), 1); AssertPinnedTaskArgumentsPresent(task); // This task can run because it depends on the same object as the first task. auto task2 = CreateTask({{ray::kCPU_ResourceLabel, 1}}, 1, task.GetTaskSpecification().GetDependencyIds()); task_manager_.QueueAndScheduleTask(task2, &reply, callback); ASSERT_EQ(num_callbacks, 2); ASSERT_EQ(leased_workers_.size(), 2); ASSERT_EQ(pool_.workers.size(), 0); Task finished_task; for (auto &worker : leased_workers_) { task_manager_.TaskFinished(worker.second, &finished_task); } AssertNoLeaks(); } TEST_F(ClusterTaskManagerTest, LargeArgsNoStarvationTest) { std::shared_ptr<MockWorker> worker = std::make_shared<MockWorker>(WorkerID::FromRandom(), 1234); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); rpc::RequestWorkerLeaseReply reply; int num_callbacks = 0; int *num_callbacks_ptr = &num_callbacks; auto callback = [num_callbacks_ptr](Status, std::function<void()>, std::function<void()>) { (*num_callbacks_ptr) = *num_callbacks_ptr + 1; }; default_arg_size_ = 2000; auto task = CreateTask({{ray::kCPU_ResourceLabel, 1}}, 1); pool_.PushWorker(std::static_pointer_cast<WorkerInterface>(worker)); task_manager_.QueueAndScheduleTask(task, &reply, callback); ASSERT_EQ(num_callbacks, 1); ASSERT_EQ(leased_workers_.size(), 1); AssertPinnedTaskArgumentsPresent(task); Task finished_task; task_manager_.TaskFinished(leased_workers_.begin()->second, &finished_task); AssertNoLeaks(); } int main(int argc, char **argv) { ::testing::InitGoogleTest(&argc, argv); return RUN_ALL_TESTS(); } } // namespace raylet } // namespace ray
[ "noreply@github.com" ]
noreply@github.com
6a24e28f6fe86352b150ad7abd28104a3a1f9151
a360a187fb653e5ac3c5e337437cce47cee16cad
/netLightServer/netLightServer.ino
d59e8742b50b420b09fa306140d2570790a3eaa7
[]
no_license
akirayou/hikarioto
2fbc6473c6c594cec366a90e1023edc8382c3032
50af2f92a1786513b525e992c8def6e41a9bdc56
refs/heads/master
2022-10-24T04:45:15.244470
2022-10-10T08:15:22
2022-10-10T08:15:22
224,053,106
0
0
null
null
null
null
UTF-8
C++
false
false
3,107
ino
#include <WiFi.h> #include <WiFiUdp.h> #include <ESPmDNS.h> #include <WiFiClient.h> #include<M5Stack.h> #include"cmdBuf.h" const char *ssid = "NETLED"; const char *password = "yamashiro"; const IPAddress ip(192, 168, 4, 1); const IPAddress subnet(255, 255, 255, 0); WiFiUDP udp; static uint8_t _cmdbuf[100]; CmdBuf cmd(_cmdbuf, 100); int deltaTime() { static unsigned long oldTime = 0; unsigned long now = millis(); int diff = now - oldTime; oldTime = now; return diff; } int resendCount = 0; void newState(int state) { log_i("new State: %d",state); cmd.clearCmd(); switch (state) { case 0: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 0); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 0); } break; case 1: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 0); } break; case 2: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 0); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 1); } break; case 3: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 0); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 0); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 1); } break; case 4: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 0); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 1); } break; case 5: for(int i=0;i<8;i++){ if(i%3==0)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==1)cmd.putCmd(i, CMD_NEXT, 1); if(i%3==2)cmd.putCmd(i, CMD_NEXT, 0); } default: break; } resendCount = 0; } void inState(int state) { if (resendCount < 3) { udp.beginPacket("192.168.4.255", 12322); udp.write(cmd.sendBuf, cmd.sendPos); udp.endPacket(); resendCount++; } } void setup() { // put your setup code here, to run once: M5.Lcd.setTextWrap(true); M5.begin(); WiFi.softAP(ssid, password); delay(100); WiFi.softAPConfig(ip, ip, subnet); M5.Lcd.printf("AP:%s,%s\n", ssid, password); udp.begin(12321); newState(0); } int wdtPacketCount=0; void loop() { static int state = 0; static int stateCount[] = {20000, 20000, 20000, 20000,20000,20000, -1}; static int count = 0; M5.update(); int delta = deltaTime(); count += delta; wdtPacketCount+=delta; if(wdtPacketCount>511){ wdtPacketCount=0; udp.beginPacket("192.168.4.255", 12322); udp.write(0); udp.endPacket(); } if (count > stateCount[state]) { count = 0; state++; if(stateCount[state]<0)state=0; M5.Lcd.clear(); M5.Lcd.setCursor(0,0); M5.Lcd.printf("State:%d",state); newState(state); } inState(state); delay(100); }
[ "you.akira.noda@gmail.com" ]
you.akira.noda@gmail.com
b92c0338aa2457bfadaece9ec1ea32b440ceb8b2
300abd8e158e48c0c113f5f0cb86afa0d162ab99
/Base/Access.h
8bfb81058d52cc75a4664e1eebc1414b3a0b0e68
[]
no_license
kepich/Base
f14c07f619073dd94f2f1a82bbf60f62d02eb4bd
8c5e09cc169e24797720804d947fdf26847aefba
refs/heads/master
2020-03-17T10:01:49.312222
2018-06-27T13:34:05
2018-06-27T13:34:05
133,497,491
0
0
null
null
null
null
WINDOWS-1251
C++
false
false
9,412
h
#pragma once #include "CreateNewAccount.h" namespace Base { using namespace System; using namespace System::ComponentModel; using namespace System::Collections; using namespace System::Windows::Forms; using namespace System::Data; using namespace System::Drawing; using namespace System::IO; /// <summary> /// Сводка для Access /// </summary> public ref class Access : public System::Windows::Forms::Form { public: Access() { InitializeComponent(); } public:Int32 ReturnData() { if (type == 'A') return 1; if (type == 'U') return 2; return 0; } protected: /// <summary> /// Освободить все используемые ресурсы. /// </summary> ~Access() { if (components) { delete components; } } private: Char type; private: System::Windows::Forms::TextBox^ textBox_Access_Login; private: System::Windows::Forms::TextBox^ textBox_Access_Password; private: System::Windows::Forms::Button^ button_Access_Enter; private: System::Windows::Forms::Label^ label1_Access_Login; private: System::Windows::Forms::Label^ label_Access_Password; private: System::Windows::Forms::Label^ label_Access_Description; private: System::Windows::Forms::Label^ Error; private: System::Windows::Forms::Button^ button1; private: /// <summary> /// Обязательная переменная конструктора. /// </summary> System::ComponentModel::Container ^components; #pragma region Windows Form Designer generated code /// <summary> /// Требуемый метод для поддержки конструктора — не изменяйте /// содержимое этого метода с помощью редактора кода. /// </summary> void InitializeComponent(void) { System::ComponentModel::ComponentResourceManager^ resources = (gcnew System::ComponentModel::ComponentResourceManager(Access::typeid)); this->textBox_Access_Login = (gcnew System::Windows::Forms::TextBox()); this->textBox_Access_Password = (gcnew System::Windows::Forms::TextBox()); this->button_Access_Enter = (gcnew System::Windows::Forms::Button()); this->label1_Access_Login = (gcnew System::Windows::Forms::Label()); this->label_Access_Password = (gcnew System::Windows::Forms::Label()); this->label_Access_Description = (gcnew System::Windows::Forms::Label()); this->Error = (gcnew System::Windows::Forms::Label()); this->button1 = (gcnew System::Windows::Forms::Button()); this->SuspendLayout(); // // textBox_Access_Login // this->textBox_Access_Login->Location = System::Drawing::Point(69, 34); this->textBox_Access_Login->Name = L"textBox_Access_Login"; this->textBox_Access_Login->Size = System::Drawing::Size(179, 20); this->textBox_Access_Login->TabIndex = 0; this->textBox_Access_Login->TextChanged += gcnew System::EventHandler(this, &Access::textBox_Access_Login_TextChanged); // // textBox_Access_Password // this->textBox_Access_Password->Location = System::Drawing::Point(69, 60); this->textBox_Access_Password->Name = L"textBox_Access_Password"; this->textBox_Access_Password->Size = System::Drawing::Size(179, 20); this->textBox_Access_Password->TabIndex = 2; this->textBox_Access_Password->UseSystemPasswordChar = true; this->textBox_Access_Password->TextChanged += gcnew System::EventHandler(this, &Access::textBox_Access_Password_TextChanged); // // button_Access_Enter // this->button_Access_Enter->Location = System::Drawing::Point(64, 101); this->button_Access_Enter->Name = L"button_Access_Enter"; this->button_Access_Enter->Size = System::Drawing::Size(184, 23); this->button_Access_Enter->TabIndex = 4; this->button_Access_Enter->Text = L"Войти"; this->button_Access_Enter->UseVisualStyleBackColor = true; this->button_Access_Enter->Click += gcnew System::EventHandler(this, &Access::button_Access_Enter_Click); // // label1_Access_Login // this->label1_Access_Login->AutoSize = true; this->label1_Access_Login->Location = System::Drawing::Point(6, 37); this->label1_Access_Login->Name = L"label1_Access_Login"; this->label1_Access_Login->Size = System::Drawing::Size(41, 13); this->label1_Access_Login->TabIndex = 2; this->label1_Access_Login->Text = L"Логин:"; // // label_Access_Password // this->label_Access_Password->AutoSize = true; this->label_Access_Password->Location = System::Drawing::Point(6, 63); this->label_Access_Password->Name = L"label_Access_Password"; this->label_Access_Password->Size = System::Drawing::Size(48, 13); this->label_Access_Password->TabIndex = 2; this->label_Access_Password->Text = L"Пароль:"; // // label_Access_Description // this->label_Access_Description->AutoSize = true; this->label_Access_Description->Location = System::Drawing::Point(12, 9); this->label_Access_Description->Name = L"label_Access_Description"; this->label_Access_Description->Size = System::Drawing::Size(236, 13); this->label_Access_Description->TabIndex = 3; this->label_Access_Description->Text = L"Добро пожаловать в абонентский менеджер"; // // Error // this->Error->AutoSize = true; this->Error->ForeColor = System::Drawing::Color::Red; this->Error->Location = System::Drawing::Point(66, 85); this->Error->Name = L"Error"; this->Error->Size = System::Drawing::Size(0, 13); this->Error->TabIndex = 4; // // button1 // this->button1->Location = System::Drawing::Point(64, 130); this->button1->Name = L"button1"; this->button1->Size = System::Drawing::Size(184, 23); this->button1->TabIndex = 6; this->button1->Text = L"Создать новую учетную запись"; this->button1->UseVisualStyleBackColor = true; this->button1->Click += gcnew System::EventHandler(this, &Access::button1_Click); // // Access // this->AutoScaleDimensions = System::Drawing::SizeF(6, 13); this->AutoScaleMode = System::Windows::Forms::AutoScaleMode::Font; this->ClientSize = System::Drawing::Size(263, 160); this->Controls->Add(this->button1); this->Controls->Add(this->Error); this->Controls->Add(this->label_Access_Description); this->Controls->Add(this->label_Access_Password); this->Controls->Add(this->label1_Access_Login); this->Controls->Add(this->button_Access_Enter); this->Controls->Add(this->textBox_Access_Password); this->Controls->Add(this->textBox_Access_Login); this->FormBorderStyle = System::Windows::Forms::FormBorderStyle::FixedDialog; this->Icon = (cli::safe_cast<System::Drawing::Icon^>(resources->GetObject(L"$this.Icon"))); this->Name = L"Access"; this->Text = L"Вход в учетную запись"; this->ResumeLayout(false); this->PerformLayout(); } #pragma endregion private: System::Void button_Access_Enter_Click(System::Object^ sender, System::EventArgs^ e) { array <Char>^ key = { 1,2,3,4,5,6,7,8,9 }; array <Char>^ login = textBox_Access_Login->Text->ToCharArray(); array <Char>^ password = textBox_Access_Password->Text->ToCharArray(); if (!textBox_Access_Login->Text->CompareTo("") || !textBox_Access_Password->Text->CompareTo("")) { if (!textBox_Access_Login->Text->CompareTo("")) Error->Text = "Введите логин!"; else Error->Text = "Введите пароль!"; } else { for (int i = 0; i < login->Length; i++) login[i] ^= key[i]; for (int i = 0; i < password->Length; i++) password[i] ^= key[8 - i]; StreamReader ^accessFile = gcnew StreamReader("AccessAccounts.txt"); String ^row; int isPasswordAccepted = 1, isLoginAccepted = 1, isHave = 0; while (accessFile->Peek() >= 0) { isPasswordAccepted = 1; isLoginAccepted = 1; row = accessFile->ReadLine(); array <String^>^ cells = row->Split(' ', '\0'); array <Char>^ loginNew = cells[0]->ToCharArray(); array <Char>^ passwordNew = cells[1]->ToCharArray(); if (login->Length == loginNew->Length) { for (int i = 0; i < login->Length; i++) if (login[i] != loginNew[i]) { isLoginAccepted = 0; break; } } else continue; if ((password->Length == passwordNew->Length) && isLoginAccepted) { for (int i = 0; i < password->Length; i++) if (password[i] != passwordNew[i]) { isPasswordAccepted = 0; break; } } if (isLoginAccepted && isPasswordAccepted) { type = (cells[2]->ToCharArray())[0]; isHave = 1; break; } } accessFile->Close(); if (isHave) { //**************************Вход в учетную запись******************************** this->DialogResult = System::Windows::Forms::DialogResult::OK; } else { Error->Text = "Неправильный логин/пароль!"; } } } private: System::Void textBox_Access_Login_TextChanged(System::Object^ sender, System::EventArgs^ e) { Error->Text = ""; } private: System::Void textBox_Access_Password_TextChanged(System::Object^ sender, System::EventArgs^ e) { Error->Text = ""; } private: System::Void button1_Click(System::Object^ sender, System::EventArgs^ e) { CreateNewAccount ^CreateNew = gcnew CreateNewAccount(); CreateNew->Enabled = true; CreateNew->ShowDialog(); } }; }
[ "pav007prikhod@mail.ru" ]
pav007prikhod@mail.ru
6d1066c1fd05473e6056f319d77debf103d69966
04b42e80b80a62596efca5f2077ed949b0bc8f18
/src/BUSINESS/TaskFactory.hpp
888bbf7859c84637ad5c438bc42b788c64434b76
[]
no_license
kiskompi/design_patterns
106011bf615bbaa65ea7a17648a4ac5775923900
d63309c401f601a64698219f730da90cc98671a4
refs/heads/master
2021-05-15T15:46:45.580467
2017-12-14T23:11:38
2017-12-14T23:11:38
107,419,805
0
0
null
null
null
null
UTF-8
C++
false
false
680
hpp
#ifndef TASKFACTORY_HPP #define TASKFACTORY_HPP #include "../TRANSFER/Task.hpp" #include "../DAO/DAO.hpp" class TaskFactory: public ElementFactory { DAOTask m_dao_empl = DAOFactory().get<DAOTask> (); public: TaskFactory () {} virtual Task make_element ( const std::string& p_name, const std::string& p_type, const std::string& p_priority, const std::string& p_deadline, const std::string& p_Task, const std::string& p_desc) const { Task empl = Task (p_name, p_type, p_priority, p_deadline, p_Task, p_desc); m_dao_empl.add (&empl); return empl; } }; #endif //TASKFACTORY_HPP
[ "kiskompi@gmail.com" ]
kiskompi@gmail.com
30b22d260d97c4bd9bed74b1cf4f989b73149431
35a0a383b079978992647555645ac30e52ebec3f
/lib/AST/Interp/Opcode.h
d2daa1ea52ac14865b33176cd16e36027651fae3
[ "Apache-2.0", "LLVM-exception", "NCSA" ]
permissive
Codeon-GmbH/mulle-clang
f050d6d8fb64689a1e4b039c4a6513823de9b430
214e526a2b6afeb9508cac5f88c5a4c28e98982f
refs/heads/mulle_objclang_100
2021-07-18T07:45:29.083064
2021-02-16T17:21:51
2021-02-16T17:21:51
72,544,381
29
5
Apache-2.0
2020-04-30T11:36:08
2016-11-01T14:32:02
C++
UTF-8
C++
false
false
817
h
//===--- Opcode.h - Opcodes for the constexpr VM ----------------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// // // Defines all opcodes executed by the VM and emitted by the compiler. // //===----------------------------------------------------------------------===// #ifndef LLVM_CLANG_AST_INTERP_OPCODE_H #define LLVM_CLANG_AST_INTERP_OPCODE_H #include <cstdint> namespace clang { namespace interp { enum Opcode : uint32_t { #define GET_OPCODE_NAMES #include "Opcodes.inc" #undef GET_OPCODE_NAMES }; } // namespace interp } // namespace clang #endif
[ "n@ndor.email" ]
n@ndor.email
304795d79032bdb0ddb4ad07715c79b39a5c7fbe
1912375effe70a5250ef73c4a64ec059f23e62c7
/crypter.cpp
c44aae62ad3d16819c5314e2c1c6473f842a8130
[]
no_license
NaidaTania/31-Day-Crypter
7c74edfb5202f4c33a48edeb2a703cd73f3e19ef
a7ac736dd4f935dc96ab72bb0630e2929f255ba4
refs/heads/master
2020-04-07T18:52:26.417274
2018-11-22T02:19:37
2018-11-22T02:19:37
158,627,375
0
0
null
null
null
null
UTF-8
C++
false
false
1,742
cpp
#include <iostream> #include <string> #include <fstream> #include <exception> #include <stdexcept> using namespace std; string asciiConvt(string s, int shift){ int asciiBef,asciiAft; string result; //65-90 | 97-122 for (int i = 0; i < s.length(); ++i){ asciiBef = (int)s[i]; asciiAft = asciiBef; if((asciiBef >= 65 && asciiBef <= 90) || (asciiBef >= 97 && asciiBef <= 122)){ //asciiBef += shift; asciiAft = asciiBef + shift; if(asciiBef <= 90 && asciiAft >= 97){ asciiAft += 6; } while(asciiAft>122){ asciiAft = 65 + (asciiAft-122) - 1; } while(asciiAft > 90 && asciiAft < 97){ asciiAft = 97 + abs(90 - asciiAft) - 1; } while(asciiAft<65){ asciiAft = 122 - abs(65-asciiAft) + 1; } } result += (char)asciiAft; } return result; } bool argLen(int x) { if (x == 2){ return true; } throw std::invalid_argument("Only 2 arguments please"); } int main(int argc, char* argv[]){ string temp; int i = 1; try{ argLen(argc); } catch(std::invalid_argument){ cout << "Please put the filename to be converted as the second argument!" << endl; return -1; } string inputname = argv[1]; ifstream r(inputname); //input file is to be named input.txt string outputname = inputname.substr(0,inputname.size() - 4) + "C.txt"; ofstream w(outputname); //crypted input exported into inputC.txt while(!r.eof()){ getline(r,temp); temp = asciiConvt(temp,i); w << temp << endl; i++; } w.close(); r.close(); }
[ "NaidaTania72@gmail.com" ]
NaidaTania72@gmail.com
31fb59ec9222336d0896a1bbead4297601ae012d
f41f55492e098d29c8af40477df6ab87ca0ebcad
/src/gl-spectrum/gl-spectrum.cc
e37caafaf0d65679554273783fe40e97eabf94f4
[ "LicenseRef-scancode-unknown-license-reference", "BSD-3-Clause" ]
permissive
codeseedr/audacious-plugins
0d1ca68f4f9336cc04a00f441ab2ccdee80d4254
458c4ed861fc0bac67ccd8420f0397c685ed1744
refs/heads/master
2021-01-21T09:53:39.697015
2014-10-11T00:22:23
2014-10-11T00:22:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
11,119
cc
/* * OpenGL Spectrum Analyzer for Audacious * Copyright 2013 Christophe Budé, John Lindgren, and Carlo Bramini * * Based on the XMMS plugin: * Copyright 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson, and * 4Front Technologies * * This program is free software; you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation; either version 2 of the License, or (at your option) any later * version. * * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. * * You should have received a copy of the GNU General Public License along with * this program; if not, write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ #include <math.h> #include <string.h> #include <libaudcore/i18n.h> #include <libaudcore/plugin.h> #include <gdk/gdk.h> #include <gtk/gtk.h> #include <GL/gl.h> #ifdef GDK_WINDOWING_X11 #include <GL/glx.h> #include <gdk/gdkx.h> #endif #ifdef GDK_WINDOWING_WIN32 #include <gdk/gdkwin32.h> #endif #define NUM_BANDS 32 #define DB_RANGE 40 #define BAR_SPACING (3.2f / NUM_BANDS) #define BAR_WIDTH (0.8f * BAR_SPACING) static const char gl_about[] = N_("OpenGL Spectrum Analyzer for Audacious\n" "Copyright 2013 Christophe Budé, John Lindgren, and Carlo Bramini\n\n" "Based on the XMMS plugin:\n" "Copyright 1998-2000 Peter Alm, Mikael Alm, Olle Hallnas, Thomas Nilsson, " "and 4Front Technologies\n\n" "License: GPLv2+"); class GLSpectrum : public VisPlugin { public: static constexpr PluginInfo info = { N_("OpenGL Spectrum Analyzer"), PACKAGE, gl_about }; constexpr GLSpectrum () : VisPlugin (info, AUD_VIS_TYPE_FREQ) {} bool init (); void * get_gtk_widget (); void clear (); void render_freq (const float * freq); }; EXPORT GLSpectrum aud_plugin_instance; static float logscale[NUM_BANDS + 1]; static float colors[NUM_BANDS][NUM_BANDS][3]; #ifdef GDK_WINDOWING_X11 static Display * s_display; static Window s_xwindow; static GLXContext s_context; #endif #ifdef GDK_WINDOWING_WIN32 static HWND s_hwnd; static HDC s_hdc; static HGLRC s_glrc; #endif static GtkWidget * s_widget = nullptr; static int s_pos = 0; static float s_angle = 25, s_anglespeed = 0.05f; static float s_bars[NUM_BANDS][NUM_BANDS]; bool GLSpectrum::init () { for (int i = 0; i <= NUM_BANDS; i ++) logscale[i] = powf (256, (float) i / NUM_BANDS) - 0.5f; for (int y = 0; y < NUM_BANDS; y ++) { float yf = (float) y / (NUM_BANDS - 1); for (int x = 0; x < NUM_BANDS; x ++) { float xf = (float) x / (NUM_BANDS - 1); colors[x][y][0] = (1 - xf) * (1 - yf); colors[x][y][1] = xf; colors[x][y][2] = yf; } } return true; } /* stolen from the skins plugin */ /* convert linear frequency graph to logarithmic one */ static void make_log_graph (const float * freq, float * graph) { for (int i = 0; i < NUM_BANDS; i ++) { /* sum up values in freq array between logscale[i] and logscale[i + 1], including fractional parts */ int a = ceilf (logscale[i]); int b = floorf (logscale[i + 1]); float sum = 0; if (b < a) sum += freq[b] * (logscale[i + 1] - logscale[i]); else { if (a > 0) sum += freq[a - 1] * (a - logscale[i]); for (; a < b; a ++) sum += freq[a]; if (b < 256) sum += freq[b] * (logscale[i + 1] - b); } /* fudge factor to make the graph have the same overall height as a 12-band one no matter how many bands there are */ sum *= (float) NUM_BANDS / 12; /* convert to dB */ float val = 20 * log10f (sum); /* scale (-DB_RANGE, 0.0) to (0.0, 1.0) */ val = 1 + val / DB_RANGE; graph[i] = aud::clamp (val, 0.0f, 1.0f); } } void GLSpectrum::render_freq (const float * freq) { make_log_graph (freq, s_bars[s_pos]); s_pos = (s_pos + 1) % NUM_BANDS; s_angle += s_anglespeed; if (s_angle > 45 || s_angle < -45) s_anglespeed = -s_anglespeed; if (s_widget) gtk_widget_queue_draw (s_widget); } void GLSpectrum::clear () { memset (s_bars, 0, sizeof s_bars); if (s_widget) gtk_widget_queue_draw (s_widget); } static void draw_rectangle (float x1, float y1, float z1, float x2, float y2, float z2, float r, float g, float b) { glColor3f (r, g, b); glBegin (GL_POLYGON); glVertex3f (x1, y2, z1); glVertex3f (x2, y2, z1); glVertex3f (x2, y2, z2); glVertex3f (x1, y2, z2); glEnd (); glColor3f (0.65f * r, 0.65f * g, 0.65f * b); glBegin (GL_POLYGON); glVertex3f (x1, y1, z1); glVertex3f (x1, y2, z1); glVertex3f (x1, y2, z2); glVertex3f (x1, y1, z2); glEnd (); glBegin (GL_POLYGON); glVertex3f (x2, y2, z1); glVertex3f (x2, y1, z1); glVertex3f (x2, y1, z2); glVertex3f (x2, y2, z2); glEnd (); glColor3f (0.8f * r, 0.8f * g, 0.8f * b); glBegin (GL_POLYGON); glVertex3f (x1, y1, z1); glVertex3f (x2, y1, z1); glVertex3f (x2, y2, z1); glVertex3f (x1, y2, z1); glEnd (); } static void draw_bar (float x, float z, float h, float r, float g, float b) { draw_rectangle (x, 0, z, x + BAR_WIDTH, h, z + BAR_WIDTH, r * (0.2f + 0.8f * h), g * (0.2f + 0.8f * h), b * (0.2f + 0.8f * h)); } static void draw_bars () { glPushMatrix (); glTranslatef (0.0f, -0.5f, -5.0f); glRotatef (38.0f, 1.0f, 0.0f, 0.0f); glRotatef (s_angle + 180.0f, 0.0f, 1.0f, 0.0f); glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); for (int i = 0; i < NUM_BANDS; i ++) { float z = -1.6f + (NUM_BANDS - i) * BAR_SPACING; for (int j = 0; j < NUM_BANDS; j ++) { draw_bar (1.6f - BAR_SPACING * j, z, s_bars[(s_pos + i) % NUM_BANDS][j] * 1.6, colors[i][j][0], colors[i][j][1], colors[i][j][2]); } } glPolygonMode (GL_FRONT_AND_BACK, GL_FILL); glPopMatrix (); } static gboolean draw_cb (GtkWidget * widget) { #ifdef GDK_WINDOWING_X11 if (! s_context) return FALSE; #endif #ifdef GDK_WINDOWING_WIN32 if (! s_glrc) return FALSE; #endif GtkAllocation alloc; gtk_widget_get_allocation (widget, & alloc); glViewport (0, 0, alloc.width, alloc.height); glDisable (GL_BLEND); glMatrixMode (GL_PROJECTION); glPushMatrix(); glLoadIdentity(); glFrustum (-1.1f, 1, -1.5f, 1, 2, 10); glMatrixMode (GL_MODELVIEW); glPushMatrix (); glLoadIdentity (); glEnable (GL_DEPTH_TEST); glDepthFunc (GL_LESS); glPolygonMode (GL_FRONT, GL_FILL); glEnable (GL_BLEND); glBlendFunc (GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); glClearColor (0, 0, 0, 1); glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_bars (); glPopMatrix (); glMatrixMode (GL_PROJECTION); glPopMatrix (); glDisable (GL_DEPTH_TEST); glDisable (GL_BLEND); glDepthMask (GL_TRUE); #ifdef GDK_WINDOWING_X11 glXSwapBuffers (s_display, s_xwindow); #endif #ifdef GDK_WINDOWING_WIN32 SwapBuffers (s_hdc); #endif return TRUE; } static void widget_realized () { GdkWindow * window = gtk_widget_get_window (s_widget); #ifdef GDK_WINDOWING_X11 GdkScreen * screen = gdk_window_get_screen (window); int nscreen = GDK_SCREEN_XNUMBER (screen); s_display = GDK_SCREEN_XDISPLAY (screen); s_xwindow = GDK_WINDOW_XID (window); /* Create s_context */ int attribs[] = { GLX_RGBA, GLX_RED_SIZE, 1, GLX_GREEN_SIZE, 1, GLX_BLUE_SIZE, 1, GLX_ALPHA_SIZE, 1, GLX_DOUBLEBUFFER, GLX_DEPTH_SIZE, 1, None }; XVisualInfo * xvinfo = glXChooseVisual (s_display, nscreen, attribs); g_return_if_fail (xvinfo); /* Fix up visual/colormap */ GdkVisual * visual = gdk_x11_screen_lookup_visual (screen, xvinfo->visualid); g_return_if_fail (visual); gtk_widget_set_visual (s_widget, visual); s_context = glXCreateContext (s_display, xvinfo, 0, True); g_return_if_fail (s_context); XFree (xvinfo); glXMakeCurrent (s_display, s_xwindow, s_context); #endif #ifdef GDK_WINDOWING_WIN32 s_hwnd = (HWND) GDK_WINDOW_HWND (window); s_hdc = GetDC (s_hwnd); PIXELFORMATDESCRIPTOR desc = { sizeof (PIXELFORMATDESCRIPTOR), 1, // version number (?) PFD_DRAW_TO_WINDOW | // format must support window PFD_SUPPORT_OPENGL | // format must support OpenGL PFD_DOUBLEBUFFER, // must support double buffering PFD_TYPE_RGBA, // request an RGBA format 24, // select a 8:8:8 bit color depth 0, 0, 0, 0, 0, 0, // color bits ignored (?) 0, // no alpha buffer 0, // shift bit ignored (?) 0, // no accumulation buffer 0, 0, 0, 0, // accumulation bits ignored (?) 16, // 16-bit z-buffer (depth buffer) 0, // no stencil buffer 0, // no auxiliary buffer (?) PFD_MAIN_PLANE, // main drawing layer 0, // reserved (?) 0, 0, 0 // layer masks ignored (?) }; int format = ChoosePixelFormat (s_hdc, & desc); g_return_if_fail (format != 0); SetPixelFormat (s_hdc, format, & desc); s_glrc = wglCreateContext (s_hdc); g_return_if_fail (s_glrc); wglMakeCurrent (s_hdc, s_glrc); #endif } static void widget_destroyed () { s_widget = nullptr; #ifdef GDK_WINDOWING_X11 if (s_context) { glXDestroyContext (s_display, s_context); s_context = nullptr; } s_display = nullptr; #endif #ifdef GDK_WINDOWING_WIN32 if (s_glrc) { wglMakeCurrent (s_hdc, nullptr); wglDeleteContext (s_glrc); s_glrc = nullptr; } if (s_hdc) { ReleaseDC (s_hwnd, s_hdc); s_hdc = nullptr; } s_hwnd = nullptr; #endif } void * GLSpectrum::get_gtk_widget () { if (s_widget) return s_widget; s_widget = gtk_drawing_area_new (); g_signal_connect (s_widget, "expose-event", (GCallback) draw_cb, nullptr); g_signal_connect (s_widget, "realize", (GCallback) widget_realized, nullptr); g_signal_connect (s_widget, "destroy", (GCallback) widget_destroyed, nullptr); /* Disable GTK double buffering */ gtk_widget_set_double_buffered (s_widget, FALSE); return s_widget; }
[ "john.lindgren@aol.com" ]
john.lindgren@aol.com
796cfd6d090f9e190cf02b8a4b2aabce19563542
38d076c54edecf59636096c6c35dbec95a0a44ae
/main.cpp
dfde5df047ff58035f6f9cb93a947e669d69916d
[]
no_license
SenshiH/myprojectcpp
b59ec6236eb16146f4f6ec8cce949c59369d9259
dbe3880ee41987a837aaaa50159e9419194fab18
refs/heads/master
2022-12-16T03:53:30.749478
2020-09-29T09:42:18
2020-09-29T09:42:18
299,569,980
0
0
null
null
null
null
UTF-8
C++
false
false
199
cpp
#include <iostream> #include <string> int main() { std::string nbre; std::cout << "Veuillez choisir un nombre : "; std::getline (std::cin, nbre); std::cout << "Ton nombre est : " << nbre; }
[ "noreply@github.com" ]
noreply@github.com
f291d63e7f4f72b3b85520f0a05803821ba3ad7f
a394443f7e28b1f95074b83a82744d3d7dfbcc9b
/part7/main.cpp
ea9da7325ca04e78a38fd7d2b7c3e695eb5c726e
[]
no_license
zqplgl/threadlearning
93059267c46f97b87435d53cdb54d31215749c9a
dad7768790d39733c0ac3f970eb49a44ac376668
refs/heads/master
2020-07-17T23:54:09.639339
2019-09-03T16:57:19
2019-09-03T16:57:19
206,128,279
0
0
null
null
null
null
UTF-8
C++
false
false
1,117
cpp
#include<thread> #include<vector> #include<iostream> #include<list> #include<mutex> #include<condition_variable> using namespace std; class A { public: void inMsgRecvQueue(){ for(int i=0; i<10000; ++i){ cout<<"push message "<<i<<endl; my_mutex1.lock(); msgRecQueue.push_back(i); my_con.notify_one(); my_mutex1.unlock(); } } void outMsgRecvQueue(){ for(int i=0; i<10000; ++i){ std::unique_lock<mutex> lk_gd(my_mutex1); my_con.wait(lk_gd, [this]{ if(msgRecQueue.empty()) return false; return true; }); int num = msgRecQueue.front(); msgRecQueue.pop_front(); cout<<"pop message "<<num<<endl; } } private: list<int> msgRecQueue; mutex my_mutex1; std::condition_variable my_con; }; int main(){ A a; thread outMessageObj(&A::outMsgRecvQueue, &a); thread inMessageObj(&A::inMsgRecvQueue, &a); inMessageObj.join(); outMessageObj.join(); }
[ "1316315878@qq.com" ]
1316315878@qq.com
e4a2220789c9caf7e81c8583143e21c28c960661
c0d763e03e8241f30815db1f461b362386e86507
/Udm.ino
5850c7ca1b12590ea3ec00ed71b7ff066689d877
[]
no_license
gaurivn/Arduino-Measuring-Distance
e16c60c6e10ba3e6fc29f4589e43449a6c4abbed
e41b3ac43d6dc1676958656ed8cb19f2a0c9bd31
refs/heads/master
2020-04-30T11:50:00.745466
2019-03-31T11:51:50
2019-03-31T11:51:50
176,812,052
0
2
null
null
null
null
UTF-8
C++
false
false
640
ino
const int trigger = 7; const int echoPin = 6; void setup() { Serial.begin(9600); } void loop() { long duration, inches, cm; pinMode(trigger, OUTPUT); digitalWrite(trigger, LOW); delayMicroseconds(2); digitalWrite(trigger, HIGH); delayMicroseconds(10); digitalWrite(trigger, LOW); pinMode(echoPin, INPUT); duration = pulseIn(echoPin, HIGH); cm = microsecondsToCentimeters(duration); Serial.print(cm/100.0); Serial.print("m "); Serial.print(cm); Serial.print("cm"); Serial.println(); delay(1000); } long microsecondsToCentimeters(long microseconds) { return microseconds * 0.034 *0.5; }
[ "gaurin391@gmail.com" ]
gaurin391@gmail.com
0c9f6ee6bd748466788b4693d9fcd6b8c6a4a718
6aada0781661525baa370e53c341e75ba2d488d7
/DesignPatterns/BehavioralPatterns/BehavioralPatterns/ListTraverser.h
e9d7b74fc6a5d6b645f4c1b4ea13ef1303f23ac8
[]
no_license
Zerophase/CodeFromBooks
2aaf50e07bce39406ad4e4723545e5f0f45c075f
fef44a217cbb33991c29157aa6f60af0b457315b
refs/heads/master
2021-01-22T13:08:19.788541
2015-01-02T05:04:32
2015-01-02T05:04:32
28,703,442
0
1
null
null
null
null
UTF-8
C++
false
false
298
h
#ifndef LISTTRAVERSER_H #define LISTTRAVERSER_H #include "List.h" template<class Item> class ListTraverser { public: ListTraverser(List <Item> *aList); bool Traverse(); protected: virtual bool ProcessItem(const Item&) = 0; private: ListIterator<Item> _iterator; }; #endif // !LISTTRAVERSER_H
[ "mikelojkovic@gmail.com" ]
mikelojkovic@gmail.com
042f84fe40e956c94edb60763839fd321a33b66f
118c98acf9e57be0c844bf818bc405f0f3663e6c
/src/base/win/metro.cc
f7f1078b9d872bef47cd5990eb6979cf3ca6ef27
[]
no_license
zcnet4/cp-sky
7b465dd6f018bd17cf9196109b27cc23f821dd72
5f4f19673c90f15766bf5d904b21e1e0198bfd2a
refs/heads/master
2021-01-01T06:16:52.724105
2016-10-24T09:20:04
2016-10-24T09:20:04
12,173,428
0
0
null
null
null
null
UTF-8
C++
false
false
5,987
cc
// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "base/win/metro.h" #include "base/message_loop.h" #include "base/string_util.h" #include "base/win/scoped_comptr.h" #include "base/win/windows_version.h" namespace base { namespace win { namespace { bool g_should_tsf_aware_required = false; } HMODULE GetMetroModule() { const HMODULE kUninitialized = reinterpret_cast<HMODULE>(1); static HMODULE metro_module = kUninitialized; if (metro_module == kUninitialized) { // Initialize the cache, note that the initialization is idempotent // under the assumption that metro_driver is never unloaded, so the // race to this assignment is safe. metro_module = GetModuleHandleA("metro_driver.dll"); if (metro_module != NULL) { // This must be a metro process if the metro_driver is loaded. DCHECK(IsMetroProcess()); } } DCHECK(metro_module != kUninitialized); return metro_module; } bool IsMetroProcess() { enum ImmersiveState { kImmersiveUnknown, kImmersiveTrue, kImmersiveFalse }; // The immersive state of a process can never change. // Look it up once and cache it here. static ImmersiveState state = kImmersiveUnknown; if (state == kImmersiveUnknown) { if (IsProcessImmersive(::GetCurrentProcess())) { state = kImmersiveTrue; } else { state = kImmersiveFalse; } } DCHECK_NE(kImmersiveUnknown, state); return state == kImmersiveTrue; } bool IsProcessImmersive(HANDLE process) { typedef BOOL (WINAPI* IsImmersiveProcessFunc)(HANDLE process); HMODULE user32 = ::GetModuleHandleA("user32.dll"); DCHECK(user32 != NULL); IsImmersiveProcessFunc is_immersive_process = reinterpret_cast<IsImmersiveProcessFunc>( ::GetProcAddress(user32, "IsImmersiveProcess")); if (is_immersive_process) return is_immersive_process(process) ? true: false; return false; } bool IsTSFAwareRequired() { // Although this function is equal to IsMetroProcess at this moment, // Chrome for Win7 and Vista may support TSF in the future. return g_should_tsf_aware_required || IsMetroProcess(); } void SetForceToUseTSF() { g_should_tsf_aware_required = true; // Since Windows 8 Metro mode disables CUAS (Cicero Unaware Application // Support) via ImmDisableLegacyIME API, Chrome must be fully TSF-aware on // Metro mode. For debugging purposes, explicitly call ImmDisableLegacyIME so // that one can test TSF functionality even on Windows 8 desktop mode. Note // that CUAS cannot be disabled on Windows Vista/7 where ImmDisableLegacyIME // is not available. typedef BOOL (* ImmDisableLegacyIMEFunc)(); HMODULE imm32 = ::GetModuleHandleA("imm32.dll"); if (imm32 == NULL) return; ImmDisableLegacyIMEFunc imm_disable_legacy_ime = reinterpret_cast<ImmDisableLegacyIMEFunc>( ::GetProcAddress(imm32, "ImmDisableLegacyIME")); if (imm_disable_legacy_ime == NULL) { // Unsupported API, just do nothing. return; } if (!imm_disable_legacy_ime()) { DVLOG(1) << "Failed to disable legacy IME."; } } wchar_t* LocalAllocAndCopyString(const string16& src) { size_t dest_size = (src.length() + 1) * sizeof(wchar_t); wchar_t* dest = reinterpret_cast<wchar_t*>(LocalAlloc(LPTR, dest_size)); base::wcslcpy(dest, src.c_str(), dest_size); return dest; } bool IsTouchEnabled() { /*int value = GetSystemMetrics(SM_DIGITIZER); return (value & (NID_READY | NID_INTEGRATED_TOUCH)) == (NID_READY | NID_INTEGRATED_TOUCH);*/ return false; } bool IsParentalControlActivityLoggingOn() { // Query this info on Windows Vista and above. if (base::win::GetVersion() < base::win::VERSION_VISTA) return false; static bool parental_control_logging_required = false; static bool parental_control_status_determined = false; if (parental_control_status_determined) return parental_control_logging_required; parental_control_status_determined = true; ScopedComPtr<IWindowsParentalControlsCore> parent_controls; HRESULT hr = parent_controls.CreateInstance( __uuidof(WindowsParentalControls)); if (FAILED(hr)) return false; ScopedComPtr<IWPCSettings> settings; hr = parent_controls->GetUserSettings(NULL, settings.Receive()); if (FAILED(hr)) return false; unsigned long restrictions = 0; settings->GetRestrictions(&restrictions); parental_control_logging_required = (restrictions & WPCFLAG_LOGGING_REQUIRED) == WPCFLAG_LOGGING_REQUIRED; return parental_control_logging_required; } // Metro driver exports for getting the launch type, initial url, initial // search term, etc. extern "C" { typedef const wchar_t* (*GetInitialUrl)(); typedef const wchar_t* (*GetInitialSearchString)(); typedef base::win::MetroLaunchType (*GetLaunchType)( base::win::MetroPreviousExecutionState* previous_state); } MetroLaunchType GetMetroLaunchParams(string16* params) { HMODULE metro = base::win::GetMetroModule(); if (!metro) return base::win::METRO_LAUNCH_ERROR; GetLaunchType get_launch_type = reinterpret_cast<GetLaunchType>( ::GetProcAddress(metro, "GetLaunchType")); DCHECK(get_launch_type); base::win::MetroLaunchType launch_type = get_launch_type(NULL); if ((launch_type == base::win::METRO_PROTOCOL) || (launch_type == base::win::METRO_LAUNCH)) { GetInitialUrl initial_metro_url = reinterpret_cast<GetInitialUrl>( ::GetProcAddress(metro, "GetInitialUrl")); DCHECK(initial_metro_url); *params = initial_metro_url(); } else if (launch_type == base::win::METRO_SEARCH) { GetInitialSearchString initial_search_string = reinterpret_cast<GetInitialSearchString>( ::GetProcAddress(metro, "GetInitialSearchString")); DCHECK(initial_search_string); *params = initial_search_string(); } return launch_type; } } // namespace win } // namespace base
[ "zcnet4@gmail.com" ]
zcnet4@gmail.com
c73f8eeedf7b805831255f728b6b427fb1a1968d
0cb371cbf25a8151a24c336236ab8f8598bd1541
/base/features/skinchanger.cpp
502208a90f35262d8c9ac5cbbbc286c002b3d591
[ "MIT" ]
permissive
playday3008/qo0-base
72adc81fc9dab0d1e3bda9d709d00017066c6040
69159dae8a466b51ae74847e9bbe6b0db04a26d2
refs/heads/master
2023-01-28T20:15:27.508354
2020-11-29T11:56:01
2020-11-29T11:56:01
292,084,952
0
0
MIT
2020-11-28T14:36:41
2020-09-01T19:08:21
C++
UTF-8
C++
false
false
629
cpp
#include "skinchanger.h" // used: create entity #include "../utilities.h" // used: client, engine interfaces #include "../core/interfaces.h" void CSkinChanger::Run() { CBaseEntity* pLocal = CBaseEntity::GetLocalPlayer(); if (pLocal == nullptr || !pLocal->IsAlive()) return; PlayerInfo_t pInfo; if (!I::Engine->GetPlayerInfo(I::Engine->GetLocalPlayer(), &pInfo)) return; // it will help you here my sweetest candy <3 // https://www.unknowncheats.me/wiki/Counter_Strike_Global_Offensive:Skin_Changer } void CSkinChanger::Event(IGameEvent* pEvent, const FNV1A_t uNameHash) { if (!I::Engine->IsInGame()) return; }
[ "blastcraft@mail.ru" ]
blastcraft@mail.ru
128ffa9d1bafae02b58a1c12902fff04181a3ed0
27dafead61b844aaa6291691bbb167707ec07407
/Test/lexicographical_compare.cpp
9c1dbe2036854d8a0036db2a7da05ce497fba4d7
[]
no_license
kusl/parallelstl
dc608e69b5c91aecbbe978f34faa6210d326be15
0f4d131de4a3836af967f240b35a1c28395f8d72
refs/heads/master
2021-01-25T10:05:45.531787
2014-04-21T21:11:49
2014-04-21T21:11:49
null
0
0
null
null
null
null
UTF-8
C++
false
false
7,394
cpp
#include "stdafx.h" namespace ParallelSTL_Tests { TEST_CLASS(LexicographicalCompareTest) { static const size_t MARKER_VALUE_LESS = 2; static const size_t MARKER_VALUE_GRATER = 3; enum CompareDataType { Equal, Less, Greater }; template<typename _IterCat> struct LexicographicalCompareAlgoTest : public AlgoTest<LexicographicalCompareAlgoTest<_IterCat>, _IterCat, size_t, bool> { CompareDataType _ExpectedResultType; LexicographicalCompareAlgoTest(CompareDataType _Type) : _ExpectedResultType(_Type) { auto _Start = MARKER_VALUE_GRATER + rand(); std::iota(std::begin(_Ct), std::end(_Ct), _Start); _Ct_copy.resize(_Ct.size()); std::iota(std::begin(_Ct_copy), std::end(_Ct_copy), _Start); if (_Type != Equal) { auto _Pos = rand() % _Ct.size(); _Ct[_Pos] = _Type == Less ? MARKER_VALUE_GRATER : MARKER_VALUE_LESS; _Ct_copy[_Pos] = _Type == Less ? MARKER_VALUE_LESS : MARKER_VALUE_GRATER; } } ~LexicographicalCompareAlgoTest() { if (_ExpectedResultType == Equal || _ExpectedResultType == Less) Assert::IsFalse(_Result); else Assert::IsTrue(_Result); } std::function<bool(size_t, size_t)> callback() { return std::function<bool(size_t, size_t)>([](size_t _Val, size_t _Val2) { if (_Val == MARKER_VALUE_GRATER || _Val2 == MARKER_VALUE_GRATER) return _Val != MARKER_VALUE_GRATER; return false; }); } }; template<typename _IterCat> void RunLexicographicalCompare(CompareDataType _Type) { { // seq LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(seq, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest())); } { //par LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(par, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest())); } { //vec LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(vec, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest())); } } TEST_METHOD(LexicographicalCompare) { RunLexicographicalCompare<random_access_iterator_tag>(Equal); RunLexicographicalCompare<random_access_iterator_tag>(Less); RunLexicographicalCompare<random_access_iterator_tag>(Greater); RunLexicographicalCompare<forward_iterator_tag>(Equal); RunLexicographicalCompare<forward_iterator_tag>(Less); RunLexicographicalCompare<forward_iterator_tag>(Greater); RunLexicographicalCompare<input_iterator_tag>(Equal); RunLexicographicalCompare<input_iterator_tag>(Less); RunLexicographicalCompare<input_iterator_tag>(Greater); } template<typename _IterCat> void RunLexicographicalCompareCallback(CompareDataType _Type) { { // seq LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(seq, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest(), _Alg.callback())); } { //par LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(par, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest(), _Alg.callback())); } { //vec LexicographicalCompareAlgoTest<_IterCat> _Alg(_Type); _Alg.set_result(lexicographical_compare(vec, _Alg.begin_in(), _Alg.end_in(), _Alg.begin_dest(), _Alg.end_dest(), _Alg.callback())); } } TEST_METHOD(LexicographicalCompareCallback) { RunLexicographicalCompareCallback<random_access_iterator_tag>(Equal); RunLexicographicalCompareCallback<random_access_iterator_tag>(Less); RunLexicographicalCompareCallback<random_access_iterator_tag>(Greater); RunLexicographicalCompareCallback<forward_iterator_tag>(Equal); RunLexicographicalCompareCallback<forward_iterator_tag>(Less); RunLexicographicalCompareCallback<forward_iterator_tag>(Greater); RunLexicographicalCompareCallback<input_iterator_tag>(Equal); RunLexicographicalCompareCallback<input_iterator_tag>(Less); RunLexicographicalCompareCallback<input_iterator_tag>(Greater); } TEST_METHOD(LexicographicalCompareEdgeCases) { std::vector<int> vec_empty; Assert::IsFalse(lexicographical_compare(par, std::begin(vec_empty), std::end(vec_empty), std::begin(vec_empty), std::end(vec_empty))); std::vector<int> vec_one_0 = { 0 }; std::vector<int> vec_one_1 = { 1 }; Assert::IsTrue(lexicographical_compare(par, std::begin(vec_empty), std::end(vec_empty), std::begin(vec_one_0), std::end(vec_one_0))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_one_0), std::end(vec_one_0), std::begin(vec_empty), std::end(vec_empty))); Assert::IsTrue(lexicographical_compare(par, std::begin(vec_one_0), std::end(vec_one_0), std::begin(vec_one_1), std::end(vec_one_1))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_one_1), std::end(vec_one_1), std::begin(vec_one_0), std::end(vec_one_0))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_one_1), std::end(vec_one_1), std::begin(vec_one_1), std::end(vec_one_1))); std::vector<int> vec_two_10 = { 1, 0 }; std::vector<int> vec_two_01 = { 0, 1 }; Assert::IsTrue(lexicographical_compare(par, std::begin(vec_two_01), std::end(vec_two_01), std::begin(vec_two_10), std::end(vec_two_10))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_two_10), std::end(vec_two_10), std::begin(vec_two_01), std::end(vec_two_01))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_two_10), std::end(vec_two_10), std::begin(vec_two_10), std::end(vec_two_10))); std::vector<int> vec_short = { 0, 0, 2, 3, 4 }; std::vector<int> vec_long = { 0, 0, 2, 3, 5, 6, 10, 10, 12, 12, 12 }; Assert::IsTrue(lexicographical_compare(par, std::begin(vec_short), std::end(vec_short), std::begin(vec_long), std::end(vec_long))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_long), std::end(vec_long), std::begin(vec_short), std::end(vec_short))); std::vector<int> vec_mismatch = { 1, 2 }; std::vector<int> vec_mismatch2 = { 1, 2, 3, 4, 5 }; // Prefix of vec_mismatch2 Assert::IsTrue(lexicographical_compare(par, std::begin(vec_mismatch), std::end(vec_mismatch), std::begin(vec_mismatch2), std::end(vec_mismatch2))); Assert::IsFalse(lexicographical_compare(par, std::begin(vec_mismatch2), std::end(vec_mismatch2), std::begin(vec_mismatch), std::end(vec_mismatch))); } TEST_METHOD(LexicographicalIteratorCombinations) { // This test must just instantiate all template no runtime execution is required bool _Exit = true; // Removes constant expresssion warning if (_Exit) return; std::vector<int> vec; auto _RaIter = make_test_iterator<random_access_iterator_tag>(std::begin(vec)); auto _FwdIter = make_test_iterator<forward_iterator_tag>(std::begin(vec)); auto _InIter = make_test_iterator<input_iterator_tag>(std::begin(vec)); lexicographical_compare(par, _RaIter, _RaIter, _FwdIter, _FwdIter); lexicographical_compare(par, _RaIter, _RaIter, _InIter, _InIter); lexicographical_compare(par, _FwdIter, _FwdIter, _RaIter, _RaIter); lexicographical_compare(par, _FwdIter, _FwdIter, _InIter, _InIter); lexicographical_compare(par, _InIter, _InIter, _FwdIter, _FwdIter); lexicographical_compare(par, _InIter, _InIter, _RaIter, _RaIter); } }; }
[ "laksberg@hotmail.com" ]
laksberg@hotmail.com
f8e6a345ece0412404020004e70f477ca7078b3c
deeb441d58bf7b5d8c5115db414663e900807127
/src/PID/PID.h
d16a883c2a091de3a205b48117a2169ae60a0e94
[]
no_license
mltmyr/extruderCtrl
01a67febe9e45286a90a1c24b5d79120b3bc9c8a
a25b6d5582591434fc628c5fa28e59077be489be
refs/heads/main
2023-07-22T01:14:02.657496
2021-09-06T17:05:23
2021-09-06T17:05:23
341,133,266
0
0
null
null
null
null
UTF-8
C++
false
false
597
h
#ifndef PID_H__ #define PID_H__ typedef struct { float Kp; float Ki; float Kd; float i_sum0; float u_lim_low; float u_lim_high; } pid_cfg_t; class Pid { public: Pid(pid_cfg_t* cfg); Pid(float Kp, float Ki, float Kd, float i_sum0, float u_lim_low, float u_lim_high); ~Pid(); float get_u(float error); void set_iSum(float i_sum0); private: float P; float I; float D; float i_sum; float u_lim_low; float u_lim_high; float e; float e_prev; uint32_t t; uint32_t t_prev; float u; }; #endif /* PID_H__ */
[ "kallexm@hotmail.com" ]
kallexm@hotmail.com
4bd8d31cc1bc467117d11231a849a7c2e8b0a33a
6a721fb3eecf92950e1f6007fb49c399f0b3cb7c
/SDK/PUBG_BP_InteractionWidget_classes.hpp
d4e9b666c9abb82c513056f3dc07c31051aa6867
[]
no_license
handsomeprince/PUBG-SDK-3
5474c48041b6fd4e4be975c222f76b6c02df9f31
5a922157f770a49c82ae597284d2a7cb60c86515
refs/heads/master
2021-04-15T09:46:11.411487
2018-02-22T06:13:30
2018-02-22T06:13:30
null
0
0
null
null
null
null
UTF-8
C++
false
false
13,226
hpp
#pragma once // PlayerUnknown's Battlegrounds (2.6.23) SDK #ifdef _MSC_VER #pragma pack(push, 0x8) #endif #include "PUBG_BP_InteractionWidget_structs.hpp" namespace Classes { //--------------------------------------------------------------------------- //Classes //--------------------------------------------------------------------------- // WidgetBlueprintGeneratedClass BP_InteractionWidget.BP_InteractionWidget_C // 0x0098 (0x0630 - 0x0598) class UBP_InteractionWidget_C : public UInteractionBaseWidget { public: class UWidgetAnimation* InteractionUnavaliableLooping; // 0x0598(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* InteractionUnavaliableVanishing; // 0x05A0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* InteractionUnavaliableEmerging; // 0x05A8(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* ResetItemSwitchAnimation; // 0x05B0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* ItemSwitchAnimation; // 0x05B8(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* AdditionalMessageVanishing; // 0x05C0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* AdditionalMessageEmerging; // 0x05C8(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* AdditionalMessageNormal; // 0x05D0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* AdditionalMessageBlinking; // 0x05D8(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* Vanishing; // 0x05E0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* show; // 0x05E8(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UWidgetAnimation* Default; // 0x05F0(0x0008) (BlueprintVisible, ExportObject, BlueprintReadOnly, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* Image_6; // 0x05F8(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* Image_7; // 0x0600(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UBorder* InteractionBorder; // 0x0608(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* InteractionKeyImage_Left; // 0x0610(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* InteractionKeyImage_Right; // 0x0618(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* ProgressCircle; // 0x0620(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) class UImage* ProgressCircleBg; // 0x0628(0x0008) (BlueprintVisible, ExportObject, ZeroConstructor, InstancedReference, IsPlainOldData, RepSkip, RepNotify, Interp, NonTransactional, EditorOnly, NoDestructor, AutoWeak, ContainsInstancedReference, AssetRegistrySearchable, SimpleDisplay, AdvancedDisplay, Protected, BlueprintCallable, BlueprintAuthorityOnly, TextExportTransient, NonPIEDuplicateTransient, ExposeOnSpawn, PersistentInstance, UObjectWrapper, HasGetValueTypeHash, NativeAccessSpecifierPublic, NativeAccessSpecifierProtected, NativeAccessSpecifierPrivate) static UClass* StaticClass() { static auto ptr = UObject::FindClass("WidgetBlueprintGeneratedClass BP_InteractionWidget.BP_InteractionWidget_C"); return ptr; } }; } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "number201724@me.com" ]
number201724@me.com
36ff685e047d1c44ed6a9a58f4ab45ba377ed9a6
385cb811d346a4d7a285fc087a50aaced1482851
/NEERC/2012-2013/Moscow/I.cpp
931c57eb2b57584cf99748eaaa178099ddc9ce99
[]
no_license
NoureldinYosri/competitive-programming
aa19f0479420d8d1b10605536e916f0f568acaec
7739344404bdf4709c69a97f61dc3c0b9deb603c
refs/heads/master
2022-11-22T23:38:12.853482
2022-11-10T20:32:28
2022-11-10T20:32:28
40,174,513
4
1
null
null
null
null
UTF-8
C++
false
false
1,087
cpp
#include <bits/stdc++.h> #define loop(i,n) for(int i = 0;i < (n);i++) #define range(i,a,b) for(int i = (a);i <= (b);i++) #define rrep(i,n) for(int i = (n);i >= 0;i--) #define rran(i,a,b) for(int i = (b);i >= (a);i--) #define step(i,a,b,d) for(int i = (a);i <= (b); i += d) #define all(A) A.begin(),A.end() #define pb push_back #define mp make_pair #define sz(A) A.size() #define len(A) A.length() #define print(A,t) cout << #A << ": "; copy(all(A),ostream_iterator<t>(cout," " )); cout << endl #define pi pair<int,int> #define point pi #define vi vector<int> #define ll long long #define pl pair<ll,ll> #define pre() cin.tie(0),cout.tie(0),ios_base::sync_with_stdio(0) #define popcnt(x) __builtin_popcount(x) using namespace std; ll x,y; ll solve(ll X,ll Y){ bool c = X%x && Y%y; ll ans = (X/x) * (Y/y); if(X%x){ ll t = X%x; t = x/t; ans += (Y/y + t - 1)/t; c = !((Y/y)%t); } if(Y%y){ ll t = Y%y; t = y/t; ans += (X/x + t - 1)/t; c = !((X/x)%t); } ans += c; return ans; } int main(){ ll X,Y; cin >> X >> Y >> x >> y; cout << solve(X,Y) << endl; return 0; }
[ "noureldinyosri@gmail.com" ]
noureldinyosri@gmail.com
68f0e90b9bd5f4f5854270b8c2c33c929b409c53
c9cf73543d7c81f8e87a58e051380e98e92f978a
/baseline/happy_trader/shared/cpputils/src/sysdep/win32/filelock.cpp
84dd301b610b2fc06d66a7abae9a7abc9d355aea
[]
no_license
vit2000005/happy_trader
0802d38b49d5313c09f79ee88407806778cb4623
471e9ca4a89db1b094e477d383c12edfff91d9d8
refs/heads/master
2021-01-01T19:46:10.038753
2015-08-23T10:29:57
2015-08-23T10:29:57
41,203,190
0
1
null
null
null
null
UTF-8
C++
false
false
500
cpp
#include "../../filelock.hpp" namespace CppUtils { FileLock::FileLock(CppUtils::FileHandle fhndl) { memset(&overlapped_m, '\0', sizeof(OVERLAPPED)); hndl_m = fhndl; BOOL res = ::LockFileEx(hndl_m, LOCKFILE_EXCLUSIVE_LOCK,0,0,0xffff0000,&overlapped_m); if (res == 0) { THROW(CppUtils::ResourceFailure, "exc_CannotLockFile", "ctx_FileLock", CppUtils::getOSError()); } } FileLock::~FileLock() { ::UnlockFileEx(hndl_m,0,0,0xffff0000,&overlapped_m); } }; //end of namespace
[ "victorofff@gmail.com" ]
victorofff@gmail.com
ab709b4a1a78dadb2fb1e1b99c5dcd59bbc5cfab
02a31c4dd48344f5014133da0a3bc815735e7028
/IntegrationPlatform/Adapters/Subversion/Interop.Subversion/SubversionContext.cpp
6afcfd74ea6ef089de6691f6aa25d48771fa0f81
[]
no_license
galexander3/TFS-Integration-Platform
72f1a48fd5c8aa750db8fa2951a183829bf512ad
46d6ab2f1d77b7b685abfba11eb899a8229aa14d
refs/heads/master
2021-05-13T14:24:30.223164
2018-01-09T00:13:56
2018-01-09T00:13:56
116,739,358
0
0
null
null
null
null
UTF-8
C++
false
false
2,180
cpp
#include "Stdafx.h" #include "AprPool.h" #include "DI_LibApr.h" #include "DI_Svn_Client-1.h" #include "DI_Svn_Subr-1.h" #include "LibraryLoader.h" #include "SubversionContext.h" #include "SvnError.h" using namespace System::Net; using namespace Microsoft::TeamFoundation::Migration::SubversionAdapter::Interop::Subversion; using namespace Microsoft::TeamFoundation::Migration::SubversionAdapter::Interop::Subversion::Helpers; using namespace Microsoft::TeamFoundation::Migration::SubversionAdapter::Interop::Subversion::LibraryAccess; SubversionContext::SubversionContext() { m_pool = nullptr; m_credential = nullptr; Initialize(); } SubversionContext::SubversionContext(NetworkCredential^ credential) { m_pool = nullptr; m_credential = credential; Initialize(); } SubversionContext::!SubversionContext() { if(nullptr != m_pool) { delete m_pool; m_pool = nullptr; } } SubversionContext::~SubversionContext() { if(nullptr != m_pool) { delete m_pool; m_pool = nullptr; } } NetworkCredential^ SubversionContext::Credential::get() { return m_credential; } svn_client_ctx_t* SubversionContext::Handle::get() { return m_context; } AprPool^ SubversionContext::MemoryPool::get() { return m_pool; } void SubversionContext::Initialize() { Svn_subr::Instance()->SVN_CMDLINE_INIT("Integration Platform Subversion Adapter", nullptr); m_pool = gcnew AprPool(); pin_ptr<svn_client_ctx_t*> context = &m_context; pin_ptr<apr_pool_t> pool = m_pool->Handle; SvnError::Err(Svn_Client::Instance()->SVN_CLIENT_CREATE_CONTEXT(context, pool)); SvnError::Err(Svn_subr::Instance()->SVN_CONFIG_GET_CONFIG(&((*context)->config), NULL, pool)); m_context->log_msg_func = NULL; m_context->log_msg_baton = NULL; if(nullptr != m_credential) { SvnError::Err(Svn_subr::Instance()->SVN_CMDLINE_CREATE_AUTH_BATON(&(m_context->auth_baton), true, m_pool->CopyString(m_credential->UserName), m_pool->CopyString(m_credential->Password), NULL, false, false, NULL, NULL, NULL, pool)); } else { SvnError::Err(Svn_subr::Instance()->SVN_CMDLINE_CREATE_AUTH_BATON(&(m_context->auth_baton), true, NULL, NULL, NULL, false, false, NULL, NULL, NULL, pool)); } }
[ "galexander3@users.noreply.github.com" ]
galexander3@users.noreply.github.com
f461bf7dc916f32e10672a68f03dc747378b939b
51cc187c58ba87edc32bc0bfd8088beab84b225b
/Lab 1/Lab01_3/Problem 3/Problem 3.cpp
fa706ea97bf05962729f6c0389bb7cd4f595c020
[ "Unlicense" ]
permissive
tkapusniak/Cpp_Lab_01
cbec698aefc53f3f778eb8bc5e66fb8f82aa697b
a2f0e6407496cb283e04f5058f8a7fccad5d889e
refs/heads/master
2021-01-18T02:55:43.343609
2015-01-21T16:00:57
2015-01-21T16:00:57
29,533,183
0
0
null
2015-01-20T14:18:25
2015-01-20T14:18:24
null
UTF-8
C++
false
false
814
cpp
// Problem 3.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> using namespace std; int main() { double Car = 0.0; float Tax = 3.5; int liscense = 200; int Prep = 150; double Destination = 0.0; float DestinationTax = 2.7; cout << "\t Welcome To My Car Sales Place" << endl; cout << "Please enter the value of a car worth more than 200 USD. "; cin >> Car; Tax = Car / 3.5; liscense = Car + liscense; Prep = Car + Prep; cout << "How far do you want to go with the car? (in miles) "; cin >> Destination; DestinationTax = Destination / DestinationTax; DestinationTax = Car / DestinationTax; Car = Car + Tax + liscense + Prep + DestinationTax; cout << "Your subtotal is $" << Car << ". Hope you enjoy it!"; getchar(); getchar(); return 0; }
[ "IEUser@IE8Win7-10.cis.com" ]
IEUser@IE8Win7-10.cis.com
4731ec1f3b75d1c99eaf89ff62c21c864d3f2f43
282702d1d861fdb3a292fab9c5f58950a120c9fd
/Kattis/STRING/Kemija/kemija.cpp
7d6d987306621c52d082660f8190a14ef51dec0a
[]
no_license
nguyenla/Ziticode
6261573d1b0ecd54590959335d5e6a026ee8a233
1c52dfedccbfda8f34a1d0f81ef725cf722c37f5
refs/heads/master
2021-01-23T03:43:35.347801
2020-07-20T18:01:55
2020-07-20T18:01:55
86,113,653
0
0
null
null
null
null
UTF-8
C++
false
false
428
cpp
#include <iostream> #include <string> #include <vector> #include <algorithm> using namespace std; int main() { string line; char vowels[] = {'a', 'e', 'i', 'o', 'u'}; getline(cin, line); for (size_t i = 0; i != line.length(); ++i) { if (find(begin(vowels), end(vowels), line[i]) != end(vowels)) { line.replace(i+1, 2, ""); } } cout << line << '\n'; return 0; }
[ "phulamnjc@gmail.com" ]
phulamnjc@gmail.com
8aeb2a804dc8ec9c2ff6fda08fc6809000251cef
c7ec332f7e51fc9224ef79ca7dde75bcc317a973
/src/Core/Common/MultipleOutputsOfSameType/Code.cxx
1fadbadefea01668d7440ee4c8a9ecf78b117b7e
[ "Apache-2.0" ]
permissive
wilson-ben/ITKExamples
2c6e4886f53f150ccdd3d976dbf8d126a89ed28d
17d6c6ffb0b0178d5f584cdec5c863b42c63590d
refs/heads/master
2020-06-09T20:05:01.483170
2019-06-10T00:23:40
2019-06-10T15:57:43
193,497,909
0
0
null
2019-06-24T12:07:29
2019-06-24T12:07:29
null
UTF-8
C++
false
false
1,708
cxx
/*========================================================================= * * Copyright Insight Software Consortium * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0.txt * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * *=========================================================================*/ #include "itkImage.h" #include "itkImageFileReader.h" #include "itkImageFileWriter.h" #include "ImageFilterMultipleOutputs.h" int main(int, char*[]) { // Setup types using ImageType = itk::Image<unsigned char, 2>; using FilterType = itk::ImageFilterMultipleOutputs<ImageType>; // Create and the filter FilterType::Pointer filter = FilterType::New(); filter->Update(); { using WriterType = itk::ImageFileWriter< ImageType >; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("TestOutput1.jpg"); writer->SetInput(filter->GetOutput1()); writer->Update(); } { using WriterType = itk::ImageFileWriter< ImageType >; WriterType::Pointer writer = WriterType::New(); writer->SetFileName("TestOutput2.jpg"); writer->SetInput(filter->GetOutput2()); writer->Update(); } return EXIT_SUCCESS; }
[ "dzenan.zukic@kitware.com" ]
dzenan.zukic@kitware.com
414f2e76867efd4b980e4841823ab2fdb221f346
766c6804d92778d45203c5c99f146eae894a542d
/src/qt/bitcoin.cpp
0e39e3a098dfa072df51c13adb01692fed9a406d
[ "MIT" ]
permissive
becoin-profile/becoin
6768ac28ef3390fc2e8322a953056926f625f56e
f3d48214e878b7dc1ee8a6391d7cd97fa4910e98
refs/heads/main
2023-03-02T16:39:36.711163
2021-01-17T06:15:14
2021-01-17T06:15:14
325,146,053
0
1
null
null
null
null
UTF-8
C++
false
false
10,770
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 <QApplication> #include "bitcoingui.h" #include "clientmodel.h" #include "walletmodel.h" #include "optionsmodel.h" #include "guiutil.h" #include "guiconstants.h" #include "init.h" #include "util.h" #include "ui_interface.h" #include "paymentserver.h" #include "splashscreen.h" #include <QMessageBox> #if QT_VERSION < 0x050000 #include <QTextCodec> #endif #include <QLocale> #include <QTimer> #include <QTranslator> #include <QLibraryInfo> #ifdef Q_OS_MAC #include "macdockiconhandler.h" #endif #if defined(BITCOIN_NEED_QT_PLUGINS) && !defined(_BITCOIN_QT_PLUGINS_INCLUDED) #define _BITCOIN_QT_PLUGINS_INCLUDED #define __INSURE__ #include <QtPlugin> Q_IMPORT_PLUGIN(qcncodecs) Q_IMPORT_PLUGIN(qjpcodecs) Q_IMPORT_PLUGIN(qtwcodecs) Q_IMPORT_PLUGIN(qkrcodecs) Q_IMPORT_PLUGIN(qtaccessiblewidgets) #endif // Declare meta types used for QMetaObject::invokeMethod Q_DECLARE_METATYPE(bool*) // Need a global reference for the notifications to find the GUI static BitcoinGUI *guiref; static SplashScreen *splashref; static bool ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style) { // Message from network thread if(guiref) { bool modal = (style & CClientUIInterface::MODAL); bool ret = false; // In case of modal message, use blocking connection to wait for user to click a button QMetaObject::invokeMethod(guiref, "message", modal ? GUIUtil::blockingGUIThreadConnection() : Qt::QueuedConnection, Q_ARG(QString, QString::fromStdString(caption)), Q_ARG(QString, QString::fromStdString(message)), Q_ARG(unsigned int, style), Q_ARG(bool*, &ret)); return ret; } else { printf("%s: %s\n", caption.c_str(), message.c_str()); fprintf(stderr, "%s: %s\n", caption.c_str(), message.c_str()); return false; } } static bool ThreadSafeAskFee(int64 nFeeRequired) { if(!guiref) return false; if(nFeeRequired < CTransaction::nMinTxFee || nFeeRequired <= nTransactionFee || fDaemon) return true; bool payFee = false; QMetaObject::invokeMethod(guiref, "askFee", GUIUtil::blockingGUIThreadConnection(), Q_ARG(qint64, nFeeRequired), Q_ARG(bool*, &payFee)); return payFee; } static void InitMessage(const std::string &message) { if(splashref) { splashref->showMessage(QString::fromStdString(message), Qt::AlignBottom|Qt::AlignHCenter, QColor(55,55,55)); qApp->processEvents(); } printf("init message: %s\n", message.c_str()); } /* Translate string to current locale using Qt. */ static std::string Translate(const char* psz) { return QCoreApplication::translate("bitcoin-core", psz).toStdString(); } /* Handle runaway exceptions. Shows a message box with the problem and quits the program. */ static void handleRunawayException(std::exception *e) { PrintExceptionContinue(e, "Runaway exception"); QMessageBox::critical(0, "Runaway exception", BitcoinGUI::tr("A fatal error occurred. Becoin can no longer continue safely and will quit.") + QString("\n\n") + QString::fromStdString(strMiscWarning)); exit(1); } #ifndef BITCOIN_QT_TEST int main(int argc, char *argv[]) { // Command-line options take precedence: ParseParameters(argc, argv); #if QT_VERSION < 0x050000 // Internal string conversion is all UTF-8 QTextCodec::setCodecForTr(QTextCodec::codecForName("UTF-8")); QTextCodec::setCodecForCStrings(QTextCodec::codecForTr()); #endif Q_INIT_RESOURCE(bitcoin); QApplication app(argc, argv); // Register meta types used for QMetaObject::invokeMethod qRegisterMetaType< bool* >(); // Do this early as we don't want to bother initializing if we are just calling IPC // ... but do it after creating app, so QCoreApplication::arguments is initialized: if (PaymentServer::ipcSendCommandLine()) exit(0); PaymentServer* paymentServer = new PaymentServer(&app); // Install global event filter that makes sure that long tooltips can be word-wrapped app.installEventFilter(new GUIUtil::ToolTipToRichTextFilter(TOOLTIP_WRAP_THRESHOLD, &app)); // ... then bitcoin.conf: if (!boost::filesystem::is_directory(GetDataDir(false))) { // This message can not be translated, as translation is not initialized yet // (which not yet possible because lang=XX can be overridden in bitcoin.conf in the data directory) QMessageBox::critical(0, "Becoin", QString("Error: Specified data directory \"%1\" does not exist.").arg(QString::fromStdString(mapArgs["-datadir"]))); return 1; } ReadConfigFile(mapArgs, mapMultiArgs); // Application identification (must be set before OptionsModel is initialized, // as it is used to locate QSettings) QApplication::setOrganizationName("Becoin"); QApplication::setOrganizationDomain("becoin.org"); if(GetBoolArg("-testnet")) // Separate UI settings for testnet QApplication::setApplicationName("Becoin-Qt-testnet"); else QApplication::setApplicationName("Becoin-Qt"); // ... then GUI settings: OptionsModel optionsModel; // Get desired locale (e.g. "de_DE") from command line or use system locale QString lang_territory = QString::fromStdString(GetArg("-lang", QLocale::system().name().toStdString())); QString lang = lang_territory; // Convert to "de" only by truncating "_DE" lang.truncate(lang_territory.lastIndexOf('_')); QTranslator qtTranslatorBase, qtTranslator, translatorBase, translator; // Load language files for configured locale: // - First load the translator for the base language, without territory // - Then load the more specific locale translator // Load e.g. qt_de.qm if (qtTranslatorBase.load("qt_" + lang, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(&qtTranslatorBase); // Load e.g. qt_de_DE.qm if (qtTranslator.load("qt_" + lang_territory, QLibraryInfo::location(QLibraryInfo::TranslationsPath))) app.installTranslator(&qtTranslator); // Load e.g. bitcoin_de.qm (shortcut "de" needs to be defined in bitcoin.qrc) if (translatorBase.load(lang, ":/translations/")) app.installTranslator(&translatorBase); // Load e.g. bitcoin_de_DE.qm (shortcut "de_DE" needs to be defined in bitcoin.qrc) if (translator.load(lang_territory, ":/translations/")) app.installTranslator(&translator); // Subscribe to global signals from core uiInterface.ThreadSafeMessageBox.connect(ThreadSafeMessageBox); uiInterface.ThreadSafeAskFee.connect(ThreadSafeAskFee); uiInterface.InitMessage.connect(InitMessage); uiInterface.Translate.connect(Translate); // Show help message immediately after parsing command-line options (for "-lang") and setting locale, // but before showing splash screen. if (mapArgs.count("-?") || mapArgs.count("--help")) { GUIUtil::HelpMessageBox help; help.showOrPrint(); return 1; } #ifdef Q_OS_MAC // on mac, also change the icon now because it would look strange to have a testnet splash (green) and a std app icon (orange) if(GetBoolArg("-testnet")) { MacDockIconHandler::instance()->setIcon(QIcon(":icons/bitcoin_testnet")); } #endif SplashScreen splash(QPixmap(), 0); if (GetBoolArg("-splash", true) && !GetBoolArg("-min")) { splash.show(); splash.setAutoFillBackground(true); splashref = &splash; } app.processEvents(); app.setQuitOnLastWindowClosed(false); try { #ifndef Q_OS_MAC // Regenerate startup link, to fix links to old versions // OSX: makes no sense on mac and might also scan/mount external (and sleeping) volumes (can take up some secs) if (GUIUtil::GetStartOnSystemStartup()) GUIUtil::SetStartOnSystemStartup(true); #endif boost::thread_group threadGroup; BitcoinGUI window; guiref = &window; QTimer* pollShutdownTimer = new QTimer(guiref); QObject::connect(pollShutdownTimer, SIGNAL(timeout()), guiref, SLOT(detectShutdown())); pollShutdownTimer->start(200); if(AppInit2(threadGroup)) { { // Put this in a block, so that the Model objects are cleaned up before // calling Shutdown(). optionsModel.Upgrade(); // Must be done after AppInit2 if (splashref) splash.finish(&window); ClientModel clientModel(&optionsModel); WalletModel *walletModel = 0; if(pwalletMain) walletModel = new WalletModel(pwalletMain, &optionsModel); window.setClientModel(&clientModel); if(walletModel) { window.addWallet("~Default", walletModel); window.setCurrentWallet("~Default"); } // If -min option passed, start window minimized. if(GetBoolArg("-min")) { window.showMinimized(); } else { window.show(); } // Now that initialization/startup is done, process any command-line // bitcoin: URIs QObject::connect(paymentServer, SIGNAL(receivedURI(QString)), &window, SLOT(handleURI(QString))); QTimer::singleShot(100, paymentServer, SLOT(uiReady())); app.exec(); window.hide(); window.setClientModel(0); window.removeAllWallets(); guiref = 0; delete walletModel; } // Shutdown the core and its threads, but don't exit Bitcoin-Qt here threadGroup.interrupt_all(); threadGroup.join_all(); Shutdown(); } else { threadGroup.interrupt_all(); threadGroup.join_all(); Shutdown(); return 1; } } catch (std::exception& e) { handleRunawayException(&e); } catch (...) { handleRunawayException(NULL); } return 0; } #endif // BITCOIN_QT_TEST
[ "76711493+becoin-profile@users.noreply.github.com" ]
76711493+becoin-profile@users.noreply.github.com
071dc7a7f736ed81a36cc12d759fa1f44d91b6b5
db0e5cad25ae831bbe32a987a362eabc83d49a89
/xa-exp02/xa-exp02/world/Dog.cpp
b085df802a3e04699af3b510cf00a68162f6b2cd
[]
no_license
xea/infini
0fe40454e1b73e00f4fef715a09708e9ae5577c9
b199e03588ae1925d49c9dfad5d1c2d7d80a76e6
refs/heads/master
2021-06-30T05:29:47.144969
2019-04-29T19:17:53
2019-04-29T19:17:53
9,730,546
1
0
null
null
null
null
UTF-8
C++
false
false
138
cpp
#include "Dog.h" Dog::Dog() { //visual = new Triangle(); visual = new Cube(); } RenderObject &Dog::renderObject() { return *visual; }
[ "sandor.pecsi@shiwaforce.com" ]
sandor.pecsi@shiwaforce.com
9d10537dd8525fd56134a02eafa8b39b436f0a3e
39b003b15d9cdf42483f43ee59293a935cd26ef1
/RemoteV/SA_Remote/BitSaAnaView/sa_dialog_spurem.cpp
e017801f3dbff3f4974165b5a367579efb923156
[]
no_license
hanqianjin/kang
f16fb3835ecd850a3a86bb93f0679c878c82acab
cc40e6be18287a7a3269e50371f2850cd03bfb5d
refs/heads/master
2021-06-25T23:47:54.108574
2020-11-20T02:46:25
2020-11-20T02:46:25
142,751,390
1
0
null
null
null
null
UTF-8
C++
false
false
16,543
cpp
#include "sa_dialog_spurem.h" #include "ui_sa_dialog_spurem.h" #include "sa_applicationcontrol.h" #include "sa_lineedit.h" #include "sa_combobox.h" #include "sa_dialog_digitinput.h" #include "QSpinBox" #include <QThread> SA_Dialog_SpurEM::SA_Dialog_SpurEM(controlInterface *interface,QWidget *parent) : QWidget(parent), mControl(interface), ui(new Ui::SA_Dialog_SpurEM) { ui->setupUi(this); hide(); setProperty("status",qssMode[mControl->GetDisplayMode()]); tableType = SA_SPUREM_SETTABLE_FREQ; setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_TranslucentBackground, true); setWindowFlags(Qt::WindowStaysOnTopHint |Qt::FramelessWindowHint /*| Qt::Dialog*/); initMap(); initDisplay(); mCurEdit = SA_INPUT_SPUREM_SPUR_INDEX; on_getFocus(ui->LedSpurIndex); mInputDialog = NULL; } SA_Dialog_SpurEM::~SA_Dialog_SpurEM() { if(mControl) { mControl->setSpurEMTableType(SA_SPUREM_MEASURE); } delete ui; } void SA_Dialog_SpurEM::initMap() { mEditList.insert(SA_INPUT_SPUREM_SPUR_INDEX,ui->LedSpurIndex); mEditList.insert(SA_INPUT_SPUREM_RANGE_INDEX,ui->LedRangeIndex); mEditList.insert(SA_INPUT_SPUREM_FREQ_START,ui->LedStartFreq); mEditList.insert(SA_INPUT_SPUREM_FREQ_STOP,ui->LedStopFreq); mEditList.insert(SA_INPUT_SPUREM_SWEEP_TIME,ui->LedSweepTime); mEditList.insert(SA_INPUT_SPUREM_LIMIT_START,ui->LedStartLimit); mEditList.insert(SA_INPUT_SPUREM_LIMIT_STOP,ui->LedStopLimit); mEditList.insert(SA_INPUT_SPUREM_PEAK_DEFINITION,ui->LedPeakDefinition); mEditList.insert(SA_INPUT_SPUREM_PEAK_THRESHOLD,ui->LedPeakThreshold); mEditList.insert(SA_INPUT_SPUREM_ATTEN,ui->LedAtten); qint32 size = mEditList.size(); for(qint32 i =0;i<size;i++) { connect(mEditList.values().at(i),SIGNAL(clicked()),this,SLOT(edit_clicked())); connect(mEditList.values().at(i),SIGNAL(mFocus(SA_LineEdit*)),this,SLOT(on_getFocus(SA_LineEdit*))); } mBoxList.insert(SA_COMBOBOX_RBW,ui->RBWBox); mBoxList.insert(SA_COMBOBOX_VBW,ui->VBWBox); size = mBoxList.size(); for(qint32 i =0;i<size;i++) { mBoxList.values().at(i)->setView(new QListView()); connect(mBoxList.values().at(i),SIGNAL(clicked(SA_Combobox*)),this,SLOT(on_getComboBoxFocus(SA_Combobox*))); mBoxList.values().at(i)->setPopupPotion(SA_TOP,0,0); } return ; } void SA_Dialog_SpurEM::on_getComboBoxFocus(SA_Combobox* mBox) { QString qss = "#SA_Dialog_SpurEM[status=\"indoor\"] QComboBox{background-image: url(:/sa/image/dropdown_click.png);}\ #SA_Dialog_SpurEM[status=\"outdoor\"] QComboBox{background-image: url(:/sa/image/dropdown_click.png);}\ #SA_Dialog_SpurEM[status=\"night\"] QComboBox{background-image: url(:/sa/image/night/dropdown_click.png);}"; if(mCurEdit<0 && mBoxList.contains(mCurEdit)) { mBoxList.value(mCurEdit)->setStyleSheet(""); }else if(mCurEdit>0&& mEditList.contains(mCurEdit)) { mEditList.value(mCurEdit)->setStyleSheet(""); } mBox->setStyleSheet(qss); mCurEdit = mBoxList.key(mBox); this->repaint(); return; } void SA_Dialog_SpurEM::on_getFocus(SA_LineEdit* mEdit) { QString qss =QString("outline: none;border:2px solid rgba(162,115,0,1);padding:6px 6px 5px 8px;"); qint32 index = mEditList.key(mEdit); if(mCurEdit<0 && mBoxList.contains(mCurEdit)) { mBoxList.value(mCurEdit)->setStyleSheet(""); }else if(mCurEdit>0&& mEditList.contains(mCurEdit)) { mEditList.value(mCurEdit)->setStyleSheet(""); } mEdit->setStyleSheet(qss); mCurEdit = index; this->repaint(); return; } void SA_Dialog_SpurEM::edit_clicked() { qint32 menuID; SA_LineEdit* mCurEditLine = qobject_cast<SA_LineEdit*>(sender()); mCurEdit = mEditList.key(mCurEditLine); showInputDialog(mCurEdit); } /** * @brief show digit input dialog * @param void * @author Tony * @since 2019-05-15 */ void SA_Dialog_SpurEM::showInputDialog(qint32 index) { if(mInputDialog) { mInputDialog->initDisplay(index); mInputDialog->setFocus(); }else { mInputDialog = new SA_Dialog_DigitInput(mControl,mControl->globalUserVariable,index,this); mInputDialog->setFocus(); mInputDialog->setGeometry(mapToGlobal(QPoint(0,0)).x(),mapToGlobal(QPoint(0,0)).y(),DIGITINPUT_WIDTH,DIGITINPUT_HEIGHT); connect(mInputDialog,SIGNAL(finishEntry(qint32)),this,SLOT(on_finishEntry(qint32))); mInputDialog->show(); } return ; } /** * @brief Slot of finish entry. * @param void * @author Tony * @since 2019-05-15 */ void SA_Dialog_SpurEM::on_finishEntry(qint32 index) { disconnect(mInputDialog,SIGNAL(finishEntry(qint32)),this,SLOT(on_finishEntry(qint32))); mInputDialog = NULL; if(mEditList.contains(index)) initDisplay(); return ; } void SA_Dialog_SpurEM::initDisplay() { qint32 SpurValue,RangeValue; if(SA_SPUREM_AVE_EXP==mControl->getSpurEMAveType()) { ui->pb_Ave_1->setChecked(true); }else{ ui->pb_Ave_2->setChecked(true); } if(SA_SPUREM_REPORT_ALL == mControl->getSpurReportType()) { ui->pb_Report_Mode1->setChecked(true); }else { ui->pb_Report_Mode2->setChecked(true); } refreshEdit(SA_INPUT_SPUREM_SPUR_INDEX); refreshEdit(SA_INPUT_SPUREM_RANGE_INDEX); refreshSubMenu(tableType); } void SA_Dialog_SpurEM::refreshSubMenu(qint32 mTableType) { qint32 value,minus,status; QString strGab; status = mControl->getSpurEMDisplay(); if(status) { ui->pb_RangeOn->setChecked(true); ui->pb_RangeOn->setText("On"); }else { ui->pb_RangeOn->setChecked(false); ui->pb_RangeOn->setText("Off"); } if(mTableType == SA_SPUREM_SETTABLE_FREQ) { ui->stackedWidget->setCurrentIndex(1); refreshEdit(SA_INPUT_SPUREM_FREQ_START); refreshEdit(SA_INPUT_SPUREM_FREQ_STOP); refreshEdit(SA_INPUT_SPUREM_SWEEP_TIME); refreshCombobox(); } else if(mTableType == SA_SPUREM_SETTABLE_LIMIT) { ui->stackedWidget->setCurrentIndex(2); refreshEdit(SA_INPUT_SPUREM_LIMIT_START); refreshEdit(SA_INPUT_SPUREM_LIMIT_STOP); refreshEdit(SA_INPUT_SPUREM_PEAK_DEFINITION); refreshEdit(SA_INPUT_SPUREM_PEAK_THRESHOLD); refreshEdit(SA_INPUT_SPUREM_ATTEN); } //ui->stackedWidget->repaint(); } void SA_Dialog_SpurEM::refreshCombobox() { qint32 mRBW,mVBW; qint32 indexRBW,indexVBW; mRBW = mControl->getSpurEMRBW(); mVBW = mControl->getSpurEMVBW(); indexRBW = RbwVbwCompare(mRBW); indexVBW = RbwVbwCompare(mVBW); if(indexRBW < 0) { indexRBW = sizeof(SA_u32BWTable) -1; } if(indexVBW < 0) { indexVBW = sizeof(SA_u32BWTable) -2; } ui->RBWBox->blockSignals(true); ui->VBWBox->blockSignals(true); ui->RBWBox->setCurrentIndex(indexRBW); ui->VBWBox->setCurrentIndex(indexVBW-1); ui->RBWBox->blockSignals(false); ui->VBWBox->blockSignals(false); } qint32 SA_Dialog_SpurEM::RbwVbwCompare(qint32 value) { qint32 mSize = sizeof(SA_u32BWTable)/4; for(qint32 i = 0;i < mSize ; i++) { if(SA_u32BWTable[i] == value) return i; } return -1; } void SA_Dialog_SpurEM::refreshEdit(qint32 index) { qreal value; qint32 minus = 0; QString strGab; switch (index) { case SA_INPUT_SPUREM_SPUR_INDEX: value = mControl->getSpurEMCurSpurIndex(); strGab =QString::number(value+1); break; case SA_INPUT_SPUREM_RANGE_INDEX: value = mControl->getSpurEMCurRangeIndex(); strGab =QString::number(value+1); break; case SA_INPUT_SPUREM_FREQ_START: value = mControl->getSpurEMstartFreq(); if(value < 0) { minus = 1; value *= -1; } strGab = mControl->globalUserVariable->freqValueToQstring(value); if(minus) { strGab = QString("-%1").arg(strGab); } break; case SA_INPUT_SPUREM_FREQ_STOP: value = mControl->getSpurEMstopFreq(); if(value < 0) { minus = 1; value *= -1; } strGab = mControl->globalUserVariable->freqValueToQstring(value); if(minus) { strGab = QString("-%1").arg(strGab); } break; case SA_INPUT_SPUREM_SWEEP_TIME: value = mControl->getSpurEMSweepTime(); strGab = mControl->globalUserVariable->TimeTransformToQstring(value); if(minus) { strGab = QString("-%1").arg(strGab); } break; case SA_INPUT_SPUREM_LIMIT_START: value = mControl->getSpurEMStartLimit(); strGab = QString::number(value)+" dBm"; if(minus) { strGab = QString("-%1").arg(strGab); } break; case SA_INPUT_SPUREM_LIMIT_STOP: value = mControl->getSpurEMStopLimit(); strGab = QString::number(value)+" dBm"; if(minus) { strGab = QString("-%1").arg(strGab); } break; case SA_INPUT_SPUREM_PEAK_DEFINITION: value = mControl->getSpurEMpeakDefi(); strGab = QString::number(value)+" dB"; break; case SA_INPUT_SPUREM_PEAK_THRESHOLD: value = mControl->getSpurEMpeakThreshold(); strGab = QString::number(value)+" dBm"; break; case SA_INPUT_SPUREM_ATTEN: value = mControl->getSpurEMAtten(); strGab = QString::number(value)+" dB"; break; default: break; } mEditList.find(index).value()->setText(strGab); return; } void SA_Dialog_SpurEM::on_pb_cancel_clicked() { hideWidget(); } void SA_Dialog_SpurEM::keyPressEvent(QKeyEvent *event) { qint32 keyvalue = event->key(); if(event->key() == Qt::Key_PowerOff) { if(!event->isAutoRepeat()) QApplication::sendEvent(this->parent(),event); return; } switch(keyvalue){ case Qt::Key_Escape: hideWidget(); return; case Qt::Key_Shift: if(mControl->globalUserVariable->bShiftKeyPressed) mControl->globalUserVariable->bShiftKeyPressed = false; else mControl->globalUserVariable->bShiftKeyPressed = true; hideWidget(); return; } switch(keyvalue){ case Qt::Key_0: case Qt::Key_1: case Qt::Key_2: case Qt::Key_3: case Qt::Key_4: case Qt::Key_5: case Qt::Key_6: case Qt::Key_7: case Qt::Key_8: case Qt::Key_9: case Qt::Key_F2: case Qt::Key_Minus: case Qt::Key_Period: if(!mInputDialog) mEditList.value(mCurEdit)->clicked(); mInputDialog->initInputKey(event); break; case Qt::Key_F4: if(mInputDialog) mInputDialog->close(); getKnobValue(CLOCKWISE); break; case Qt::Key_F3: if(mInputDialog) mInputDialog->close(); getKnobValue(ANTICLOCKWISE); break; default: if(mInputDialog) QApplication::sendEvent(mInputDialog,event); break; } return; } void SA_Dialog_SpurEM::getKnobValue(qint32 mode) { qreal mValue; qreal mFreqStep; qreal mFreqValue; mFreqStep = mControl->getCFFreq(); switch (mCurEdit) { case SA_INPUT_SPUREM_SPUR_INDEX: mValue = mControl->getSpurEMCurSpurIndex(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMCurSpurIndex(mValue); break; case SA_INPUT_SPUREM_RANGE_INDEX: mValue = mControl->getSpurEMCurRangeIndex(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMCurRangeIndex(mValue); break; case SA_INPUT_SPUREM_FREQ_START: mFreqValue = mControl->getSpurEMstartFreq(); if(mode) mFreqValue += mFreqStep; else mFreqValue -= mFreqStep; //if(mFreqValue < 0) mFreqValue=0; mControl->setSpurEMstartFreq(mFreqValue); break; case SA_INPUT_SPUREM_FREQ_STOP: mFreqValue = mControl->getSpurEMstopFreq(); if(mode) mFreqValue += mFreqStep; else mFreqValue -= mFreqStep; mControl->setSpurEMstopFreq(mFreqValue); break; case SA_INPUT_SPUREM_SWEEP_TIME: mValue = mControl->getSpurEMSweepTime(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMSweepTime(mValue); break; case SA_INPUT_SPUREM_LIMIT_START: mValue = mControl->getSpurEMStartLimit(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMstartLimit(mValue); break; case SA_INPUT_SPUREM_LIMIT_STOP: mValue = mControl->getSpurEMStopLimit(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMStopLimit(mValue); break; case SA_INPUT_SPUREM_PEAK_DEFINITION: mValue = mControl->getSpurEMpeakDefi(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMpeakDefi(mValue); break; case SA_INPUT_SPUREM_PEAK_THRESHOLD: mValue = mControl->getSpurEMpeakThreshold(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMpeakThreshold(mValue); break; case SA_INPUT_SPUREM_ATTEN: mValue = mControl->getSpurEMAtten(); if(mode) mValue += 1; else mValue -= 1; mControl->setSpurEMAtten(mValue); break; } initDisplay(); } void SA_Dialog_SpurEM::on_pb_RangePara_1_clicked(bool checked) { if(checked) { mControl->setSpurEMTableType(SA_SPUREM_SETTABLE_FREQ); tableType = SA_SPUREM_SETTABLE_FREQ; refreshSubMenu(tableType); on_getFocus(ui->LedStartFreq); ui->stackedWidget->setCurrentIndex(1); } } void SA_Dialog_SpurEM::on_pb_RangePara_2_clicked(bool checked) { if(checked) { mControl->setSpurEMTableType(SA_SPUREM_SETTABLE_LIMIT); tableType = SA_SPUREM_SETTABLE_LIMIT; refreshSubMenu(tableType); on_getFocus(ui->LedStartLimit); ui->stackedWidget->setCurrentIndex(2); } } void SA_Dialog_SpurEM::on_RBWBox_currentIndexChanged(int index) { qint32 mSize = sizeof(SA_u32BWTable)/4; if(index >= mSize) { return; } mControl->setSpurEMRBW(SA_u32BWTable[index]); } void SA_Dialog_SpurEM::on_VBWBox_currentIndexChanged(int index) { qreal vbw,rbw,ratio; qint32 mSize = sizeof(SA_u32BWTable)/4; if(index >= (mSize - 1)) { return; } vbw = SA_u32BWTable[index+1]; rbw = mControl->getSpurEMVBW(); ratio = (qreal)vbw/rbw; mControl->setSpurEMVBW(vbw); } void SA_Dialog_SpurEM::on_pb_Ave_1_clicked(bool checked) { if(checked) { mControl->setSpurEMAveType(SA_SPUREM_AVE_EXP); } return; } void SA_Dialog_SpurEM::on_pb_Ave_2_clicked(bool checked) { if(checked) { mControl->setSpurEMAveType(SA_SPUREM_AVE_REPEAT); } return; } void SA_Dialog_SpurEM::on_pb_Report_Mode1_clicked(bool checked) { if(checked) { mControl->setSpurReportType(SA_SPUREM_REPORT_ALL); } refreshEdit(SA_INPUT_SPUREM_SPUR_INDEX); return; } void SA_Dialog_SpurEM::on_pb_Report_Mode2_clicked(bool checked) { if(checked) { mControl->setSpurReportType(SA_SPUREM_REPORT_TEST); } refreshEdit(SA_INPUT_SPUREM_SPUR_INDEX); return; } void SA_Dialog_SpurEM::on_pb_ReMeasure_clicked() { mControl->setMeasureStatus(SA_ON); //mControl->setSuspendFunc(SA_OFF); hideWidget(); } void SA_Dialog_SpurEM::on_pb_RangeOn_clicked(bool checked) { if(checked) { mControl->setSpurEMDisplay(SA_ON); ui->pb_RangeOn->setText("On"); }else { mControl->setSpurEMDisplay(SA_OFF); ui->pb_RangeOn->setText("Off"); } refreshEdit(SA_INPUT_SPUREM_SPUR_INDEX); } void SA_Dialog_SpurEM::initWidget() { } void SA_Dialog_SpurEM::showWidget() { initDisplay(); show(); return; } void SA_Dialog_SpurEM::hideWidget() { hide(); if(mInputDialog) { disconnect(mInputDialog,SIGNAL(finishEntry(qint32)),this,SLOT(on_finishEntry(qint32))); delete mInputDialog; mInputDialog = NULL; } emit mDialogHide(); return; }
[ "41859296+hanqianjin@users.noreply.github.com" ]
41859296+hanqianjin@users.noreply.github.com
df6f7340d5b5fea0e92c16d8e8c1974e4ecd47fc
b00ca3ef0aec0c161d11ae655957aed863fcb292
/C++/2475.cpp
41235a4f39fe06b5be078b171bcc949eb6cb2a05
[]
no_license
tmdghks9574/Algorithm
52b711915d1aa902e09216436adc02d038e95af9
0394cee78449a23f878b33154da543393bb6b24a
refs/heads/master
2021-07-19T04:10:06.512655
2020-08-10T05:44:17
2020-08-10T05:44:17
201,771,779
1
0
null
null
null
null
UTF-8
C++
false
false
212
cpp
#include<iostream> using namespace std; int arr[6]; int main() { int sum = 0; for(int i = 0; i < 5; i++) { cin >> arr[i]; sum += arr[i] * arr[i]; } cout << sum % 10 << endl; }
[ "tmdghks9574@gmail.com" ]
tmdghks9574@gmail.com
2219678fb6b86678e9ea5fe42ae1b64af0d77048
e6d6ad84335bf3b3738795c2683b0f130034a47e
/widgets/syncstatuswidget.h
2d352e4453404c8c458492273402668a3bcfef9e
[ "BSD-3-Clause", "BSD-2-Clause" ]
permissive
jlehtoma/symphytum
be3030fbfbb74f98e99ec54511b997461f169130
94dee431d52d51866271bc9d33592d2a7ee4bd52
refs/heads/master
2021-05-08T10:56:21.114359
2018-02-01T11:50:16
2018-02-01T11:50:16
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,484
h
/** * \class SyncStatusWidget * \brief This is widget is added to the dock under the collection * list view and displays status info about the sync service. * \author Giorgio Wicklein - GIOWISYS Software * \date 28/08/2012 */ #ifndef SYNCSTATUSWIDGET_H #define SYNCSTATUSWIDGET_H //----------------------------------------------------------------------------- // Headers //----------------------------------------------------------------------------- #include <QtWidgets/QWidget> //----------------------------------------------------------------------------- // Forward declarations //----------------------------------------------------------------------------- class QLabel; class QVBoxLayout; class QHBoxLayout; class QProgressBar; //----------------------------------------------------------------------------- // SyncStatusWidget //----------------------------------------------------------------------------- class SyncStatusWidget : public QWidget { Q_OBJECT public: explicit SyncStatusWidget(QWidget *parent = 0); ~SyncStatusWidget(); public slots: /** Update display to show current status based on SyncSession */ void updateStatus(); private: void init(); void createConnections(); QVBoxLayout *m_mainLayout; QLabel *m_syncServiceLabel; QLabel *m_syncStatusLabel; QHBoxLayout *m_syncStatusLayout; QLabel *m_syncOperation; QProgressBar *m_progressBar; }; #endif // SYNCSTATUSWIDGET_H
[ "giowckln@gmail.com" ]
giowckln@gmail.com
632069f6177af76cc739b818b29388381f608e2d
99f01afd8ceda416a842c86a6865075d2b55a259
/code/uart/uart.ino
acacbb281fe5b61b73366b7e1644c0ab47dac2f3
[]
no_license
nguyenduc2611/do_an
02d53d96ee5f1f5016f5d081c47674aa3c3c7beb
86c6d5f569cf8f7686663e9c17a4b983ac2d8e81
refs/heads/master
2023-02-12T18:20:11.916021
2021-01-11T11:56:11
2021-01-11T11:56:11
328,410,104
0
0
null
null
null
null
UTF-8
C++
false
false
731
ino
#include <Servo.h> #include <SoftwareSerial.h> #include <TimerOne.h> #include <Adafruit_Fingerprint.h> int led = 13; //Chân led Servo myservo; SoftwareSerial mySerial(2, 3); void setup() { pinMode(led, OUTPUT); //Định nghĩa chân led là OUTPUT Serial.begin(9600); //Set Baudrate của Serial mySerial.begin(9600); myservo.attach(5); myservo.write(90); } void loop() { if(Serial.available() > 0) //Nếu có tín hiệu gửi đến Serial { char ledState = Serial.read(); //Đọc giá trị gửi if(ledState == '1') //Nếu gửi '1' { Serial.println(ledState); myservo.write(0); delay(3000); myservo.write(90); ledState = 0; } } delay(10); //Ngưng 10ms }
[ "nguyenvanduc2611@gmail.com" ]
nguyenvanduc2611@gmail.com
6beb45fdad12c1022a3ec4857717c288843147a0
feb441fc1bc930e8987850824ee813347e859ec8
/temp/operator.cpp
6360b9898cb2352d149e083b1f6d2c6d69258458
[]
no_license
leafee98/CppCode
841daafde9e4d90e0f4ce811f2a051db09ac99a7
eb82e15a9dd6de493de41a86dc6891b9f5933137
refs/heads/master
2021-09-18T13:21:41.104024
2018-07-15T03:11:08
2018-07-15T03:11:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
961
cpp
// operator.cpp -- basic overload operator and translate function #include <iostream> using std::cout; using std::cin; using std::endl; class Myclass { public: int a, b; operator int() const; Myclass operator+(const Myclass & t) const; void show() const; }; Myclass::operator int() const { return a + b; } Myclass Myclass::operator+(const Myclass & t) const { Myclass result; result.a = a + t.a; result.b = b + t.b; return result; } Myclass operator+(int i, const Myclass & t) { Myclass result; result.a = i + t.a; result.b = i + t.b; return result; } void Myclass::show() const { cout << "a = " << a << ", b = " << b << endl; } int main() { Myclass x, y, z; int i = 1; x.a = 1, x.b = 2; y.a = 0, y.b = 4; z = x + y; cout << "x: "; x.show(); cout << "y: "; y.show(); cout << "z: "; z.show(); cout << endl << "i = " << i << endl; z = 1 + z; cout << "z: "; z.show(); cout << "int(x) = " << int(x) << endl; return 0; }
[ "feng19980910@foxmail.com" ]
feng19980910@foxmail.com
8aeeaad84bc3e8b3e6a52e79f98ab4b80098fb22
4ce2f891eb49889de40de2e75c4a0e685c3332a2
/src/esferaDial.h
cce4a62b1f0078721beae1251ad9952a9f487bc1
[]
no_license
natxopedreira/acuraGui09
58fc617791a37f3b617bbbc87cbda16f0b3d01da
9d903397919a92ddb11ab9594d6f4092937ff942
refs/heads/master
2021-01-10T07:01:50.416499
2015-12-01T18:28:07
2015-12-01T18:28:07
47,209,192
0
0
null
null
null
null
UTF-8
C++
false
false
10,559
h
// // esferaDial.h // accuraGUI // // Created by Natxo Pedreira gonzalez on 25/11/15. // // #ifndef accuraGUI_esferaDial_h #define accuraGUI_esferaDial_h #include "ledGlow.h" #include "txtDisplay.h" #include "ofxBlur.h" class esferaDial { public: //// setea el origen de la esfera //-------------------------------------------------------------- void setOrigenEsfera(ofPoint p){ origenEsfera = p; } //// setea el punto de rotacion de la imagen de la casilla //-------------------------------------------------------------- void setImgPivotPoint(ofPoint p){ imgPivotPoint = p; } //// setea el punto de origen de las lineas //-------------------------------------------------------------- void setLineaOrPoint(ofPoint p){ lineaOrPoint = p; } //// setea el punto final de las lineas //-------------------------------------------------------------- void setLineaFinPoint(ofPoint p){ lineaFinPoint = p; } //// setea la escala de la esfera //-------------------------------------------------------------- void setScale(float f){ esferaScale = f; } //// setea el numero de pastillas en una esfera //-------------------------------------------------------------- void setNumPastillas(int n){ numeroPastillasEsfera = n; } //// setea el numero de grados en la esfera //-------------------------------------------------------------- void setGradosDial(int n){ gradosDial = n; } //// setea el origen y fin de la linea //-------------------------------------------------------------- void setLineaOrFin(int o, int f){ lineaOr = o; lineaFin = f; } // pones el color a la pastilla //-------------------------------------------------------------- void setPastillaColor(ofColor c){ color = c; } //-------------------------------------------------------------- void setFontScale(int c){ fontScale = c; } //-------------------------------------------------------------- void setBlur(bool c){ enableBlur = c; } /// carga la imagen para la esfera //-------------------------------------------------------------- void setup(){ potencia = 0; if(numeroPastillasEsfera==0)numeroPastillasEsfera = 35; if(gradosDial==0)gradosDial = 320; fontScale = 1.1; lineaOr = 355; lineaFin = 100; lineaOrPoint.set(355,0); lineaFinPoint.set(100,18); rotationInicial = 87; desfaseLineasRotacion = 5.5; pastilla.loadImage("pastilla.png"); pastilla.setAnchorPoint(imgPivotPoint.x, imgPivotPoint.y); pastillaOn.loadImage("pastillaOnBlanca.png"); pastillaOn.setAnchorPoint(imgPivotPoint.x+3, imgPivotPoint.y+3); pastillaLuz.loadImage("pastillaLuzBlanca.png"); pastillaLuz.setAnchorPoint(imgPivotPoint.x+3, imgPivotPoint.y+3); //color.setSaturation(color.getSaturation()+numeroPastillasEsfera); for (int i = 0; i<numeroPastillasEsfera; i++) { //int f = ((float)i / (float)numeroPastillasEsfera)*4; //color.setSaturation(color.getSaturation()+f); //int f = ((float)i / (float)numeroPastillasEsfera)*6; //color.setSaturation(color.getSaturation()-f); ledGlow led; led.pastillaLuz = &pastillaLuz; led.pastillaOn = &pastillaOn; led.colorPastilla = color; led.setup(); ledsEsfera.push_back(led); } // texto speedText.setup(230); speedText.setColor(ofColor(130,255,222)); if(enableBlur){ // filtro blur blur.setup(320, 240, 6, .2, 2); // fbo para el blur del texto areaTexto.allocate(320,240); areaTexto.begin(); ofClear(color.r,color.g,color.b); areaTexto.end(); } } //-------------------------------------------------------------- void setPotencia(int p){ potencia = p; } //-------------------------------------------------------------- void setPotenciaNorm(float p){ int potNorm = ofMap(p, 0, 1, 0, numeroPastillasEsfera); potPercent = ofMap(p, 0, 1, 0, 99); potencia = potNorm; } //-------------------------------------------------------------- void update(){ for (int i = 0; i<numeroPastillasEsfera; i++) { if(i < potencia){ ledsEsfera.at(i).enciendete(); }else{ ledsEsfera.at(i).apagate(); } ledsEsfera.at(i).update(); } // texto con la velocidad speedText.setPotencia(potPercent); speedText.update(); if(enableBlur){ areaTexto.begin(); ofClear(color.r,color.g,color.b); speedText.drawBlur(); areaTexto.end(); } } // dibuja la esfera //-------------------------------------------------------------- void draw(ofPoint _origenEsfera){ ofPushMatrix(); // posicion origen de la esfera //ofTranslate(origenEsfera); ofTranslate(_origenEsfera); // escala pa la esfera ofScale(esferaScale, esferaScale); ofPushMatrix(); ofTranslate(-155, -140); ofScale(fontScale, fontScale); speedText.draw(); speedText.drawBlur(); if(enableBlur){ drawVelocidadTextBlur(); } ofPopMatrix(); float gradosStep = gradosDial/numeroPastillasEsfera; /// lineas dial ofPushStyle(); ofSetColor(140, 140, 140); for (int j = 0; j < numeroPastillasEsfera; j++) { ofPushMatrix(); // rotacion inicial de la esfera ofRotate(rotationInicial + desfaseLineasRotacion); ofRotate(j*gradosStep); if(j%2==0){ ofRect(lineaOrPoint.x-40, lineaOrPoint.y+2, lineaFinPoint.x+80, lineaOrPoint.y+2); }else{ ofRect(lineaOrPoint.x, lineaOrPoint.y+2, lineaFinPoint.x, lineaOrPoint.y+2); } ofPopMatrix(); } ofPopStyle(); // rotacion inicial de la esfera ofRotate(rotationInicial*-1); //cout << "numeroPastillasEsfera:: " << numeroPastillasEsfera << endl; //cout << "gradosDial:: " << gradosDial << endl; /// pastillas dial for (int i = 0; i < numeroPastillasEsfera; i++) { ofPushMatrix(); ofRotate(i*(gradosStep)); //cout << "i*(gradosStep):: " << i*(gradosStep) << endl; pastilla.draw(0,0); ledsEsfera.at(i).draw(); ofPopMatrix(); } ofPopMatrix(); } // dibuja la esfera //-------------------------------------------------------------- void drawSinTexto(ofPoint _origenEsfera){ ofPushMatrix(); // posicion origen de la esfera //ofTranslate(origenEsfera); ofTranslate(_origenEsfera); // escala pa la esfera ofScale(esferaScale, esferaScale); ofEnableAlphaBlending(); float gradosStep = gradosDial/numeroPastillasEsfera; /// lineas dial ofPushStyle(); ofSetColor(140, 140, 140); for (int j = 0; j < numeroPastillasEsfera; j++) { ofPushMatrix(); // rotacion inicial de la esfera ofRotate(rotationInicial + desfaseLineasRotacion); ofRotate(j*gradosStep); if(j%2==0){ ofRect(lineaOrPoint.x-40, lineaOrPoint.y+2, lineaFinPoint.x+80, lineaOrPoint.y+2); }else{ ofRect(lineaOrPoint.x, lineaOrPoint.y+2, lineaFinPoint.x, lineaOrPoint.y+2); } ofPopMatrix(); } ofPopStyle(); // rotacion inicial de la esfera ofRotate(rotationInicial*-1); //cout << "numeroPastillasEsfera:: " << numeroPastillasEsfera << endl; //cout << "gradosDial:: " << gradosDial << endl; /// pastillas dial for (int i = 0; i < numeroPastillasEsfera; i++) { ofPushMatrix(); ofRotate(i*(gradosStep)); //cout << "i*(gradosStep):: " << i*(gradosStep) << endl; pastilla.draw(0,0); ledsEsfera.at(i).draw(); ofPopMatrix(); } ofPopMatrix(); } //-------------------------------------------------------------- void drawVelocidadTextBlur(){ speedText.draw(); speedText.drawWhite(); blur.begin(); ofClear(color.r,color.g,color.b); ofEnableAlphaBlending(); areaTexto.draw(0, 0); ofDisableAlphaBlending(); blur.end(); ofEnableAlphaBlending(); blur.draw(); } //-------------------------------------------------------------- int rotationInicial; float desfaseLineasRotacion,fontScale; txtDisplay speedText; //-------------------------------------------------------------- //-------------------------------------------------------------- private: bool enableBlur; ofxBlur blur; ofFbo areaTexto; vector<ledGlow> ledsEsfera; ofImage pastilla, pastillaOn, pastillaLuz; ofPoint origenEsfera; ofPoint imgPivotPoint; ofPoint lineaOrPoint, lineaFinPoint; ofColor color; float esferaScale; int potPercent; int numeroPastillasEsfera; int gradosDial; int potencia; int lineaOr, lineaFin; }; #endif
[ "natxopedreira@gmail.com" ]
natxopedreira@gmail.com
53032ad01b7c65eabae90b0ccebdfa118762f839
2e9e227f4945ef55d1165eb61e016624db4db974
/OpenGL/src/fw.cc
8801734e1b0a109f3d317c70584b64961d3493b7
[ "MIT" ]
permissive
kygx-legend/GLmacia
6155cdaf62ff8534212875990f23defb89ed50f0
67ef41c83404ae0346c522b0045454826c30b8bd
refs/heads/master
2021-01-14T13:21:11.706787
2015-09-08T01:44:54
2015-09-08T01:44:54
null
0
0
null
null
null
null
UTF-8
C++
false
false
3,056
cc
#include "fw.h" const ContextVersion kContextVersionDefault = ContextVersion(3, 1); const Dimension2D kWindowSizeDefault = Dimension2D(640, 480); const string kDebugTag = "[GLFW] "; static void sErrorCallback(int error, const char* description) { cout << kDebugTag << "Error: " << error << endl; cout << kDebugTag << "Description: " << string(description) << endl; } FW::FW() : m_is_initialized(false), m_is_setup(false), m_window_resizable(false), m_context_version(kContextVersionDefault), m_window_size(kWindowSizeDefault), m_window_title(""), m_window(NULL) { setup(); } FW::FW(string title) : m_is_initialized(false), m_is_setup(false), m_window_resizable(false), m_context_version(kContextVersionDefault), m_window_size(kWindowSizeDefault), m_window_title(title), m_window(NULL) { setup(); } void FW::setContextVersion(int major, int minor) { m_context_version = ContextVersion(major, minor); } void FW::setWindowSize(int width, int height) { m_window_size = Dimension2D(width, height); } void FW::setWindowResizable(bool resizable) { m_window_resizable = resizable; } void FW::setKeyCallback(KeyCallback callback) { if (!isSetup()) { cout << kDebugTag << "No valid window!" << endl; return; } glfwSetKeyCallback(m_window, callback); } void FW::setMouseCallback(MouseCallback callback) { if (!isSetup()) { cout << kDebugTag << "No valid window!" << endl; return; } glfwSetCursorPosCallback(m_window, callback); } void FW::setScrollCallback(ScrollCallback callback) { if (!isSetup()) { cout << kDebugTag << "No valid window!" << endl; return; } glfwSetScrollCallback(m_window, callback); } void FW::setup() { glfwSetErrorCallback(sErrorCallback); if (!glfwInit()) { cout << kDebugTag << "Failed to be initialized!" << endl; m_is_initialized = false; return; } m_is_initialized = true; glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, m_context_version.major); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, m_context_version.minor); glfwWindowHint(GLFW_RESIZABLE, m_window_resizable); m_window = glfwCreateWindow(m_window_size.width, m_window_size.height, m_window_title.c_str(), NULL, NULL); if (!m_window) { cout << kDebugTag << "Can not create a window!" << endl; m_is_setup = false; return; } glfwMakeContextCurrent(m_window); GLenum error = glewInit(); if (error != GLEW_OK) { cout << kDebugTag << "Failed to initialize glew!" << endl; m_is_setup = false; return; } m_is_setup = true; } void FW::runMainLoop(VoidFunction render) { if (!isInitialized() || !isSetup()) { cout << kDebugTag << "Can not run main loop!" << endl; return; } while (!glfwWindowShouldClose(m_window)) { glfwPollEvents(); render(); glfwSwapBuffers(m_window); } } double FW::getTime() const { return glfwGetTime(); } FW::~FW() { tearDown(); } void FW::tearDown() { if (!isInitialized()) return; glfwTerminate(); }
[ "guanxian.li@intel.com" ]
guanxian.li@intel.com
8a6d83ad4e80d5595ace17c5ce9a890487cd2905
d245e768fe4f4a9eb1d765e61e8704947e3fc31a
/TextureLoader/src/Image.cpp
f1d7cef2eae5734d2dd88963072086c058784826
[ "Apache-2.0" ]
permissive
ccf19881030/DiligentTools
241757768bd7b7666398b0cd60dea86f975e64ca
5b2da8d2da0a71465a5bcbc9ed4780eb8568c891
refs/heads/master
2020-04-28T00:55:11.145873
2019-03-06T04:06:31
2019-03-06T04:06:31
null
0
0
null
null
null
null
UTF-8
C++
false
false
16,724
cpp
/* Copyright 2015-2019 Egor Yusov * * 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 * * 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 OF ANY PROPRIETARY RIGHTS. * * In no event and under no legal theory, whether in tort (including negligence), * contract, or otherwise, unless required by applicable law (such as deliberate * and grossly negligent acts) or agreed to in writing, shall any Contributor be * liable for any damages, including any direct, indirect, special, incidental, * or consequential damages of any character arising as a result of this License or * out of the use or inability to use the software (including but not limited to damages * for loss of goodwill, work stoppage, computer failure or malfunction, or any and * all other commercial damages or losses), even if such Contributor has been advised * of the possibility of such damages. */ #include "pch.h" #include "Image.h" #include "Errors.h" #include "tiffio.h" #include "png.h" #include "jpeglib.h" #include "DataBlobImpl.h" #include "DebugUtilities.h" #include "RefCntAutoPtr.h" #include "Align.h" namespace Diligent { class TIFFClientOpenWrapper { public: TIFFClientOpenWrapper( IDataBlob *pData ) : m_Offset( 0 ), m_Size( pData->GetSize() ), m_pData( pData ) { } static tmsize_t TIFFReadProc( thandle_t pClientData, void* pBuffer, tmsize_t Size ) { auto *pThis = reinterpret_cast<TIFFClientOpenWrapper*>(pClientData); auto *pSrcPtr = reinterpret_cast<Uint8*>(pThis->m_pData->GetDataPtr()) + pThis->m_Offset; memcpy( pBuffer, pSrcPtr, Size ); pThis->m_Offset += Size; return Size; } static tmsize_t TIFFWriteProc( thandle_t pClientData, void* pBuffer, tmsize_t Size ) { auto *pThis = reinterpret_cast<TIFFClientOpenWrapper*>(pClientData); if( pThis->m_Offset + Size > pThis->m_Size ) { pThis->m_Size = pThis->m_Offset + Size; pThis->m_pData->Resize( pThis->m_Size ); } auto *pDstPtr = reinterpret_cast<Uint8*>(pThis->m_pData->GetDataPtr()) + pThis->m_Offset; memcpy( pDstPtr, pBuffer, Size ); pThis->m_Offset += Size; return Size; } static toff_t TIFFSeekProc( thandle_t pClientData, toff_t Offset, int Whence ) { auto *pThis = reinterpret_cast<TIFFClientOpenWrapper*>(pClientData); switch( Whence ) { case SEEK_SET: pThis->m_Offset = static_cast<size_t>(Offset); break; case SEEK_CUR: pThis->m_Offset += static_cast<size_t>(Offset); break; case SEEK_END: pThis->m_Offset = pThis->m_Size + static_cast<size_t>(Offset); break; default: UNEXPECTED( "Unexpected whence" ); } return pThis->m_Offset; } static int TIFFCloseProc( thandle_t pClientData ) { auto *pThis = reinterpret_cast<TIFFClientOpenWrapper*>(pClientData); pThis->m_pData.Release(); pThis->m_Size = 0; pThis->m_Offset = 0; return 0; } static toff_t TIFFSizeProc( thandle_t pClientData ) { auto *pThis = reinterpret_cast<TIFFClientOpenWrapper*>(pClientData); return pThis->m_Size; } static int TIFFMapFileProc( thandle_t pClientData, void** base, toff_t* size ) { UNEXPECTED( "Client file mapping is not implemented. Use \'m\' when opening TIFF file to disable file mapping." ); return 0; } static void TIFFUnmapFileProc( thandle_t pClientData, void* base, toff_t size ) { UNEXPECTED( "Client file mapping is not implemented. Use \'m\' when opening TIFF file to disable file mapping." ); } private: size_t m_Offset; size_t m_Size; RefCntAutoPtr<IDataBlob> m_pData; }; void Image::LoadTiffFile( IDataBlob *pFileData, const ImageLoadInfo& LoadInfo ) { TIFFClientOpenWrapper TiffClientOpenWrpr(pFileData); auto TiffFile = TIFFClientOpen("", "rm", &TiffClientOpenWrpr, TIFFClientOpenWrapper::TIFFReadProc, TIFFClientOpenWrapper::TIFFWriteProc, TIFFClientOpenWrapper::TIFFSeekProc, TIFFClientOpenWrapper::TIFFCloseProc, TIFFClientOpenWrapper::TIFFSizeProc, TIFFClientOpenWrapper::TIFFMapFileProc, TIFFClientOpenWrapper::TIFFUnmapFileProc); TIFFGetField(TiffFile, TIFFTAG_IMAGEWIDTH, &m_Desc.Width); TIFFGetField(TiffFile, TIFFTAG_IMAGELENGTH, &m_Desc.Height); Uint16 SamplesPerPixel = 0; // SamplesPerPixel is usually 1 for bilevel, grayscale, and palette-color images. // SamplesPerPixel is usually 3 for RGB images. If this value is higher, ExtraSamples // should give an indication of the meaning of the additional channels. TIFFGetField(TiffFile, TIFFTAG_SAMPLESPERPIXEL, &SamplesPerPixel); m_Desc.NumComponents = SamplesPerPixel; Uint16 BitsPerSample = 0; TIFFGetField(TiffFile, TIFFTAG_BITSPERSAMPLE, &BitsPerSample); m_Desc.BitsPerPixel = m_Desc.NumComponents * BitsPerSample; auto ScanlineSize = TIFFScanlineSize(TiffFile); m_Desc.RowStride = Align(static_cast<Uint32>( ScanlineSize ), 4u); m_pData->Resize(size_t{m_Desc.Height} * size_t{m_Desc.RowStride}); auto *pDataPtr = reinterpret_cast<Uint8*>( m_pData->GetDataPtr() ); for (Uint32 row = 0; row < m_Desc.Height; row++, pDataPtr += m_Desc.RowStride) { TIFFReadScanline(TiffFile, pDataPtr, row); } TIFFClose(TiffFile); } class PNGReadFnHelper { public: PNGReadFnHelper( IDataBlob *pData ) : m_pData( pData ), m_Offset( 0 ) { } static void ReadData( png_structp pngPtr, png_bytep data, png_size_t length ) { auto pThis = reinterpret_cast<PNGReadFnHelper*>( png_get_io_ptr(pngPtr) ); memcpy( data, reinterpret_cast<Uint8*>(pThis->m_pData->GetDataPtr()) + pThis->m_Offset, length ); pThis->m_Offset += length; } private: RefCntAutoPtr<IDataBlob> m_pData; size_t m_Offset; }; void Image::LoadPngFile( IDataBlob *pFileData, const ImageLoadInfo& LoadInfo ) { // http://www.piko3d.net/tutorials/libpng-tutorial-loading-png-files-from-streams/ // http://www.libpng.org/pub/png/book/chapter13.html#png.ch13.div.10 // https://gist.github.com/niw/5963798 PNGReadFnHelper ReadFnHelper(pFileData); const size_t PngSigSize = 8; png_const_bytep pngsig = reinterpret_cast<png_const_bytep>(pFileData->GetDataPtr()); //Let LibPNG check the signature. If this function returns 0, everything is OK. if( png_sig_cmp( pngsig, 0, PngSigSize ) != 0 ) { LOG_ERROR_AND_THROW( "Invalid png signature" ); } png_structp png = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); VERIFY(png, "png_create_read_struct() failed"); png_infop info = png_create_info_struct(png); VERIFY(info, "png_create_info_struct() failed"); if( setjmp( png_jmpbuf( png ) ) ) { // When an error occurs during parsing, libPNG will jump to here png_destroy_read_struct(&png, &info, (png_infopp)0); LOG_ERROR_AND_THROW( "Failed to read png file" ); } png_set_read_fn(png, (png_voidp)&ReadFnHelper, PNGReadFnHelper::ReadData); png_read_info(png, info); m_Desc.Width = png_get_image_width(png, info); m_Desc.Height = png_get_image_height(png, info); m_Desc.NumComponents = png_get_channels(png, info); auto bit_depth = png_get_bit_depth(png, info); m_Desc.BitsPerPixel = bit_depth * m_Desc.NumComponents; // PNG files store 16-bit pixels in network byte order (big-endian, ie // most significant bytes first). png_set_swap() shall switch the byte-order // to little-endian (ie, least significant bits first). if( bit_depth == 16 ) png_set_swap(png); #if 0 auto color_type = png_get_color_type(png, info); // Read any color_type into 8bit depth, RGBA format. // See http://www.libpng.org/pub/png/libpng-manual.txt if( bit_depth == 16 ) png_set_strip_16( png ); if( color_type == PNG_COLOR_TYPE_PALETTE ) png_set_palette_to_rgb( png ); // PNG_COLOR_TYPE_GRAY_ALPHA is always 8 or 16bit depth. if( color_type == PNG_COLOR_TYPE_GRAY && bit_depth < 8 ) png_set_expand_gray_1_2_4_to_8( png ); if( png_get_valid( png, info, PNG_INFO_tRNS ) ) png_set_tRNS_to_alpha( png ); // These color_type don't have an alpha channel then fill it with 0xff. if( color_type == PNG_COLOR_TYPE_RGB || color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_PALETTE ) png_set_filler( png, 0xFF, PNG_FILLER_AFTER ); if( color_type == PNG_COLOR_TYPE_GRAY || color_type == PNG_COLOR_TYPE_GRAY_ALPHA ) png_set_gray_to_rgb( png ); png_read_update_info( png, info ); #endif //Array of row pointers. One for every row. std::vector<png_bytep> rowPtrs(m_Desc.Height); //Alocate a buffer with enough space. Align stride to 4 bytes m_Desc.RowStride = Align(m_Desc.Width * bit_depth * m_Desc.NumComponents / 8, 4u); m_pData->Resize( size_t{m_Desc.Height} * size_t{m_Desc.RowStride} ); for( size_t i = 0; i < m_Desc.Height; i++ ) rowPtrs[i] = reinterpret_cast<png_bytep>(m_pData->GetDataPtr()) + i * m_Desc.RowStride; //Read the imagedata and write it to the adresses pointed to //by rowptrs (in other words: our image databuffer) png_read_image( png, rowPtrs.data() ); png_destroy_read_struct(&png, &info, (png_infopp)0); } struct my_jpeg_error_mgr { jpeg_error_mgr pub; char padding[8]; jmp_buf setjmp_buffer;// for return to caller }; // Here's the routine that will replace the standard error_exit method: METHODDEF(void) my_error_exit (j_common_ptr cinfo) { // cinfo->err really points to a my_jpeg_error_mgr struct, so coerce pointer my_jpeg_error_mgr* myerr = (my_jpeg_error_mgr*) cinfo->err; /* Always display the message. */ /* We could postpone this until after returning, if we chose. */ (*cinfo->err->output_message) (cinfo); // Return control to the setjmp point longjmp(myerr->setjmp_buffer, 1); } void Image::LoadJpegFile( IDataBlob *pFileData, const ImageLoadInfo& LoadInfo ) { // https://github.com/LuaDist/libjpeg/blob/master/example.c // This struct contains the JPEG decompression parameters and pointers to // working space (which is allocated as needed by the JPEG library). jpeg_decompress_struct cinfo; // We use our private extension JPEG error handler. // Note that this struct must live as long as the main JPEG parameter // struct, to avoid dangling-pointer problems. my_jpeg_error_mgr jerr; // Step 1: allocate and initialize JPEG decompression object // We set up the normal JPEG error routines, then override error_exit. cinfo.err = jpeg_std_error( &jerr.pub ); jerr.pub.error_exit = my_error_exit; // Establish the setjmp return context for my_error_exit to use. if( setjmp( jerr.setjmp_buffer ) ) { // If we get here, the JPEG code has signaled an error. // We need to clean up the JPEG object, close the input file, and return. jpeg_destroy_decompress( &cinfo ); LOG_ERROR_AND_THROW( "Failed to decompress JPEG image" ); } // Now we can initialize the JPEG decompression object. jpeg_create_decompress( &cinfo ); // Step 2: specify data source jpeg_mem_src( &cinfo, reinterpret_cast<unsigned char*>(pFileData->GetDataPtr()), static_cast<unsigned long>(pFileData->GetSize()) ); // Step 3: read file parameters with jpeg_read_header() jpeg_read_header( &cinfo, TRUE ); // We can ignore the return value from jpeg_read_header since // (a) suspension is not possible with the stdio data source, and // (b) we passed TRUE to reject a tables-only JPEG file as an error. // See libjpeg.txt for more info. // Step 4: set parameters for decompression // In this example, we don't need to change any of the defaults set by // jpeg_read_header(), so we do nothing here. // Step 5: Start decompressor jpeg_start_decompress( &cinfo ); // We can ignore the return value since suspension is not possible // with the stdio data source. // We may need to do some setup of our own at this point before reading // the data. After jpeg_start_decompress() we have the correct scaled // output image dimensions available, as well as the output colormap // if we asked for color quantization. m_Desc.Width = cinfo.output_width; m_Desc.Height = cinfo.output_height; m_Desc.NumComponents = cinfo.output_components; m_Desc.RowStride = Align(m_Desc.Width * m_Desc.NumComponents, 4u); m_Desc.BitsPerPixel = 8 * m_Desc.NumComponents; m_pData->Resize(size_t{m_Desc.RowStride} * size_t{m_Desc.Height}); // Step 6: while (scan lines remain to be read) // jpeg_read_scanlines(...); // Here we use the library's state variable cinfo.output_scanline as the // loop counter, so that we don't have to keep track ourselves. while( cinfo.output_scanline < cinfo.output_height ) { // jpeg_read_scanlines expects an array of pointers to scanlines. // Here the array is only one element long, but you could ask for // more than one scanline at a time if that's more convenient. auto *pDstScanline = reinterpret_cast<Uint8*>( m_pData->GetDataPtr() ) + size_t{cinfo.output_scanline} * size_t{m_Desc.RowStride}; JSAMPROW RowPtrs[] = { reinterpret_cast<JSAMPROW>(pDstScanline) }; jpeg_read_scanlines( &cinfo, RowPtrs, 1 ); } // Step 7: Finish decompression jpeg_finish_decompress( &cinfo ); // We can ignore the return value since suspension is not possible // with the stdio data source. // Step 8: Release JPEG decompression object // This is an important step since it will release a good deal of memory. jpeg_destroy_decompress( &cinfo ); // At this point you may want to check to see whether any corrupt-data // warnings occurred (test whether jerr.pub.num_warnings is nonzero). } Image::Image( IReferenceCounters *pRefCounters, IDataBlob *pFileData, const ImageLoadInfo& LoadInfo ) : TBase(pRefCounters), m_pData( MakeNewRCObj<DataBlobImpl>()(0) ) { if( LoadInfo.Format == EImageFileFormat::tiff ) { LoadTiffFile(pFileData, LoadInfo ); } else if( LoadInfo.Format == EImageFileFormat::png ) { LoadPngFile(pFileData, LoadInfo ); } else if( LoadInfo.Format == EImageFileFormat::jpeg ) { LoadJpegFile(pFileData, LoadInfo ); } } void Image::CreateFromDataBlob(IDataBlob *pFileData, const ImageLoadInfo& LoadInfo, Image **ppImage) { *ppImage = MakeNewRCObj<Image>()(pFileData, LoadInfo); (*ppImage)->AddRef(); } }
[ "egor.yusov@gmail.com" ]
egor.yusov@gmail.com
89f6320703a69f6a60ff3cb1fed7ce5f6fc1ae69
f68c1a09ade5d969f3973246747466e4a540ff74
/src/prod/src/ServiceModel/management/UpgradeOrchestrationService/OrchestrationUpgradeState.h
aa0644d8ac09d80664c4d7e4a30ee6827dfcf556
[ "MIT" ]
permissive
GitTorre/service-fabric
ab38752d4cc7c8f2ee03553372c0f3e05911ff67
88da19dc5ea8edfe1c9abebe25a5c5079995db63
refs/heads/master
2021-04-09T10:57:45.678751
2018-08-20T19:17:28
2018-08-20T19:17:28
125,401,516
0
0
MIT
2018-03-15T17:13:53
2018-03-15T17:13:52
null
UTF-8
C++
false
false
1,023
h
// ------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License (MIT). See License.txt in the repo root for license information. // ------------------------------------------------------------ #pragma once namespace Management { namespace UpgradeOrchestrationService { namespace OrchestrationUpgradeState { enum Enum { Invalid = 0, RollingBackInProgress = 1, RollingBackCompleted = 2, RollingForwardPending = 3, RollingForwardInProgress = 4, RollingForwardCompleted = 5, Failed = 6 }; void WriteToTextWriter(Common::TextWriter & w, Enum const & val); Common::ErrorCode FromPublicApi(FABRIC_UPGRADE_STATE const & state, __out Enum & progress); FABRIC_UPGRADE_STATE ToPublicApi(Enum const & state); }; } }
[ "noreply-sfteam@microsoft.com" ]
noreply-sfteam@microsoft.com
e6f7d23b59b8837ba518ec9d453574f4ea13ec6d
b8b3913b510c2979b03f755e5981fdbb4406ebad
/剑指offer/032_03-按之字形顺序打印二叉树/src/cpp/032_03-按之字形顺序打印二叉树.cpp
1ccccbc1f3736ef952a0470391675f825dd289ec
[]
no_license
Richard-coder/Programming-Practice
ca489d16e0dec70699239c0e4a31d29c6d0b72e9
ae93a271fc552fcf85c306bd5573533344eae8fb
refs/heads/master
2021-01-23T02:15:50.288066
2019-07-31T02:07:33
2019-07-31T02:07:33
102,436,144
2
1
null
null
null
null
UTF-8
C++
false
false
1,297
cpp
/* struct TreeNode { int val; struct TreeNode *left; struct TreeNode *right; TreeNode(int x) : val(x), left(NULL), right(NULL) { } }; */ class Solution { public: vector<vector<int> > Print(TreeNode* pRoot) { vector<vector<int>> res; if(pRoot==nullptr) return res; vector<int> v; stack<TreeNode*> s[2]; int current=0; int next=1; s[current].push(pRoot); while(!s[0].empty()||!s[1].empty()){ TreeNode* node=s[current].top(); v.push_back(node->val); s[current].pop(); if(current==0){ if(node->left!=nullptr) s[next].push(node->left); if(node->right!=nullptr) s[next].push(node->right); }else{ if(node->right!=nullptr) s[next].push(node->right); if(node->left!=nullptr) s[next].push(node->left); } if(s[current].empty()){ res.push_back(v); vector<int> ().swap(v); current=1-current; next=1-next; } } return res; } };
[ "zhi_zhuce@126.com" ]
zhi_zhuce@126.com
516ec08acb368c24793e08cccc8203c2e5975b81
393e111a0a9a1ce4715ee29523167724684d096f
/codeexact/shah.cpp
2f52bf33c02db47a10d203f715f1f10afcc36b3a
[]
no_license
kartikvishwakarma/code_chef
9d447ae15c64fadf05123c61daea98ab4c905ea0
c5d04fb73e4b6d9c3e1f9243656273ae017fa46c
refs/heads/master
2020-04-05T09:11:30.534406
2018-11-08T17:54:48
2018-11-08T17:54:48
156,746,387
0
0
null
null
null
null
UTF-8
C++
false
false
554
cpp
#include <iostream> using namespace std; typedef long long ll; const ll N = (ll)(1e+8); ll dp[N+2]; /* int solve(int n, int k){ if(n==1){ //cout<<n<<" "<<k<<"\n"; return n; } else return (solve(n-1,k)+k-1)%n+1; } */ int dp_solve(ll n, ll k){ //cout<<"here\n"; for(ll i=1;i<=n;i++){ if(i==1 || i==2) dp[i]=i; else dp[i]=(dp[i-1]+k-1)%i+1; // cout<<"there\n"; } //cout<<dp[n-1]<<" "<<dp[n]<<"\n"; } int main(){ ll t, n; dp_solve(N,2); //cout<<"done\n"; cin>>t; while(t--){ cin>>n; cout<<dp[n-1]<<" "<<dp[n]<<"\n"; } }
[ "kartik@kartik-Predator-G3-572" ]
kartik@kartik-Predator-G3-572
66181bce932f0128c56cf52c5535fbf676dc245f
12f8a24c7c1ccb868fbef6faa269f6da75324dc8
/src/Sem_List.cpp
462a31d9029aa566e5ab1ba926e47d78a41677aa
[]
no_license
lukatomanovic/OS-kernel
fe16a8a9b3749724d7402aeaaf91c4298660742e
89573152142d6494cc1b3ec3b2d49d3a085fc562
refs/heads/main
2023-04-04T17:07:28.009158
2021-04-13T18:33:09
2021-04-13T18:33:09
357,651,613
0
0
null
null
null
null
UTF-8
C++
false
false
1,999
cpp
/* * Sem_List.cpp * * Created on: Apr 24, 2020 * Author: OS1 */ #include"Sem_List.h" #include"PCB_List.h" #include "kersem.h" #include "locking.h" #include<stdio.h> KernelSem_List::KernelSem_List():first_(0),last_(0),number_of_sem_(0){} KernelSem_List::~KernelSem_List(){ LOCK KernelSemnode *old; while(first_){ old=first_; first_=first_->next_; delete old; } number_of_sem_=0; UNLOCK } void KernelSem_List::add(KernelSem* ks) { LOCK KernelSemnode* novi = new KernelSemnode(ks); if (first_ == 0) first_ = novi; else last_->next_ = novi; last_ = novi; number_of_sem_++; UNLOCK } KernelSem* KernelSem_List::getAndRemove(){ if (first_ == 0) return 0; KernelSemnode* old = first_; KernelSem* ret = old->sem_; first_ = first_->next_; if (first_ == 0) last_ = 0; delete old; number_of_sem_--; return ret; } void KernelSem_List::remove(KernelSem* ks) { KernelSemnode* curr = first_, * prev = 0; while(curr != 0 && curr->sem_ != ks){ prev=curr; curr = curr->next_; } if (curr == 0) return; if (curr == first_){ //remove first first_ = first_->next_; if(first_==0)last_=0; } else { prev->next_ = curr->next_; if (curr == last_) last_ = prev; } delete curr; number_of_sem_--; } void KernelSem_List::updateTime() { //zakljucavamo kako bi vreme bilo azurirano u celoj listi LOCK //fsem=fopen("semaf.txt","a+"); KernelSemnode* curr = first_; KernelSem* ks = 0; //fprintf(fsem,"Obilazak svih vremenskih semafora! \n"); int no=0; while (curr != 0) { //fprintf(fsem,"Obilazak semafora %d! \n",no++); ks = curr->sem_; //ks->list_of_time_blocked_->print_list(fsem); ks->list_of_time_blocked_->timerUpdate(ks); curr = curr->next_; } //fclose(fsem); UNLOCK } void KernelSem_List::print_list() { KernelSemnode *curr = first_; if (!curr) printf("Lista semafora je prazna!\n"); else { int i = 1; while (curr) { printf("%d\t%d\n",i,curr->sem_->getVal()); i++; curr = curr->next_; } } }
[ "tl180410d@student.etf.bg.ac.rs" ]
tl180410d@student.etf.bg.ac.rs
f0fdb1379c7d23fd3110ffb7b551af346e7cb9c7
a62342d6359a88b0aee911e549a4973fa38de9ea
/0.6.0.3/Internal/SDK/BTTask_GoToPoint_functions.cpp
c27fb4c6444a8c30fd4be009e045b282a9c36d59
[]
no_license
zanzo420/Medieval-Dynasty-SDK
d020ad634328ee8ee612ba4bd7e36b36dab740ce
d720e49ae1505e087790b2743506921afb28fc18
refs/heads/main
2023-06-20T03:00:17.986041
2021-07-15T04:51:34
2021-07-15T04:51:34
386,165,085
0
0
null
null
null
null
UTF-8
C++
false
false
5,442
cpp
// Name: Medieval Dynasty, Version: 0.6.0.3 #include "../pch.h" /*!!DEFINE!!*/ /*!!HELPER_DEF!!*/ /*!!HELPER_INC!!*/ #ifdef _MSC_VER #pragma pack(push, 0x01) #endif namespace CG { //--------------------------------------------------------------------------- // Functions //--------------------------------------------------------------------------- // Function BTTask_GoToPoint.BTTask_GoToPoint_C.OnFail_4C725ACE474ACC526129799B3233F46E // (BlueprintCallable, BlueprintEvent) // Parameters: // TEnumAsByte<AIModule_EPathFollowingResult> MovementResult (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBTTask_GoToPoint_C::OnFail_4C725ACE474ACC526129799B3233F46E(TEnumAsByte<AIModule_EPathFollowingResult> MovementResult) { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.OnFail_4C725ACE474ACC526129799B3233F46E"); UBTTask_GoToPoint_C_OnFail_4C725ACE474ACC526129799B3233F46E_Params params; params.MovementResult = MovementResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.OnSuccess_4C725ACE474ACC526129799B3233F46E // (BlueprintCallable, BlueprintEvent) // Parameters: // TEnumAsByte<AIModule_EPathFollowingResult> MovementResult (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBTTask_GoToPoint_C::OnSuccess_4C725ACE474ACC526129799B3233F46E(TEnumAsByte<AIModule_EPathFollowingResult> MovementResult) { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.OnSuccess_4C725ACE474ACC526129799B3233F46E"); UBTTask_GoToPoint_C_OnSuccess_4C725ACE474ACC526129799B3233F46E_Params params; params.MovementResult = MovementResult; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.ReceiveExecuteAI // (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) // class APawn* ControlledPawn (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBTTask_GoToPoint_C::ReceiveExecuteAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.ReceiveExecuteAI"); UBTTask_GoToPoint_C_ReceiveExecuteAI_Params params; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.FinishOnIdle // (BlueprintCallable, BlueprintEvent) void UBTTask_GoToPoint_C::FinishOnIdle() { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.FinishOnIdle"); UBTTask_GoToPoint_C_FinishOnIdle_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.ReceiveAbortAI // (Event, Protected, BlueprintEvent) // Parameters: // class AAIController* OwnerController (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) // class APawn* ControlledPawn (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBTTask_GoToPoint_C::ReceiveAbortAI(class AAIController* OwnerController, class APawn* ControlledPawn) { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.ReceiveAbortAI"); UBTTask_GoToPoint_C_ReceiveAbortAI_Params params; params.OwnerController = OwnerController; params.ControlledPawn = ControlledPawn; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.Finish // (BlueprintCallable, BlueprintEvent) void UBTTask_GoToPoint_C::Finish() { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.Finish"); UBTTask_GoToPoint_C_Finish_Params params; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } // Function BTTask_GoToPoint.BTTask_GoToPoint_C.ExecuteUbergraph_BTTask_GoToPoint // (Final, HasDefaults) // Parameters: // int EntryPoint (BlueprintVisible, BlueprintReadOnly, Parm, ZeroConstructor, IsPlainOldData, NoDestructor, HasGetValueTypeHash) void UBTTask_GoToPoint_C::ExecuteUbergraph_BTTask_GoToPoint(int EntryPoint) { static auto fn = UObject::FindObject<UFunction>("Function BTTask_GoToPoint.BTTask_GoToPoint_C.ExecuteUbergraph_BTTask_GoToPoint"); UBTTask_GoToPoint_C_ExecuteUbergraph_BTTask_GoToPoint_Params params; params.EntryPoint = EntryPoint; auto flags = fn->FunctionFlags; UObject::ProcessEvent(fn, &params); fn->FunctionFlags = flags; } } #ifdef _MSC_VER #pragma pack(pop) #endif
[ "zp2kshield@gmail.com" ]
zp2kshield@gmail.com
6355995da32e379ab95e0f46629a6f4f4963e88e
097df0a03ead79f6b2880872e33fd6cf04694867
/PhoneBook/PersonWithPhoneNums.h
cce97c5d411b34f04f77b7b243f20fab676245ee
[]
no_license
KrastevST/Phone-Book
e6f56848abc81c75e31561bd27e074368cd84ed6
c847b4c336b4a1e56be2590a2686d0600bd4a670
refs/heads/master
2021-01-15T00:15:03.287870
2020-08-25T16:32:33
2020-08-25T16:32:33
242,807,997
0
0
null
null
null
null
UTF-8
C++
false
false
590
h
#pragma once #include "Structures.h" ////////////////////////////////////////////////////////////////////////////////// // CPersonWithPhoneNums class CPersonWithPhoneNums { // Constructor / Destructor //--------------------- public: CPersonWithPhoneNums(PERSONS& recPerson); virtual ~CPersonWithPhoneNums(); // Methods //--------------------- public: void AddPhoneNumber(PHONE_NUMBERS& recPhoneNumbers); PERSONS& GetPerson(); CPhoneNumbersArray& GetPhoneNumbers(); // Members //--------------------- private: PERSONS& m_Person; CPhoneNumbersArray m_oPhoneNumbersArray{}; };
[ "svetoslav.tkrastev@gmail.com" ]
svetoslav.tkrastev@gmail.com
a9e4d6600634c03dc2e63760e9f9dd1c93c72db8
94b125971d072f478327c5f71347e1c554e7f986
/opsin_params.h
ab1aeece7400f28a4a40434c5975c420535ec26c
[ "Apache-2.0" ]
permissive
FreedomCodes/pik
a08ccf01f120b673a46bef1ab321fa6fd9adabd0
04eca24c7b7f59a6d534065db2f448fccce5dd81
refs/heads/master
2021-01-01T18:01:16.487240
2017-07-24T16:20:17
2017-07-24T16:20:17
98,228,153
0
1
null
2017-07-24T19:40:59
2017-07-24T19:40:59
null
UTF-8
C++
false
false
2,303
h
// Copyright 2017 Google Inc. All Rights Reserved. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef OPSIN_PARAMS_H_ #define OPSIN_PARAMS_H_ namespace pik { static constexpr float kScale = 255.0; static constexpr float kOpsinAbsorbanceMatrix[9] = { 0.355028246972028f / kScale, 0.589422218034148f / kScale, 0.055549534993826f / kScale, 0.250871605395556f / kScale, 0.714937756329137f / kScale, 0.034190638275308f / kScale, 0.091915449087840f / kScale, 0.165250230906774f / kScale, 0.742834320005384f / kScale, }; static constexpr float kOpsinAbsorbanceInverseMatrix[9] = { 6.805644286129f * kScale, -5.552270790544f * kScale, -0.253373707795f * kScale, -2.373074275591f * kScale, 3.349796660147f * kScale, 0.023277709773f * kScale, -0.314192274838f * kScale, -0.058176067042f * kScale, 1.372368367449f * kScale, }; static constexpr float kScaleR = 1.001746913108605f; static constexpr float kScaleG = 2.0f - kScaleR; static constexpr float kInvScaleR = 1.0f / kScaleR; static constexpr float kInvScaleG = 1.0f / kScaleG; static constexpr float kXybCenter[3] = {0.008714601398f, 0.5f, 0.5f}; // This is the radius of the range, not the diameter. static constexpr float kXybRange[3] = {0.035065606236f, 0.5f, 0.5f}; static constexpr float kXybMin[3] = { kXybCenter[0] - kXybRange[0], kXybCenter[1] - kXybRange[1], kXybCenter[2] - kXybRange[2], }; static constexpr float kXybMax[3] = { kXybCenter[0] + kXybRange[0], kXybCenter[1] + kXybRange[1], kXybCenter[2] + kXybRange[2], }; static constexpr float kGammaInitialCutoff = 10.31475f; static constexpr float kGammaInitialSlope = 12.92f; static constexpr float kGammaOffset = 0.055f; static constexpr float kGammaPower = 2.4f; } // namespace pik #endif // OPSIN_PARAMS_H_
[ "janwas@google.com" ]
janwas@google.com
3de3ebbca4eee66d1b5bf33156bc104600307f1a
f291417624f65a0f731ca7a8319275604fda455a
/OLED.ino
5cc9479550d22996957172dcd0c28c3551ce303b
[]
no_license
Rohithtiruveedhula/OLED
70ff4b3341be805273642ed0c9c0dcfdfd45930a
bd623d3a38a37bd27f5875f8e6fb9d6252218377
refs/heads/master
2020-06-12T08:40:53.372635
2019-06-28T09:39:20
2019-06-28T09:39:20
194,248,097
0
0
null
null
null
null
UTF-8
C++
false
false
7,596
ino
#include <SPI.h> #include <Wire.h> #include <Adafruit_GFX.h> #include <Adafruit_SSD1306.h> #define OLED_RESET D5 /* Object named display, of the class Adafruit_SSD1306 */ Adafruit_SSD1306 display(OLED_RESET); #if (SSD1306_LCDHEIGHT != 64) #error("Height incorrect, please fix Adafruit_SSD1306.h!"); #endif uint8_t s = 0, m = 0, h = 0; void setup() { display.begin(SSD1306_SWITCHCAPVCC, 0x3C); /* Initialize display with address 0x3C */ display.clearDisplay(); /* Clear display */ display.setTextSize(1); /* Select font size of text. Increases with size of argument. */ display.setTextColor(WHITE); /* Color of text*/ testdrawcircle(); testdrawchar(); testdrawstyles(); } void loop() { updateWatch();/* Every second increment clock and display */ delay(1000); } void updateWatch() { s = s + 1; if (s == 60) { s = 0; m = m + 1; } if (m == 60) { m = 0; h = h + 1; } if (h == 13) h = 1; writeOLED(); } void writeOLED(){ char time[30]; display.clearDisplay(); /* Clear display */ sprintf(time, "%02d:%02d:%02d", h, m, s); drawStr(50, 10, "Timer"); drawStr(40, 30, time); drawStr(20, 50, "smarbridge"); display.display(); } void drawStr(uint8_t x, uint8_t y, char* str){ display.setCursor(x, y); /* Set x,y coordinates */ display.println(str); } void testdrawline() { int16_t i; display.clearDisplay(); // Clear display buffer for(i=0; i<display.width(); i+=4) { display.drawLine(0, 0, i, display.height()-1, WHITE); display.display(); // Update screen with each newly-drawn line delay(1); } for(i=0; i<display.height(); i+=4) { display.drawLine(0, 0, display.width()-1, i, WHITE); display.display(); delay(1); } delay(250); display.clearDisplay(); for(i=0; i<display.width(); i+=4) { display.drawLine(0, display.height()-1, i, 0, WHITE); display.display(); delay(1); } for(i=display.height()-1; i>=0; i-=4) { display.drawLine(0, display.height()-1, display.width()-1, i, WHITE); display.display(); delay(1); } delay(250); display.clearDisplay(); for(i=display.width()-1; i>=0; i-=4) { display.drawLine(display.width()-1, display.height()-1, i, 0, WHITE); display.display(); delay(1); } for(i=display.height()-1; i>=0; i-=4) { display.drawLine(display.width()-1, display.height()-1, 0, i, WHITE); display.display(); delay(1); } delay(250); display.clearDisplay(); for(i=0; i<display.height(); i+=4) { display.drawLine(display.width()-1, 0, 0, i, WHITE); display.display(); delay(1); } for(i=0; i<display.width(); i+=4) { display.drawLine(display.width()-1, 0, i, display.height()-1, WHITE); display.display(); delay(1); } delay(2000); // Pause for 2 seconds } void testdrawrect(void) { display.clearDisplay(); for(int16_t i=0; i<display.height()/2; i+=2) { display.drawRect(i, i, display.width()-2*i, display.height()-2*i, WHITE); display.display(); // Update screen with each newly-drawn rectangle delay(1); } delay(2000); } void testfillrect(void) { display.clearDisplay(); for(int16_t i=0; i<display.height()/2; i+=3) { // The INVERSE color is used so rectangles alternate white/black display.fillRect(i, i, display.width()-i*2, display.height()-i*2, INVERSE); display.display(); // Update screen with each newly-drawn rectangle delay(1); } delay(2000); } void testdrawcircle(void) { display.clearDisplay(); for(int16_t i=0; i<max(display.width(),display.height())/2; i+=2) { display.drawCircle(display.width()/2, display.height()/2, i, WHITE); display.display(); delay(1); } delay(2000); } void testfillcircle(void) { display.clearDisplay(); for(int16_t i=max(display.width(),display.height())/2; i>0; i-=3) { // The INVERSE color is used so circles alternate white/black display.fillCircle(display.width() / 2, display.height() / 2, i, INVERSE); display.display(); // Update screen with each newly-drawn circle delay(1); } delay(2000); } void testdrawroundrect(void) { display.clearDisplay(); for(int16_t i=0; i<display.height()/2-2; i+=2) { display.drawRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, WHITE); display.display(); delay(1); } delay(2000); } void testfillroundrect(void) { display.clearDisplay(); for(int16_t i=0; i<display.height()/2-2; i+=2) { // The INVERSE color is used so round-rects alternate white/black display.fillRoundRect(i, i, display.width()-2*i, display.height()-2*i, display.height()/4, INVERSE); display.display(); delay(1); } delay(2000); } void testdrawtriangle(void) { display.clearDisplay(); for(int16_t i=0; i<max(display.width(),display.height())/2; i+=5) { display.drawTriangle( display.width()/2 , display.height()/2-i, display.width()/2-i, display.height()/2+i, display.width()/2+i, display.height()/2+i, WHITE); display.display(); delay(1); } delay(2000); } void testfilltriangle(void) { display.clearDisplay(); for(int16_t i=max(display.width(),display.height())/2; i>0; i-=5) { // The INVERSE color is used so triangles alternate white/black display.fillTriangle( display.width()/2 , display.height()/2-i, display.width()/2-i, display.height()/2+i, display.width()/2+i, display.height()/2+i, INVERSE); display.display(); delay(1); } delay(2000); } void testdrawchar(void) { display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(WHITE); // Draw white text display.setCursor(0, 0); // Start at top-left corner display.cp437(true); // Use full 256 char 'Code Page 437' font // Not all the characters will fit on the display. This is normal. // Library will draw what it can and the rest will be clipped. for(int16_t i=0; i<256; i++) { if(i == '\n') display.write(' '); else display.write(i); } display.display(); delay(2000); } void testdrawstyles(void) { display.clearDisplay(); display.setTextSize(1); // Normal 1:1 pixel scale display.setTextColor(WHITE); // Draw white text display.setCursor(0,0); // Start at top-left corner display.println(F("Hello, world!")); display.setTextColor(BLACK, WHITE); // Draw 'inverse' text display.println(3.141592); display.setTextSize(2); // Draw 2X-scale text display.setTextColor(WHITE); display.print(F("0x")); display.println(0xDEADBEEF, HEX); display.display(); delay(2000); } void testscrolltext(void) { display.clearDisplay(); display.setTextSize(2); // Draw 2X-scale text display.setTextColor(WHITE); display.setCursor(10, 0); display.println(F("scroll")); display.display(); // Show initial text delay(100); // Scroll in various directions, pausing in-between: display.startscrollright(0x00, 0x0F); delay(2000); display.stopscroll(); delay(1000); display.startscrollleft(0x00, 0x0F); delay(2000); display.stopscroll(); delay(1000); display.startscrolldiagright(0x00, 0x07); delay(2000); display.startscrolldiagleft(0x00, 0x07); delay(2000); display.stopscroll(); delay(1000); }
[ "noreply@github.com" ]
noreply@github.com
bffc92c004602580063b259679e63fd84f50132a
2aa75176e93bc5cee6e3c66a82acf3701af56678
/c++/basic/unicode/unicode.cpp
5f61528bb643ac246fc7548983355a743d68c3e2
[]
no_license
dedowsdi/journey
5d5c11a5e2c143f031ad2d801c731c2ca381c18a
0e9f1dd34a6bb7d5c9c8225ef1595a8cfd188593
refs/heads/master
2021-06-02T00:31:44.925551
2020-10-05T06:14:08
2020-10-05T06:14:08
116,079,146
12
1
null
null
null
null
UTF-8
C++
false
false
2,883
cpp
/* * http://www.fmddlmyy.cn/text6.html * * ACCII 7 bits * extended ASCII, 0x80 to 0xff is not fixed, don't go there * UNICODE "Universal Multiple-Octet Coded Character Set",short as UCS * UCS defined how to encode, but don't care about transform and storage * UCS-2 2 bytes unicode * UCS-4 4 bytes unicode * BMP 0x0000**** * UTF UCS Transformation Format * * UCS-2 and UTF-8 * * UCS-2 UTF-8 * 0x0000-0x007f 0b0******* * 0x0080-0x07ff 0b110***** 10****** * 0x08ff-0xffff 0b1110**** 10****** 10****** * * example: * binary of 6C49 (汉) is 0110 1100 0100 1001, as 08ff < 6c49 < 0xffff, it's * three bytes in utf-8: * 11100110 10110001 10001001 * * utf-16 is exactly the same as ucs-2 in bmp * * BOM byte order mask, appears in the beginning of a string * utf16: * FEFF big endian. FEFF is some "ZERO WIDTH NO-BREAK SPACE" character which * FFFE little endian * * there has no BOM for utf8, but it can be used to describe utf8 encoding: * FF BB BF * * windows support only utf-16 * linux works well with utf-8 */ #include <iostream> #include <string> #include <bitset> #include <algorithm> #include <iomanip> // the number of characters in a multibyte string is the sum of mblen()'s // note: the simpler approach is std::mbstowcs(NULL, s.c_str(), s.size()) std::size_t strlen_mb(const std::string& s) { std::size_t result = 0; const char* ptr = s.data(); const char* end = ptr + s.size(); std::mblen(NULL, 0); // reset the conversion state while (ptr < end) { int next = std::mblen(ptr, end-ptr); if (next == -1) { throw std::runtime_error("strlen_mb(): conversion error"); } ptr += next; ++result; } return result; } void print_binary_string(const std::string& s) { std::cout << s << " : 0x"; std::for_each(s.begin(), s.end(), [](char c)->void { std::cout << std::setw(2) << std::setfill('0') << std::hex << (unsigned int)(unsigned char)c; }); std::cout << " : "; std::for_each(s.begin(), s.end(), [](char c)->void { std::bitset<8> bits(c); std::cout << bits << " "; }); std::cout << std::endl; } int main(int argc, char *argv[]) { std::string s = u8"你好啊"; std::cout << s << std::endl; // crap in windows print_binary_string("\u0081"); print_binary_string("\x4e\x07"); print_binary_string("\u4e07"); print_binary_string(u8"\u4e07"); // the same as above under ubuntu std::setlocale(LC_ALL, "en_US.utf8"); std::cout << strlen_mb(s) << std::endl; std::cout << std::mbstowcs(nullptr, s.data(), s.size()) << std::endl; std::string s1 = u8"\u4e07"; // unicode of 万 std::cout << s1 << " size :" << s1.size() << std::endl; std::u16string s2 = u"\u4e07"; std::cout << s2.size() << std::endl; std::cout << std::hex << std::endl; return 0; }
[ "peanutandchestnut@gmail.com" ]
peanutandchestnut@gmail.com
4060ad8a3488c27cda27b6b7106249aee99e7a04
5a22564b54825d51e9df5766031b9b6cc2fa85f4
/Dependencies/AndroidExtensions/Include/AndroidExtensions/JavaWrappers.h
dbd9fb314880992fe275c550806b7acfe8cdc46f
[ "MIT", "LicenseRef-scancode-nvidia-2002", "BSD-3-Clause", "LicenseRef-scancode-openssl", "LicenseRef-scancode-unicode", "NTP", "CC0-1.0", "curl", "Zlib", "NAIST-2003", "LGPL-2.1-or-later", "Artistic-2.0", "LicenseRef-scancode-unknown-license-reference", "LicenseRef-scancode-public-domain-d...
permissive
Palmer-JC/BabylonNative
d0a36168134a06b52723dc625d790e71f71a4900
d381969e728e6cedd17642ae571ffdfe1d76b2a5
refs/heads/master
2023-03-16T03:41:31.968897
2022-08-24T17:24:02
2022-08-24T17:24:02
250,812,235
0
0
MIT
2020-03-28T14:14:32
2020-03-28T14:14:31
null
UTF-8
C++
false
false
6,427
h
#pragma once #include <jni.h> #include <string> #include <vector> #include <cstddef> #include <android/asset_manager.h> #include <android/native_window.h> // -------------------- // Forward Declarations // -------------------- namespace java::lang { class ByteArray; class Object; class String; } namespace java::io { class ByteArrayOutputStream; class InputStream; } namespace java::net { class HttpURLConnection; class URL; class URLConnection; } namespace android { class ManifestPermission; } namespace android::app { class Activity; } namespace android::content { class Context; } namespace android::content::res { class AssetManager; class Resources; class Configuration; } namespace android::net { class Uri; } // ------------ // Declarations // ------------ namespace java::lang { class ByteArray { public: ByteArray(int size); ByteArray(jbyteArray byteArray); operator jbyteArray() const; operator std::vector<std::byte>() const; protected: JNIEnv* m_env; jbyteArray m_byteArray; }; class Class final { public: Class(const char* className); Class(const jclass classObj); ~Class(); Class(const Class&); Class& operator=(const Class&); Class(Class&&); Class& operator=(Class&&); operator jclass() const; bool IsAssignableFrom(Class otherClass); private: jclass JClass() const; void JClass(jclass classObj); JNIEnv* m_env; jclass m_class; }; class Object { public: operator jobject() const; Class GetClass(); ~Object(); protected: Object(const char* className); Object(jobject object); Object(const Object&); Object& operator=(const Object&); Object(Object&&); Object& operator=(Object&&); jobject JObject() const; void JObject(jobject object); JNIEnv* m_env; Class m_class; private: jobject m_object; }; class String { public: String(jstring string); String(const char* string); operator jstring() const; operator std::string() const; protected: JNIEnv* m_env; jstring m_string; }; class Throwable : public Object, public std::exception { public: Throwable(jthrowable throwable); ~Throwable(); String GetMessage() const; const char* what() const noexcept override; private: jobject m_throwableRef; std::string m_message; }; } namespace java::io { class ByteArrayOutputStream : public lang::Object { public: ByteArrayOutputStream(); ByteArrayOutputStream(int size); ByteArrayOutputStream(jobject object); void Write(lang::ByteArray b, int off, int len); lang::ByteArray ToByteArray() const; lang::String ToString(const char* charsetName) const; }; class InputStream : public lang::Object { public: InputStream(jobject object); int Read(lang::ByteArray byteArray) const; }; } namespace java::net { class HttpURLConnection : public lang::Object { public: static lang::Class Class(); HttpURLConnection(jobject object); int GetResponseCode() const; }; class URL : public lang::Object { public: URL(jobject object); URL(lang::String url); URLConnection OpenConnection(); lang::String ToString(); }; class URLConnection : public lang::Object { public: URLConnection(jobject object); void Connect(); URL GetURL() const; int GetContentLength() const; io::InputStream GetInputStream() const; explicit operator HttpURLConnection() const; }; } namespace android { class ManifestPermission { public: static jstring CAMERA(); private: static jstring getPermissionName(const char* permissionName); }; } namespace android::app { class Activity : public java::lang::Object { public: Activity(jobject object); void requestPermissions(jstring systemPermissionName, int permissionRequestID); }; } namespace android::content { class Context : public java::lang::Object { public: Context(jobject object); Context getApplicationContext(); res::AssetManager getAssets() const; res::Resources getResources(); template<typename ServiceT> ServiceT getSystemService() { return {getSystemService(ServiceT::ServiceName)}; }; jobject getSystemService(const char* serviceName); bool checkSelfPermission(jstring systemPermissionName); }; } namespace android::content::res { class AssetManager : public java::lang::Object { public: AssetManager(jobject object); operator AAssetManager*() const; }; class Resources : public java::lang::Object { public: Resources(jobject object); Configuration getConfiguration(); }; class Configuration : public java::lang::Object { public: Configuration(jobject object); int getDensityDpi(); }; } namespace android::graphics { class SurfaceTexture : public java::lang::Object { public: SurfaceTexture(); void InitWithTexture(int texture); void updateTexImage() const; }; } namespace android::view { class Display : public java::lang::Object { public: Display(jobject object); int getRotation(); }; class WindowManager : public java::lang::Object { public: static constexpr const char* ServiceName{"window"}; WindowManager(jobject object); Display getDefaultDisplay(); }; class Surface : public java::lang::Object { public: Surface(android::graphics::SurfaceTexture& surfaceTexture); }; } namespace android::net { class Uri : public java::lang::Object { public: Uri(jobject object); java::lang::String getScheme() const; java::lang::String getPath() const; static Uri Parse(java::lang::String uriString); }; }
[ "noreply@github.com" ]
noreply@github.com
329d975274f1894a753cc215afeb10fec1570dba
c4bccc5bc166736346f51445b780056a6165d0a5
/super_mario3/items.h
d882f6f3aa44044c4b3f72c2558a45845e2fc759
[]
no_license
anyr1005/super_mario3_copy
a2cc8fda152257c2a81215897b75d8df479bd736
86352b561cb86ce6933fefd67c4a24e888e79fdd
refs/heads/main
2023-08-28T00:44:26.892666
2021-10-11T02:44:47
2021-10-11T02:44:47
374,068,766
1
0
null
null
null
null
UHC
C++
false
false
3,090
h
#pragma once #include "gameNode.h" #include <vector> #define ITEMSPEED 3 //#define GRAVITY 0.1f enum ItemState { ITEM_UP, ITEM_LEFT, ITEM_RIGHT, ITEM_IDLE }; struct tagCoin { image* itemImage; //아이템 이미지 image* effectImage; //이펙트 있는 경우 이펙트 이미지 RECT rc; float x, y; // 중점 좌표 float fireX, fireY; //처음 좌표 int count; //프레임 렌더용 함수 float jumpPower; bool isStop; }; struct tagItem { image* itemImage; //아이템 이미지 RECT rc; float x, y; // 중점 좌표 float fireX, fireY; //처음 좌표 float fallSpeed; float angle; //각도 bool isRight; bool isOnGround; //땅 위에 있는지 확인 bool currentFrameY; //나뭇잎 왼쪽 오른쪽 이미지 구분 bool isLife; ItemState state; }; struct tagParticle { image* itemImage; RECT rc; float x, y; float angle; float gravity; bool isFire; int currentFrameX; int speed; int count; }; class coin : public gameNode { private: vector<tagCoin> _vCoin; vector<tagCoin>::iterator _viCoin; public: HRESULT init(); virtual void release(); virtual void update(); virtual void render(); void fire(float x, float y); void move(); vector<tagCoin> getVCoin() { return _vCoin; } vector<tagCoin>::iterator getViCoin() { return _viCoin; } }; class mushroom : public gameNode { private: vector<tagItem> _vMushroom; vector<tagItem>::iterator _viMushroom; public: HRESULT init(); virtual void release(); virtual void update(); virtual void render(); void fire(float x, float y, bool isRight, bool isLife); //x,y : 아이템 나올 장소, isRight -> 아이템이 오른쪽으로 움직일 지 왼쪽으로 움직일 지 설정 void move(); void removeMushroom(int arrNum); void setIsOnGround(int arrNum, bool b) { _vMushroom[arrNum].isOnGround = b; } void setX(int arrNum, float x) { _vMushroom[arrNum].x = x; } void setY(int arrNum, float y) { _vMushroom[arrNum].y = y; } void setState(int arrNum, ItemState s) { _vMushroom[arrNum].state = s; } vector<tagItem> getVMushroom() { return _vMushroom; } vector<tagItem>::iterator getViMushroom() { return _viMushroom; } }; class leaf : public gameNode { private: vector<tagItem> _vLeaf; vector<tagItem>::iterator _viLeaf; public: HRESULT init(); virtual void release(); virtual void update(); virtual void render(); void fire(float x, float y, bool isRight); void move(); void removeLeaf(int arrNum); void setIsOnGround(int arrNum, bool b) { _vLeaf[arrNum].isOnGround = b; } void setX(int arrNum, float x) { _vLeaf[arrNum].x = x; } void setY(int arrNum, float y) { _vLeaf[arrNum].y = y; } void setState(int arrNum, ItemState s) { _vLeaf[arrNum].state = s; } vector<tagItem> getVLeaf() { return _vLeaf; } vector<tagItem>::iterator getViLeaf() { return _viLeaf; } }; class particle : public gameNode //금색 블록 터지면 나오는 조각 { private: tagParticle _particle[2][4]; int _fireCount; public: HRESULT init(); virtual void release(); virtual void update(); virtual void render(); void fire(float x, float y); void move(); };
[ "yearinan@gmail.com" ]
yearinan@gmail.com
dbcc43fbe7fd49b255a853d9678cde222d089977
7c38be5b2a708c43ac7bd12e8a382908a56da7b1
/proj/alog/11. Container With Most Water/11. Container With Most Water.h
97f03064b48d70920890ccae75f2c999306718d8
[ "MIT" ]
permissive
andy-sheng/leetcode
408572ed16da2a126e4703ee8e329d1af861be14
1fa070036f31d0bd18a9a11a5c771641f3cd9a03
refs/heads/master
2021-12-30T09:06:20.173352
2021-12-26T17:08:23
2021-12-26T17:08:23
44,297,054
1
0
null
null
null
null
UTF-8
C++
false
false
666
h
// // 11. Container With Most Water.h // leetcode // // Created by andysheng on 2021/9/12. // Copyright © 2021 Andy. All rights reserved. // #ifndef _1__Container_With_Most_Water_h #define _1__Container_With_Most_Water_h namespace P11 { class Solution { public: int maxArea(vector<int>& height) { int i = 0, j = height.size() - 1; int ret = 0; while (i < j) { ret = max(ret, min(height[i], height[j]) * (j - i)); if (height[i] < height[j]) { ++i; } else { --j; } } return ret; } }; } #endif /* _1__Container_With_Most_Water_h */
[ "andysheng@live.com" ]
andysheng@live.com
cc8c989f25d25e9911f53e6d89377f3854c86b8b
789269144d17a5c466b86c5682cfa2df32e38912
/stanford_cs229/utils/accel_timer_upres_CSV.ino
ab3560107469a1cfc3b2ef4322af101f8096eaba
[]
no_license
rae018/stanford-cs229
d9fc310d2ae7fd37defdde47014a1ac5f580b19e
ff5f95d4e35ece7a51611bf5980f49a4869458e5
refs/heads/master
2023-01-20T17:50:30.507468
2020-11-19T02:29:44
2020-11-19T02:29:44
305,878,796
0
0
null
null
null
null
UTF-8
C++
false
false
2,339
ino
// constants describing pin allocations const int xpin = A1; // x-axis of the accelerometer const int ypin = A0; // y-axis //const int zpin = A2; // z-axis (only on 3-axis models) const int pin0 = A2; const int pin1 = A3; const int pin2 = A4; const int pin3 = A5; void setup() { Serial.begin(9600); //initialize serial communications pinMode(xpin, INPUT); pinMode(ypin, INPUT); //pinMode(zpin, INPUT); pinMode(pin0, INPUT); pinMode(pin1, INPUT); pinMode(pin2, INPUT); pinMode(pin3, INPUT); } //global variables int dataX; int dataY; int dataZ; //store data from all three axes int data1; //int data2; int data2; //store data from three muscular sensors int period = 16; //sampling period (in milliseconds) int timer = 0; //time elapsed since last sample taken //output, input tags String outputX = "X axis acceleration"; String outputY = "Y axis acceleration"; //String outputZ = "Z axis acceleration"; String input1 = "Bicep signal"; String input2 = "Shoulder signal"; String input3 = "Tricep signal"; String input0 = "Forearm signal"; bool label = true; void loop() { //Print out column headers while(label){ Serial.print(outputX); Serial.print(","); Serial.print(outputY); Serial.print(","); Serial.print(input1); Serial.print(","); Serial.print(input2); Serial.print(","); Serial.print(input3); Serial.print(","); Serial.print(input0); Serial.println(); //new line label = false; //only runs once timer = millis(); //start the timer } if (millis() - timer >= period){ //Conditional loop to enforce sampling frequency //Display data to Serial Monitor Serial.print(analogRead(xpin)); //print sensor value //Serial.print("\t"); //print tab between values Serial.print(","); //print comma between values Serial.print(analogRead(ypin)); //Serial.print("\t"); Serial.print(","); Serial.print(analogRead(pin1)); Serial.print(","); Serial.print(analogRead(pin2)); Serial.print(","); Serial.print(analogRead(pin3)); Serial.print(","); Serial.print(analogRead(pin0)); Serial.println(); //new line timer = millis(); //reset timer, to delay before taking next reading } }
[ "noreply@github.com" ]
noreply@github.com
e51897287f3747dbff9c70f472c11143ebd42938
ca9ad97d6383f5b5c57b56aff6f5b208fe1c061a
/firmware/blink-test/blink-test.ino
b48f74806d574ec8e264e723331fd77dbb9dd778
[ "Apache-2.0" ]
permissive
kallaspriit/arduino-android-bluetooth-reflow-controller
0648cc1085e8739f0114dea1519f32da22a0e5dd
df4810188aef6308e7a7e2af428670d53d2e34ab
refs/heads/master
2021-01-22T16:37:51.271821
2015-04-30T08:44:57
2015-04-30T08:44:57
17,485,816
1
1
null
null
null
null
UTF-8
C++
false
false
820
ino
/* Blink Turns on an LED on for one second, then off for one second, repeatedly. This example code is in the public domain. */ // Pin 13 has an LED connected on most Arduino boards. // Pin 11 has the LED on Teensy 2.0 // Pin 6 has the LED on Teensy++ 2.0 // Pin 13 has the LED on Teensy 3.0 // give it a name: int led = 10; // the setup routine runs once when you press reset: void setup() { // initialize the digital pin as an output. pinMode(led, OUTPUT); } // the loop routine runs over and over again forever: void loop() { digitalWrite(led, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(led, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
[ "kallaspriit@gmail.com" ]
kallaspriit@gmail.com
ccde4e6c715eaed13768893de04d8c0752686180
8a213f015fe67169e3e885ab12baf8c638d98b71
/mp_traversals/imageTraversal/BFS.cpp
3c72f7aa7374cac18bb605e6a787cc0c4a88424a
[]
no_license
mshah12/cs225-sp20
bf749bd6d84a07bbb34432e56b0d4b9811d8c299
21a949eb61eadbfe7e89c8aeea63cf3fe6322907
refs/heads/master
2022-11-19T13:30:25.461014
2020-07-20T18:06:29
2020-07-20T18:06:29
267,644,695
2
4
null
null
null
null
UTF-8
C++
false
false
1,851
cpp
#include <iterator> #include <cmath> #include <list> #include <queue> #include <stack> #include <vector> #include "../cs225/PNG.h" #include "../Point.h" #include "ImageTraversal.h" #include "BFS.h" using namespace cs225; /** * Initializes a breadth-first ImageTraversal on a given `png` image, * starting at `start`, and with a given `tolerance`. * @param png The image this BFS is going to traverse * @param start The start point of this BFS * @param tolerance If the current point is too different (difference larger than tolerance) with the start point, * it will not be included in this BFS */ BFS::BFS(const PNG & png, const Point & start, double tolerance) { /** @todo [Part 1] */ png_ = png; start_ = start; tolerance_ = tolerance; queue_.push(start); } /** * Returns an iterator for the traversal starting at the first point. */ ImageTraversal::Iterator BFS::begin() { /** @todo [Part 1] */ return ImageTraversal::Iterator(png_, start_, tolerance_, this); } /** * Returns an iterator for the traversal one past the end of the traversal. */ ImageTraversal::Iterator BFS::end() { /** @todo [Part 1] */ return ImageTraversal::Iterator(); } /** * Adds a Point for the traversal to visit at some point in the future. */ void BFS::add(const Point & point) { /** @todo [Part 1] */ queue_.push(point); } /** * Removes and returns the current Point in the traversal. */ Point BFS::pop() { /** @todo [Part 1] */ Point firstPoint = queue_.front(); queue_.pop(); return firstPoint; } /** * Returns the current Point in the traversal. */ Point BFS::peek() const { /** @todo [Part 1] */ Point firstPoint = queue_.front(); return firstPoint; } /** * Returns true if the traversal is empty. */ bool BFS::empty() const { /** @todo [Part 1] */ bool empty = queue_.empty(); return empty; }
[ "megh5000@gmail.com" ]
megh5000@gmail.com
73ff848a53ecddcc58bc3e8fb44be1d11df17cbb
8c8820fb84dea70d31c1e31dd57d295bd08dd644
/Engine/Private/SkeletalRenderStatic.cpp
090ea31d6f2d67ac4f8356b9d9f25e10fd4ffa0e
[]
no_license
redisread/UE-Runtime
e1a56df95a4591e12c0fd0e884ac6e54f69d0a57
48b9e72b1ad04458039c6ddeb7578e4fc68a7bac
refs/heads/master
2022-11-15T08:30:24.570998
2020-06-20T06:37:55
2020-06-20T06:37:55
274,085,558
3
0
null
null
null
null
UTF-8
C++
false
false
6,662
cpp
// Copyright Epic Games, Inc. All Rights Reserved. /*============================================================================= SkeletalRenderStatic.cpp: CPU skinned skeletal mesh rendering code. =============================================================================*/ #include "SkeletalRenderStatic.h" #include "EngineStats.h" #include "Components/SkeletalMeshComponent.h" #include "SceneManagement.h" #include "SkeletalRender.h" #include "Rendering/SkeletalMeshRenderData.h" FSkeletalMeshObjectStatic::FSkeletalMeshObjectStatic(USkinnedMeshComponent* InMeshComponent, FSkeletalMeshRenderData* InSkelMeshRenderData, ERHIFeatureLevel::Type InFeatureLevel) : FSkeletalMeshObject(InMeshComponent, InSkelMeshRenderData, InFeatureLevel) { // create LODs to match the base mesh for (int32 LODIndex = 0; LODIndex < InSkelMeshRenderData->LODRenderData.Num(); LODIndex++) { new(LODs) FSkeletalMeshObjectLOD(InFeatureLevel, InSkelMeshRenderData, LODIndex); } InitResources(InMeshComponent); } FSkeletalMeshObjectStatic::~FSkeletalMeshObjectStatic() { } void FSkeletalMeshObjectStatic::InitResources(USkinnedMeshComponent* InMeshComponent) { for( int32 LODIndex=0;LODIndex < LODs.Num();LODIndex++ ) { FSkeletalMeshObjectLOD& SkelLOD = LODs[LODIndex]; // Skip LODs that have their render data stripped if (SkelLOD.SkelMeshRenderData->LODRenderData[LODIndex].GetNumVertices() > 0) { FSkelMeshComponentLODInfo* CompLODInfo = nullptr; if (InMeshComponent->LODInfo.IsValidIndex(LODIndex)) { CompLODInfo = &InMeshComponent->LODInfo[LODIndex]; } SkelLOD.InitResources(CompLODInfo); } } } void FSkeletalMeshObjectStatic::ReleaseResources() { for( int32 LODIndex=0;LODIndex < LODs.Num();LODIndex++ ) { FSkeletalMeshObjectLOD& SkelLOD = LODs[LODIndex]; // Skip LODs that have their render data stripped if (SkelLOD.SkelMeshRenderData->LODRenderData[LODIndex].GetNumVertices() > 0) { SkelLOD.ReleaseResources(); } } } const FVertexFactory* FSkeletalMeshObjectStatic::GetSkinVertexFactory(const FSceneView* View, int32 LODIndex, int32 ChunkIdx) const { check(LODs.IsValidIndex(LODIndex)); return &LODs[LODIndex].VertexFactory; } TArray<FTransform>* FSkeletalMeshObjectStatic::GetComponentSpaceTransforms() const { return nullptr; } const TArray<FMatrix>& FSkeletalMeshObjectStatic::GetReferenceToLocalMatrices() const { static TArray<FMatrix> ReferenceToLocalMatrices; return ReferenceToLocalMatrices; } void FSkeletalMeshObjectStatic::FSkeletalMeshObjectLOD::InitResources(FSkelMeshComponentLODInfo* CompLODInfo) { check(SkelMeshRenderData); check(SkelMeshRenderData->LODRenderData.IsValidIndex(LODIndex)); FSkeletalMeshLODRenderData& LODData = SkelMeshRenderData->LODRenderData[LODIndex]; FPositionVertexBuffer* PositionVertexBufferPtr = &LODData.StaticVertexBuffers.PositionVertexBuffer; FStaticMeshVertexBuffer* StaticMeshVertexBufferPtr = &LODData.StaticVertexBuffers.StaticMeshVertexBuffer; // If we have a vertex color override buffer (and it's the right size) use it if (CompLODInfo && CompLODInfo->OverrideVertexColors && CompLODInfo->OverrideVertexColors->GetNumVertices() == PositionVertexBufferPtr->GetNumVertices()) { ColorVertexBuffer = CompLODInfo->OverrideVertexColors; } else { ColorVertexBuffer = &LODData.StaticVertexBuffers.ColorVertexBuffer; } FLocalVertexFactory* VertexFactoryPtr = &VertexFactory; FColorVertexBuffer* ColorVertexBufferPtr = ColorVertexBuffer; ENQUEUE_RENDER_COMMAND(InitSkeletalMeshStaticSkinVertexFactory)( [VertexFactoryPtr, PositionVertexBufferPtr, StaticMeshVertexBufferPtr, ColorVertexBufferPtr](FRHICommandListImmediate& RHICmdList) { FLocalVertexFactory::FDataType Data; PositionVertexBufferPtr->InitResource(); StaticMeshVertexBufferPtr->InitResource(); ColorVertexBufferPtr->InitResource(); PositionVertexBufferPtr->BindPositionVertexBuffer(VertexFactoryPtr, Data); StaticMeshVertexBufferPtr->BindTangentVertexBuffer(VertexFactoryPtr, Data); StaticMeshVertexBufferPtr->BindTexCoordVertexBuffer(VertexFactoryPtr, Data); ColorVertexBufferPtr->BindColorVertexBuffer(VertexFactoryPtr, Data); VertexFactoryPtr->SetData(Data); VertexFactoryPtr->InitResource(); }); #if RHI_RAYTRACING if (IsRayTracingEnabled()) { check(SkelMeshRenderData); check(SkelMeshRenderData->LODRenderData.IsValidIndex(LODIndex)); FSkeletalMeshLODRenderData& LODModel = SkelMeshRenderData->LODRenderData[LODIndex]; FVertexBufferRHIRef VertexBufferRHI = LODModel.StaticVertexBuffers.PositionVertexBuffer.VertexBufferRHI; FIndexBufferRHIRef IndexBufferRHI = LODModel.MultiSizeIndexContainer.GetIndexBuffer()->IndexBufferRHI; uint32 VertexBufferStride = LODModel.StaticVertexBuffers.PositionVertexBuffer.GetStride(); uint32 TrianglesCount = 0; for (int32 SectionIndex = 0; SectionIndex < LODModel.RenderSections.Num(); SectionIndex++) { const FSkelMeshRenderSection& Section = LODModel.RenderSections[SectionIndex]; TrianglesCount += Section.NumTriangles; } TArray<FSkelMeshRenderSection>* RenderSections = &LODModel.RenderSections; ENQUEUE_RENDER_COMMAND(InitSkeletalRenderStaticRayTracingGeometry)( [this, VertexBufferRHI, IndexBufferRHI, VertexBufferStride, TrianglesCount, RenderSections](FRHICommandListImmediate& RHICmdList) { FRayTracingGeometryInitializer Initializer; Initializer.IndexBuffer = IndexBufferRHI; Initializer.TotalPrimitiveCount = TrianglesCount; Initializer.GeometryType = RTGT_Triangles; Initializer.bFastBuild = false; TArray<FRayTracingGeometrySegment> GeometrySections; GeometrySections.Reserve(RenderSections->Num()); for (const FSkelMeshRenderSection& Section : *RenderSections) { FRayTracingGeometrySegment Segment; Segment.VertexBuffer = VertexBufferRHI; Segment.VertexBufferElementType = VET_Float3; Segment.VertexBufferOffset = 0; Segment.VertexBufferStride = VertexBufferStride; Segment.FirstPrimitive = Section.BaseIndex / 3; Segment.NumPrimitives = Section.NumTriangles; Segment.bEnabled = !Section.bDisabled; GeometrySections.Add(Segment); } Initializer.Segments = GeometrySections; RayTracingGeometry.SetInitializer(Initializer); RayTracingGeometry.InitResource(); } ); } #endif // RHI_RAYTRACING bResourcesInitialized = true; } /** * Release rendering resources for this LOD */ void FSkeletalMeshObjectStatic::FSkeletalMeshObjectLOD::ReleaseResources() { BeginReleaseResource(&VertexFactory); #if RHI_RAYTRACING BeginReleaseResource(&RayTracingGeometry); #endif // RHI_RAYTRACING bResourcesInitialized = false; }
[ "wujiahong19981022@outlook.com" ]
wujiahong19981022@outlook.com
75328bc76a693e0b88f7f8a49d9afa46cc9ec232
8f9e7d1b57b4fa28ea067d71d4b1a72763af035e
/include/GafferArnold/ArnoldRender.h
e52d22f3b64a89b327a01caee58640525b82955e
[ "BSD-3-Clause" ]
permissive
hradec/gaffer
e4e798739b45df624595c9980b8c649cea04522c
43ea3477775a4c425501f082548b67e8a1526273
refs/heads/master
2023-04-28T15:29:15.015254
2022-05-24T23:34:29
2022-05-24T23:34:29
9,508,356
0
1
BSD-3-Clause
2021-09-09T21:19:26
2013-04-17T21:52:17
Python
UTF-8
C++
false
false
2,423
h
////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2016, Image Engine Design 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 John Haddon nor the names of // any other contributors to this software 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 GAFFERARNOLD_ARNOLDRENDER_H #define GAFFERARNOLD_ARNOLDRENDER_H #include "GafferArnold/Export.h" #include "GafferArnold/TypeIds.h" #include "GafferScene/Render.h" namespace GafferArnold { class GAFFERARNOLD_API ArnoldRender : public GafferScene::Render { public : ArnoldRender( const std::string &name=defaultName<ArnoldRender>() ); ~ArnoldRender() override; GAFFER_NODE_DECLARE_TYPE( GafferArnold::ArnoldRender, ArnoldRenderTypeId, GafferScene::Render ); }; IE_CORE_DECLAREPTR( ArnoldRender ); } // namespace GafferArnold #endif // GAFFERARNOLD_ARNOLDRENDER_H
[ "thehaddonyoof@gmail.com" ]
thehaddonyoof@gmail.com
4676913043b9af3afc048e988e50ee6f427bb868
25a44ce978c53666bbe162b372298ac5eed432f4
/Uri/1048.cpp
8c6f60c86e7aa21530cffacc4c077f0846f8e17a
[]
no_license
Kanchii/Online_Judge_Problems
85304dfaf4d12516c8a511e9b9957ab59cc77a71
4bac6d7e547a01cd81d79d50ec37a93e8d915807
refs/heads/master
2021-10-19T03:17:28.285146
2018-09-09T12:53:35
2018-09-09T12:53:35
110,837,225
0
0
null
null
null
null
UTF-8
C++
false
false
856
cpp
#include <iostream> using namespace std; int main() { float salario, newSalario; int reajuste; char porcento; scanf("%f", &salario); porcento = 37; if(salario <= 400){ newSalario = salario*1.15; reajuste = 15; } else if(salario >= 400.01 && salario <= 800){ newSalario = salario*1.12; reajuste = 12; } else if(salario >= 800.01 && salario <= 1200){ newSalario = salario*1.10; reajuste = 10; } else if (salario >= 1200.01 && salario <= 2000){ newSalario = salario*1.07; reajuste = 7; } else if(salario > 2000){ newSalario = salario*1.04; reajuste = 4; } printf("Novo salario: %.2f\nReajuste ganho: %.2f\nEm percentual: %d %c\n", newSalario, (newSalario - salario), reajuste, porcento); return 0; }
[ "weisslipe@gmail.com" ]
weisslipe@gmail.com
07aad3816db495f3e8b411119c79e75b91b07d4d
7c878b1c0dbd53aa765c02b7761dd289b4d68027
/include/pronto/raster/gdal_raster_view.h
3802c4a3dbe1e9b874b5be02723813db6d41318a
[ "BSD-3-Clause", "MIT", "LicenseRef-scancode-generic-cla" ]
permissive
ahhz/raster
ce38bea753df44031e4c1f3c4ba4ee36b3baa539
9c1e633970332ecdcddf13a259731064bb40ab29
refs/heads/master
2022-08-27T02:01:34.054825
2022-08-09T11:09:58
2022-08-09T11:09:58
46,578,310
63
18
MIT
2018-02-02T16:39:36
2015-11-20T18:03:15
C++
UTF-8
C++
false
false
7,222
h
//======================================================================= // Copyright 2015 // Author: Alex Hagen-Zanker // University of Surrey // // Distributed under the MIT Licence (http://opensource.org/licenses/MIT) //======================================================================= // // This header file provides a wrapper around a GDALRasterBand that allows it // to be used by the gdal_raster_iterator (which iterates row-by-row or // column-by-column) over the rasterdata. // #pragma once #include <pronto/raster/access_type.h> #include <pronto/raster/exceptions.h> #include <pronto/raster/gdal_includes.h> #include <pronto/raster/gdal_raster_iterator.h> #include <pronto/raster/optional.h> #include <cassert> #include <cstdint> #include <memory> #include <ranges> #include <type_traits> namespace pronto { namespace raster { class gdal_raster_view_base { public: virtual int rows() const = 0; virtual int cols() const = 0; virtual int size() const = 0; virtual CPLErr get_geo_transform(double* padfTransform) const = 0; virtual std::shared_ptr<GDALRasterBand> get_band() const = 0; }; template<class T, iteration_type IterationType = iteration_type::multi_pass, access AccessType= access::read_write> class gdal_raster_view : public std::ranges::view_interface<gdal_raster_view<T, IterationType> >, public gdal_raster_view_base { private: using value_type = T; public: gdal_raster_view(std::shared_ptr<GDALRasterBand> band) : m_band(band), m_rows(band->GetYSize()), m_cols(band->GetXSize()),m_first_row(0), m_first_col(0), put(nullptr), get(nullptr) { GDALDataType datatype = m_band->GetRasterDataType(); m_stride = GDALGetDataTypeSize(datatype) / 8; // Using pointers to member functions as a means of run-time polymorphism static_assert(sizeof(float) == 4, "GDAL assumes size of float is 4 bytes"); static_assert(sizeof(double) == 8, "GDAL assumes size of double is 8 bytes"); switch (m_band->GetRasterDataType()) { case GDT_Byte: set_accessors<uint8_t >(); break; case GDT_Int16: set_accessors<int16_t >(); break; case GDT_UInt16: set_accessors<uint16_t>(); break; case GDT_Int32: set_accessors<int32_t>(); break; case GDT_UInt32: set_accessors<uint32_t>(); break; case GDT_Float32: set_accessors<float>(); break; case GDT_Float64: set_accessors<double>(); break; // Complex numbers not currently supported // //case GDT_CInt16: set_accessors<cint16_t>(); break; //case GDT_CInt32: set_accessors<cint32_t>(); break; //case GDT_CFloat32: set_accessors<cfloat32_t>(); break; //case GDT_CFloat64: set_accessors<cfloat64_t>(); break; default: break; } if (m_band->GetAccess() == GA_ReadOnly) { put = gdal_raster_view::put_nothing; } } gdal_raster_view() = default; // using the aliasing constructor seems overly complicated now. Just remove for a // deleter that does nothing? gdal_raster_view(GDALRasterBand* band) : gdal_raster_view(std::shared_ptr<GDALRasterBand>{ std::shared_ptr<GDALRasterBand>{}, band}) {}; using iterator = gdal_raster_iterator<value_type, IterationType, AccessType>; std::shared_ptr<GDALRasterBand> get_band() const { return m_band; } // friend create_standard_gdaldataset_from_model CPLErr get_geo_transform(double* padfTransform) const { CPLErr err = m_band->GetDataset()->GetGeoTransform(padfTransform); // Set this default affine transformation to be consistent with ARCGIS // For a raster with missing transformation, arcgis centers the top // left cell at (0,0). The cell-size is 1, the positive y-directions // direction is South to North. // if (err == CE_Failure) { padfTransform[0] = -0.5; padfTransform[1] = 1; padfTransform[2] = 0; padfTransform[3] = 0.5; padfTransform[4] = 0; padfTransform[5] = -1; } // Modify the transform such that is only for the sub-raster and not for // the dataset. padfTransform[0] = padfTransform[0] + padfTransform[1] * m_first_col + padfTransform[2] * m_first_row; padfTransform[3] = padfTransform[3] + padfTransform[4] * m_first_col + padfTransform[5] * m_first_row; return err; } int rows() const { return m_rows; }; int cols() const { return m_cols; }; int size() const { return rows() * cols(); }; gdal_raster_view sub_raster(int first_row, int first_col, int rows, int cols) const { gdal_raster_view out{m_band}; out.m_first_row = m_first_row + first_row; out.m_first_col = m_first_col + first_col; out.m_rows = rows; out.m_cols = cols; return out; } iterator begin() const { iterator i; i.find_begin(this); return i; } iterator end() const { iterator i; i.find_end(this); return i; } std::optional<T> get_nodata_value() const { int* check = nullptr; double value = m_band->GetNoDataValue(check); if (check) return std::optional<T>{static_cast<T>(value)}; return std::optional<T>{}; } void set_nodata_value(bool has_nodata, const T& value) const { if (has_nodata) m_band->SetNoDataValue(value); else m_band->DeleteNoDataValue(); } private: //friend class iterator; //friend class const_iterator; friend class gdal_raster_iterator<value_type, IterationType, AccessType>; template<typename U> static void put_special(const value_type& value, void* const target) { *(static_cast<U*>(target)) = static_cast<U>(value); } static void put_nothing(const value_type& value, void* const target) { assert(false); throw(writing_to_raster_failed{}); } template<typename U> static value_type get_special(const void* const source) { return static_cast<value_type>(*static_cast<const U*>(source)); } template<typename U> void set_accessors() { put = gdal_raster_view::put_special<U>; get = gdal_raster_view::get_special<U>; } // function pointers for "runtime polymorphism" based on file datatype. void(*put)(const value_type&, void* const); value_type(*get)(const void* const); // Using std::function is just a bit less efficient //std::function<void(const value_type&, void* const)> put; //std::function<value_type(const void* const)> get; unsigned char m_stride; std::shared_ptr<GDALRasterBand> m_band; int m_rows; int m_cols; int m_first_row; int m_first_col; }; } }
[ "a.hagen-zanker@surrey.ac.uk" ]
a.hagen-zanker@surrey.ac.uk
848f74d6d130242f55ced5c1f34e84dba69fe661
6109cd6d803d703afab659ef82dfe0489729e17b
/Composite_Binary_Node.cpp
a1727b0561a29597ac11071957f984d3179c7bb7
[]
no_license
hesta/design_pattern
76807307f357548489e75866d18ee54004e2efda
2ec4c99904499f7597253997e72f42dc8e5e1dbc
refs/heads/master
2021-01-10T21:33:35.505529
2014-08-17T16:40:36
2014-08-17T16:40:36
null
0
0
null
null
null
null
UTF-8
C++
false
false
579
cpp
/* -*- C++ -*- */ #if !defined (_Composite_Binary_Node_CPP) #define _Composite_Binary_Node_CPP template <typename T> Composite_Binary_Node<T>::Composite_Binary_Node (Component_Node<T> *left,Component_Node<T> *right) // You fill in here. :left_(left), Composite_Unary_Node<T>(right) { } template <typename T> Composite_Binary_Node<T>::~Composite_Binary_Node() { } // Return the left child. template <typename T> Component_Node<T> * Composite_Binary_Node<T>::left (void) const { // You fill in here. return left_.get(); } #endif /*_Composite__Binary_Node_CPP*/
[ "007hei@gmail.com" ]
007hei@gmail.com
71b586160feebcc1205c0a85d0526b5f02ee763c
8f759450fe7615e7251c1c0c44e1f3812b6f3a22
/Sandbox_Project/Sandbox_Project/RendObject.cpp
9088feeab3842c2fe41927dd3c1dad33625f8bb0
[]
no_license
nuup20/Max_IAProject
acf4d0d81032e28c9a5c963b1071fd3208772ad9
401f92395c77e2739e23bd161269fc940407e37c
refs/heads/master
2021-08-22T11:24:16.437279
2017-11-11T16:53:45
2017-11-11T16:53:45
103,217,414
0
0
null
null
null
null
UTF-8
C++
false
false
1,126
cpp
#include "stdafx.h" #include "RendObject.h" CRendObject::CRendObject(unsigned int group) : CGameObject(group) { } CRendObject::~CRendObject() { destroy(); } void CRendObject::init() { m_texture.loadFromFile("textures/default/spr_circle_01.png"); m_sprite.setTexture(m_texture); m_sprite.setColor(Color::Red); sf::FloatRect rect = m_sprite.getLocalBounds(); m_sprite.setOrigin(rect.width * 0.5f, rect.height * 0.5f); } void CRendObject::render(RenderWindow & wnd) { wnd.draw(m_sprite); } void CRendObject::update() { m_sprite.setPosition(m_position.x, m_position.y); } void CRendObject::destroy() { } void CRendObject::setSpriteDirectory(string directory) { if(!m_texture.loadFromFile(directory)) m_texture.loadFromFile("textures/default/spr_circle_01.png"); m_sprite.setTexture(m_texture, true); sf::FloatRect rect = m_sprite.getLocalBounds(); m_sprite.setOrigin(rect.width * 0.5f, rect.height * 0.5f); } void CRendObject::setColor(float r, float g, float b, float a) { m_sprite.setColor(Color(r, g, b, a)); } void CRendObject::scale(float scalation) { m_sprite.scale(scalation, scalation); }
[ "idv16a.msolano@uartesdigitales.edu.mx" ]
idv16a.msolano@uartesdigitales.edu.mx
9ac1cbdbf658f3267b42c336b55db94454725a61
c721b5e66a5d3a0a546a88d64c9f37e58842898c
/src/qt/transactiontablemodel.cpp
2bfa2a897ddcebb4224a978d853c8e87a382a96b
[ "MIT" ]
permissive
transcoincc/transcoin
35203ef36f6b7334ebc68862171afaa161787665
a3df0d9946753c838394e1e6357f7a4590c9a858
refs/heads/master
2020-05-30T23:18:52.301698
2019-06-03T14:02:41
2019-06-03T14:02:41
190,014,270
0
0
null
null
null
null
UTF-8
C++
false
false
27,638
cpp
// Copyright (c) 2011-2014 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 "transactiontablemodel.h" #include "addresstablemodel.h" #include "guiconstants.h" #include "guiutil.h" #include "optionsmodel.h" #include "transactiondesc.h" #include "transactionrecord.h" #include "walletmodel.h" #include "main.h" #include "sync.h" #include "uint256.h" #include "util.h" #include "wallet.h" #include <QColor> #include <QDateTime> #include <QDebug> #include <QIcon> #include <QList> // Amount column is right-aligned it contains numbers static int column_alignments[] = { Qt::AlignLeft | Qt::AlignVCenter, /* status */ Qt::AlignLeft | Qt::AlignVCenter, /* watchonly */ Qt::AlignLeft | Qt::AlignVCenter, /* date */ Qt::AlignLeft | Qt::AlignVCenter, /* type */ Qt::AlignLeft | Qt::AlignVCenter, /* address */ Qt::AlignRight | Qt::AlignVCenter /* amount */ }; // Comparison operator for sort/binary search of model tx list struct TxLessThan { bool operator()(const TransactionRecord& a, const TransactionRecord& b) const { return a.hash < b.hash; } bool operator()(const TransactionRecord& a, const uint256& b) const { return a.hash < b; } bool operator()(const uint256& a, const TransactionRecord& b) const { return a < b.hash; } }; // Private implementation class TransactionTablePriv { public: TransactionTablePriv(CWallet* wallet, TransactionTableModel* parent) : wallet(wallet), parent(parent) { } CWallet* wallet; TransactionTableModel* parent; /* Local cache of wallet. * As it is in the same order as the CWallet, by definition * this is sorted by sha256. */ QList<TransactionRecord> cachedWallet; /* Query entire wallet anew from core. */ void refreshWallet() { qDebug() << "TransactionTablePriv::refreshWallet"; cachedWallet.clear(); { LOCK2(cs_main, wallet->cs_wallet); for (std::map<uint256, CWalletTx>::iterator it = wallet->mapWallet.begin(); it != wallet->mapWallet.end(); ++it) { if (TransactionRecord::showTransaction(it->second)) cachedWallet.append(TransactionRecord::decomposeTransaction(wallet, it->second)); } } } /* Update our model of the wallet incrementally, to synchronize our model of the wallet with that of the core. Call with transaction that was added, removed or changed. */ void updateWallet(const uint256& hash, int status, bool showTransaction) { qDebug() << "TransactionTablePriv::updateWallet : " + QString::fromStdString(hash.ToString()) + " " + QString::number(status); // Find bounds of this transaction in model QList<TransactionRecord>::iterator lower = qLowerBound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); QList<TransactionRecord>::iterator upper = qUpperBound( cachedWallet.begin(), cachedWallet.end(), hash, TxLessThan()); int lowerIndex = (lower - cachedWallet.begin()); int upperIndex = (upper - cachedWallet.begin()); bool inModel = (lower != upper); if (status == CT_UPDATED) { if (showTransaction && !inModel) status = CT_NEW; /* Not in model, but want to show, treat as new */ if (!showTransaction && inModel) status = CT_DELETED; /* In model, but want to hide, treat as deleted */ } qDebug() << " inModel=" + QString::number(inModel) + " Index=" + QString::number(lowerIndex) + "-" + QString::number(upperIndex) + " showTransaction=" + QString::number(showTransaction) + " derivedStatus=" + QString::number(status); switch (status) { case CT_NEW: if (inModel) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is already in model"; break; } if (showTransaction) { LOCK2(cs_main, wallet->cs_wallet); // Find transaction in wallet std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash); if (mi == wallet->mapWallet.end()) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_NEW, but transaction is not in wallet"; break; } // Added -- insert at the right position QList<TransactionRecord> toInsert = TransactionRecord::decomposeTransaction(wallet, mi->second); if (!toInsert.isEmpty()) /* only if something to insert */ { parent->beginInsertRows(QModelIndex(), lowerIndex, lowerIndex + toInsert.size() - 1); int insert_idx = lowerIndex; foreach (const TransactionRecord& rec, toInsert) { cachedWallet.insert(insert_idx, rec); insert_idx += 1; } parent->endInsertRows(); } } break; case CT_DELETED: if (!inModel) { qWarning() << "TransactionTablePriv::updateWallet : Warning: Got CT_DELETED, but transaction is not in model"; break; } // Removed -- remove entire transaction from table parent->beginRemoveRows(QModelIndex(), lowerIndex, upperIndex - 1); cachedWallet.erase(lower, upper); parent->endRemoveRows(); break; case CT_UPDATED: // Miscellaneous updates -- nothing to do, status update will take care of this, and is only computed for // visible transactions. break; } } int size() { return cachedWallet.size(); } TransactionRecord* index(int idx) { if (idx >= 0 && idx < cachedWallet.size()) { TransactionRecord* rec = &cachedWallet[idx]; // Get required locks upfront. This avoids the GUI from getting // stuck if the core is holding the locks for a longer time - for // example, during a wallet rescan. // // If a status update is needed (blocks came in since last check), // update the status of this transaction from the wallet. Otherwise, // simply re-use the cached status. TRY_LOCK(cs_main, lockMain); if (lockMain) { TRY_LOCK(wallet->cs_wallet, lockWallet); if (lockWallet && rec->statusUpdateNeeded()) { std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash); if (mi != wallet->mapWallet.end()) { rec->updateStatus(mi->second); } } } return rec; } return 0; } QString describe(TransactionRecord* rec, int unit) { { LOCK2(cs_main, wallet->cs_wallet); std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(rec->hash); if (mi != wallet->mapWallet.end()) { return TransactionDesc::toHTML(wallet, mi->second, rec, unit); } } return QString(); } }; TransactionTableModel::TransactionTableModel(CWallet* wallet, WalletModel* parent) : QAbstractTableModel(parent), wallet(wallet), walletModel(parent), priv(new TransactionTablePriv(wallet, this)), fProcessingQueuedTransactions(false) { columns << QString() << QString() << tr("Date") << tr("Type") << tr("Address") << BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); priv->refreshWallet(); connect(walletModel->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit())); subscribeToCoreSignals(); } TransactionTableModel::~TransactionTableModel() { unsubscribeFromCoreSignals(); delete priv; } /** Updates the column title to "Amount (DisplayUnit)" and emits headerDataChanged() signal for table headers to react. */ void TransactionTableModel::updateAmountColumnTitle() { columns[Amount] = BitcoinUnits::getAmountColumnTitle(walletModel->getOptionsModel()->getDisplayUnit()); emit headerDataChanged(Qt::Horizontal, Amount, Amount); } void TransactionTableModel::updateTransaction(const QString& hash, int status, bool showTransaction) { uint256 updated; updated.SetHex(hash.toStdString()); priv->updateWallet(updated, status, showTransaction); } void TransactionTableModel::updateConfirmations() { // Blocks came in since last poll. // Invalidate status (number of confirmations) and (possibly) description // for all rows. Qt is smart enough to only actually request the data for the // visible rows. emit dataChanged(index(0, Status), index(priv->size() - 1, Status)); emit dataChanged(index(0, ToAddress), index(priv->size() - 1, ToAddress)); } int TransactionTableModel::rowCount(const QModelIndex& parent) const { Q_UNUSED(parent); return priv->size(); } int TransactionTableModel::columnCount(const QModelIndex& parent) const { Q_UNUSED(parent); return columns.length(); } QString TransactionTableModel::formatTxStatus(const TransactionRecord* wtx) const { QString status; switch (wtx->status.status) { case TransactionStatus::OpenUntilBlock: status = tr("Open for %n more block(s)", "", wtx->status.open_for); break; case TransactionStatus::OpenUntilDate: status = tr("Open until %1").arg(GUIUtil::dateTimeStr(wtx->status.open_for)); break; case TransactionStatus::Offline: status = tr("Offline"); break; case TransactionStatus::Unconfirmed: status = tr("Unconfirmed"); break; case TransactionStatus::Confirming: status = tr("Confirming (%1 of %2 recommended confirmations)").arg(wtx->status.depth).arg(TransactionRecord::RecommendedNumConfirmations); break; case TransactionStatus::Confirmed: status = tr("Confirmed (%1 confirmations)").arg(wtx->status.depth); break; case TransactionStatus::Conflicted: status = tr("Conflicted"); break; case TransactionStatus::Immature: status = tr("Immature (%1 confirmations, will be available after %2)").arg(wtx->status.depth).arg(wtx->status.depth + wtx->status.matures_in); break; case TransactionStatus::MaturesWarning: status = tr("This block was not received by any other nodes and will probably not be accepted!"); break; case TransactionStatus::NotAccepted: status = tr("Orphan Block - Generated but not accepted. This does not impact your holdings."); break; } return status; } QString TransactionTableModel::formatTxDate(const TransactionRecord* wtx) const { if (wtx->time) { return GUIUtil::dateTimeStr(wtx->time); } return QString(); } /* Look up address in address book, if found return label (address) otherwise just return (address) */ QString TransactionTableModel::lookupAddress(const std::string& address, bool tooltip) const { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(address)); QString description; if (!label.isEmpty()) { description += label; } if (label.isEmpty() || tooltip) { description += QString(" (") + QString::fromStdString(address) + QString(")"); } return description; } QString TransactionTableModel::formatTxType(const TransactionRecord* wtx) const { switch (wtx->type) { case TransactionRecord::RecvWithAddress: return tr("Received with"); case TransactionRecord::MNReward: return tr("Masternode Reward"); case TransactionRecord::RecvFromOther: return tr("Received from"); case TransactionRecord::RecvWithObfuscation: return tr("Received via Obfuscation"); case TransactionRecord::SendToAddress: case TransactionRecord::SendToOther: return tr("Sent to"); case TransactionRecord::SendToSelf: return tr("Payment to yourself"); case TransactionRecord::StakeMint: return tr("Minted"); case TransactionRecord::Generated: return tr("Mined"); case TransactionRecord::ObfuscationDenominate: return tr("Obfuscation Denominate"); case TransactionRecord::ObfuscationCollateralPayment: return tr("Obfuscation Collateral Payment"); case TransactionRecord::ObfuscationMakeCollaterals: return tr("Obfuscation Make Collateral Inputs"); case TransactionRecord::ObfuscationCreateDenominations: return tr("Obfuscation Create Denominations"); case TransactionRecord::Obfuscated: return tr("Obfuscated"); case TransactionRecord::ZerocoinMint: return tr("Converted TransCoin to zTransCoin"); case TransactionRecord::ZerocoinSpend: return tr("Spent zTransCoin"); case TransactionRecord::RecvFromZerocoinSpend: return tr("Received TransCoin from zTransCoin"); case TransactionRecord::ZerocoinSpend_Change_zTransCoin: return tr("Minted Change as zTransCoin from zTransCoin Spend"); case TransactionRecord::ZerocoinSpend_FromMe: return tr("Converted zTransCoin to TransCoin"); default: return QString(); } } QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord* wtx) const { switch (wtx->type) { case TransactionRecord::Generated: case TransactionRecord::StakeMint: case TransactionRecord::MNReward: return QIcon(":/icons/tx_mined"); case TransactionRecord::RecvWithObfuscation: case TransactionRecord::RecvWithAddress: case TransactionRecord::RecvFromOther: case TransactionRecord::RecvFromZerocoinSpend: return QIcon(":/icons/tx_input"); case TransactionRecord::SendToAddress: case TransactionRecord::SendToOther: case TransactionRecord::ZerocoinSpend: return QIcon(":/icons/tx_output"); default: return QIcon(":/icons/tx_inout"); } } QString TransactionTableModel::formatTxToAddress(const TransactionRecord* wtx, bool tooltip) const { QString watchAddress; if (tooltip) { // Mark transactions involving watch-only addresses by adding " (watch-only)" watchAddress = wtx->involvesWatchAddress ? QString(" (") + tr("watch-only") + QString(")") : ""; } switch (wtx->type) { case TransactionRecord::RecvFromOther: return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::RecvWithAddress: case TransactionRecord::MNReward: case TransactionRecord::RecvWithObfuscation: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: case TransactionRecord::StakeMint: case TransactionRecord::ZerocoinSpend: case TransactionRecord::ZerocoinSpend_FromMe: case TransactionRecord::RecvFromZerocoinSpend: return lookupAddress(wtx->address, tooltip); case TransactionRecord::Obfuscated: return lookupAddress(wtx->address, tooltip) + watchAddress; case TransactionRecord::SendToOther: return QString::fromStdString(wtx->address) + watchAddress; case TransactionRecord::ZerocoinMint: case TransactionRecord::ZerocoinSpend_Change_zTransCoin: return tr("zTransCoin Accumulator"); case TransactionRecord::SendToSelf: default: return tr("(n/a)") + watchAddress; } } QVariant TransactionTableModel::addressColor(const TransactionRecord* wtx) const { switch (wtx->type) { case TransactionRecord::SendToSelf: return COLOR_BAREADDRESS; // Show addresses without label in a less visible color case TransactionRecord::RecvWithAddress: case TransactionRecord::SendToAddress: case TransactionRecord::Generated: case TransactionRecord::MNReward: { QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address)); if (label.isEmpty()) return COLOR_BAREADDRESS; } default: // To avoid overriding above conditional formats a default text color for this QTableView is not defined in stylesheet, // so we must always return a color here return COLOR_BLACK; } } QString TransactionTableModel::formatTxAmount(const TransactionRecord* wtx, bool showUnconfirmed, BitcoinUnits::SeparatorStyle separators) const { QString str = BitcoinUnits::format(walletModel->getOptionsModel()->getDisplayUnit(), wtx->credit + wtx->debit, false, separators); if (showUnconfirmed) { if (!wtx->status.countsForBalance) { str = QString("[") + str + QString("]"); } } return QString(str); } QVariant TransactionTableModel::txStatusDecoration(const TransactionRecord* wtx) const { switch (wtx->status.status) { case TransactionStatus::OpenUntilBlock: case TransactionStatus::OpenUntilDate: return COLOR_TX_STATUS_OPENUNTILDATE; case TransactionStatus::Offline: return COLOR_TX_STATUS_OFFLINE; case TransactionStatus::Unconfirmed: return QIcon(":/icons/transaction_0"); case TransactionStatus::Confirming: switch (wtx->status.depth) { case 1: return QIcon(":/icons/transaction_1"); case 2: return QIcon(":/icons/transaction_2"); case 3: return QIcon(":/icons/transaction_3"); case 4: return QIcon(":/icons/transaction_4"); default: return QIcon(":/icons/transaction_5"); }; case TransactionStatus::Confirmed: return QIcon(":/icons/transaction_confirmed"); case TransactionStatus::Conflicted: return QIcon(":/icons/transaction_conflicted"); case TransactionStatus::Immature: { int total = wtx->status.depth + wtx->status.matures_in; int part = (wtx->status.depth * 4 / total) + 1; return QIcon(QString(":/icons/transaction_%1").arg(part)); } case TransactionStatus::MaturesWarning: case TransactionStatus::NotAccepted: return QIcon(":/icons/transaction_0"); default: return COLOR_BLACK; } } QVariant TransactionTableModel::txWatchonlyDecoration(const TransactionRecord* wtx) const { if (wtx->involvesWatchAddress) return QIcon(":/icons/eye"); else return QVariant(); } QString TransactionTableModel::formatTooltip(const TransactionRecord* rec) const { QString tooltip = formatTxStatus(rec) + QString("\n") + formatTxType(rec); if (rec->type == TransactionRecord::RecvFromOther || rec->type == TransactionRecord::SendToOther || rec->type == TransactionRecord::SendToAddress || rec->type == TransactionRecord::RecvWithAddress || rec->type == TransactionRecord::MNReward) { tooltip += QString(" ") + formatTxToAddress(rec, true); } return tooltip; } QVariant TransactionTableModel::data(const QModelIndex& index, int role) const { if (!index.isValid()) return QVariant(); TransactionRecord* rec = static_cast<TransactionRecord*>(index.internalPointer()); switch (role) { case Qt::DecorationRole: switch (index.column()) { case Status: return txStatusDecoration(rec); case Watchonly: return txWatchonlyDecoration(rec); case ToAddress: return txAddressDecoration(rec); } break; case Qt::DisplayRole: switch (index.column()) { case Date: return formatTxDate(rec); case Type: return formatTxType(rec); case ToAddress: return formatTxToAddress(rec, false); case Amount: return formatTxAmount(rec, true, BitcoinUnits::separatorAlways); } break; case Qt::EditRole: // Edit role is used for sorting, so return the unformatted values switch (index.column()) { case Status: return QString::fromStdString(rec->status.sortKey); case Date: return rec->time; case Type: return formatTxType(rec); case Watchonly: return (rec->involvesWatchAddress ? 1 : 0); case ToAddress: return formatTxToAddress(rec, true); case Amount: return qint64(rec->credit + rec->debit); } break; case Qt::ToolTipRole: return formatTooltip(rec); case Qt::TextAlignmentRole: return column_alignments[index.column()]; case Qt::ForegroundRole: // Non-confirmed (but not immature) as transactions are grey if (!rec->status.countsForBalance && rec->status.status != TransactionStatus::Immature) { return COLOR_UNCONFIRMED; } if (index.column() == Amount && (rec->credit + rec->debit) < 0) { return COLOR_NEGATIVE; } if (index.column() == ToAddress) { return addressColor(rec); } // To avoid overriding above conditional formats a default text color for this QTableView is not defined in stylesheet, // so we must always return a color here return COLOR_BLACK; case TypeRole: return rec->type; case DateRole: return QDateTime::fromTime_t(static_cast<uint>(rec->time)); case WatchonlyRole: return rec->involvesWatchAddress; case WatchonlyDecorationRole: return txWatchonlyDecoration(rec); case LongDescriptionRole: return priv->describe(rec, walletModel->getOptionsModel()->getDisplayUnit()); case AddressRole: return QString::fromStdString(rec->address); case LabelRole: return walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(rec->address)); case AmountRole: return qint64(rec->credit + rec->debit); case TxIDRole: return rec->getTxID(); case TxHashRole: return QString::fromStdString(rec->hash.ToString()); case ConfirmedRole: return rec->status.countsForBalance; case FormattedAmountRole: // Used for copy/export, so don't include separators return formatTxAmount(rec, false, BitcoinUnits::separatorNever); case StatusRole: return rec->status.status; } return QVariant(); } QVariant TransactionTableModel::headerData(int section, Qt::Orientation orientation, int role) const { if (orientation == Qt::Horizontal) { if (role == Qt::DisplayRole) { return columns[section]; } else if (role == Qt::TextAlignmentRole) { return column_alignments[section]; } else if (role == Qt::ToolTipRole) { switch (section) { case Status: return tr("Transaction status. Hover over this field to show number of confirmations."); case Date: return tr("Date and time that the transaction was received."); case Type: return tr("Type of transaction."); case Watchonly: return tr("Whether or not a watch-only address is involved in this transaction."); case ToAddress: return tr("Destination address of transaction."); case Amount: return tr("Amount removed from or added to balance."); } } } return QVariant(); } QModelIndex TransactionTableModel::index(int row, int column, const QModelIndex& parent) const { Q_UNUSED(parent); TransactionRecord* data = priv->index(row); if (data) { return createIndex(row, column, priv->index(row)); } return QModelIndex(); } void TransactionTableModel::updateDisplayUnit() { // emit dataChanged to update Amount column with the current unit updateAmountColumnTitle(); emit dataChanged(index(0, Amount), index(priv->size() - 1, Amount)); } // queue notifications to show a non freezing progress dialog e.g. for rescan struct TransactionNotification { public: TransactionNotification() {} TransactionNotification(uint256 hash, ChangeType status, bool showTransaction) : hash(hash), status(status), showTransaction(showTransaction) {} void invoke(QObject* ttm) { QString strHash = QString::fromStdString(hash.GetHex()); qDebug() << "NotifyTransactionChanged : " + strHash + " status= " + QString::number(status); QMetaObject::invokeMethod(ttm, "updateTransaction", Qt::QueuedConnection, Q_ARG(QString, strHash), Q_ARG(int, status), Q_ARG(bool, showTransaction)); } private: uint256 hash; ChangeType status; bool showTransaction; }; static bool fQueueNotifications = false; static std::vector<TransactionNotification> vQueueNotifications; static void NotifyTransactionChanged(TransactionTableModel* ttm, CWallet* wallet, const uint256& hash, ChangeType status) { // Find transaction in wallet std::map<uint256, CWalletTx>::iterator mi = wallet->mapWallet.find(hash); // Determine whether to show transaction or not (determine this here so that no relocking is needed in GUI thread) bool inWallet = mi != wallet->mapWallet.end(); bool showTransaction = (inWallet && TransactionRecord::showTransaction(mi->second)); TransactionNotification notification(hash, status, showTransaction); if (fQueueNotifications) { vQueueNotifications.push_back(notification); return; } notification.invoke(ttm); } static void ShowProgress(TransactionTableModel* ttm, const std::string& title, int nProgress) { if (nProgress == 0) fQueueNotifications = true; if (nProgress == 100) { fQueueNotifications = false; if (vQueueNotifications.size() > 10) // prevent balloon spam, show maximum 10 balloons QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, true)); for (unsigned int i = 0; i < vQueueNotifications.size(); ++i) { if (vQueueNotifications.size() - i <= 10) QMetaObject::invokeMethod(ttm, "setProcessingQueuedTransactions", Qt::QueuedConnection, Q_ARG(bool, false)); vQueueNotifications[i].invoke(ttm); } std::vector<TransactionNotification>().swap(vQueueNotifications); // clear } } void TransactionTableModel::subscribeToCoreSignals() { // Connect signals to wallet wallet->NotifyTransactionChanged.connect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.connect(boost::bind(ShowProgress, this, _1, _2)); } void TransactionTableModel::unsubscribeFromCoreSignals() { // Disconnect signals from wallet wallet->NotifyTransactionChanged.disconnect(boost::bind(NotifyTransactionChanged, this, _1, _2, _3)); wallet->ShowProgress.disconnect(boost::bind(ShowProgress, this, _1, _2)); }
[ "admin@transcoin.cc" ]
admin@transcoin.cc
507102cd468b686b761ea8a4dcfb5a3824423a4a
a75723c142d67d852be573c125dea9e4eda10de4
/HouseEditor.cpp
b5fcd84e59e027c745401e3e94aae2b4f592a891
[]
no_license
EugeneLN/Dissertation
d53ac1a67274be50866b7442c82622571c40b645
2c90189c7123ff6225bee638f3530a8606e296bd
refs/heads/main
2023-05-26T17:49:52.898211
2021-06-17T04:45:51
2021-06-17T04:45:51
375,339,998
0
0
null
null
null
null
UTF-8
C++
false
false
35,004
cpp
// Fill out your copyright notice in the Description page of Project Settings. #include "HouseEditor/HouseEditor.h" #include "HouseEditor/HouseEditorFunctionLibrary.h" #include "HouseEditor/BaseFireLadder.h" #include "HouseEditor/BaseQuoin.h" #include "HouseEditor/BasePilaster.h" #include "HouseEditor/BaseCornice.h" #include "HouseEditor/BaseRoof.h" #include "SegmentEditor/BaseSegment.h" #include "SegmentEditor/BaseSegmentDecoration.h" #include "EdgeHouseConstructor/EdgeHouseConstructorSettings.h" #include "RuntimeMesh/EDGEMeshUtility.h" #include "MeshMergeModule.h" #include "AssetRegistry/AssetRegistryModule.h" #include "Engine/Selection.h" #include "Components/SceneComponent.h" #include "Kismet/KismetSystemLibrary.h" #include "RuntimeMesh/RMCProviderManager.h" #include "UObject/UObjectGlobals.h" AHouseEditor::AHouseEditor() { PrimaryActorTick.bCanEverTick = false; Walls.SetNum(4); TemplateLocal.WallPatterns.SetNum(4); TemplateLocal.FireLadderRates.SetNum(4); TemplateLocal.FireLadderOffsets.SetNum(4); TemplateLocal.PilasterRates.SetNum(4); TemplateLocal.PilasterOffsets.SetNum(4); TemplateLocal.HouseLength = 1; TemplateLocal.HouseWidth = 1; TemplateLocal.HouseHeight = 1; bFirstConstruction = true; DefaultRoofClass = GetDefault<UEdgeHouseConstructorSettings>()->DefaultRoofClass; DefaultWallMat = Cast<UMaterialInterface>(GetDefault<UEdgeHouseConstructorSettings>()->DefaultWallMaterial.ResolveObject()); // Temp default values FillDecorationsWithDefaults(TemplateLocal.GlobalDecorationWeights); BaseRoot = CreateDefaultSubobject<USceneComponent>(FName("Root")); RootComponent = BaseRoot; HouseNavCollider = CreateDefaultSubobject<UBoxComponent>(FName("House Navigation Collider")); HouseNavCollider->SetCollisionProfileName("HouseNav"); HouseNavCollider->SetCanEverAffectNavigation(true); HouseNavCollider->InitBoxExtent(FVector(0.f)); HouseNavCollider->SetupAttachment(BaseRoot); } void AHouseEditor::OnConstruction(const FTransform& Transform) { Super::OnConstruction(Transform); if (RuntimeMeshComponent == nullptr) { RuntimeMeshComponent = NewObject<URuntimeMeshComponent>(this, URuntimeMeshComponent::StaticClass(), NAME_None); RuntimeMeshComponent->CreationMethod = EComponentCreationMethod::Native; RuntimeMeshComponent->SetCanEverAffectNavigation(false); RuntimeMeshComponent->RegisterComponent(); RuntimeMeshComponent->AttachToComponent(BaseRoot, FAttachmentTransformRules::SnapToTargetIncludingScale); bFirstConstruction = true; } if (bFirstConstruction) { bFirstConstruction = false; RMCProvider = NewObject<UEDGERuntimeMeshProvider>(this); if (ReadTemplate()) { // --- New mesh merging if (!GetRMCProvider()->HaveMeshData()) { //if (!(IsInGameThread() || IsAsyncLoading())) { GenerateMeshData(); ClearHouse(); } } // --- } // KOSTYL. remove links to elements that are not attached - possible when copying editor BP with them if (RoofActor != nullptr) { if (RoofActor->GetAttachParentActor() != this) { AllSegments.Empty(); AllCustoms.Empty(); RoofActor = nullptr; } } // --- Old mesh merging // if (TemplateLocal.MergedMesh != nullptr && SavedHouseMeshComponent == nullptr) // { // ConstructMergedMeshComponent(); // } // --- } if (RMCProvider != nullptr) { if (GetRMCProvider()->HaveMeshData() && AllSegments.Num() == 0) { GetRuntimeMeshComponent()->Initialize(GetRMCProvider()); } } else { RMCProvider = NewObject<UEDGERuntimeMeshProvider>(this); } } void AHouseEditor::ClearHouse(bool bRemoveInstanceMeshes) { if (SavedHouseMeshComponent != nullptr) { SavedHouseMeshComponent->DestroyComponent(); } GetRuntimeMeshComponent()->SetRuntimeMesh(nullptr); while (AllCustoms.Num() > 0) { AActor* Element = AllCustoms.Pop(); if (Element != nullptr) { Element->Destroy(); } } while (AllSegments.Num() > 0) { AActor* Element = AllSegments.Pop(); if (Element != nullptr) { TArray<AActor*> Decorations; Element->GetAttachedActors(Decorations); for (AActor* Actor : Decorations) { Actor->Destroy(); } Element->Destroy(); } } while (WallAnchors.Num() > 0) { USceneComponent* Element = WallAnchors.Pop(); if (Element != nullptr) { Element->DestroyComponent(); } } if (RoofActor != nullptr) { RoofActor->Destroy(); } if (bRemoveInstanceMeshes) { while (InstancedElements.Num() > 0) { InstancedElements.Pop()->DestroyComponent(); } } } bool AHouseEditor::BuildHouse() { ClearHouse(); // works for now - cause using only "box"-houses, must be reworked later for (int i = 0; i < 4; i++) { FVector CompRelLoc; switch (i) { case 0: CompRelLoc = FVector(0); break; case 1: CompRelLoc = FVector(SegmentWidthInUnits * TemplateLocal.HouseLength, 0, 0); break; case 2: CompRelLoc = FVector(SegmentWidthInUnits * TemplateLocal.HouseLength, SegmentWidthInUnits * -TemplateLocal.HouseWidth, 0); break; case 3: CompRelLoc = FVector(0, SegmentWidthInUnits * -TemplateLocal.HouseWidth, 0); break; default: break; } FName CompName = *FString::Printf(TEXT("Anchor_%i"), i); USceneComponent* NewComp = NewObject<USceneComponent>(this, USceneComponent::StaticClass(), CompName); NewComp->CreationMethod = EComponentCreationMethod::Instance; NewComp->SetupAttachment(RootComponent); NewComp->SetRelativeLocationAndRotation(CompRelLoc, FRotator(0, i * -90, 0)); NewComp->RegisterComponent(); WallAnchors.Add(NewComp); } // Random preparations (for decorations) if (TemplateLocal.RandomSeed <= 0) { TemplateLocal.RandomSeed = abs(rand()); } srand(1); // Reset any previous calls srand(static_cast<unsigned>(TemplateLocal.RandomSeed)); // MMMM????? // Walls UDataTable* PatternDataTable = UHouseEditorFunctionLibrary::GetPatternDataTable(); if (PatternDataTable == NULL) { UE_LOG(LogTemp, Warning, TEXT("Data table is not valid. Can't build house. Construction aborted.")); return false; } for (int WallIndex = 0; WallIndex < Walls.Num(); WallIndex++) { FPatternData* Data = PatternDataTable->FindRow<FPatternData>(TemplateLocal.WallPatterns[WallIndex], FString()); if (Data == NULL) { UE_LOG(LogTemp, Warning, TEXT("Wall pattern #%i - '%s' was not found. Construction aborted."), WallIndex, *TemplateLocal.WallPatterns[WallIndex].ToString()); ClearHouse(); return false; } Walls[WallIndex] = *Data; int WallLength = (WallIndex % 2 == 0) ? TemplateLocal.HouseLength : TemplateLocal.HouseWidth; // works for now - couse using only "box"-houses // FireLadders TArray<int> LaddersHIndexes; if (TemplateLocal.HouseHeight > 1 && TemplateLocal.FireLadderClass != NULL && TemplateLocal.FireLadderRates[WallIndex] > 0 && WallLength >= 4) { ABaseFireLadder* NewLadder; if (TemplateLocal.FireLadderRates[WallIndex] == 1) { int SegmentIndex = FMath::Clamp(TemplateLocal.FireLadderOffsets[WallIndex], 0, WallLength - 4); NewLadder = GetWorld()->SpawnActorDeferred<ABaseFireLadder>(TemplateLocal.FireLadderClass, FTransform(), this); NewLadder->ladderHeight = TemplateLocal.HouseHeight - 1; NewLadder->FinishSpawning(FTransform(FVector(SegmentWidthInUnits * (1 + SegmentIndex), 0, GetRealHeight()))); NewLadder->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewLadder); LaddersHIndexes.Add(SegmentIndex+1); LaddersHIndexes.Add(SegmentIndex+2); } else { for (int SegmentIndex = 1; SegmentIndex < WallLength - 2; SegmentIndex++) { if ((SegmentIndex - TemplateLocal.FireLadderOffsets[WallIndex]) % TemplateLocal.FireLadderRates[WallIndex] == 0) { NewLadder = GetWorld()->SpawnActorDeferred<ABaseFireLadder>(TemplateLocal.FireLadderClass, FTransform(), this); NewLadder->ladderHeight = TemplateLocal.HouseHeight - 1; NewLadder->FinishSpawning(FTransform(FVector(SegmentWidthInUnits * SegmentIndex, 0, GetRealHeight()))); NewLadder->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewLadder); LaddersHIndexes.Add(SegmentIndex); LaddersHIndexes.Add(SegmentIndex+1); } } } } // Segments for (int vi = 0; vi < TemplateLocal.HouseHeight; vi++) { int OffsetH = 0; int LineIndex; if (Data->bRepeatPattern) { LineIndex = vi % Walls[WallIndex].Lines.Num(); } else { LineIndex = (vi < Walls[WallIndex].Lines.Num()) ? vi : Walls[WallIndex].Lines.Num() - 1; } FPatternLine Line = Walls[WallIndex].Lines[LineIndex]; for (int hi = 0; hi + OffsetH < WallLength; hi++) { int SegmentHIndex; if (Line.bRepeatLine) { SegmentHIndex = hi % Line.Segments.Num(); } else { SegmentHIndex = (hi < Line.Segments.Num()) ? hi : Line.Segments.Num() - 1; } ABaseSegment* NewActor = GetWorld()->SpawnActor<ABaseSegment>(UHouseEditorFunctionLibrary::GetSegmentClassByFName(Line.Segments[SegmentHIndex].SegmentName), FVector(SegmentWidthInUnits * (hi + OffsetH), 0, GetRealHeight(vi)), FRotator(0)); if (NewActor == NULL) { UE_LOG(LogTemp, Warning, TEXT("Actor was not created - aborting construction.")); ClearHouse(); return false; } NewActor->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); //TArray<TEnumAsByte<EMaterialSlot>> keys; //materialOverrides.GetKeys(keys); //for (int i = 0; i < keys.Num(); i++) { // newActor->SetMaterialByName(keys[i], materialOverrides[keys[i]]); //} // temp single mat override ^ if (TemplateLocal.WallMatOverride != nullptr) { NewActor->SetMaterialByName(Wall, TemplateLocal.WallMatOverride); } AllSegments.Add(NewActor); // Segment decorations if (LaddersHIndexes.Contains(hi + OffsetH) == false || vi == 0) { TArray<USceneComponent*> Sockets = NewActor->GetDecorationSockets(); if (Sockets.Num() > 0) { for (USceneComponent* Socket : Sockets) { float RValue = static_cast<float>(rand()) / static_cast<float>(RAND_MAX); float Threshold = 0.f; TMap<FName, float> WeightsMap; if (vi == 0 && TemplateLocal.bGlobalDecorationsIgnoreGroundFloor) { const FSegmentDecorationsData EmptyData; WeightsMap = UHouseEditorFunctionLibrary::GetNormalizedDecorationWeights(Line.Segments[SegmentHIndex], Socket->GetFName(), EmptyData); } else { WeightsMap = UHouseEditorFunctionLibrary::GetNormalizedDecorationWeights(Line.Segments[SegmentHIndex], Socket->GetFName(), TemplateLocal.GlobalDecorationWeights[WallIndex]); } TSubclassOf<ABaseSegmentDecoration> DecorationClass; TArray<FName> Names; WeightsMap.GenerateKeyArray(Names); for (FName Name : Names) { Threshold += WeightsMap.FindRef(Name); if (RValue <= Threshold) { DecorationClass = UHouseEditorFunctionLibrary::GetSegmentDecorationClassByFName(Name); break; } } if (DecorationClass != NULL) { ABaseSegmentDecoration* NewDecoration = GetWorld()->SpawnActor<ABaseSegmentDecoration>(DecorationClass, FVector(0.f), FRotator(0.f)); if (NewDecoration == NULL) { UE_LOG(LogTemp, Warning, TEXT("Decoration was not created! Process continued...")); } NewDecoration->AttachToComponent(Socket, FAttachmentTransformRules::KeepRelativeTransform); } } } } OffsetH += NewActor->GetSegmentSize() - 1; } } // Quoins if (TemplateLocal.QuoinClass != NULL) { ABaseQuoin* NewQuoin = GetWorld()->SpawnActorDeferred<ABaseQuoin>(TemplateLocal.QuoinClass, FTransform(), this); NewQuoin->quoinHeight = TemplateLocal.HouseHeight; if (TemplateLocal.BottomCorniceClass != NULL) { NewQuoin->corniceOffset = CorniceHeightOffset; } NewQuoin->FinishSpawning(FTransform()); NewQuoin->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewQuoin); } // Pilasters if (TemplateLocal.PilasterClass != NULL && TemplateLocal.PilasterRates[WallIndex] > 0) { for (int SegmentNum = 1; SegmentNum < WallLength; SegmentNum++) { if ((SegmentNum - TemplateLocal.PilasterOffsets[WallIndex]) % TemplateLocal.PilasterRates[WallIndex] == 0) { ABasePilaster* NewPilaster = GetWorld()->SpawnActorDeferred<ABasePilaster>(TemplateLocal.PilasterClass, FTransform(), this); NewPilaster->pilasterHeight = (TemplateLocal.bPilasterIgnoreGroundFloor) ? TemplateLocal.HouseHeight - 1 : TemplateLocal.HouseHeight; if (TemplateLocal.BottomCorniceClass != NULL && !TemplateLocal.bPilasterIgnoreGroundFloor) { NewPilaster->corniceOffset = CorniceHeightOffset; } NewPilaster->FinishSpawning(FTransform(FVector(SegmentWidthInUnits * SegmentNum, 0, (TemplateLocal.bPilasterIgnoreGroundFloor) ? GetRealHeight() : 0))); NewPilaster->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewPilaster); } } } // Cornices if (TemplateLocal.BottomCorniceClass != NULL) { ABaseCornice* NewCornice = GetWorld()->SpawnActorDeferred<ABaseCornice>(TemplateLocal.BottomCorniceClass, FTransform(), this); NewCornice->corniceLength = WallLength; NewCornice->FinishSpawning(FTransform(FVector(0, 0, SegmentHeightInUnits))); NewCornice->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewCornice); } if (TemplateLocal.TopCorniceClass != NULL) { ABaseCornice* NewCornice = GetWorld()->SpawnActorDeferred<ABaseCornice>(TemplateLocal.TopCorniceClass, FTransform(), this); NewCornice->corniceLength = WallLength; NewCornice->FinishSpawning(FTransform(FVector(0, 0, GetRealHeight(TemplateLocal.HouseHeight)))); NewCornice->AttachToComponent(WallAnchors[WallIndex], FAttachmentTransformRules::KeepRelativeTransform); AllCustoms.Add(NewCornice); } } // Roof if (TemplateLocal.RoofClass == nullptr) { if (DefaultRoofClass == nullptr) { UE_LOG(LogTemp, Warning, TEXT("No Default Room Class found. Please check Edge House Constructor plugin settings.")) } TemplateLocal.RoofClass = DefaultRoofClass; } float ExtraHeight = (TemplateLocal.TopCorniceClass != NULL) ? CorniceHeightOffset - 0.3f : 0; RoofActor = GetWorld()->SpawnActorDeferred<ABaseRoof>(TemplateLocal.RoofClass, FTransform(), this); RoofActor->RoofLength = TemplateLocal.HouseLength; RoofActor->RoofWidth = TemplateLocal.HouseWidth; RoofActor->FinishSpawning(FTransform(FVector(0, 0, GetRealHeight(TemplateLocal.HouseHeight) + ExtraHeight))); RoofActor->AttachToComponent(WallAnchors[0], FAttachmentTransformRules::KeepRelativeTransform); if (TemplateLocal.WallMatOverride != nullptr) { RoofActor->SetMaterialByName(Wall, TemplateLocal.WallMatOverride ); } return true; } bool AHouseEditor::ReadTemplate() { if (HouseTemplateName != NAME_None) { UDataTable* HouseTemplateTable = UHouseEditorFunctionLibrary::GetHouseParamsTemplateDataTable(); if (HouseTemplateTable == nullptr) { UE_LOG(LogTemp, Warning, TEXT("No House Params Template Data Table availavle. Aborting parameters transfer.")) return false; } FHouseParamsTemplate* MainTemplate = HouseTemplateTable->FindRow<FHouseParamsTemplate>(HouseTemplateName, FString()); if (MainTemplate == nullptr) { UE_LOG(LogTemp, Warning, TEXT("Aborting parameters transfer.")) return false; } TemplateLocal.HouseHeight = (TemplateOverride.bOverHouseHeight) ? TemplateOverride.HouseHeight : MainTemplate->HouseHeight; TemplateLocal.HouseLength = (TemplateOverride.bOverHouseLength) ? TemplateOverride.HouseLength : MainTemplate->HouseLength; TemplateLocal.HouseWidth = (TemplateOverride.bOverHouseWidth) ? TemplateOverride.HouseWidth : MainTemplate->HouseWidth; TemplateLocal.PilasterClass = (TemplateOverride.bOverPilasterClass) ? TemplateOverride.PilasterClass : MainTemplate->PilasterClass; TemplateLocal.PilasterOffsets = (TemplateOverride.bOverPilasterOffsets) ? TemplateOverride.PilasterOffsets : MainTemplate->PilasterOffsets; TemplateLocal.PilasterRates = (TemplateOverride.bOverPilasterRates) ? TemplateOverride.PilasterRates : MainTemplate->PilasterRates; TemplateLocal.QuoinClass = (TemplateOverride.bOverQuoinClass) ? TemplateOverride.QuoinClass : MainTemplate->QuoinClass; TemplateLocal.RoofClass = (TemplateOverride.bOverRoofClass) ? TemplateOverride.RoofClass : MainTemplate->RoofClass; TemplateLocal.WallPatterns = (TemplateOverride.bOverWallPatterns) ? TemplateOverride.WallPatterns : MainTemplate->WallPatterns; TemplateLocal.FireLadderClass = (TemplateOverride.bOverFireLadderClass) ? TemplateOverride.FireLadderClass : MainTemplate->FireLadderClass; TemplateLocal.FireLadderOffsets = (TemplateOverride.bOverFireLadderOffsets) ? TemplateOverride.FireLadderOffsets : MainTemplate->FireLadderOffsets; TemplateLocal.FireLadderRates = (TemplateOverride.bOverFireLadderRates) ? TemplateOverride.FireLadderRates : MainTemplate->FireLadderRates; TemplateLocal.BottomCorniceClass = (TemplateOverride.bOverBottomCorniceClass) ? TemplateOverride.BottomCorniceClass : MainTemplate->BottomCorniceClass; TemplateLocal.TopCorniceClass = (TemplateOverride.bOverTopCorniceClass) ? TemplateOverride.TopCorniceClass : MainTemplate->TopCorniceClass; TemplateLocal.WallMatOverride = (TemplateOverride.bOverWallMatOverride) ? TemplateOverride.WallMatOverride : MainTemplate->WallMatOverride; TemplateLocal.bPilasterIgnoreGroundFloor = (TemplateOverride.bOverPilasterIgnoreGroundFloor) ? TemplateOverride.bPilasterIgnoreGroundFloor : MainTemplate->bPilasterIgnoreGroundFloor; TemplateLocal.GlobalDecorationWeights = (TemplateOverride.bOverGlobalDecorationWeights) ? TemplateOverride.GlobalDecorationWeights : MainTemplate->GlobalDecorationWeights; TemplateLocal.bGlobalDecorationsIgnoreGroundFloor = (TemplateOverride.bOverGlobalDecorationsIgnoreGroundFloor) ? TemplateOverride.bGlobalDecorationsIgnoreGroundFloor : MainTemplate->bGlobalDecorationsIgnoreGroundFloor; TemplateLocal.MergedMesh = (TemplateOverride.bOverMergedMesh) ? TemplateOverride.MergedMesh : MainTemplate->MergedMesh; TemplateLocal.RandomSeed = MainTemplate->RandomSeed; // Check for empty input - can occur from old data if (TemplateLocal.GlobalDecorationWeights.Num() == 0) { FillDecorationsWithDefaults(TemplateLocal.GlobalDecorationWeights); } // --- Don't think this must be here after all --- Old mesh merging // if(TemplateLocal.MergedMesh != nullptr) // { // ConstructMergedMeshComponent(); // } // else // { // BuildHouse(); // } // --- return true; } return false; } void AHouseEditor::SaveTemplate() { UDataTable* HouseTemplateTable = UHouseEditorFunctionLibrary::GetHouseParamsTemplateDataTable(); if (HouseTemplateTable == nullptr) { UE_LOG(LogTemp, Warning, TEXT("No House Params Template Data Table availavle. Aborting template saving.")) return; } // --- Old mesh merging //CreateMergedMesh(HouseTemplateName.ToString()); // --- bMeshIsDirty = true; HouseTemplateTable->AddRow(HouseTemplateName, TemplateLocal); UHouseEditorFunctionLibrary::CheckOutAndSave(HouseTemplateTable); } void AHouseEditor::SaveTemplateOverride() { if (HouseTemplateName == NAME_None) { UE_LOG(LogTemp, Warning, TEXT("No base template for override generation. Specify one or save as new template instead of overrides.")); return; } UDataTable* HouseTemplateTable = UHouseEditorFunctionLibrary::GetHouseParamsTemplateDataTable(); if (HouseTemplateTable == nullptr) { UE_LOG(LogTemp, Warning, TEXT("No House Params Template Data Table availavle. Aborting parameters transfer.")) return; } FHouseParamsTemplate* MainTemplate = HouseTemplateTable->FindRow<FHouseParamsTemplate>(HouseTemplateName, FString()); if (MainTemplate == nullptr) { return; } TemplateOverride = *(new FHouseParamsOverrides()); if (TemplateLocal.HouseHeight != MainTemplate->HouseHeight) { TemplateOverride.bOverHouseHeight = true; TemplateOverride.HouseHeight = TemplateLocal.HouseHeight; } if (TemplateLocal.HouseLength != MainTemplate->HouseLength) { TemplateOverride.bOverHouseLength = true; TemplateOverride.HouseLength = TemplateLocal.HouseLength; } if (TemplateLocal.HouseWidth != MainTemplate->HouseWidth) { TemplateOverride.bOverHouseWidth = true; TemplateOverride.HouseWidth = TemplateLocal.HouseWidth; } if (TemplateLocal.PilasterClass != MainTemplate->PilasterClass) { TemplateOverride.bOverPilasterClass = true; TemplateOverride.PilasterClass = TemplateLocal.PilasterClass; } if (TemplateLocal.QuoinClass != MainTemplate->QuoinClass) { TemplateOverride.bOverQuoinClass = true; TemplateOverride.QuoinClass = TemplateLocal.QuoinClass; } if (TemplateLocal.RoofClass != MainTemplate->RoofClass) { TemplateOverride.bOverRoofClass = true; TemplateOverride.RoofClass = TemplateLocal.RoofClass; } if (TemplateLocal.BottomCorniceClass != MainTemplate->BottomCorniceClass) { TemplateOverride.bOverBottomCorniceClass = true; TemplateOverride.BottomCorniceClass = TemplateLocal.BottomCorniceClass; } if (TemplateLocal.TopCorniceClass != MainTemplate->TopCorniceClass) { TemplateOverride.bOverTopCorniceClass = true; TemplateOverride.TopCorniceClass = TemplateLocal.TopCorniceClass; } if (TemplateLocal.FireLadderClass != MainTemplate->FireLadderClass) { TemplateOverride.bOverFireLadderClass = true; TemplateOverride.FireLadderClass = TemplateLocal.FireLadderClass; } if (TemplateLocal.WallMatOverride != MainTemplate->WallMatOverride) { TemplateOverride.bOverWallMatOverride = true; TemplateOverride.WallMatOverride = TemplateLocal.WallMatOverride; } if (TemplateLocal.bPilasterIgnoreGroundFloor != MainTemplate->bPilasterIgnoreGroundFloor) { TemplateOverride.bOverPilasterIgnoreGroundFloor = true; TemplateOverride.bPilasterIgnoreGroundFloor = TemplateLocal.bPilasterIgnoreGroundFloor; } if (TemplateLocal.PilasterOffsets != MainTemplate->PilasterOffsets) { TemplateOverride.bOverPilasterOffsets = true; TemplateOverride.PilasterOffsets = TemplateLocal.PilasterOffsets; } if (TemplateLocal.PilasterRates != MainTemplate->PilasterRates) { TemplateOverride.bOverPilasterRates = true; TemplateOverride.PilasterRates = TemplateLocal.PilasterRates; } if (TemplateLocal.FireLadderOffsets != MainTemplate->FireLadderOffsets) { TemplateOverride.bOverFireLadderOffsets = true; TemplateOverride.FireLadderOffsets = TemplateLocal.FireLadderOffsets; } if (TemplateLocal.FireLadderRates != MainTemplate->FireLadderRates) { TemplateOverride.bOverFireLadderRates = true; TemplateOverride.FireLadderRates = TemplateLocal.FireLadderRates; } if (TemplateLocal.WallPatterns != MainTemplate->WallPatterns) { TemplateOverride.bOverWallPatterns = true; TemplateOverride.WallPatterns = TemplateLocal.WallPatterns; } if (TemplateLocal.GlobalDecorationWeights != MainTemplate->GlobalDecorationWeights) { TemplateOverride.bOverGlobalDecorationWeights = true; TemplateOverride.GlobalDecorationWeights = TemplateLocal.GlobalDecorationWeights; } if (TemplateLocal.bGlobalDecorationsIgnoreGroundFloor != MainTemplate->bGlobalDecorationsIgnoreGroundFloor) { TemplateOverride.bOverGlobalDecorationsIgnoreGroundFloor = true; TemplateOverride.bGlobalDecorationsIgnoreGroundFloor = TemplateLocal.bGlobalDecorationsIgnoreGroundFloor; } TemplateOverride.bOverMergedMesh = TemplateOverride.bOverHouseHeight || TemplateOverride.bOverHouseLength || TemplateOverride.bOverHouseWidth || TemplateOverride.bOverPilasterClass || TemplateOverride.bOverPilasterOffsets || TemplateOverride.bOverPilasterRates || TemplateOverride.bOverQuoinClass || TemplateOverride.bOverRoofClass || TemplateOverride.bOverWallPatterns || TemplateOverride.bOverFireLadderClass || TemplateOverride.bOverFireLadderOffsets || TemplateOverride.bOverFireLadderRates || TemplateOverride.bOverBottomCorniceClass || TemplateOverride.bOverTopCorniceClass || TemplateOverride.bOverWallMatOverride || TemplateOverride.bOverPilasterIgnoreGroundFloor || TemplateOverride.bOverGlobalDecorationWeights || TemplateOverride.bOverGlobalDecorationsIgnoreGroundFloor; bMeshIsDirty = true; if (TemplateOverride.bOverMergedMesh == true) { const FString MeshName = GetLevel()->GetName() + "_" + GetName(); // --- Old mesh merging // CreateMergedMesh(MeshName); // TemplateOverride.MergedMesh = TemplateLocal.MergedMesh; // --- } } void AHouseEditor::ClearTemplateOverride() { TemplateOverride = *(new FHouseParamsOverrides()); ReadTemplate(); } void AHouseEditor::UpdateMaterials() { //TArray<TEnumAsByte<EMaterialSlot>> keys; //materialOverrides.GetKeys(keys); //if (keys.Num() == 0) { // return; //} // temp single mat override UMaterialInterface* newMat = (TemplateLocal.WallMatOverride != nullptr) ? TemplateLocal.WallMatOverride : DefaultWallMat; for (int i = 0; i < AllSegments.Num(); i++) { //for (int k = 0; k < keys.Num(); k++) { // allSegments[i]->SetMaterialByName(keys[k], materialOverrides[keys[k]]); //} AllSegments[i]->SetMaterialByName(Wall, newMat); } if (IsValid(RoofActor)) { RoofActor->SetMaterialByName(Wall, newMat); } } void AHouseEditor::ConstructMergedMeshComponent() { ClearHouse(); SavedHouseMeshComponent = NewObject<UStaticMeshComponent>(this, FName("MergedMesh")); SavedHouseMeshComponent->CreationMethod = EComponentCreationMethod::Instance; SavedHouseMeshComponent->SetupAttachment(GetRootComponent()); SavedHouseMeshComponent->RegisterComponent(); SavedHouseMeshComponent->SetStaticMesh(TemplateLocal.MergedMesh); } void AHouseEditor::RebuildWithRMC() { if (!GetRMCProvider()) { UE_LOG(LogTemp, Error, TEXT("[%s] No RMCProvider to build mesh."), *GetName()); return; } if (!GetRMCProvider()->HaveMeshData() || bMeshIsDirty) { GenerateMeshData(); } ClearHouse(); // This can be FALSE if house couldn't be built for some reasons if (GetRMCProvider()->HaveMeshData()) { GetRuntimeMeshComponent()->Initialize(GetRMCProvider()); } } void AHouseEditor::InstantiateElements() { TArray<FName> MeshNames; TArray<UStaticMeshComponent*> SMComps; if (AllSegments.Num() == 0) { UE_LOG(LogTemp, Warning, TEXT("Can't instantiate meshes - there are no segments!")); return; } while (InstancedElements.Num() > 0) { InstancedElements.Pop()->DestroyComponent(); } // Func to add instance to existing instance or create new one auto AddInstancedElement = [&](UStaticMeshComponent*& Comp) { const FName MeshName = Comp->GetStaticMesh()->GetFName(); const int Idx = MeshNames.Find(MeshName); if (Idx >= 0) { InstancedElements[Idx]->AddInstanceWorldSpace(Comp->GetComponentTransform()); } else { UInstancedStaticMeshComponent* NewISMComp = NewObject<UInstancedStaticMeshComponent>(this, UInstancedStaticMeshComponent::StaticClass(), MeshName); NewISMComp->RegisterComponent(); this->AddInstanceComponent(NewISMComp); NewISMComp->SetStaticMesh(Comp->GetStaticMesh()); for (int MatIdx = 0; MatIdx < Comp->GetNumMaterials(); MatIdx++) { NewISMComp->SetMaterial(MatIdx, Comp->GetMaterial(MatIdx)); } NewISMComp->AddInstanceWorldSpace(Comp->GetComponentTransform()); InstancedElements.Add(NewISMComp); MeshNames.Add(MeshName); } }; // Copy segments and decorations for (auto& Segment : AllSegments) { TArray<AActor*> Attachements; Segment->GetAttachedActors(Attachements); for (auto& Attachement : Attachements) { Attachement->GetComponents<UStaticMeshComponent>(SMComps); for (auto& SMComp : SMComps) { AddInstancedElement(SMComp); } } Segment->GetComponents<UStaticMeshComponent>(SMComps); for (auto& SMComp : SMComps) { AddInstancedElement(SMComp); } } // Copy custom elements for (auto& Custom : AllCustoms) { Custom->GetComponents<UStaticMeshComponent>(SMComps); for (auto& SMComp : SMComps) { AddInstancedElement(SMComp); } } // Copy roof RoofActor->GetComponents<UStaticMeshComponent>(SMComps); // MB make elements (such as cornices/pillars/roof) to create ISMs by default??? for (auto& SMComp : SMComps) { AddInstancedElement(SMComp); } ClearHouse(false); for (auto& ISM : InstancedElements) { ISM->MarkRenderStateDirty(); } } void AHouseEditor::GenerateMeshData() { TArray<FRMCSectionData> AllSections; vector<EDGEMeshSectionData> AllRawSections; TArray<UMaterialInterface*> AllMaterials; bool bDataFound = false; const FString FileName = TemplateOverride.bOverMergedMesh ? GetLevel()->GetName() + "_" + GetName() : HouseTemplateName.ToString(); if (!bMeshIsDirty) { bDataFound = EDGERuntimeProviderManager::GetProvider(this, FileName, RMCProvider); } if (!bDataFound) { // If no file found - generate new one vector<EDGEMeshSectionData> RawSections; TArray<UStaticMeshComponent*> MeshComponents; // Build house segments, if they are not present if (AllSegments.Num() == 0) { if (!BuildHouse()) { UE_LOG(LogTemp, Error, TEXT("House couldn't be rebuilt. Aborting mesh generation.")); return; } } // Start with roof meshes if (RoofActor != nullptr) { RoofActor->GetComponents<UStaticMeshComponent>(MeshComponents); } // Collect meshes from segment and decorations for (auto& Segment : AllSegments) { TArray<UStaticMeshComponent*> ThisComponents; Segment->GetComponents<UStaticMeshComponent>(ThisComponents); MeshComponents.Append(ThisComponents); // --- For now skip decorations // TArray<AActor*> Attachements; // Segment->GetAttachedActors(Attachements); // for (auto& Actor : Attachements) // { // ABaseSegmentDecoration* Decor = Cast<ABaseSegmentDecoration>(Actor); // if (Decor != nullptr) // { // Decor->GetComponents<UStaticMeshComponent>(ThisComponents); // } // MeshComponents.Append(ThisComponents); // } } // Collect meshes from house elements for (auto& Element : AllCustoms) { TArray<UStaticMeshComponent*> ThisComponents; Element->GetComponents<UStaticMeshComponent>(ThisComponents); MeshComponents.Append(ThisComponents); } FVertexOffsetParams OffsetParams; for (auto& MeshComponent : MeshComponents) { USceneComponent* HousePoint = MeshComponent->GetAttachParent(); while (HousePoint->GetOwner() != this) { HousePoint = HousePoint->GetAttachParent(); } OffsetParams.MeshRotation = MeshComponent->GetComponentRotation() - GetActorRotation(); OffsetParams.PivotOffset = GetActorRotation().UnrotateVector(MeshComponent->GetComponentLocation() - HousePoint->GetComponentLocation()) + HousePoint->GetRelativeLocation(); if (UEDGEMeshUtility::ReadMeshDataAsRaw(MeshComponent, OffsetParams, RawSections)) { // Add sections to All array for (auto& RawSection : RawSections) { AllRawSections.push_back(RawSection); } } } UEDGEMeshUtility::MergeSections(AllRawSections); UEDGEMeshUtility::WriteMeshDataToFile(FileName, AllRawSections); UEDGEMeshUtility::ConvertSectionDataToUnreal(AllRawSections, AllSections, AllMaterials); const FName Name = *FString::Printf(TEXT("%s"), *FileName); RMCProvider = NewObject<UEDGERuntimeMeshProvider>(this); RMCProvider->SetTemplateName(Name); RMCProvider->SetSectionsData(AllSections); RMCProvider->SetMaterials(AllMaterials); EDGERuntimeProviderManager::AddProvider(this, Name, RMCProvider); } GetHouseNavCollider()->SetRelativeLocation(GetRMCProvider()->GetBoxCenter()); GetHouseNavCollider()->SetBoxExtent(GetRMCProvider()->GetBoxRadius()); bMeshIsDirty = false; } // Floor = 0 means ground floor, where cornice offset never used int AHouseEditor::GetRealHeight(int Floor) const { bool corniceOffsetMP = (TemplateLocal.BottomCorniceClass != NULL && Floor > 0) ? 1 : 0; return (SegmentHeightInUnits * Floor) + (CorniceHeightOffset * corniceOffsetMP); } void AHouseEditor::CreateMergedMesh(FString MeshName) { if (AllSegments.Num() > 0) { UWorld* World = GetWorld(); FMeshMergingSettings MergingSettings = FMeshMergingSettings(); MergingSettings.bPivotPointAtZero = true; // We moving actor to Zero before merge. Look below. MergingSettings.bMergePhysicsData = true; const float ScreenSize = TNumericLimits<float>::Max(); const FString PackageName = GetDefault<UEdgeHouseConstructorSettings>()->HouseMeshesDirectory.Path + "/HouseMesh_" + MeshName; TArray<UPrimitiveComponent*> ComponentsToMerge; TArray<AActor*> ActorsToMerge; ActorsToMerge.Append(AllSegments); for (AActor* Segment : AllSegments) { TArray<AActor*> Decorations; //TODO: Can be made better. In case of some unexpected attachments. Segment->GetAttachedActors(Decorations); ActorsToMerge.Append(Decorations); } ActorsToMerge.Append(AllCustoms); ActorsToMerge.Add(RoofActor); for (AActor* Actor : ActorsToMerge) { TArray<UPrimitiveComponent*> ActorComps; Actor->GetComponents<UPrimitiveComponent>(ActorComps); ComponentsToMerge.Append(ActorComps); } TArray<UObject*> OutAssetsToSync; FVector OutMergedActorLocation; // When merging it's necessary to counter merge Rotation and Location. Using Zero transform // makes life easier and we have "normalized" merged mesh. const FTransform OldTransform = GetActorTransform(); SetActorTransform(FTransform()); const IMeshMergeUtilities& MergeModule = FModuleManager::Get().LoadModuleChecked<IMeshMergeModule>("MeshMergeUtilities").GetUtilities(); MergeModule.MergeComponentsToStaticMesh(ComponentsToMerge, World, MergingSettings, // mb InOuter can be made from SavedHouseMesh ? nullptr, nullptr, PackageName, OutAssetsToSync, OutMergedActorLocation, ScreenSize, true); SetActorTransform(OldTransform); UStaticMesh* SavedHouseMesh; OutAssetsToSync.FindItemByClass(&SavedHouseMesh); const FString SavePath = FPaths::ProjectContentDir() + PackageName.RightChop(6) + ".uasset"; UHouseEditorFunctionLibrary::CheckOutAndSave(SavedHouseMesh, SavePath); TemplateLocal.MergedMesh = SavedHouseMesh; } if (TemplateLocal.MergedMesh != nullptr) { ConstructMergedMeshComponent(); } } void AHouseEditor::FillDecorationsWithDefaults(TArray<FSegmentDecorationsData>& Data) { Data.Empty(); FSegmentDecorationsData DecorationsData; DecorationsData.SocketName = "Wall F"; Data.Add(DecorationsData); DecorationsData.SocketName = "Wall R"; Data.Add(DecorationsData); DecorationsData.SocketName = "Wall B"; Data.Add(DecorationsData); DecorationsData.SocketName = "Wall L"; Data.Add(DecorationsData); }
[ "evgenln11401@gmail.com" ]
evgenln11401@gmail.com
bbecf0b33ffe9dcdafd94c2da2614ff36214b7ec
eb21bd14c58619408d9bc24702008188a5831295
/3CMaker/LmUIMotionThread.cpp
850d517f18d7e8f51d5ebe4e0220bf8140758c74
[]
no_license
REVOLUTION-Game-Creation-Club/3D-Cartoon-Maker
e437a1803607cc0084a43b1b4039fe67efd5c433
e32d2b2035c07afa9f6d3a68e5c2451b957db950
refs/heads/master
2022-04-21T11:46:24.633807
2020-04-05T10:51:08
2020-04-05T10:51:08
null
0
0
null
null
null
null
UHC
C++
false
false
4,785
cpp
// LmUIMotionThread.cpp : 구현 파일입니다. // #include "stdafx.h" #include "3CMaker.h" #include "LmUIMotionThread.h" #include "LmUITimeLineView.h" #include "../Engine/LmEncoder.h" #include "../Engine/LmMixer.h" #include "../Engine/LmAVMixer.h" #include "LmUICreateMovieClipDlg.h" // LmUIMotionThread IMPLEMENT_DYNCREATE(LmUIMotionThread, CWinThread) LmUIMotionThread::LmUIMotionThread() { } LmUIMotionThread::LmUIMotionThread( LmUITimeLineView* _pTimeLineView ) { m_pTimeLIneView = _pTimeLineView; } LmUIMotionThread::~LmUIMotionThread() { } BOOL LmUIMotionThread::InitInstance() { // TODO: 여기에서 각 스레드에 대한 초기화를 수행합니다. return TRUE; } int LmUIMotionThread::ExitInstance() { // TODO: 여기에서 각 스레드에 대한 정리를 수행합니다. return CWinThread::ExitInstance(); } void LmUIMotionThread::OnMotionPlay( WPARAM wParam, LPARAM lParam ) { INT nFramePerSec = TheCartoonMaker->GetFramePerSec(); INT nSleepTime = 1000 / nFramePerSec; CString PlaySoundID; while(1) { Sleep(nSleepTime); INT CurFrame = TheCartoonMaker->GetCurFrame(); // 사운드 재생 UINT nSoundPlay = 0; SectionVector vSoundPlay; vSoundPlay.clear(); vSoundPlay = TheCartoonMaker->GetNowSoundSection( CurFrame, &nSoundPlay); SectionVectorItr itrSection; for(itrSection = vSoundPlay.begin(); itrSection != vSoundPlay.end() ; itrSection ++) { TheCartoonMaker->SoundPlay(itrSection->m_wstrSectionName.c_str()); } // 다음 프레임으로 넘어가기 INT Result = (INT)m_pTimeLIneView->GoNextCaret(); if(Result<0) { m_pTimeLIneView->ChangeStopToPlayBtn(); return; } //메시지를 받아오는 부분 MSG msg; PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); if(msg.message==WM_MOTION_STOP) break; } } void LmUIMotionThread::OnCreateMovie(WPARAM wParam, LPARAM lParam) { HBITMAP MyBit; LmEncoder encoder; CString AVIFileName, BMPFileName, WAVFileName, AVIFileNameTemp; DWORD cFrame = 0; // 다이얼로그에 정보를 갱신하기 위해. LmUICreateMovieClipDlg* CreateMovieClopDlg = (LmUICreateMovieClipDlg*)lParam; HWND hParent = CreateMovieClopDlg->m_hWnd; // 각종 파일 이름 설정 BMPFileName = g_strFilePath + _T("\\temp.bmp"); WAVFileName = g_strFilePath + _T("\\temp.wav"); AVIFileNameTemp = g_strFilePath + _T("\\temp.avi"); AVIFileName = (LPCTSTR)wParam; // AVIFileNameTemp == AVIFileName 일때 처리 해줘야함. // 믹싱 초기화 LmMixer Mixer; if (!Mixer.Init(TheCartoonMaker->GetSoundLayerCount(), TheCartoonMaker->GetFramePerSec(), WAVFileName.GetBuffer())){ return; } WAVFileName.ReleaseBuffer(); // Video 초기화 if (encoder.OpenAVIFile(AVIFileNameTemp, mmioFOURCC('c','v','i','d'), 20, 100)){ //MSVC, cvid return; } while(1) { // 현재 프레임 얻어오기 INT CurFrame = TheCartoonMaker->GetCurFrame(); TheCartoonMaker->RenderOnce(); // Video 작업 if (!TheCartoonMaker->ScreenToFile(BMPFileName)){ } MyBit = (HBITMAP)LoadImage(NULL, BMPFileName, IMAGE_BITMAP, 0, 0, LR_LOADFROMFILE | LR_CREATEDIBSECTION | LR_DEFAULTSIZE); if (!encoder.AppendFrame(MyBit)){ DeleteObject(MyBit); DeleteFile(BMPFileName); encoder.CloseAVIFile();; //return; } DeleteObject(MyBit); // Sound 작업 UINT nSoundPlay = 0; SectionVector vSoundPlay; vSoundPlay.clear(); vSoundPlay = TheCartoonMaker->GetNowSoundSection( CurFrame, &nSoundPlay); SectionVectorItr itrSection; for(itrSection = vSoundPlay.begin(); itrSection != vSoundPlay.end() ; itrSection ++) { Mixer.AddFile(TheCartoonMaker->GetSoundFileName(itrSection->m_wstrSectionName.c_str())); } Mixer.Mixing(); INT Result = (INT)m_pTimeLIneView->GoNextCaret(); if(Result<0) break; MSG msg; PeekMessage(&msg, NULL, 0, 0, PM_REMOVE); if(msg.message==WM_MOTION_MOVIESTOP){ break; } CreateMovieClopDlg->SetState(++cFrame); } // 동영상 작업 마무리 부분 encoder.CloseAVIFile(); DeleteFile(BMPFileName); Mixer.CloseWaveFile(); // Video와 Sound 합침 LmAVMixer AVMixer; AVMixer.InitAvi(AVIFileNameTemp, OPEN_FILE); AVMixer.InitAvi(WAVFileName, MERGE_FILE); AVMixer.Mixing(AVIFileName); DeleteFile(AVIFileNameTemp); DeleteFile(WAVFileName); TheCartoonMaker->m_bMovieStart = FALSE; PostMessage(hParent, WM_CLOSE, 0, 0); } BEGIN_MESSAGE_MAP(LmUIMotionThread, CWinThread) ON_THREAD_MESSAGE(WM_MOTION_PLAY,OnMotionPlay) ON_THREAD_MESSAGE(WM_MOTION_MOVIE,OnCreateMovie) END_MESSAGE_MAP() // LmUIMotionThread 메시지 처리기입니다.
[ "noreply@github.com" ]
noreply@github.com
a9b5eb17aa10d0e37809ffd74bb81d2f2a315e36
b0a38fb83bca587c18cd0dda31ad7f37c273a3b2
/exercise-9.cpp
e693cb5099cc95080823e174b5ffd9879c3f86e5
[]
no_license
Lewizard98/AP-Module-C-Monday-Exercises
7dccdf980286406d269ef9c0f61f3a7eb81f1c86
50a086f52967d02122d4c4e27940e7c92fdd759d
refs/heads/main
2023-02-13T20:04:24.544048
2021-01-11T21:21:45
2021-01-11T21:21:45
328,698,806
0
0
null
null
null
null
UTF-8
C++
false
false
1,031
cpp
#include <iostream> #include <string> int main() { char inputChar; char tryAgain; std::string inputCharStr; std::string tryAgainStr; bool play = true; bool repeatTryAgain; while(play == true){ std::cout << "\nPlease enter a character: "; getline(std::cin, inputCharStr); inputChar = inputCharStr[0]; if (isalpha(inputChar)){ std::cout << "Alphabetic Character detected"; } else if (isdigit(inputChar)){ std::cout << "Digit detected"; } else{ std::cout << "Special Character detected"; } do{ std::cout << "\nTry again? (Y/N): "; getline(std::cin, tryAgainStr); tryAgain = toupper(tryAgainStr[0]); repeatTryAgain = true; if(tryAgain == 'N'){ play = false; repeatTryAgain = false; std::cout << "\nThank you, good bye."; } else if(tryAgain == 'Y'){ repeatTryAgain = false; } else{ std::cout << "Invalid value, try again (Y/N): "; } }while(repeatTryAgain == true); } }
[ "noreply@github.com" ]
noreply@github.com
ae723b878ed920745a77ad40e3e684b6966d6934
b3a86f9abffb5a6d581af1b40e08695c105e0681
/src/avwutils/calc_grad_perc_dev.cc
9382dc60aef3749d2d65e6a51a64c31c6d44477a
[]
no_license
fithisux/FSL
60e3e0f90430db343b3170f25a6e8b77811e6bdf
7aa2932949129f5c61af912ea677d4dbda843895
refs/heads/fsl-5.0.9
2020-12-30T16:16:32.812486
2016-01-29T18:52:06
2016-01-29T18:52:06
90,979,243
9
1
null
2017-05-11T12:56:41
2017-05-11T12:56:41
null
UTF-8
C++
false
false
7,266
cc
/* calc_grad_perc_dev.cc Mark Jenkinson, FMRIB Image Analysis Group Copyright (C) 2012 University of Oxford */ /* Part of FSL - FMRIB's Software Library http://www.fmrib.ox.ac.uk/fsl fsl@fmrib.ox.ac.uk Developed at FMRIB (Oxford Centre for Functional Magnetic Resonance Imaging of the Brain), Department of Clinical Neurology, Oxford University, Oxford, UK LICENCE FMRIB Software Library, Release 5.0 (c) 2012, The University of Oxford (the "Software") The Software remains the property of the University of Oxford ("the University"). The Software is distributed "AS IS" under this Licence solely for non-commercial use in the hope that it will be useful, but in order that the University as a charitable foundation protects its assets for the benefit of its educational and research purposes, the University makes clear that no condition is made or to be implied, nor is any warranty given or to be implied, as to the accuracy of the Software, or that it will be suitable for any particular purpose or for use under any specific conditions. Furthermore, the University disclaims all responsibility for the use which is made of the Software. It further disclaims any liability for the outcomes arising from using the Software. The Licensee agrees to indemnify the University and hold the University harmless from and against any and all claims, damages and liabilities asserted by third parties (including claims for negligence) which arise directly or indirectly from the use of the Software or the sale of any products based on the Software. No part of the Software may be reproduced, modified, transmitted or transferred in any form or by any means, electronic or mechanical, without the express permission of the University. The permission of the University is not required if the said reproduction, modification, transmission or transference is done without financial return, the conditions of this Licence are imposed upon the receiver of the product, and all original and amended source code is included in any transmitted product. You may be held legally responsible for any copyright infringement that is caused or encouraged by your failure to abide by these terms and conditions. You are not permitted under this Licence to use this Software commercially. Use for which any financial return is received shall be defined as commercial use, and includes (1) integration of all or part of the source code or the Software into a product for sale or license by or on behalf of Licensee to third parties or (2) use of the Software or any derivative of it for research with the final aim of developing software products for sale or license to a third party or (3) use of the Software or any derivative of it for research with the final aim of developing non-software products for sale or license to a third party, or (4) use of the Software to provide any service to an external organisation for which payment is received. If you are interested in using the Software commercially, please contact Isis Innovation Limited ("Isis"), the technology transfer company of the University, to negotiate a licence. Contact details are: innovation@isis.ox.ac.uk quoting reference DE/9564. */ // Calculates the percentage deviation in the gradient fields due to non-linearities // Relies on the output of gradient_unwarp.py #define _GNU_SOURCE 1 #define POSIX_SOURCE 1 #include "newimage/newimageall.h" #include "miscmaths/miscmaths.h" #include "utils/options.h" using namespace MISCMATHS; using namespace NEWIMAGE; using namespace Utilities; // The two strings below specify the title and example usage that is // printed out as the help or usage message string title="calc_grad_perc_dev (Version 1.0)\nCopyright(c) 2003, University of Oxford (Mark Jenkinson)"; string examples="calc_grad_perc_dev [options] --fullwarp=<warp image> --out=<basename>"; // Each (global) object below specificies as option and can be accessed // anywhere in this file (since they are global). The order of the // arguments needed is: name(s) of option, default value, help message, // whether it is compulsory, whether it requires arguments // Note that they must also be included in the main() function or they // will not be active. Option<bool> verbose(string("-v,--verbose"), false, string("switch on diagnostic messages"), false, no_argument); Option<bool> help(string("-h,--help"), false, string("display this message"), false, no_argument); Option<string> fullwarp(string("--fullwarp"), string(""), string("full warp image from gradient_unwarp.py"), true, requires_argument); Option<string> outname(string("-o,--out"), string(""), string("output basename"), true, requires_argument); int nonoptarg; //////////////////////////////////////////////////////////////////////////// // Local functions // for example ... print difference of COGs between 2 images ... int do_work(int argc, char* argv[]) { volume4D<float> fw, xpd, ypd, zpd, tmp; volume<float> mask; read_volume4D(fw,fullwarp.value()); mask=fw[0]*0.0f + 1.0f; tmp=lrxgrad(fw[0],mask); xpd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrygrad(fw[0],mask); xpd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrzgrad(fw[0],mask); xpd.addvolume((tmp[0]+tmp[1])*0.5f); xpd[0]*=100.0/fw.xdim(); xpd[1]*=100.0/fw.ydim(); xpd[2]*=100.0/fw.zdim(); tmp=lrxgrad(fw[1],mask); ypd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrygrad(fw[1],mask); ypd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrzgrad(fw[1],mask); ypd.addvolume((tmp[0]+tmp[1])*0.5f); ypd[0]*=100.0/fw.xdim(); ypd[1]*=100.0/fw.ydim(); ypd[2]*=100.0/fw.zdim(); tmp=lrxgrad(fw[2],mask); zpd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrygrad(fw[2],mask); zpd.addvolume((tmp[0]+tmp[1])*0.5f); tmp=lrzgrad(fw[2],mask); zpd.addvolume((tmp[0]+tmp[1])*0.5f); zpd[0]*=100.0/fw.xdim(); zpd[1]*=100.0/fw.ydim(); zpd[2]*=100.0/fw.zdim(); string bname=fslbasename(outname.value()); save_volume4D(xpd,bname+"_x"); save_volume4D(ypd,bname+"_y"); save_volume4D(zpd,bname+"_z"); return 0; } //////////////////////////////////////////////////////////////////////////// int main(int argc,char *argv[]) { Tracer tr("main"); OptionParser options(title, examples); try { // must include all wanted options here (the order determines how // the help message is printed) options.add(fullwarp); options.add(outname); options.add(verbose); options.add(help); nonoptarg = options.parse_command_line(argc, argv); // line below stops the program if the help was requested or // a compulsory option was not set if ( (help.value()) || (!options.check_compulsory_arguments(true)) ) { options.usage(); exit(EXIT_FAILURE); } } catch(X_OptionError& e) { options.usage(); cerr << endl << e.what() << endl; exit(EXIT_FAILURE); } catch(std::exception &e) { cerr << e.what() << endl; } // Call the local functions return do_work(argc,argv); }
[ "methodscorehelp@umich.edu" ]
methodscorehelp@umich.edu
f6e861ee16b53c4148b412686a776de6dc8ce78b
087d25fadcd330790dc0254ae74779523d4d182b
/Bomberman/Src/Utils.h
613290436c56c18ed0999a0f3096192cef484164
[]
no_license
BenjaminHamon/ClassicBomberman
1d0932ea5e0b6742fc348c2560fe83bd16c2b783
f420659f55dd127955880f50a91dc04503abb6c6
refs/heads/master
2016-09-15T23:00:14.264797
2013-04-10T16:32:04
2013-04-10T16:32:04
null
0
0
null
null
null
null
UTF-8
C++
false
false
484
h
#pragma once namespace Bomberman { /// <summary> /// Static methods for general purpose. /// </summary> class Utils { private: Utils(void) {} ~Utils(void) {} public: /// <summary> /// Clamps number to the range between lowerBound and upperBound. /// <returns>lowerBound if number is less than lowerBound, upperBound if it is greater than upperBound, number otherwise.</returns> /// </summary> static int Clamp(int number, int lowerBound, int upperBound); }; }
[ "hamon.benjamin@gmail.com" ]
hamon.benjamin@gmail.com
d327ef0b86eb39f945f4f77fd754162e43b32485
6066f9d73e8b962ae8340a56ed3ae3e9d0d82339
/2018Beijing/a.cpp
1c130fc7c0dcbfec346ea84e7de6c400e9efb61c
[]
no_license
yjl9903/XLor-PKu
682eb025c2a60a21591cf4f04a1f8f91fe30f4ae
654b12c8a4e1160da132583a65cab6ecd028a007
refs/heads/master
2021-07-07T07:05:03.767212
2020-07-07T09:11:20
2020-07-07T09:11:20
134,394,801
0
0
null
null
null
null
UTF-8
C++
false
false
1,188
cpp
#include <iostream> #include <cstdio> #include <cstring> #include <algorithm> #include <string> #include <vector> #include <map> #include <set> #define ms(a,b) memset(a,b,sizeof(a)) using namespace std; typedef long long ll; const int maxn = 50 + 5; char s[maxn], t[maxn]; int n, tag; vector<int> edge[maxn]; int dfs(int u){ if (u == tag) return 1; for (auto& v : edge[u]){ if (dfs(v)) return 1; } return 0; } int main(){ while (~scanf("%d", &n)){ for (int i = 0; i <= 2 * n; i++) edge[i].clear(); vector<string> v; map<string,int> mp; int flag = 1; for (int i = 0; i < n; i++){ scanf("%s%s", s, t); if (!flag) continue; int x, y; if (mp.count(s)) x = mp[s]; else x = mp[s] = v.size(), v.emplace_back(s); if (mp.count(t)) y = mp[t]; else y = mp[t] = v.size(), v.emplace_back(t); tag = x; if (dfs(y)) { printf("%s %s\n", s, t); flag = 0; } edge[x].push_back(y); } if (flag) puts("0"); } return 0; }
[ "yjl9903@vip.qq.com" ]
yjl9903@vip.qq.com
7f3c2e5f9ca2d5697295dbb2dc67fb113db3e382
1d2ba792308d055713245364fcc293d1a0070d56
/src/checkpoints.cpp
9f9909551ee42aa37d56224c6bdecd4020869677
[ "MIT" ]
permissive
mrk-9/GirlsToken
e962eabcf7539909e41701f675327ec931102340
9b56eb94e204b4e53ca360178088219ff6952fa2
refs/heads/master
2020-03-21T05:48:13.082275
2018-06-21T14:33:52
2018-06-21T14:33:52
138,181,578
2
2
null
null
null
null
UTF-8
C++
false
false
19,385
cpp
// Copyright (c) 2009-2012 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 <boost/assign/list_of.hpp> // for 'map_list_of()' #include <boost/foreach.hpp> #include "checkpoints.h" #include "txdb.h" #include "main.h" #include "uint256.h" static const int nCheckpointSpan = 10; namespace Checkpoints { typedef std::map<int, uint256> MapCheckpoints; // // What makes a good checkpoint block? // + Is surrounded by blocks with reasonable timestamps // (no blocks before with a timestamp after, none after with // timestamp before) // + Contains no strange transactions // static MapCheckpoints mapCheckpoints = boost::assign::map_list_of ( 0, hashGenesisBlock ) ( 10000, uint256("0x000000001aae92252eab8839c29dc588949b40f6b40fbab82b2309237f0d215b")) ( 25000, uint256("0xd2cb189f6943204544db514e43e6238a4768731ab16ee2978d0b848e4d858b8b")) ( 50000, uint256("0x96c9cc66dc7cd27de8605ed0d921ec306abc0f78c779fdf6edc3ddefc9e9a460")) ( 75000, uint256("0x239fb3e3c2bfb2455b9b7ce343bd6c4b7ca0d637905765356c7262ada353ef5b")) ( 100000, uint256("0x065a18151d5e19abe052874ca32454123cda935a70c4e00d0550be337272865a")) ( 133000, uint256("0x7d001ab2ec207ea91f8b831b43e734f47268f228a26d925e3729818923227807")) ( 166000, uint256("0x3e534d4a579d7b58def8639e0e77bd386ce14ddc2a60d245c74113614f3d5b7b")) ( 250000, uint256("0x9cd6732ca67aff524ae4ad24516f16a2a976e8faacf594c83bf0a05f1f444466")) ( 300000, uint256("0x000000072576f4d2fce95cfec4eae4110361c6c5504f6e2b276347ea2e2c844e")) ( 350000, uint256("0x00000014d263998c453bcdfeae11a0062c1c4148a5dda81a4c7a89b18e4b9dad")) ( 400000, uint256("0x00000003ba7fedbf512bce4a5e1e31f5f2a29cf575d655f6860f103236bfe4e3")) ( 450000, uint256("0x00000000372d8ec757e3ac713a0af40fd8ebad704b66235f4cde8241cf3fadde")) ( 600000, uint256("0x00000000434dfd40f8b582f209f086ff82699186567c8dd68ddecb83051a19bf")) ( 750000, uint256("0x4b7a7913218280253bda8f68563f1eb8a0e40b85817fb38b7a96376c457e5f72")) ( 1000000, uint256("0x1f0cf3e0c06c106bf1bf767daabe941df034bbe807325bcd0619907020a64eac")) ; // TestNet has no checkpoints static MapCheckpoints mapCheckpointsTestnet = boost::assign::map_list_of ( 0, hashGenesisBlockTestNet ) ; bool CheckHardened(int nHeight, const uint256& hash) { MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); MapCheckpoints::const_iterator i = checkpoints.find(nHeight); if (i == checkpoints.end()) return true; return hash == i->second; } int GetTotalBlocksEstimate() { MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); return checkpoints.rbegin()->first; } CBlockIndex* GetLastCheckpoint(const std::map<uint256, CBlockIndex*>& mapBlockIndex) { MapCheckpoints& checkpoints = (fTestNet ? mapCheckpointsTestnet : mapCheckpoints); BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, checkpoints) { const uint256& hash = i.second; std::map<uint256, CBlockIndex*>::const_iterator t = mapBlockIndex.find(hash); if (t != mapBlockIndex.end()) return t->second; } return NULL; } // ppcoin: synchronized checkpoint (centrally broadcasted) uint256 hashSyncCheckpoint = 0; uint256 hashPendingCheckpoint = 0; CSyncCheckpoint checkpointMessage; CSyncCheckpoint checkpointMessagePending; uint256 hashInvalidCheckpoint = 0; CCriticalSection cs_hashSyncCheckpoint; // ppcoin: get last synchronized checkpoint CBlockIndex* GetLastSyncCheckpoint() { LOCK(cs_hashSyncCheckpoint); if (!mapBlockIndex.count(hashSyncCheckpoint)) error("GetSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str()); else return mapBlockIndex[hashSyncCheckpoint]; return NULL; } // ppcoin: only descendant of current sync-checkpoint is allowed bool ValidateSyncCheckpoint(uint256 hashCheckpoint) { if (!mapBlockIndex.count(hashSyncCheckpoint)) return error("ValidateSyncCheckpoint: block index missing for current sync-checkpoint %s", hashSyncCheckpoint.ToString().c_str()); if (!mapBlockIndex.count(hashCheckpoint)) return error("ValidateSyncCheckpoint: block index missing for received sync-checkpoint %s", hashCheckpoint.ToString().c_str()); CBlockIndex* pindexSyncCheckpoint = mapBlockIndex[hashSyncCheckpoint]; CBlockIndex* pindexCheckpointRecv = mapBlockIndex[hashCheckpoint]; if (pindexCheckpointRecv->nHeight <= pindexSyncCheckpoint->nHeight) { // Received an older checkpoint, trace back from current checkpoint // to the same height of the received checkpoint to verify // that current checkpoint should be a descendant block CBlockIndex* pindex = pindexSyncCheckpoint; while (pindex->nHeight > pindexCheckpointRecv->nHeight) if (!(pindex = pindex->pprev)) return error("ValidateSyncCheckpoint: pprev null - block index structure failure"); if (pindex->GetBlockHash() != hashCheckpoint) { hashInvalidCheckpoint = hashCheckpoint; return error("ValidateSyncCheckpoint: new sync-checkpoint %s is conflicting with current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str()); } return false; // ignore older checkpoint } // Received checkpoint should be a descendant block of the current // checkpoint. Trace back to the same height of current checkpoint // to verify. CBlockIndex* pindex = pindexCheckpointRecv; while (pindex->nHeight > pindexSyncCheckpoint->nHeight) if (!(pindex = pindex->pprev)) return error("ValidateSyncCheckpoint: pprev2 null - block index structure failure"); if (pindex->GetBlockHash() != hashSyncCheckpoint) { hashInvalidCheckpoint = hashCheckpoint; return error("ValidateSyncCheckpoint: new sync-checkpoint %s is not a descendant of current sync-checkpoint %s", hashCheckpoint.ToString().c_str(), hashSyncCheckpoint.ToString().c_str()); } return true; } bool WriteSyncCheckpoint(const uint256& hashCheckpoint) { CTxDB txdb; txdb.TxnBegin(); if (!txdb.WriteSyncCheckpoint(hashCheckpoint)) { txdb.TxnAbort(); return error("WriteSyncCheckpoint(): failed to write to db sync checkpoint %s", hashCheckpoint.ToString().c_str()); } if (!txdb.TxnCommit()) return error("WriteSyncCheckpoint(): failed to commit to db sync checkpoint %s", hashCheckpoint.ToString().c_str()); Checkpoints::hashSyncCheckpoint = hashCheckpoint; return true; } bool AcceptPendingSyncCheckpoint() { LOCK(cs_hashSyncCheckpoint); if (hashPendingCheckpoint != 0 && mapBlockIndex.count(hashPendingCheckpoint)) { if (!ValidateSyncCheckpoint(hashPendingCheckpoint)) { hashPendingCheckpoint = 0; checkpointMessagePending.SetNull(); return false; } CTxDB txdb; CBlockIndex* pindexCheckpoint = mapBlockIndex[hashPendingCheckpoint]; if (!pindexCheckpoint->IsInMainChain()) { CBlock block; if (!block.ReadFromDisk(pindexCheckpoint)) return error("AcceptPendingSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str()); if (!block.SetBestChain(txdb, pindexCheckpoint)) { hashInvalidCheckpoint = hashPendingCheckpoint; return error("AcceptPendingSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashPendingCheckpoint.ToString().c_str()); } } if (!WriteSyncCheckpoint(hashPendingCheckpoint)) return error("AcceptPendingSyncCheckpoint(): failed to write sync checkpoint %s", hashPendingCheckpoint.ToString().c_str()); hashPendingCheckpoint = 0; checkpointMessage = checkpointMessagePending; checkpointMessagePending.SetNull(); printf("AcceptPendingSyncCheckpoint : sync-checkpoint at %s\n", hashSyncCheckpoint.ToString().c_str()); // relay the checkpoint if (!checkpointMessage.IsNull()) { BOOST_FOREACH(CNode* pnode, vNodes) checkpointMessage.RelayTo(pnode); } return true; } return false; } // Automatically select a suitable sync-checkpoint uint256 AutoSelectSyncCheckpoint() { const CBlockIndex *pindex = pindexBest; // Search backward for a block within max span and maturity window while (pindex->pprev && (pindex->GetBlockTime() + nCheckpointSpan * nTargetSpacing > pindexBest->GetBlockTime() || pindex->nHeight + nCheckpointSpan > pindexBest->nHeight)) pindex = pindex->pprev; return pindex->GetBlockHash(); } // Check against synchronized checkpoint bool CheckSync(const uint256& hashBlock, const CBlockIndex* pindexPrev) { if (fTestNet) return true; // Testnet has no checkpoints int nHeight = pindexPrev->nHeight + 1; LOCK(cs_hashSyncCheckpoint); // sync-checkpoint should always be accepted block assert(mapBlockIndex.count(hashSyncCheckpoint)); const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint]; if (nHeight > pindexSync->nHeight) { // trace back to same height as sync-checkpoint const CBlockIndex* pindex = pindexPrev; while (pindex->nHeight > pindexSync->nHeight) if (!(pindex = pindex->pprev)) return error("CheckSync: pprev null - block index structure failure"); if (pindex->nHeight < pindexSync->nHeight || pindex->GetBlockHash() != hashSyncCheckpoint) return false; // only descendant of sync-checkpoint can pass check } if (nHeight == pindexSync->nHeight && hashBlock != hashSyncCheckpoint) return false; // same height with sync-checkpoint if (nHeight < pindexSync->nHeight && !mapBlockIndex.count(hashBlock)) return false; // lower height than sync-checkpoint return true; } bool WantedByPendingSyncCheckpoint(uint256 hashBlock) { LOCK(cs_hashSyncCheckpoint); if (hashPendingCheckpoint == 0) return false; if (hashBlock == hashPendingCheckpoint) return true; if (mapOrphanBlocks.count(hashPendingCheckpoint) && hashBlock == WantedByOrphan(mapOrphanBlocks[hashPendingCheckpoint])) return true; return false; } // ppcoin: reset synchronized checkpoint to last hardened checkpoint bool ResetSyncCheckpoint() { LOCK(cs_hashSyncCheckpoint); const uint256& hash = mapCheckpoints.rbegin()->second; if (mapBlockIndex.count(hash) && !mapBlockIndex[hash]->IsInMainChain()) { // checkpoint block accepted but not yet in main chain printf("ResetSyncCheckpoint: SetBestChain to hardened checkpoint %s\n", hash.ToString().c_str()); CTxDB txdb; CBlock block; if (!block.ReadFromDisk(mapBlockIndex[hash])) return error("ResetSyncCheckpoint: ReadFromDisk failed for hardened checkpoint %s", hash.ToString().c_str()); if (!block.SetBestChain(txdb, mapBlockIndex[hash])) { return error("ResetSyncCheckpoint: SetBestChain failed for hardened checkpoint %s", hash.ToString().c_str()); } } else if(!mapBlockIndex.count(hash)) { // checkpoint block not yet accepted hashPendingCheckpoint = hash; checkpointMessagePending.SetNull(); printf("ResetSyncCheckpoint: pending for sync-checkpoint %s\n", hashPendingCheckpoint.ToString().c_str()); } BOOST_REVERSE_FOREACH(const MapCheckpoints::value_type& i, mapCheckpoints) { const uint256& hash = i.second; if (mapBlockIndex.count(hash) && mapBlockIndex[hash]->IsInMainChain()) { if (!WriteSyncCheckpoint(hash)) return error("ResetSyncCheckpoint: failed to write sync checkpoint %s", hash.ToString().c_str()); printf("ResetSyncCheckpoint: sync-checkpoint reset to %s\n", hashSyncCheckpoint.ToString().c_str()); return true; } } return false; } void AskForPendingSyncCheckpoint(CNode* pfrom) { LOCK(cs_hashSyncCheckpoint); if (pfrom && hashPendingCheckpoint != 0 && (!mapBlockIndex.count(hashPendingCheckpoint)) && (!mapOrphanBlocks.count(hashPendingCheckpoint))) pfrom->AskFor(CInv(MSG_BLOCK, hashPendingCheckpoint)); } bool SetCheckpointPrivKey(std::string strPrivKey) { // Test signing a sync-checkpoint with genesis block CSyncCheckpoint checkpoint; checkpoint.hashCheckpoint = !fTestNet ? hashGenesisBlock : hashGenesisBlockTestNet; CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION); sMsg << (CUnsignedSyncCheckpoint)checkpoint; checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end()); std::vector<unsigned char> vchPrivKey = ParseHex(strPrivKey); CKey key; key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig)) return false; // Test signing successful, proceed CSyncCheckpoint::strMasterPrivKey = strPrivKey; return true; } bool SendSyncCheckpoint(uint256 hashCheckpoint) { CSyncCheckpoint checkpoint; checkpoint.hashCheckpoint = hashCheckpoint; CDataStream sMsg(SER_NETWORK, PROTOCOL_VERSION); sMsg << (CUnsignedSyncCheckpoint)checkpoint; checkpoint.vchMsg = std::vector<unsigned char>(sMsg.begin(), sMsg.end()); if (CSyncCheckpoint::strMasterPrivKey.empty()) return error("SendSyncCheckpoint: Checkpoint master key unavailable."); std::vector<unsigned char> vchPrivKey = ParseHex(CSyncCheckpoint::strMasterPrivKey); CKey key; key.SetPrivKey(CPrivKey(vchPrivKey.begin(), vchPrivKey.end())); // if key is not correct openssl may crash if (!key.Sign(Hash(checkpoint.vchMsg.begin(), checkpoint.vchMsg.end()), checkpoint.vchSig)) return error("SendSyncCheckpoint: Unable to sign checkpoint, check private key?"); if(!checkpoint.ProcessSyncCheckpoint(NULL)) { printf("WARNING: SendSyncCheckpoint: Failed to process checkpoint.\n"); return false; } // Relay checkpoint { LOCK(cs_vNodes); BOOST_FOREACH(CNode* pnode, vNodes) checkpoint.RelayTo(pnode); } return true; } // Is the sync-checkpoint outside maturity window? bool IsMatureSyncCheckpoint() { LOCK(cs_hashSyncCheckpoint); // sync-checkpoint should always be accepted block assert(mapBlockIndex.count(hashSyncCheckpoint)); const CBlockIndex* pindexSync = mapBlockIndex[hashSyncCheckpoint]; return (nBestHeight >= pindexSync->nHeight + nCoinbaseMaturity || pindexSync->GetBlockTime() + nStakeMinAge < GetAdjustedTime()); } } // ppcoin: sync-checkpoint master key const std::string CSyncCheckpoint::strMasterPubKey = "04a18357665ed7a802dcf252ef528d3dc786da38653b51d1ab8e9f4820b55aca807892a056781967315908ac205940ec9d6f2fd0a85941966971eac7e475a27826"; std::string CSyncCheckpoint::strMasterPrivKey = ""; // ppcoin: verify signature of sync-checkpoint message bool CSyncCheckpoint::CheckSignature() { CKey key; if (!key.SetPubKey(ParseHex(CSyncCheckpoint::strMasterPubKey))) return error("CSyncCheckpoint::CheckSignature() : SetPubKey failed"); if (!key.Verify(Hash(vchMsg.begin(), vchMsg.end()), vchSig)) return error("CSyncCheckpoint::CheckSignature() : verify signature failed"); // Now unserialize the data CDataStream sMsg(vchMsg, SER_NETWORK, PROTOCOL_VERSION); sMsg >> *(CUnsignedSyncCheckpoint*)this; return true; } // ppcoin: process synchronized checkpoint bool CSyncCheckpoint::ProcessSyncCheckpoint(CNode* pfrom) { if (!CheckSignature()) return false; LOCK(Checkpoints::cs_hashSyncCheckpoint); if (!mapBlockIndex.count(hashCheckpoint)) { // We haven't received the checkpoint chain, keep the checkpoint as pending Checkpoints::hashPendingCheckpoint = hashCheckpoint; Checkpoints::checkpointMessagePending = *this; printf("ProcessSyncCheckpoint: pending for sync-checkpoint %s\n", hashCheckpoint.ToString().c_str()); // Ask this guy to fill in what we're missing if (pfrom) { pfrom->PushGetBlocks(pindexBest, hashCheckpoint); // ask directly as well in case rejected earlier by duplicate // proof-of-stake because getblocks may not get it this time pfrom->AskFor(CInv(MSG_BLOCK, mapOrphanBlocks.count(hashCheckpoint)? WantedByOrphan(mapOrphanBlocks[hashCheckpoint]) : hashCheckpoint)); } return false; } if (!Checkpoints::ValidateSyncCheckpoint(hashCheckpoint)) return false; CTxDB txdb; CBlockIndex* pindexCheckpoint = mapBlockIndex[hashCheckpoint]; if (!pindexCheckpoint->IsInMainChain()) { // checkpoint chain received but not yet main chain CBlock block; if (!block.ReadFromDisk(pindexCheckpoint)) return error("ProcessSyncCheckpoint: ReadFromDisk failed for sync checkpoint %s", hashCheckpoint.ToString().c_str()); if (!block.SetBestChain(txdb, pindexCheckpoint)) { Checkpoints::hashInvalidCheckpoint = hashCheckpoint; return error("ProcessSyncCheckpoint: SetBestChain failed for sync checkpoint %s", hashCheckpoint.ToString().c_str()); } } if (!Checkpoints::WriteSyncCheckpoint(hashCheckpoint)) return error("ProcessSyncCheckpoint(): failed to write sync checkpoint %s", hashCheckpoint.ToString().c_str()); Checkpoints::checkpointMessage = *this; Checkpoints::hashPendingCheckpoint = 0; Checkpoints::checkpointMessagePending.SetNull(); printf("ProcessSyncCheckpoint: sync-checkpoint at %s\n", hashCheckpoint.ToString().c_str()); return true; }
[ "chuch@chuchs-Mac-mini.local" ]
chuch@chuchs-Mac-mini.local
c9525445af9912090a89313714d5f10cc03f1b0d
aeff2a5a844ac4b11f5425a58ca15740beacb1d8
/src/ElVis/Core/Timer.h
a294bdea6b5e4c55aee203be8dacda24a51e072c
[]
no_license
z-jack/ElVisX
2ab0cb1dfb2b362b17e9708c17ca8dd1064e50c1
ce314d5a939b8cf4233d40ba42479faaa893f569
refs/heads/master
2020-04-11T21:08:05.080308
2018-12-17T08:26:20
2018-12-17T08:26:20
162,096,000
0
0
null
null
null
null
UTF-8
C++
false
false
2,447
h
/////////////////////////////////////////////////////////////////////////////// // // The MIT License // // Copyright (c) 2006 Scientific Computing and Imaging Institute, // University of Utah (USA) // // License for the specific language governing rights and limitations under // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restriction, including without limitation // the rights to use, copy, modify, merge, publish, distribute, sublicense, // and/or sell copies of the Software, and to permit persons to whom the // Software is furnished to do so, subject to the following conditions: // // The above copyright notice and this permission notice shall be included // in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL // THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING // FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER // DEALINGS IN THE SOFTWARE. // /////////////////////////////////////////////////////////////////////////////// #ifndef ELVIS_TIMER_H #define ELVIS_TIMER_H #ifdef _WIN32 #include <windows.h> #else #include <sys/time.h> #include <time.h> #endif #include <ElVis/Core/ElVisDeclspec.h> namespace ElVis { class Timer { public: #ifdef _WIN32 typedef LARGE_INTEGER CounterType; #elif defined(__APPLE__) typedef timeval CounterType; #else typedef timespec CounterType; #endif public: ELVIS_EXPORT Timer(); ELVIS_EXPORT ~Timer(); ELVIS_EXPORT Timer(const Timer& rhs); ELVIS_EXPORT Timer& operator=(const Timer& rhs); ELVIS_EXPORT void Start(); ELVIS_EXPORT void Stop(); ELVIS_EXPORT CounterType Elapsed(); ELVIS_EXPORT double TimePerTest(unsigned int n); private: CounterType m_start; CounterType m_end; CounterType m_resolution; }; } #endif //ELVIS_TIMER_H
[ "emailjiong@126.com" ]
emailjiong@126.com
97255aa4d74ddbad2a741734dfcc088ec458cba2
545d450fe9e126e0ae3e1816d7feb3b1def5f884
/cpp/codejam/sotong/stakeCovering.cpp
6555bcafb2b68f109104ca3bdc233479bcba6876
[]
no_license
nberserk/codejam
452241ea2068cd5f16c6ee9d9d2164d6c64ce777
19b75bcdeaad9a565f4bd86e82942d9201e85941
refs/heads/master
2022-04-29T10:40:00.764553
2022-04-20T16:29:32
2022-04-20T16:29:32
9,389,773
1
2
null
null
null
null
UTF-8
C++
false
false
3,113
cpp
#include <algorithm> #include <unistd.h> #include <stdio.h> #include <math.h> #include <vector> #include <map> #include <queue> #include <time.h> #include <string> #include <sstream> #include <string.h> #include <stack> #include <list> #include <limits> #include <set> #include <iostream> using namespace std; #define H_MAX 987654321 #define H_MIN -987654321 #define H_EPSILON 0.000001 #define H_MOD 10000000 typedef long long ll; void check(bool ret); bool gDebug; int gN; float gX[500]; float gH[500]; float gMaxHeight; int selected[500]; void calc(int s, int e, float& a, float& b){ a = (gH[e]-gH[s])/(gX[e]-gX[s]); b = gH[e]-a*gX[e]; } void split(int s, int e){ if (s>e){ return; } selected[s]=1; selected[e]=1; float a,b; float y,d; float maxDiff=-2000; int idx[500]; int count =0; calc(s,e,a,b); for (int i = s+1; i < e; i++){ y = a*gX[i]+b; d = gH[i]-y; if (d<0)continue; if (d> maxDiff){ maxDiff = d; count=0; idx[count++] = i; }else if (d==maxDiff){ idx[count++]=i; } } if (count==0){ return; } for (int i = 0; i < count; i++){ selected[idx[i]]=1; } if (count>1){ split(s, idx[0]); split(idx[count-1], e); }else{ split(s,idx[0]); split(idx[0], e); } } void solve(){ for (int i = 0; i < gN; i++){ selected[i]=-1; } selected[0] = 1; selected[gN-1] =1; int left=-1; int right=-1; for (int i = 0; i < gN; i++){ if (gH[i]==gMaxHeight){ selected[i]=true; if (left==-1){ left = i; } right =i; } } // left split(0, left); // right split(right, gN-1); for (int i = 0; i < gN; i++){ if (selected[i]==1){ printf("%d ", i+1); } } printf("\n"); } void check(bool ret){ if (ret==false) { printf("failed\n"); } } void check(int expected, int actual){ if (expected!=actual) { printf("failed expected=%d, actual=%d\n", expected, actual); } } void check(char expected, char actual){ if (expected!=actual) { printf("failed expected=%c, actual=%c\n", expected, actual); } } void test(){ } int main(){ string fn = __FILE__; size_t pos = fn.find(".cpp"); fn = fn.substr(0,pos) + ".txt"; if (access(fn.c_str(), F_OK)!=-1) { gDebug = true; } FILE *fp; if (gDebug) { fp = freopen(fn.c_str(), "r", stdin); } //test(); // handling input int count, p,j,k, i; scanf("%d", &count); for (p=0; p<count; p++) { scanf("%d", &gN); gMaxHeight = -1; for (int i = 0; i < gN; i++){ scanf("%f %f",gX+i, gH+i); gMaxHeight = max(gH[i], gMaxHeight); } solve(); } if (gDebug) { fclose(fp); } return 0; }
[ "darren.ha@samsung.com" ]
darren.ha@samsung.com
a6f67a2385c6ee212c92fd01010bfbd306639078
7a812a7704317e99d3388df7c1d5e589ccd84c9e
/third_party/libosmium/include/osmium/area/multipolygon_collector.hpp
76d7c114221f9ca648fda31dc2ec6624bda306cd
[ "BSL-1.0", "LicenseRef-scancode-unknown-license-reference", "MIT" ]
permissive
nda97531/valhalla
77bb6dca41c1c13ed1ef5afc43c9216d34372eb3
1bc64013e3997a2325baaffdcb69d4db9c20c9a0
refs/heads/main
2023-08-12T02:39:41.180462
2021-07-15T05:24:42
2021-07-15T05:24:42
386,171,575
0
0
null
null
null
null
UTF-8
C++
false
false
8,165
hpp
#ifndef OSMIUM_AREA_MULTIPOLYGON_COLLECTOR_HPP #define OSMIUM_AREA_MULTIPOLYGON_COLLECTOR_HPP /* This file is part of Osmium (https://osmcode.org/libosmium). Copyright 2013-2021 Jochen Topf <jochen@topf.org> and others (see README). Boost Software License - Version 1.0 - August 17th, 2003 Permission is hereby granted, free of charge, to any person or organization obtaining a copy of the software and accompanying documentation covered by this license (the "Software") to use, reproduce, display, distribute, execute, and transmit the Software, and to prepare derivative works of the Software, and to permit third-parties to whom the Software is furnished to do so, all subject to the following: The copyright notices in the Software and this entire statement, including the above license grant, this restriction and the following disclaimer, must be included in all copies of the Software, in whole or in part, and all derivative works of the Software, unless such copies or derivative works are solely in the form of machine-executable object code generated by a source language processor. 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, TITLE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ #include <osmium/area/stats.hpp> #include <osmium/memory/buffer.hpp> #include <osmium/osm/item_type.hpp> #include <osmium/osm/location.hpp> #include <osmium/osm/node_ref.hpp> #include <osmium/osm/relation.hpp> #include <osmium/osm/tag.hpp> #include <osmium/osm/way.hpp> #include <osmium/relations/collector.hpp> #include <algorithm> #include <cstddef> #include <cstring> #include <vector> namespace osmium { namespace relations { class RelationMeta; } // namespace relations /** * @brief Code related to the building of areas (multipolygons) from relations. */ namespace area { /** * This class collects all data needed for creating areas from * relations tagged with type=multipolygon or type=boundary. * Most of its functionality is derived from the parent class * osmium::relations::Collector. * * The actual assembling of the areas is done by the assembler * class given as template argument. * * @tparam TAssembler Multipolygon Assembler class. * @pre The Ids of all objects must be unique in the input data. * * @deprecated Use MultipolygonManager instead. */ template <typename TAssembler> class MultipolygonCollector : public osmium::relations::Collector<MultipolygonCollector<TAssembler>, false, true, false> { using collector_type = osmium::relations::Collector<MultipolygonCollector<TAssembler>, false, true, false>; using assembler_config_type = typename TAssembler::config_type; const assembler_config_type m_assembler_config; osmium::memory::Buffer m_output_buffer; area_stats m_stats; enum { initial_output_buffer_size = 1024UL * 1024UL }; enum { max_buffer_size_for_flush = 100UL * 1024UL }; void flush_output_buffer() { if (this->callback()) { osmium::memory::Buffer buffer{initial_output_buffer_size}; using std::swap; swap(buffer, m_output_buffer); this->callback()(std::move(buffer)); } } void possibly_flush_output_buffer() { if (m_output_buffer.committed() > max_buffer_size_for_flush) { flush_output_buffer(); } } public: explicit MultipolygonCollector(const assembler_config_type& assembler_config) : collector_type(), m_assembler_config(assembler_config), m_output_buffer(initial_output_buffer_size, osmium::memory::Buffer::auto_grow::yes) { } const area_stats& stats() const noexcept { return m_stats; } /** * We are interested in all relations tagged with type=multipolygon * or type=boundary. * * Overwritten from the base class. */ bool keep_relation(const osmium::Relation& relation) const { const char* type = relation.tags().get_value_by_key("type"); // ignore relations without "type" tag if (!type) { return false; } return (!std::strcmp(type, "multipolygon")) || (!std::strcmp(type, "boundary")); } /** * Overwritten from the base class. */ bool keep_member(const osmium::relations::RelationMeta& /*relation_meta*/, const osmium::RelationMember& member) const { // We are only interested in members of type way. return member.type() == osmium::item_type::way; } /** * This is called when a way is not in any multipolygon * relation. * * Overwritten from the base class. */ void way_not_in_any_relation(const osmium::Way& way) { // you need at least 4 nodes to make up a polygon if (way.nodes().size() <= 3) { return; } try { if (!way.nodes().front().location() || !way.nodes().back().location()) { throw osmium::invalid_location{"invalid location"}; } if (way.ends_have_same_location()) { // way is closed and has enough nodes, build simple multipolygon TAssembler assembler{m_assembler_config}; assembler(way, m_output_buffer); m_stats += assembler.stats(); possibly_flush_output_buffer(); } } catch (const osmium::invalid_location&) { // XXX ignore } } void complete_relation(osmium::relations::RelationMeta& relation_meta) { const osmium::Relation& relation = this->get_relation(relation_meta); const osmium::memory::Buffer& buffer = this->members_buffer(); std::vector<const osmium::Way*> ways; ways.reserve(relation.members().size()); for (const auto& member : relation.members()) { if (member.ref() != 0) { const size_t offset = this->get_offset(member.type(), member.ref()); ways.push_back(&buffer.get<const osmium::Way>(offset)); } } try { TAssembler assembler{m_assembler_config}; assembler(relation, ways, m_output_buffer); m_stats += assembler.stats(); possibly_flush_output_buffer(); } catch (const osmium::invalid_location&) { // XXX ignore } } void flush() { flush_output_buffer(); } osmium::memory::Buffer read() { osmium::memory::Buffer buffer{initial_output_buffer_size, osmium::memory::Buffer::auto_grow::yes}; using std::swap; swap(buffer, m_output_buffer); return buffer; } }; // class MultipolygonCollector } // namespace area } // namespace osmium #endif // OSMIUM_AREA_MULTIPOLYGON_COLLECTOR_HPP
[ "anhnd59@vingroup.net" ]
anhnd59@vingroup.net