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
21cd08da35d3216539be225ba1b481795399a856
1c5a79468097465256a57c3ce26433ed9558d1bf
/catkin_ws/src/bamboo/src/ArmProtocol.cpp
c00540737c26f60517b198264328e81e7772ed83
[]
no_license
Xueming10wu/Braveheart
3c7364b41d5d9105f4aab7a253c2efb2c5803717
baad63b86bdc62682af7d4769ba3404daef56b18
refs/heads/master
2020-06-29T07:35:11.029457
2019-08-10T06:47:55
2019-08-10T06:47:55
200,476,027
0
0
null
2019-10-24T03:15:39
2019-08-04T09:53:33
C++
UTF-8
C++
false
false
6,063
cpp
#include "bamboo/ArmProtocol.h" //构造函数 ArmProtocol::ArmProtocol():bufferSize(1024) { rxBuffer = new uint8_t[bufferSize]; txBuffer = new uint8_t[bufferSize]; rxBuffer[bufferSize - 1] = '\0'; txBuffer[bufferSize - 1] = '\0'; KeyRX = 0; KeyTX = 0; cout << "ArmProtocol construct" << endl; } //析构函数 ArmProtocol::~ArmProtocol() { delete []txBuffer; delete []rxBuffer; txBuffer = NULL; rxBuffer = NULL; } //读取某个舵机的脉宽(角度),返回0则是读取数据失败 int ArmProtocol::readJoint(Serial &serialport, int joint_id) { /////////////////////////////////////请求数据消息的创建//////////////////////////////////////// stringstream ss; ss << "#"; ss << joint_id << "PRAD\r\n"; string txstring = ss.str(); char *tx_char = (char *)txstring.c_str(); KeyTX = strlen(tx_char); cout << "len " << KeyTX << " " << txstring; for (size_t i = 0; i < KeyTX; i++) { txBuffer[i] = (uint8_t)tx_char[i]; } /////////////////////////////////////请求数据消息的创建完毕////////////////////////////////////// //////////////////////////////////////串口请求发送///////////////////////////////////////////////// int txnum = serialport.write(txBuffer, KeyTX); if (txnum != KeyTX) { cout << "readJoint write failed" << endl; return 0; } else { cout << "readJoint write successed" << endl; } //////////////////////////////////////串口请求发送完毕///////////////////////////////////////////// /////////////////////////////////////响应数据的接收////////////////////////////////////////// //固定位数为11位 KeyRX = 11; //rx索引 int key = 0; bool canRead = false; while(!canRead) { //串口是否有数据 if (serialport.available()) { //数据读取 rxBuffer[key] = (serialport.read(1).c_str())[0]; key += 1; if (rxBuffer[0] != (uint8_t)'#') { //丢包错误 cout << "lost package: #" << endl; key = 0; continue; } if (key < 11) { //正常执行时 continue; } if (rxBuffer[9] != (uint8_t)'\r') { cout << "lost package: \\r" << endl; key = 0; continue; } if (rxBuffer[10] != (uint8_t)'\n') { cout << "lost package: \\n" << endl; key = 0; continue; } //通过检测,可以读取数据 canRead = true; } else { //等待数据 usleep(2000); cout << "No data get" << endl; } } cout << "RXBUFFER "; for (size_t i = 0; i < KeyRX; i++) { cout << int(rxBuffer[i]) << " "; } cout << "\n\n"; /////////////////////////////////////响应数据的接收完毕////////////////////////////////////////// /////////////////////////////////////响应数据的解码//////////////////////////////////////////// //串口读出 int res_joint_id = int((rxBuffer[1] - uint8_t('0'))* 100 + (rxBuffer[2] - uint8_t('0')) * 10 + (rxBuffer[3] - uint8_t('0')) * 1); int res_position = int((rxBuffer[5] - uint8_t('0') )* 1000 + (rxBuffer[6] - uint8_t('0') ) * 100 + (rxBuffer[7] - uint8_t('0')) * 10 + (rxBuffer[8] - uint8_t('0')) * 1); /////////////////////////////////////响应数据的解码完毕////////////////////////////////////////// if (res_joint_id == joint_id) { return res_position; } else { cout << "Read except joint is " << joint_id << " , but respond " << res_joint_id << " , position " << res_position << endl; } return 0; } //写某个舵机的脉宽(角度) 返回是否成功 成功:1 失败:0 int ArmProtocol::writeJoint( Serial &serialport, int joint_id, int puls_width, int duration ) { stringstream ss; ss << "#"; ss << joint_id << "P" << puls_width; ss << "T" << duration << "\r\n" ; string txstring = ss.str(); char *tx_char = (char *)txstring.c_str(); KeyTX = strlen(tx_char); cout << "len " << KeyTX << " " << txstring; for (size_t i = 0; i < KeyTX; i++) { txBuffer[i] = (uint8_t)tx_char[i]; } int txnum = serialport.write(txBuffer, KeyTX); if (txnum != KeyTX) { cout << "writeJoint write failed :" << endl; return 0; } else { cout << "writeJoint write success !" << endl; } return 1; } int ArmProtocol::writeMulJoint(Serial & serialport, int count, int* joint_id, int* puls_width, int duration ) { stringstream ss; for (size_t i = 0; i < count; i++) { ss << "#" << joint_id[i] << "P" << puls_width[i]; } ss << "T" << duration << "\r\n" ; string txstring = ss.str(); char *tx_char = (char *)txstring.c_str(); KeyTX = strlen(tx_char); cout << "len " << KeyTX << " " << txstring; for (size_t i = 0; i < KeyTX; i++) { txBuffer[i] = (uint8_t)tx_char[i]; } int txnum = serialport.write(txBuffer, KeyTX); if (txnum != KeyTX) { cout << "writeJoint write failed :" << endl; return 0; } else { cout << "writeJoint write success !" << endl; } return 1; } void ArmProtocol::flushTxBuffer() { for (size_t i = 0; i < bufferSize - 1; i++) { txBuffer[i] = '$'; } KeyTX = 0; } void ArmProtocol::flushRxBuffer() { for (size_t i = 0; i < bufferSize - 1; i++) { rxBuffer[i] = '$'; } KeyRX = 0; } void ArmProtocol::flush() { flushTxBuffer(); flushRxBuffer(); }
[ "noreply@github.com" ]
noreply@github.com
9200eb618c945ca7472fb8d6b8caa8ca303028c2
d92304badb95993099633c5989f6cd8af57f9b1f
/UVa/Another New Function.cpp
61b3b0812d0c8a564a3c40644e7ca3012e5fb9c5
[]
no_license
tajirhas9/Problem-Solving-and-Programming-Practice
c5e2b77c7ac69982a53d5320cebe874a7adec750
00c298233a9cde21a1cdca1f4a2b6146d0107e73
refs/heads/master
2020-09-25T22:52:00.716014
2019-12-05T13:04:40
2019-12-05T13:04:40
226,103,342
0
0
null
null
null
null
UTF-8
C++
false
false
6,134
cpp
#include<bits/stdc++.h> /* #include <ext/pb_ds/assoc_container.hpp> // Common file #include <ext/pb_ds/tree_policy.hpp> // Including */ using namespace std; //using namespace __gnu_pbds; //typedefs typedef long long ll; typedef vector<int> vi; typedef vector<ll> vl; typedef vector<vi> vvi; typedef vector<vl> vvl; typedef pair<int,int> pii; typedef pair<double, double> pdd; typedef pair<ll, ll> pll; typedef vector<pii> vii; typedef vector<pll> vll; typedef vector<int>::iterator vit; typedef set<int>::iterator sit; /* template<typename T> using ordered_set = tree<T, null_type, less<T>, rb_tree_tag, tree_order_statistics_node_update>; template<typename F, typename S> using ordered_map = tree<F, S, less<F>, rb_tree_tag, tree_order_statistics_node_update>; */ //#Defines #define rep(i,a,b) for(i=a;i<=b;i++) #define repR(i,a,b) for(i=a;i>=b;i--) //#define pb push_back #define pb emplace_back #define F first #define S second #define mp make_pair #define all(c) c.begin(),c.end() #define endl '\n' #define pf printf #define sf scanf //#define left __left //#define right __right //#define tree __tree #define MOD 1000000007 //#define harmonic(n) 0.57721566490153286l+log(n) #define RESET(a,b) memset(a,b,sizeof(a)) #define gcd(a,b) __gcd(a,b) #define lcm(a,b) (a*(b/gcd(a,b))) #define sqr(a) ((a) * (a)) #define optimize() ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); #define fraction() cout.unsetf(ios::floatfield); cout.precision(10); cout.setf(ios::fixed,ios::floatfield); const double PI = acos(-1); const double eps = 1e-9; const int inf = 2000000000; const ll infLL = 9000000000000000000; //Bit Operations inline bool checkBit(ll n, int i) { return n&(1LL<<i); } inline ll setBit(ll n, int i) { return n|(1LL<<i);; } inline ll resetBit(ll n, int i) { return n&(~(1LL<<i)); } int fx[] = {0, 0, +1, -1}; int fy[] = {+1, -1, 0, 0}; //int dx[] = {+1, 0, -1, 0, +1, +1, -1, -1}; //int dy[] = {0, +1, 0, -1, +1, -1, +1, -1}; //Inline functions inline bool EQ(double a, double b) { return fabs(a-b) < 1e-9; } inline bool isLeapYear(ll year) { return (year%400==0) || (year%4==0 && year%100!=0); } inline void normal(ll &a) { a %= MOD; (a < 0) && (a += MOD); } inline ll modMul(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a*b)%MOD; } inline ll modAdd(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); return (a+b)%MOD; } inline ll modSub(ll a, ll b) { a %= MOD, b %= MOD; normal(a), normal(b); a -= b; normal(a); return a; } inline ll modPow(ll b, ll p) { ll r = 1; while(p) { if(p&1) r = modMul(r, b); b = modMul(b, b); p >>= 1; } return r; } inline ll modInverse(ll a) { return modPow(a, MOD-2); } inline ll modDiv(ll a, ll b) { return modMul(a, modInverse(b)); } inline bool isInside(pii p,ll n,ll m) { return (p.first>=0&&p.first<n&&p.second>=0&&p.second<m); } inline bool isInside(pii p,ll n) { return (p.first>=0&&p.first<n&&p.second>=0&&p.second<n); } inline bool isSquare(ll x) { ll s = sqrt(x); return (s*s==x); } inline bool isFib(ll x) { return isSquare(5*x*x+4)|| isSquare(5*x*x-4); } inline bool isPowerOfTwo(ll x) { return ((1LL<<(ll)log2(x))==x); } struct func { //this is a sample overloading function for sorting stl bool operator()(pii const &a, pii const &b) { if(a.F==b.F) return (a.S<b.S); return (a.F<b.F); } }; //Prime Number Generator /* #define M 100000000 int marked[M/64 + 2]; #define on(x) (marked[x/64] & (1<<((x%64)/2))) #define mark(x) marked[x/64] |= (1<<((x%64)/2)) vl prime; bool isPrime(int num) { return num > 1 && (num == 2 || ((num & 1) && !on(num))); } void sieve(ll n) { for (ll i = 3; i * i < n; i += 2) { if (!on(i)) { for (ll j = i * i; j <= n; j += i + i) { mark(j); } } } prime.pb(2); for(ll i = 3; i <= n; i += 2) { if(!on(i)) prime.pb(i); } } */ // //debug #ifdef tajir template < typename F, typename S > ostream& operator << ( ostream& os, const pair< F, S > & p ) { return os << "(" << p.first << ", " << p.second << ")"; } template < typename T > ostream &operator << ( ostream & os, const vector< T > &v ) { os << "{"; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "}"; } template < typename T > ostream &operator << ( ostream & os, const set< T > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "]"; } template < typename T > ostream &operator << ( ostream & os, const multiset< T > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << *it; } return os << "]"; } template < typename F, typename S > ostream &operator << ( ostream & os, const map< F, S > &v ) { os << "["; for(auto it = v.begin(); it != v.end(); ++it) { if( it != v.begin() ) os << ", "; os << it -> first << " = " << it -> second ; } return os << "]"; } #define dbg(args...) do {cerr << #args << " : "; faltu(args); } while(0) clock_t tStart = clock(); #define timeStamp dbg("Execution Time: ", (double)(clock() - tStart)/CLOCKS_PER_SEC) void faltu () { cerr << endl; } template <typename T> void faltu( T a[], int n ) { for(int i = 0; i < n; ++i) cerr << a[i] << ' '; cerr << endl; } template <typename T, typename ... hello> void faltu( T arg, const hello &... rest) { cerr << arg << ' '; faltu(rest...); } #else #define dbg(args...) #endif // tajir #define M 2000005 ll phi[M+4], dp[M+4],sum[M+4]; void calcPhi() { for(ll i = 2; i<= M; ++i) phi[i] = i; for(ll i=2; i<= M; ++i) { if(phi[i] == i) { for(ll j = i; j <= M; j += i) { phi[j] -= phi[j] / i; } } } } void calcDepth() { for(ll i=2; i< M; ++i){ dp[i] = dp[ phi[i] ] + 1; } } void calcSum(){ sum[1] = 0; for(ll i = 2; i< M; ++i) sum[i] = sum[i-1] + dp[i]; } int main() { #ifdef tajir freopen("input.txt", "r", stdin); #else // online submission #endif optimize(); calcPhi(); calcDepth(); calcSum(); // dbg(phi, 14); // dbg(dp, 14); ll T,n,m; cin >> T; while(T--) { cin >> m >> n; cout << ( sum[n] - sum[m-1] ) << endl; } return 0; } //?
[ "tajircuet@gmail.com" ]
tajircuet@gmail.com
0c9adf27cbda37876d925071caffbf4ff2bf97e7
bb400fa43fb114748bcdc1cec5e860c07914c262
/app/src/main/cpp/TextureLoader.h
674d8cf1ff7346285998beb30143f2873039fb4c
[ "Apache-2.0" ]
permissive
Alwin-Lin/gpu-emulation-stress-test
91f40f8b393cbce4b702645ccfbc0ee41ab9fefb
736d0eecfe3f75cdb124db832942568d66a57e56
refs/heads/master
2020-04-17T10:39:04.869028
2019-11-11T02:29:45
2019-11-11T02:29:45
166,508,515
0
1
Apache-2.0
2019-01-19T05:07:31
2019-01-19T05:07:31
null
UTF-8
C++
false
false
943
h
/* * Copyright (C) 2017 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. */ #pragma once #include <string> #include <vector> class TextureLoader { public: TextureLoader(); static TextureLoader *get(); std::vector<unsigned char> loadPNGAsRGBA8(const std::string &filename, unsigned int &w, unsigned int &h); };
[ "lfy@google.com" ]
lfy@google.com
82efa2fc850efddd45a5fdf0c874ed94bfc81f74
0525f930c8343418ba22b8d090143216b33fe5f3
/iwr-course-2021/release-build/dune-common/dune/common/simd/test/looptest_vector_BinaryOpsScalarVector_double.cc
da5038fd4bf6fdd8470617ac6bfaf53add70c882
[]
no_license
jiaqiwang969/dune-course-material
7f4b9378f924ef19439174c96cc5cbe2d5606369
d72adb8686611fa827df787bd509c2d56edf0b10
refs/heads/main
2023-07-16T07:11:39.203058
2021-09-03T06:31:58
2021-09-03T06:31:58
401,549,099
0
0
null
null
null
null
UTF-8
C++
false
false
322
cc
// generated from looptest_vector.cc.in by cmake -*- buffer-read-only:t -*- vim: set readonly: #include <config.h> #include <dune/common/simd/test/looptest.hh> namespace Dune { namespace Simd { template void UnitTest::checkBinaryOpsScalarVector<LoopSIMD<double, 5> >(); } //namespace Simd } // namespace Dune
[ "jiaqiwang969@gmail.com" ]
jiaqiwang969@gmail.com
3de135e574b60ccf8d4038fa29574aa503512b2d
540221f7967b94576fd76632f33405a4e35ed4f8
/Workspace/Task-Reminder-Management-System/loginwindow.cpp
6ceb2b4cb8513f43e5eff446eab77735d04cee8f
[ "MIT" ]
permissive
hvlhasanka/UOP_SE_Y3S1-SOFT336SL_CROSS_PLATFORM_DEVELOPMENT_IN_C_Plus_Plus
14827ea13bbd6136075c4219a1caf06874903e05
ea6daa15da9c1ee1c18bef8721dc2a2043230b40
refs/heads/main
2023-02-23T18:16:19.725951
2021-01-07T09:29:03
2021-01-07T09:29:03
303,738,032
1
0
null
null
null
null
UTF-8
C++
false
false
11,356
cpp
/*********************************************** ** ** Source Code Developed By: H.V.L.Hasanka ** ***********************************************/ #include "loginwindow.h" #include "ui_loginwindow.h" #include <QPixmap> #include <QMessageBox> #include <QInputDialog> #include <QRegularExpression> #include <QCryptographicHash> #include <QString> LoginWindow::LoginWindow(QWidget *parent) : QMainWindow(parent) , ui(new Ui::LoginWindow) { ui->setupUi(this); /* Cover Image Implementation Source Code */ // Getting the cover image QPixmap coverImagePix(":/images/Cover-Image.jpg"); // Getting the width of the coverImage_label int coverImageLabelWidth = ui->coverImage_label->width(); // Getting the height of the coverImage_label int coverImageLabelHeight = ui->coverImage_label->height(); // Setting the cover image to the coverImage_Label ui->coverImage_label->setPixmap(coverImagePix.scaled(coverImageLabelWidth, coverImageLabelHeight, Qt::KeepAspectRatio)); /* Logo Image Implementation Source Code */ // Getting the logo image QPixmap logoImagePix(":/images/TRMS-Logo-WithBackground.jpg"); // Getting the width of the logo_label int logoLabelWidth = ui->logo_label->width(); // Getting the height of the logo_label int logoLabelHeight = ui->logo_label->height(); // Setting the cover image of the logo_label ui->logo_label->setPixmap(logoImagePix.scaled(logoLabelWidth, logoLabelHeight, Qt::KeepAspectRatio)); // Disabling login push button ui->login_pushButton->setEnabled(false); // Creating an object of AuthenticateLogin class auth = new AuthenticateLogic(); } LoginWindow::~LoginWindow() { delete ui; } // If user checks or unchecks 'showPassword_checkBox' void LoginWindow::on_showPassword_checkBox_stateChanged(int arg1) { // Checking whether the 'showPassword_checkBox' is checked or not // arg1 = ui->showPassword_checkBox->isChecked() if(arg1){ // If it is checked the 'password_lineEdit' text will be visible password_lineEdit = ui->password_lineEdit; password_lineEdit->setEchoMode(QLineEdit::Normal); } else{ // If it is unchecked the 'password_lineEdit' text will be invisible - password value password_lineEdit = ui->password_lineEdit; password_lineEdit->setEchoMode(QLineEdit::Password); } } // If the user clicks on 'Forgot Password?' push button void LoginWindow::on_forgotPassword_pushButton_clicked() { QMessageBox::information(this, "PLEASE SUBMIT REPORT", "Feature not currently available, please submit a report including your email address.\nApologies for the inconvenience."); /* // Showing message box to explain the procedure QString forgotPasswordResponseEmailAddress = QInputDialog::getText(this, "Password Recovery", "Unfortunately you are unable to recover the existing password, \n" "you are required to update the password.\n\n" "Please enter your email address and a pin code will be emailed.\n"); qWarning() << forgotPasswordResponseEmailAddress; QMessageBox::question(this, "Password Recovery", "Unfortunately you are unable to recover the existing password, " "you are required to update the password." "Please enter your email address and a pin code will be emailed." , "Cancel", "Continue"); */ } // When the text in the 'emailAddress_lineEdit' changes void LoginWindow::on_emailAddress_lineEdit_textChanged(const QString &arg1) { // Checking whether the user entered email address value is in the correct regular expression // arg1 = ui->emailAddress_lineEdit->text(); QString enteredEmailAddressValue = arg1; bool validationResponse = auth->validateEnteredEmailAddress(enteredEmailAddressValue); if(validationResponse == true){ // Changing lineEdit border styles ui->emailAddress_lineEdit->setStyleSheet("border: 2px solid green;" "background-color: rgb(255, 255, 255);"); // Setting enteredEmailAddressValue to true enteredEmailAddressValueAcceptable = true; if(enteredPasswordValueAcceptable == true){ // Enabling login push button ui->login_pushButton->setEnabled(true); } else if(enteredPasswordValueAcceptable == false){ // Disabling login push button ui->login_pushButton->setEnabled(false); } } else if (validationResponse == false){ // Changing lineEdit border styles ui->emailAddress_lineEdit->setStyleSheet("border: 2px solid red;" "background-color: rgb(255, 255, 255);"); // Disabling login push button ui->login_pushButton->setEnabled(false); // Setting enteredEmailAddressValue to false as the entered email address value is not acceptable enteredEmailAddressValueAcceptable = false; } } // When the text in the 'password_lineEdit' changes void LoginWindow::on_password_lineEdit_textChanged(const QString &arg1) { // Checking whether the user entered password value is in the correct regular expression // arg1 = ui->password_lineEdit->text(); QString enteredPasswordValue = arg1; bool validationResponse = auth->validateEnteredPassword(enteredPasswordValue); if(validationResponse == true){ // Changing lineEdit border styles ui->password_lineEdit->setStyleSheet("border: 2px solid green;" "background-color: rgb(255, 255, 255);"); // Setting enteredPasswordValueAcceptable to true enteredPasswordValueAcceptable = true; // Checking whether the enteredEmailAddressValueAcceptable is also true to enable the login push button if(enteredEmailAddressValueAcceptable == true){ // Enabling login push button ui->login_pushButton->setEnabled(true); } else if(enteredEmailAddressValueAcceptable == false){ // Disabling login push button ui->login_pushButton->setEnabled(false); } } else if (validationResponse == false){ ui->password_lineEdit->setStyleSheet("border: 2px solid red;" "background-color: rgb(255, 255, 255);"); // Disabling login push button ui->login_pushButton->setEnabled(false); // Setting enteredPasswordValueAcceptable to false as the entered password value is not acceptable enteredPasswordValueAcceptable = false; } } // When the user clicks on the 'login_pushButton' void LoginWindow::on_login_pushButton_clicked() { QString enteredEmailAddress; // Setting entered password value if(enteredEmailAddressValueAcceptable == true){ // Retrieving the user entered password from the user interface enteredEmailAddress = ui->emailAddress_lineEdit->text(); } // Retrieving the user entered password from the user interface QString enteredPassword = ui->password_lineEdit->text(); QString enteredPasswordHash; if(enteredPasswordValueAcceptable == true){ // Generating hash value of entered password value enteredPasswordHash = QString::fromStdString(auth->generatePasswordHash(enteredPassword.toStdString())); } QString loginCredentialsVerification = auth->loginCredentialVerification(enteredEmailAddress, enteredPasswordHash); if(loginCredentialsVerification == "Verification Successful: Account Type: UserAccount"){ /* Recording session start */ QString sessionStartStatus = auth->addSessionStartToDB(); if(sessionStartStatus == "Session Start Recorded"){ this->hide(); userAccountWindowForm = new UserAccountWindow(auth->getLoginID(), this); userAccountWindowForm->show(); } else if(sessionStartStatus == "SQL Execution Failed"){ QMessageBox::critical(this, "LOGIN - SESSION START ERROR", "SQL query execution was unsuccessful, please submit a report including your email address."); } else if(sessionStartStatus == "Database Connectivity Failed"){ QMessageBox::critical(this, "LOGIN - SESSION START ERROR", "Database Connection has lost, please submit a report."); } } else if(loginCredentialsVerification == "Verification Successful: Account Type: AdminAccount"){ /* Recording session start */ QString sessionStartStatus = auth->addSessionStartToDB(); if(sessionStartStatus == "Session Start Recorded"){ this->hide(); adminAccountWindowForm = new AdminAccountWindow(auth->getLoginID(), this); adminAccountWindowForm->show(); } else if(sessionStartStatus == "SQL Execution Failed"){ QMessageBox::critical(this, "LOGIN - SESSION START ERROR", "SQL query execution was unsuccessful, please submit a report including your email address."); } else if(sessionStartStatus == "Database Connectivity Failed"){ QMessageBox::critical(this, "LOGIN - SESSION START ERROR", "Database Connection has lost, please submit a report."); } } else if(loginCredentialsVerification == "Verification Unsuccessful: Account Disabled"){ QMessageBox::critical(this, "LOGIN ERROR", "Account is disabled, please submit a report including your email address."); } else if(loginCredentialsVerification == "Verification Unsuccessful: Password Incorrect"){ QMessageBox::critical(this, "LOGIN ERROR", "Entered password is incorrect, please reenter the password."); } else if(loginCredentialsVerification == "Verification Unsuccessful: No Account Available with Entered Email Address"){ QMessageBox::critical(this, "LOGIN ERROR", "No Account Available with the Entered Credentials, please register to continue."); } else if(loginCredentialsVerification == "Verification Unsuccessful: Database Connection Error"){ QMessageBox::critical(this, "LOGIN ERROR", "Database Connection has lost, please submit a report."); } else if(loginCredentialsVerification == "Verification Unsuccessful: SQL query execution error"){ QMessageBox::critical(this, "LOGIN ERROR", "SQL query execution was unsuccessful, please submit a report including your email address."); } else if(loginCredentialsVerification == "default"){ QMessageBox::critical(this, "LOGIN ERROR", "Please submit a report including your email address."); } } // When the user clicks on the 'REGISTER' push button void LoginWindow::on_register_pushButton_clicked() { userRegistrationWindowForm = new UserRegistrationWindow(this); userRegistrationWindowForm->show(); } // When the user clicks on the 'REPORT' push button void LoginWindow::on_report_pushButton_clicked() { reportSubmissionWindowFrom = new ReportSubmissionWindow(this); reportSubmissionWindowFrom->show(); }
[ "hvlhasanka@students.nsbm.lk" ]
hvlhasanka@students.nsbm.lk
84fd1b3e1be797df3d0e3700b7629bc0d9f62d9e
87a80092039aefe85f6e1121f9c565a1dfbda20e
/w5/w5/Fraction.h
c2a53486db7009b7fd584872c6073a2b4b1c93f3
[]
no_license
asoke1/OOP244
b11733122dc4f388f1114fe301ca2370b0f1fd56
c009d2a5545087e0b7a806fa75d910f33024c0b1
refs/heads/master
2020-05-20T09:24:27.028082
2019-05-08T00:38:44
2019-05-08T00:38:44
185,499,848
2
1
null
null
null
null
UTF-8
C++
false
false
985
h
//add file header comments here /********************************************************** * Name : Abiodun Oke * Date : 2018/10/13 **********************************************************/ //header file guard #ifndef SICT_FRACTION_H #define SICT_FRACTION_H // create namespace namespace sict { // define the Fraction class class Fraction { // declare instance variables int m_num; int m_denom; // declare private member functions int max() const; int min() const; void reduce(); int gcd() const; void setEmpty(); public: //declare public member functions Fraction(); Fraction(int numerator, int denominator); bool isEmpty() const; void display() const; // declare operator overload Fraction operator+(const Fraction& rhs) const; Fraction operator*(const Fraction& rhs) const; bool operator==(const Fraction& rhs) const; bool operator!=(const Fraction& rhs) const; Fraction operator+=(const Fraction& rhs); }; } #endif
[ "abiodayor2002@hotmail.com" ]
abiodayor2002@hotmail.com
4ef742a9b883f598a5149c124d42d1799d1722d8
6baf1408e5d7f2fffe38af4b5b79ca091988a052
/cs225-c/POTD1/potd-q14/Pet.cpp
ad20dda8e456d8e5b9d756cd2e70271f56637992
[]
no_license
TakumiDawn/UIUC
8b70d0442db314b740d8c7ea5187fd78b0311781
544e56f44b51e1064b27444811eccb12a7328be9
refs/heads/master
2021-09-23T22:03:37.036034
2018-09-28T04:21:52
2018-09-28T04:21:52
148,235,100
0
0
null
null
null
null
UTF-8
C++
false
false
776
cpp
// Pet.cpp #include "Pet.h" using namespace std; Pet::Pet() : name_("Fluffy"), owner_name_("Cinda") {setType("cat"); setFood("fish");} Pet::Pet(string type, string food,string name,string on) : name_(name),owner_name_(on) { setType(type);setFood(food); } //Pet::Pet(string y, string f, string n,string o):Animal(y,f){ name_=n; owner_name_=o;} void Pet::setFood(string nu_food) { food_ = nu_food; } string Pet::getFood() { return food_; } void Pet::setOwnerName(string nu_on) { owner_name_ = nu_on; } string Pet::getOwnerName() { return owner_name_; } void Pet::setName(string nu_name) { name_ = nu_name; } string Pet::getName() { return name_; } string Pet::print() { return "My name is " + name_; }
[ "feiyang3@illinois.edu" ]
feiyang3@illinois.edu
f0d9858102ec82a2a845aa316611e3a81f77738c
b49710257dba46537f6cd3d74c7abb5d1dc37dfc
/base/milo/dtoa_milo.h
14e9537065eada1fe7d52ca9afc1a19b67981852
[ "MIT" ]
permissive
wxuier/co
34c4577d63ef74d5e84c65bed992827b8afc871e
3f5cd009da3d72ffd9b8f5c539c8ee285ba17c43
refs/heads/master
2022-06-07T17:39:38.361012
2020-05-10T06:07:37
2020-05-10T06:07:37
261,408,404
0
0
MIT
2020-05-05T09:06:27
2020-05-05T09:06:26
null
UTF-8
C++
false
false
17,073
h
/* * Copyright (C) 2014 Milo Yip * * 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. * * Modified by Alvin. 2020.4 */ #pragma once #include <assert.h> #include <math.h> #include <string.h> #include <stdint.h> #ifdef _MSC_VER #include <intrin.h> #endif #if (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) namespace gcc_ints { __extension__ typedef __int128 int128; __extension__ typedef unsigned __int128 uint128; } #endif #define UINT64_C2(h, l) ((static_cast<uint64_t>(h) << 32) | static_cast<uint64_t>(l)) struct DiyFp { DiyFp() {} DiyFp(uint64_t f, int e) : f(f), e(e) {} DiyFp(double d) { union { double d; uint64_t u64; } u = { d }; int biased_e = (u.u64 & kDpExponentMask) >> kDpSignificandSize; uint64_t significand = (u.u64 & kDpSignificandMask); if (biased_e != 0) { f = significand + kDpHiddenBit; e = biased_e - kDpExponentBias; } else { f = significand; e = kDpMinExponent + 1; } } DiyFp operator-(const DiyFp& rhs) const { assert(e == rhs.e); assert(f >= rhs.f); return DiyFp(f - rhs.f, e); } DiyFp operator*(const DiyFp& rhs) const { #if defined(_MSC_VER) && defined(_M_AMD64) uint64_t h; uint64_t l = _umul128(f, rhs.f, &h); if (l & (uint64_t(1) << 63)) h++; // rounding return DiyFp(h, e + rhs.e + 64); #elif (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 6)) && defined(__x86_64__) gcc_ints::uint128 p = static_cast<gcc_ints::uint128>(f) * static_cast<gcc_ints::uint128>(rhs.f); uint64_t h = p >> 64; uint64_t l = static_cast<uint64_t>(p); if (l & (uint64_t(1) << 63)) h++; // rounding return DiyFp(h, e + rhs.e + 64); #else const uint64_t M32 = 0xFFFFFFFF; const uint64_t a = f >> 32; const uint64_t b = f & M32; const uint64_t c = rhs.f >> 32; const uint64_t d = rhs.f & M32; const uint64_t ac = a * c; const uint64_t bc = b * c; const uint64_t ad = a * d; const uint64_t bd = b * d; uint64_t tmp = (bd >> 32) + (ad & M32) + (bc & M32); tmp += 1U << 31; /// mult_round return DiyFp(ac + (ad >> 32) + (bc >> 32) + (tmp >> 32), e + rhs.e + 64); #endif } DiyFp Normalize() const { #if defined(_MSC_VER) && defined(_M_AMD64) unsigned long index; _BitScanReverse64(&index, f); return DiyFp(f << (63 - index), e - (63 - index)); #elif defined(__GNUC__) int s = __builtin_clzll(f); return DiyFp(f << s, e - s); #else DiyFp res = *this; while (!(res.f & kDpHiddenBit)) { res.f <<= 1; res.e--; } res.f <<= (kDiySignificandSize - kDpSignificandSize - 1); res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 1); return res; #endif } DiyFp NormalizeBoundary() const { #if defined(_MSC_VER) && defined(_M_AMD64) unsigned long index; _BitScanReverse64(&index, f); return DiyFp (f << (63 - index), e - (63 - index)); #else DiyFp res = *this; while (!(res.f & (kDpHiddenBit << 1))) { res.f <<= 1; res.e--; } res.f <<= (kDiySignificandSize - kDpSignificandSize - 2); res.e = res.e - (kDiySignificandSize - kDpSignificandSize - 2); return res; #endif } void NormalizedBoundaries(DiyFp* minus, DiyFp* plus) const { DiyFp pl = DiyFp((f << 1) + 1, e - 1).NormalizeBoundary(); DiyFp mi = (f == kDpHiddenBit) ? DiyFp((f << 2) - 1, e - 2) : DiyFp((f << 1) - 1, e - 1); mi.f <<= mi.e - pl.e; mi.e = pl.e; *plus = pl; *minus = mi; } static const int kDiySignificandSize = 64; static const int kDpSignificandSize = 52; static const int kDpExponentBias = 0x3FF + kDpSignificandSize; static const int kDpMinExponent = -kDpExponentBias; static const uint64_t kDpExponentMask = UINT64_C2(0x7FF00000, 0x00000000); static const uint64_t kDpSignificandMask = UINT64_C2(0x000FFFFF, 0xFFFFFFFF); static const uint64_t kDpHiddenBit = UINT64_C2(0x00100000, 0x00000000); uint64_t f; int e; }; inline DiyFp GetCachedPower(int e, int* K) { // 10^-348, 10^-340, ..., 10^340 static const uint64_t kCachedPowers_F[] = { UINT64_C2(0xfa8fd5a0, 0x081c0288), UINT64_C2(0xbaaee17f, 0xa23ebf76), UINT64_C2(0x8b16fb20, 0x3055ac76), UINT64_C2(0xcf42894a, 0x5dce35ea), UINT64_C2(0x9a6bb0aa, 0x55653b2d), UINT64_C2(0xe61acf03, 0x3d1a45df), UINT64_C2(0xab70fe17, 0xc79ac6ca), UINT64_C2(0xff77b1fc, 0xbebcdc4f), UINT64_C2(0xbe5691ef, 0x416bd60c), UINT64_C2(0x8dd01fad, 0x907ffc3c), UINT64_C2(0xd3515c28, 0x31559a83), UINT64_C2(0x9d71ac8f, 0xada6c9b5), UINT64_C2(0xea9c2277, 0x23ee8bcb), UINT64_C2(0xaecc4991, 0x4078536d), UINT64_C2(0x823c1279, 0x5db6ce57), UINT64_C2(0xc2109436, 0x4dfb5637), UINT64_C2(0x9096ea6f, 0x3848984f), UINT64_C2(0xd77485cb, 0x25823ac7), UINT64_C2(0xa086cfcd, 0x97bf97f4), UINT64_C2(0xef340a98, 0x172aace5), UINT64_C2(0xb23867fb, 0x2a35b28e), UINT64_C2(0x84c8d4df, 0xd2c63f3b), UINT64_C2(0xc5dd4427, 0x1ad3cdba), UINT64_C2(0x936b9fce, 0xbb25c996), UINT64_C2(0xdbac6c24, 0x7d62a584), UINT64_C2(0xa3ab6658, 0x0d5fdaf6), UINT64_C2(0xf3e2f893, 0xdec3f126), UINT64_C2(0xb5b5ada8, 0xaaff80b8), UINT64_C2(0x87625f05, 0x6c7c4a8b), UINT64_C2(0xc9bcff60, 0x34c13053), UINT64_C2(0x964e858c, 0x91ba2655), UINT64_C2(0xdff97724, 0x70297ebd), UINT64_C2(0xa6dfbd9f, 0xb8e5b88f), UINT64_C2(0xf8a95fcf, 0x88747d94), UINT64_C2(0xb9447093, 0x8fa89bcf), UINT64_C2(0x8a08f0f8, 0xbf0f156b), UINT64_C2(0xcdb02555, 0x653131b6), UINT64_C2(0x993fe2c6, 0xd07b7fac), UINT64_C2(0xe45c10c4, 0x2a2b3b06), UINT64_C2(0xaa242499, 0x697392d3), UINT64_C2(0xfd87b5f2, 0x8300ca0e), UINT64_C2(0xbce50864, 0x92111aeb), UINT64_C2(0x8cbccc09, 0x6f5088cc), UINT64_C2(0xd1b71758, 0xe219652c), UINT64_C2(0x9c400000, 0x00000000), UINT64_C2(0xe8d4a510, 0x00000000), UINT64_C2(0xad78ebc5, 0xac620000), UINT64_C2(0x813f3978, 0xf8940984), UINT64_C2(0xc097ce7b, 0xc90715b3), UINT64_C2(0x8f7e32ce, 0x7bea5c70), UINT64_C2(0xd5d238a4, 0xabe98068), UINT64_C2(0x9f4f2726, 0x179a2245), UINT64_C2(0xed63a231, 0xd4c4fb27), UINT64_C2(0xb0de6538, 0x8cc8ada8), UINT64_C2(0x83c7088e, 0x1aab65db), UINT64_C2(0xc45d1df9, 0x42711d9a), UINT64_C2(0x924d692c, 0xa61be758), UINT64_C2(0xda01ee64, 0x1a708dea), UINT64_C2(0xa26da399, 0x9aef774a), UINT64_C2(0xf209787b, 0xb47d6b85), UINT64_C2(0xb454e4a1, 0x79dd1877), UINT64_C2(0x865b8692, 0x5b9bc5c2), UINT64_C2(0xc83553c5, 0xc8965d3d), UINT64_C2(0x952ab45c, 0xfa97a0b3), UINT64_C2(0xde469fbd, 0x99a05fe3), UINT64_C2(0xa59bc234, 0xdb398c25), UINT64_C2(0xf6c69a72, 0xa3989f5c), UINT64_C2(0xb7dcbf53, 0x54e9bece), UINT64_C2(0x88fcf317, 0xf22241e2), UINT64_C2(0xcc20ce9b, 0xd35c78a5), UINT64_C2(0x98165af3, 0x7b2153df), UINT64_C2(0xe2a0b5dc, 0x971f303a), UINT64_C2(0xa8d9d153, 0x5ce3b396), UINT64_C2(0xfb9b7cd9, 0xa4a7443c), UINT64_C2(0xbb764c4c, 0xa7a44410), UINT64_C2(0x8bab8eef, 0xb6409c1a), UINT64_C2(0xd01fef10, 0xa657842c), UINT64_C2(0x9b10a4e5, 0xe9913129), UINT64_C2(0xe7109bfb, 0xa19c0c9d), UINT64_C2(0xac2820d9, 0x623bf429), UINT64_C2(0x80444b5e, 0x7aa7cf85), UINT64_C2(0xbf21e440, 0x03acdd2d), UINT64_C2(0x8e679c2f, 0x5e44ff8f), UINT64_C2(0xd433179d, 0x9c8cb841), UINT64_C2(0x9e19db92, 0xb4e31ba9), UINT64_C2(0xeb96bf6e, 0xbadf77d9), UINT64_C2(0xaf87023b, 0x9bf0ee6b) }; static const int16_t kCachedPowers_E[] = { -1220, -1193, -1166, -1140, -1113, -1087, -1060, -1034, -1007, -980, -954, -927, -901, -874, -847, -821, -794, -768, -741, -715, -688, -661, -635, -608, -582, -555, -529, -502, -475, -449, -422, -396, -369, -343, -316, -289, -263, -236, -210, -183, -157, -130, -103, -77, -50, -24, 3, 30, 56, 83, 109, 136, 162, 189, 216, 242, 269, 295, 322, 348, 375, 402, 428, 455, 481, 508, 534, 561, 588, 614, 641, 667, 694, 720, 747, 774, 800, 827, 853, 880, 907, 933, 960, 986, 1013, 1039, 1066 }; //int k = static_cast<int>(ceil((-61 - e) * 0.30102999566398114)) + 374; double dk = (-61 - e) * 0.30102999566398114 + 347; // dk must be positive, so can do ceiling in positive int k = static_cast<int>(dk); if (dk - k > 0.0) k++; unsigned index = static_cast<unsigned>((k >> 3) + 1); *K = -(-348 + static_cast<int>(index << 3)); // decimal exponent no need lookup table assert(index < sizeof(kCachedPowers_F) / sizeof(kCachedPowers_F[0])); return DiyFp(kCachedPowers_F[index], kCachedPowers_E[index]); } inline void GrisuRound(char* buffer, int len, uint64_t delta, uint64_t rest, uint64_t ten_kappa, uint64_t wp_w) { while (rest < wp_w && delta - rest >= ten_kappa && (rest + ten_kappa < wp_w || /// closer wp_w - rest > rest + ten_kappa - wp_w)) { buffer[len - 1]--; rest += ten_kappa; } } inline unsigned CountDecimalDigit32(uint32_t n) { // Simple pure C++ implementation was faster than __builtin_clz version in this situation. if (n < 10) return 1; if (n < 100) return 2; if (n < 1000) return 3; if (n < 10000) return 4; if (n < 100000) return 5; if (n < 1000000) return 6; if (n < 10000000) return 7; if (n < 100000000) return 8; if (n < 1000000000) return 9; return 10; } inline void DigitGen(const DiyFp& W, const DiyFp& Mp, uint64_t delta, char* buffer, int* len, int* K) { static const uint32_t kPow10[] = { 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000, 1000000000 }; const DiyFp one(uint64_t(1) << -Mp.e, Mp.e); const DiyFp wp_w = Mp - W; uint32_t p1 = static_cast<uint32_t>(Mp.f >> -one.e); uint64_t p2 = Mp.f & (one.f - 1); int kappa = static_cast<int>(CountDecimalDigit32(p1)); *len = 0; while (kappa > 0) { uint32_t d; switch (kappa) { case 10: d = p1 / 1000000000; p1 %= 1000000000; break; case 9: d = p1 / 100000000; p1 %= 100000000; break; case 8: d = p1 / 10000000; p1 %= 10000000; break; case 7: d = p1 / 1000000; p1 %= 1000000; break; case 6: d = p1 / 100000; p1 %= 100000; break; case 5: d = p1 / 10000; p1 %= 10000; break; case 4: d = p1 / 1000; p1 %= 1000; break; case 3: d = p1 / 100; p1 %= 100; break; case 2: d = p1 / 10; p1 %= 10; break; case 1: d = p1; p1 = 0; break; default: #if defined(_MSC_VER) __assume(0); #elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) __builtin_unreachable(); #else d = 0; #endif } if (d || *len) buffer[(*len)++] = '0' + static_cast<char>(d); kappa--; uint64_t tmp = (static_cast<uint64_t>(p1) << -one.e) + p2; if (tmp <= delta) { *K += kappa; GrisuRound(buffer, *len, delta, tmp, static_cast<uint64_t>(kPow10[kappa]) << -one.e, wp_w.f); return; } } // kappa = 0 for (;;) { p2 *= 10; delta *= 10; char d = static_cast<char>(p2 >> -one.e); if (d || *len) buffer[(*len)++] = '0' + d; p2 &= one.f - 1; kappa--; if (p2 < delta) { *K += kappa; GrisuRound(buffer, *len, delta, p2, one.f, wp_w.f * kPow10[-kappa]); return; } } } inline void Grisu2(double value, char* buffer, int* length, int* K) { const DiyFp v(value); DiyFp w_m, w_p; v.NormalizedBoundaries(&w_m, &w_p); const DiyFp c_mk = GetCachedPower(w_p.e, K); const DiyFp W = v.Normalize() * c_mk; DiyFp Wp = w_p * c_mk; DiyFp Wm = w_m * c_mk; Wm.f++; Wp.f--; DigitGen(W, Wp, Wp.f - Wm.f, buffer, length, K); } inline const char* GetDigitsLut() { static const char cDigitsLut[200] = { '0', '0', '0', '1', '0', '2', '0', '3', '0', '4', '0', '5', '0', '6', '0', '7', '0', '8', '0', '9', '1', '0', '1', '1', '1', '2', '1', '3', '1', '4', '1', '5', '1', '6', '1', '7', '1', '8', '1', '9', '2', '0', '2', '1', '2', '2', '2', '3', '2', '4', '2', '5', '2', '6', '2', '7', '2', '8', '2', '9', '3', '0', '3', '1', '3', '2', '3', '3', '3', '4', '3', '5', '3', '6', '3', '7', '3', '8', '3', '9', '4', '0', '4', '1', '4', '2', '4', '3', '4', '4', '4', '5', '4', '6', '4', '7', '4', '8', '4', '9', '5', '0', '5', '1', '5', '2', '5', '3', '5', '4', '5', '5', '5', '6', '5', '7', '5', '8', '5', '9', '6', '0', '6', '1', '6', '2', '6', '3', '6', '4', '6', '5', '6', '6', '6', '7', '6', '8', '6', '9', '7', '0', '7', '1', '7', '2', '7', '3', '7', '4', '7', '5', '7', '6', '7', '7', '7', '8', '7', '9', '8', '0', '8', '1', '8', '2', '8', '3', '8', '4', '8', '5', '8', '6', '8', '7', '8', '8', '8', '9', '9', '0', '9', '1', '9', '2', '9', '3', '9', '4', '9', '5', '9', '6', '9', '7', '9', '8', '9', '9' }; return cDigitsLut; } inline char* WriteExponent(int K, char* buffer) { if (K < 0) { *buffer++ = '-'; K = -K; } if (K >= 100) { *buffer++ = '0' + static_cast<char>(K / 100); K %= 100; const char* d = GetDigitsLut() + K * 2; *buffer++ = d[0]; *buffer++ = d[1]; } else if (K >= 10) { const char* d = GetDigitsLut() + K * 2; *buffer++ = d[0]; *buffer++ = d[1]; } else *buffer++ = '0' + static_cast<char>(K); *buffer = '\0'; return buffer; } inline char* Prettify(char* buffer, int length, int k) { const int kk = length + k; // 10^(kk-1) <= v < 10^kk if (length <= kk && kk <= 21) { // 1234e7 -> 12340000000 for (int i = length; i < kk; i++) buffer[i] = '0'; buffer[kk] = '.'; buffer[kk + 1] = '0'; buffer[kk + 2] = '\0'; return buffer + kk + 2; } else if (0 < kk && kk <= 21) { // 1234e-2 -> 12.34 memmove(&buffer[kk + 1], &buffer[kk], length - kk); buffer[kk] = '.'; buffer[length + 1] = '\0'; return buffer + length + 1; } else if (-6 < kk && kk <= 0) { // 1234e-6 -> 0.001234 const int offset = 2 - kk; memmove(&buffer[offset], &buffer[0], length); buffer[0] = '0'; buffer[1] = '.'; for (int i = 2; i < offset; i++) buffer[i] = '0'; buffer[length + offset] = '\0'; return buffer + length + offset; } else if (length == 1) { // 1e30 buffer[1] = 'e'; return WriteExponent(kk - 1, &buffer[2]); } else { // 1234e30 -> 1.234e33 memmove(&buffer[2], &buffer[1], length - 1); buffer[1] = '.'; buffer[length + 1] = 'e'; return WriteExponent(kk - 1, &buffer[0 + length + 2]); } } inline int dtoa_milo(double value, char* buffer) { // Not handling NaN and inf //assert(!isnan(value)); //assert(!isinf(value)); if (value == 0) { buffer[0] = '0'; buffer[1] = '.'; buffer[2] = '0'; buffer[3] = '\0'; return 3; } else { char* p = buffer; if (value < 0) { *buffer++ = '-'; value = -value; } int length, K; Grisu2(value, buffer, &length, &K); return static_cast<int>(Prettify(buffer, length, K) - p); } }
[ "idealvin@qq.com" ]
idealvin@qq.com
c74e31bb56e1a21092131f64df2975479b6f55bc
67483e8a2242803fef618814cd2c9a3b9a812db6
/blob/src/caffe/blob.cpp
2f904e6341e8390be6fb931141748770a5b34196
[]
no_license
tao2882038/caffe_Component
54e949568d24cb619280555405fbeba561ad3b56
30f0d20b8a54cf00779a4e09e4b4525645bb1e72
refs/heads/master
2020-04-26T16:58:46.429362
2019-03-04T07:57:04
2019-03-04T07:57:04
173,698,002
1
1
null
null
null
null
UTF-8
C++
false
false
2,527
cpp
#include <climits> #include <vector> #include "caffe/blob.hpp" #include "caffe/common.hpp" #include "caffe/syncedmem.hpp" //#include "caffe/util/math_functions.hpp" namespace caffe { template <typename Dtype> Blob<Dtype>::Blob(const vector<int>& shape) // capacity_ must be initialized before calling Reshape : capacity_(0) { Reshape(shape); } template <typename Dtype> void Blob<Dtype>::Reshape(const vector<int>& shape) { CHECK_LE(shape.size(), kMaxBlobAxes); count_ = 1; shape_.resize(shape.size()); if (!shape_data_ || shape_data_->size() < shape.size() * sizeof(int)) { shape_data_.reset(new SyncedMemory(shape.size() * sizeof(int))); } int* shape_data = static_cast<int*>(shape_data_->mutable_cpu_data()); for (int i = 0; i < shape.size(); ++i) { CHECK_GT(shape[i], 0); if (count_ != 0) { CHECK_LE(shape[i], INT_MAX / count_) << "blob size exceeds INT_MAX"; } count_ *= shape[i]; shape_[i] = shape[i]; shape_data[i] = shape[i]; } if (count_ > capacity_) { capacity_ = count_; data_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); diff_.reset(new SyncedMemory(capacity_ * sizeof(Dtype))); } } template <typename Dtype> void Blob<Dtype>::ReshapeLike(const Blob<Dtype>& other) { Reshape(other.shape()); } template <typename Dtype> void Blob<Dtype>::check_error() { CHECK_GT(0,0); } template <typename Dtype> const Dtype* Blob<Dtype>::cpu_data() const { CHECK(data_); return (const Dtype*)data_->cpu_data(); } template <typename Dtype> const Dtype* Blob<Dtype>::gpu_data() const { CHECK(data_); return (const Dtype*)data_->gpu_data(); } template <typename Dtype> const Dtype* Blob<Dtype>::cpu_diff() const { CHECK(diff_); return (const Dtype*)diff_->cpu_data(); } template <typename Dtype> const Dtype* Blob<Dtype>::gpu_diff() const { CHECK(diff_); return (const Dtype*)diff_->gpu_data(); } template <typename Dtype> Dtype* Blob<Dtype>::mutable_cpu_data() { CHECK(data_); return static_cast<Dtype*>(data_->mutable_cpu_data()); } template <typename Dtype> Dtype* Blob<Dtype>::mutable_gpu_data() { CHECK(data_); return static_cast<Dtype*>(data_->mutable_gpu_data()); } template <typename Dtype> Dtype* Blob<Dtype>::mutable_cpu_diff() { CHECK(diff_); return static_cast<Dtype*>(diff_->mutable_cpu_data()); } template <typename Dtype> Dtype* Blob<Dtype>::mutable_gpu_diff() { CHECK(diff_); return static_cast<Dtype*>(diff_->mutable_gpu_data()); } INSTANTIATE_CLASS(Blob); } // namespace caffe
[ "634332216@qq.com" ]
634332216@qq.com
83a37c307055304c137314fd3ceec345f28e94e5
20933700bd5cd75d6e9db44b3aad3d6088f18beb
/155.最小栈.cpp
0062c9ca952afd3902a2d0ec3b943f21c141ee24
[]
no_license
llk2why/leetcode
6d994c5d0aa453a91c4145863278b10272105e82
c96bc85e2763e7374cd2b6cefef92a1f4bbd548a
refs/heads/master
2020-09-08T19:31:07.264375
2020-05-22T15:22:26
2020-05-22T15:22:26
221,225,076
0
0
null
null
null
null
UTF-8
C++
false
false
796
cpp
/* * @lc app=leetcode.cn id=155 lang=cpp * * [155] 最小栈 */ // @lc code=start class MinStack { public: /** initialize your data structure here. */ int sz; bool flag; vector<pair<int,int> > s; MinStack() { sz = 0; } void push(int x) { if(!sz)s.push_back({x,x}); else s.push_back({x,min(x,s[sz-1].second)}); sz++; } void pop() { s.pop_back(); sz--; } int top() { return s[sz-1].first; } int getMin() { return s[sz-1].second; } }; /** * Your MinStack object will be instantiated and called as such: * MinStack* obj = new MinStack(); * obj->push(x); * obj->pop(); * int param_3 = obj->top(); * int param_4 = obj->getMin(); */ // @lc code=end
[ "lincolnllklee@163.com" ]
lincolnllklee@163.com
8ebe83c09fcb2cb5febc3d72afe9b200f32d8926
ff4d4757d9c811510c8c755901ef4d4c361cd731
/Tools/ADsdk/ADefx/Lowpass/myefx.cpp
f5c9b46f9bd682c2b6cb0568c5d11936966fac74
[ "LicenseRef-scancode-public-domain" ]
permissive
ApocalypseDesign/ad_public
4b6a623885808625b54b2888e79b7e2e1f834ac3
4c6a2759395a3ad36e072ffed79a7d9b48da219c
refs/heads/master
2020-06-01T02:12:11.640297
2013-05-31T19:53:30
2013-05-31T19:53:30
9,555,519
1
0
null
null
null
null
ISO-8859-1
C++
false
false
14,896
cpp
#include "myefx.h" #include <math.h> // LOWPASS FILTER by HERE // ndHere: per iniziare premetto: (TURBO && SKA) SUXXX ;) // ora posso iniziare a codare con design... void myefx::defineControllers(tChannel *defaultChannel) { // immagini in input/output: addChannel(defaultChannel,"Out","canale in input/output"); // proprietà dell'effetto: ctIntLinear *defaultWindowSize[1]; int *pippo[1]; pippo[0]=new int; *pippo[0]=2; defaultWindowSize[0]=new ctIntLinear(); defaultWindowSize[0]->keys->keyAdd(0,pippo[0]); addProperty(defaultWindowSize[0],"Window-size","intensità della sfocatura (1..15)"); } void myefx::updateControllers() { // immagini in input/output: timageInOut=getChannelImage("Out"); // controllers in input: windowSize = (ctInt *)getProperty("Window-size"); } void myefx::init() { // niente init, io rullezzo troppo per fare cose suxanti come gli init initialized=true; } void myefx::free() { // free non necessario initialized=false; } /* FUNZIONAMENTO: I comuni mortali per fare un lowpass prendono per ogni pixel il quadrato di pixel adiacenti, fanno la media e scrivono al centro il pixel risultante sono: lato*lato*3 addizioni (3 percè ho r, g, b) e 3 divisioni x pixel ma soprattutto un numero esagerato di letture in memoria che suxano a priori la prima idea è di mantenere in una variabile la media, e a ogni pixel aggiornare la media sommandoci la media pesata dei pixel a destra e sottraendo la media pesata dei pixel a sinistra ma rimangono ancora tante letture inutili... allora faccio così: ogni volta che calcolo la media pesata dei pixel a destra mi metto questa media in una fifo, in modo da poter sapere al passo n, senza ricalcolare nulla, quale è il valore da togliere alla media al passo n+lato inoltre ai fini dell'ottimizzazione l'immagine viene scomposta in 9 parti: ------------------------ | | | | | 1 | 2 | 3 | ------------------------ | | | | | | | | | | | | | 4 | 5 | 6 | ------------------------ | | | | | 7 | 8 | 9 | ------------------------ x ogni parte c'è un loop differente perchè quando si è sui bordi si rischierebbe di leggere fuori dal buffer, per non aggiungere troppi controlli ho fatto nove loops differenti, in questo modo ho anche fatto in modo che ai bordi i pixel vengono idealmente ripetuti all'infinito, come succede nel photoskiop e simili I ROX YOU SUX, Here 2001 // P.S. qualità migliorata facendo i calcoli in fixedpoint 16.16 // ora praticamente non ci sono approssimazioni visibili */ void myefx::paint(double pos) { int window=windowSize->getValue(float(pos)); if (window<=0) return; int total_window=(window<<1)+1; if (total_window>MAX_LOWPASS_WINDOW) return; int square_total_window=total_window*total_window; image* image = timageInOut; int x,y,i,j,r_sum,g_sum,b_sum; int r_med,g_med,b_med; r_med=g_med=b_med=0; i=0; //********************************************************************* for(y=0; y<window; y++) // loop iniziale delle y { // preparo tutto in modo da ripetere i pixel al bordo sinistro // *** ZONA 1 *** r_sum=g_sum=b_sum=0; for (j=y-window; j<0; j++) { r_sum+=((image->uint32ptr[0])>>16) & 0xFF; g_sum+=((image->uint32ptr[0])>>8) & 0xFF; b_sum+=(image->uint32ptr[0]) & 0xFF; } for(j=0; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->muly[j]]) & 0xFF; } val[0][0]=(r_sum<<16)/square_total_window; val[0][1]=(g_sum<<16)/square_total_window; val[0][2]=(b_sum<<16)/square_total_window; for(j=1; j<=window; j++) memcpy(val[j],val[0],12); for (x=1; x<=window; x++) { r_sum=g_sum=b_sum=0; for (j=y-window; j<0; j++) { r_sum+=((image->uint32ptr[x])>>16) & 0xFF; g_sum+=((image->uint32ptr[x])>>8) & 0xFF; b_sum+=(image->uint32ptr[x]) & 0xFF; } for(j=0; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+image->muly[j]]) & 0xFF; } val[window+x][0]=(r_sum<<16)/square_total_window; val[window+x][1]=(g_sum<<16)/square_total_window; val[window+x][2]=(b_sum<<16)/square_total_window; } r_med=g_med=b_med=0; for (x=0; x<total_window; x++) { r_med+=val[x][0]; g_med+=val[x][1]; b_med+=val[x][2]; } i=0; // ok, ora i valori sono messi in modo che al bordo i valori si ripetono for(x=0; x<image->width-window-1; x++) // loop principale delle x { // *** ZONA 2 *** r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for (j=y-window; j<0; j++) { r_sum+=((image->uint32ptr[x+window])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+window])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+window]) & 0xFF; } for(j=0; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+window+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+window+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+window+image->muly[j]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; image->uint32ptr[x+image->muly[y]]=(r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS i++; if (i>=total_window) i-=total_window; } // fine loop principale delle x // ora ripeto i pixel anche al bordo destro for(x=image->width-window-1; x<image->width; x++) // loop finale delle x { // *** ZONA 3 *** r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for (j=y-window; j<0; j++) { r_sum+=((image->uint32ptr[image->width-1])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->width-1])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->width-1]) & 0xFF; } for(j=0; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->width-1+image->muly[j]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; image->uint32ptr[x+image->muly[y]]=(r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS i++; if (i>=total_window) i-=total_window; } // fine loop finale delle x } // fine loop iniziale delle y //********************************************************************* for(y=window; y<image->height-window-1; y++) // loop principale delle y { // preparao tutto in modo da ripetere i pixel al bordo sinistro // *** ZONA 4 *** r_sum=g_sum=b_sum=0; for(j=y-window; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->muly[j]]) & 0xFF; } val[0][0]=(r_sum<<16)/square_total_window; val[0][1]=(g_sum<<16)/square_total_window; val[0][2]=(b_sum<<16)/square_total_window; for(j=1; j<=window; j++) memcpy(val[j],val[0],12); for (x=1; x<=window; x++) { r_sum=g_sum=b_sum=0; for(j=y-window; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+image->muly[j]]) & 0xFF; } val[window+x][0]=(r_sum<<16)/square_total_window; val[window+x][1]=(g_sum<<16)/square_total_window; val[window+x][2]=(b_sum<<16)/square_total_window; } r_med=g_med=b_med=0; for (x=0; x<total_window; x++) { r_med+=val[x][0]; g_med+=val[x][1]; b_med+=val[x][2]; } i=0; // ok, ora i valori sono messi in modo che al bordo i valori si ripetono for(x=0; x<image->width-window-1; x++) // loop principale delle x { // *** ZONA 5 *** (la + importante come ottimizzazione) r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for(j=y-window; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+window+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+window+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+window+image->muly[j]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; /* r_sum=((((image->uint32ptr[x+image->muly[y]])>>16) & 0xFF)<<1) - r_med; g_sum=((((image->uint32ptr[x+image->muly[y]])>>8) & 0xFF)<<1) - g_med; b_sum=(((image->uint32ptr[x+image->muly[y]]) & 0xFF)<<1) - b_med; // r_sum=r_med -(((image->uint32ptr[x+image->muly[y]])>>16) & 0xFF) ; // g_sum=g_med - (((image->uint32ptr[x+image->muly[y]])>>8) & 0xFF); // b_sum=b_med -((image->uint32ptr[x+image->muly[y]]) & 0xFF); r_sum=abs(r_sum); g_sum=abs(g_sum); b_sum=abs(b_sum); */ image->uint32ptr[x+image->muly[y]]= (r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS //((((r_med<<16)+(g_med<<8)+b_med)&0xFEFEFE)>>1)+ //LOWPASS/BLUR50% //((image->uint32ptr[x+image->muly[y]]&0xFEFEFE)>>1); //(r_sum<<16)+(g_sum<<8)+b_sum; i++; if (i>=total_window) i-=total_window; } // fine loop principale delle x // ora ripeto i pixel anche al bordo destro for(x=image->width-window-1; x<image->width; x++) // loop finale delle x { // *** ZONA 6 *** r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for(j=y-window; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->width-1+image->muly[j]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; image->uint32ptr[x+image->muly[y]]=(r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS i++; if (i>=total_window) i-=total_window; } // fine loop finale delle x } // fine loop principale delle y //*********************************************************************** for(y=image->height-window-1; y<image->height; y++) // loop finale delle y { // preparao tutto in modo da ripetere i pixel al bordo sinistro // *** ZONA 7 *** r_sum=g_sum=b_sum=0; for(j=y-window; j<image->height; j++) { r_sum+=((image->uint32ptr[image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->muly[j]]) & 0xFF; } for(j=image->height; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->muly[image->height-1]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->muly[image->height-1]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->muly[image->height-1]]) & 0xFF; } val[0][0]=(r_sum<<16)/square_total_window; val[0][1]=(g_sum<<16)/square_total_window; val[0][2]=(b_sum<<16)/square_total_window; for(j=1; j<=window; j++) memcpy(val[j],val[0],12); for (x=1; x<=window; x++) { r_sum=g_sum=b_sum=0; for(j=y-window; j<image->height; j++) { r_sum+=((image->uint32ptr[x+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+image->muly[j]]) & 0xFF; } for(j=image->height; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+image->muly[image->height-1]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+image->muly[image->height-1]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+image->muly[image->height-1]]) & 0xFF; } val[window+x][0]=(r_sum<<16)/square_total_window; val[window+x][1]=(g_sum<<16)/square_total_window; val[window+x][2]=(b_sum<<16)/square_total_window; } r_med=g_med=b_med=0; for (x=0; x<total_window; x++) { r_med+=val[x][0]; g_med+=val[x][1]; b_med+=val[x][2]; } i=0; // ok, ora i valori sono messi in modo che al bordo i valori si ripetono for(x=0; x<image->width-window-1; x++) // loop principale delle x { // *** ZONA 8 *** r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for(j=y-window; j<image->height; j++) { r_sum+=((image->uint32ptr[x+window+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+window+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+window+image->muly[j]]) & 0xFF; } for(j=image->height; j<=y+window; j++) { r_sum+=((image->uint32ptr[x+window+image->muly[image->height-1]])>>16) & 0xFF; g_sum+=((image->uint32ptr[x+window+image->muly[image->height-1]])>>8) & 0xFF; b_sum+=(image->uint32ptr[x+window+image->muly[image->height-1]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; image->uint32ptr[x+image->muly[y]]=(r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS i++; if (i>=total_window) i-=total_window; } // fine loop principale delle x // ora ripeto i pixel anche al bordo destro for(x=image->width-window-1; x<image->width; x++) // loop finale delle x { // *** ZONA 9 *** r_med-=val[i][0]; g_med-=val[i][1]; b_med-=val[i][2]; r_sum=g_sum=b_sum=0; for(j=y-window; j<image->height; j++) { r_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->width-1+image->muly[j]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->width-1+image->muly[j]]) & 0xFF; } for(j=image->height; j<=y+window; j++) { r_sum+=((image->uint32ptr[image->width-1+image->muly[image->height-1]])>>16) & 0xFF; g_sum+=((image->uint32ptr[image->width-1+image->muly[image->height-1]])>>8) & 0xFF; b_sum+=(image->uint32ptr[image->width-1+image->muly[image->height-1]]) & 0xFF; } val[i][0]=(r_sum<<16)/square_total_window; val[i][1]=(g_sum<<16)/square_total_window; val[i][2]=(b_sum<<16)/square_total_window; r_med+=val[i][0]; g_med+=val[i][1]; b_med+=val[i][2]; image->uint32ptr[x+image->muly[y]]=(r_med & 0xFF0000)+((g_med>>8) & 0xFF00)+(b_med>>16); //LOWPASS i++; if (i>=total_window) i-=total_window; } // fine loop finale delle x } // fine loop finale delle y }
[ "r.gerosa@gmail.com" ]
r.gerosa@gmail.com
acc030f172cd7ab256f7e4aa0986aab2e45b721d
261ff029c1355a8a1f74a46f76155bc44ca2f44b
/Client/Codes/Logo.cpp
075c5564bd65b2074f5346e332a2c9c38fb47b0c
[]
no_license
bisily/DirectX3D_Personal_-portfolio
39aa054f60228e703a6d942a7df94a9faaa7a00a
e06878690793d103273f2b50213a92bdfb923b33
refs/heads/master
2022-11-26T11:51:29.985373
2020-08-04T09:17:09
2020-08-04T09:17:09
284,932,529
0
0
null
null
null
null
UTF-8
C++
false
false
2,377
cpp
#include "stdafx.h" #include "Logo.h" #include "Export_Function.h" #include "BackGround.h" #include "Stage.h" CLogo::CLogo(LPDIRECT3DDEVICE9 pGraphicDev) : Engine::CScene(pGraphicDev) { } CLogo::~CLogo() { } HRESULT CLogo::Ready_Scene() { if (FAILED(Engine::CScene::Ready_Scene())) return E_FAIL; if (FAILED(Ready_Resources())) return E_FAIL; if (FAILED(Ready_Layer_GameLogic(L"Layer_GameLogic"))) return E_FAIL; m_pLoading = CLoading::Create(m_pGraphicDev, CLoading::LOADING_STAGE); NULL_CHECK_RETURN(m_pLoading, E_FAIL); return S_OK; } _int CLogo::Update_Scene(const _float& fTimeDelta) { _int iExit = Engine::CScene::Update_Scene(fTimeDelta); if (true == m_pLoading->Get_Finish()) { if (GetAsyncKeyState(VK_SPACE) & 0x8000) { Engine::CScene* pScene = NULL; pScene = CStage::Create(m_pGraphicDev); NULL_CHECK_RETURN(pScene, E_FAIL); if (FAILED(Engine::SetUp_CurrentScene(pScene))) return E_FAIL; } } return 0; } void CLogo::Render_Scene() { if (FAILED(SetUp_DefaultSetting())) return; Engine::Render_Font(L"Font_Default", m_pLoading->Get_String(), &_vec2(0.f, 0.f), D3DXCOLOR(1.f, 1.f, 1.f, 1.f)); } HRESULT CLogo::Ready_Layer_GameLogic(const _tchar* pLayerTag) { Engine::CLayer* pLayer = Engine::CLayer::Create(); NULL_CHECK_RETURN(pLayer, E_FAIL); Engine::CGameObject* pGameObject = nullptr; // For.BackGround Logo Instance pGameObject = CBackGround::Create(m_pGraphicDev); if (nullptr == pGameObject) goto except; if (FAILED(pLayer->Add_GameObject(L"BackGround", pGameObject))) goto except; m_mapLayer.insert(MAPLAYER::value_type(pLayerTag, pLayer)); return S_OK; except: Engine::Safe_Release(pLayer); return E_FAIL; } HRESULT CLogo::Ready_Resources() { if (FAILED(Engine::Ready_Textures(m_pGraphicDev, RESOURCE_LOGO, L"Texture_Logo", Engine::CTexture::TYPE_NORMAL, L"../../Resources/Texture/Logo/Logo_0%d.jpg", 7))) { return E_FAIL; } return S_OK; } HRESULT CLogo::SetUp_DefaultSetting() { m_pGraphicDev->SetRenderState(D3DRS_LIGHTING, TRUE); return S_OK; } CLogo* CLogo::Create(LPDIRECT3DDEVICE9 pGraphicDev) { CLogo* pInstance = new CLogo(pGraphicDev); if (FAILED(pInstance->Ready_Scene())) Engine::Safe_Release(pInstance); return pInstance; } void CLogo::Free() { Engine::Safe_Release(m_pLoading); Engine::CScene::Free(); }
[ "mnopw2@naver.com" ]
mnopw2@naver.com
a40ef14d941808e9c5b6d9baa936b9a4f547e696
e0a0d45181c1d0b0f0aa3d4dd977fc7bec4d21bb
/util/optional.hh
005ac9ec16e869348fa84f8a0f9dbb161491be71
[ "MIT" ]
permissive
jpanikulam/experiments
71004ff701f4552c932eb6958a0bcd3de76ee383
be36319a89f8baee54d7fa7618b885edb7025478
refs/heads/master
2021-01-12T01:35:15.817397
2020-01-24T00:59:12
2020-01-24T00:59:17
78,386,199
1
1
MIT
2018-12-29T00:54:28
2017-01-09T02:24:16
C++
UTF-8
C++
false
false
109
hh
#pragma once #include <optional> namespace jcc { template <typename T> using Optional = std::optional<T>; }
[ "jpanikul@gmail.com" ]
jpanikul@gmail.com
21c229d380ffe32cc84557e88549e0631e5e6ce5
e0d906c1e84c1f83a3da27db086aab7b7b4212af
/LevelEditor/LevelEditor/Camera.h
607075cc50516565e09a12158af689b3e606a13c
[]
no_license
StarikTenger/SpaceSodomyOnline
8904034c5ec400e17404f6e41bafb9da5fe7d2ff
cdbe6975d293bd214f8a591cbe5dfba4ea415a5d
refs/heads/master
2023-02-09T04:53:11.604384
2020-12-30T19:02:45
2020-12-30T19:02:45
237,202,605
3
5
null
2020-12-30T18:55:32
2020-01-30T11:51:53
C++
UTF-8
C++
false
false
269
h
#pragma once #include "geometry.h" class Camera{ public: Vector2d pos; Vector2d border; double angle = 0; double scale = 30; double scaleVel = 2; Camera(); Camera(Vector2d _pos, Vector2d _border, double _scale); Vector2d transform(Vector2d p); ~Camera(); };
[ "stariktenger@gmail.com" ]
stariktenger@gmail.com
7a74831fee7dd7794e0f8293e5f71f8bf781fc9f
7e6c8ddf8dc7ae224cfddb3b0e014ec684b58cb5
/week-04/day-2/GreenFoxOrganization/Cohort.h
51ad8f9c4f8ed39b2e1ca13bb8ac6a1bcf6795e0
[]
no_license
green-fox-academy/zbory
b5d9cc8bdf11130870369325e4036b4a9f6ee7d3
82594edf092ba3ad4af6267605d742335c60b7ee
refs/heads/master
2020-05-04T10:23:41.883149
2019-07-10T07:44:53
2019-07-10T07:44:53
179,086,636
1
0
null
null
null
null
UTF-8
C++
false
false
455
h
// // Created by zbora on 2019-04-23. // #include "Student.h" #include "Mentor.h" #ifndef GREENFOXORGANIZATION_COHORT_H #define GREENFOXORGANIZATION_COHORT_H class Cohort { public: Cohort(std::string name); void addStudent(Student* student); void addMentor(Mentor* mentor); void info(); private: std::string name; std::vector<Student> students; std::vector<Mentor> mentors; }; #endif //GREENFOXORGANIZATION_COHORT_H
[ "zborayb@gmail.com" ]
zborayb@gmail.com
5beece5ff375897689a2d6ffe7cb2e9aebcc22c4
39f0480a7b027050cc31abd468f30cfb2173908c
/kgraph.h
a3e5aaf352b3ed3a0ef5197467c515849af26930
[ "BSD-2-Clause" ]
permissive
aaalgo/kgraph
9773cb9458043c9510a11252a1de5fa6826b1f87
2143fd6b7aad2f044f36ef3289a6c5b9baf90b4b
refs/heads/master
2023-08-22T01:30:13.365432
2023-06-01T20:47:13
2023-06-01T20:47:13
36,503,514
368
96
BSD-2-Clause
2021-09-10T16:05:28
2015-05-29T12:38:24
C++
UTF-8
C++
false
false
11,240
h
// Copyright (C) 2013-2015 Wei Dong <wdong@wdong.org>. All Rights Reserved. // // \mainpage KGraph: A Library for Efficient K-NN Search // \author Wei Dong \f$ wdong@wdong.org \f$ // \author 2013-2015 // #ifndef WDONG_KGRAPH #define WDONG_KGRAPH #include <stdexcept> namespace kgraph { static unsigned const default_iterations = 30; static unsigned const default_L = 100; static unsigned const default_K = 25; static unsigned const default_P = 100; static unsigned const default_M = 0; static unsigned const default_T = 1; static unsigned const default_S = 10; static unsigned const default_R = 100; static unsigned const default_controls = 100; static unsigned const default_seed = 1998; static float const default_delta = 0.002; static float const default_recall = 0.99; static float const default_epsilon = 1e30; static unsigned const default_verbosity = 1; enum { PRUNE_LEVEL_1 = 1, PRUNE_LEVEL_2 = 2 }; enum { REVERSE_AUTO = -1, REVERSE_NONE = 0, }; static unsigned const default_prune = 0; static int const default_reverse = REVERSE_NONE; /// Verbosity control /** Set verbosity = 0 to disable information output to stderr. */ extern unsigned verbosity; /// Index oracle /** The index oracle is the user-supplied plugin that computes * the distance between two arbitrary objects in the dataset. * It is used for offline k-NN graph construction. */ class IndexOracle { public: /// Returns the size of the dataset. virtual unsigned size () const = 0; /// Computes similarity /** * 0 <= i, j < size() are the index of two objects in the dataset. * This method return the distance between objects i and j. */ virtual float operator () (unsigned i, unsigned j) const = 0; }; /// Search oracle /** The search oracle is the user-supplied plugin that computes * the distance between the query and a arbitrary object in the dataset. * It is used for online k-NN search. */ class SearchOracle { public: /// Returns the size of the dataset. virtual unsigned size () const = 0; /// Computes similarity /** * 0 <= i < size() are the index of an objects in the dataset. * This method return the distance between the query and object i. */ virtual float operator () (unsigned i) const = 0; /// Search with brutal force. /** * Search results are guaranteed to be ranked in ascending order of distance. * * @param K Return at most K nearest neighbors. * @param epsilon Only returns nearest neighbors within distance epsilon. * @param ids Pointer to the memory where neighbor IDs are returned. * @param dists Pointer to the memory where distance values are returned, can be nullptr. */ unsigned search (unsigned K, float epsilon, unsigned *ids, float *dists = nullptr) const; }; /// The KGraph index. /** This is an abstract base class. Use KGraph::create to create an instance. */ class KGraph { public: /// Indexing parameters. struct IndexParams { unsigned iterations; unsigned L; unsigned K; unsigned S; unsigned R; unsigned controls; unsigned seed; float delta; float recall; unsigned prune; int reverse; /// Construct with default values. IndexParams (): iterations(default_iterations), L(default_L), K(default_K), S(default_S), R(default_R), controls(default_controls), seed(default_seed), delta(default_delta), recall(default_recall), prune(default_prune), reverse(default_reverse) { } }; /// Search parameters. struct SearchParams { unsigned K; unsigned M; unsigned P; unsigned S; unsigned T; float epsilon; unsigned seed; unsigned init; /// Construct with default values. SearchParams (): K(default_K), M(default_M), P(default_P), S(default_S), T(default_T), epsilon(default_epsilon), seed(1998), init(0) { } }; enum { FORMAT_DEFAULT = 0, FORMAT_NO_DIST = 1, FORMAT_TEXT = 128 }; /// Information and statistics of the indexing algorithm. struct IndexInfo { enum StopCondition { ITERATION = 0, DELTA, RECALL } stop_condition; unsigned iterations; float cost; float recall; float accuracy; float delta; float M; }; /// Information and statistics of the search algorithm. struct SearchInfo { float cost; unsigned updates; }; virtual ~KGraph () { } /// Load index from file. /** * @param path Path to the index file. */ virtual void load (char const *path) = 0; /// Save index to file. /** * @param path Path to the index file. */ virtual void save (char const *path, int format = FORMAT_DEFAULT) const = 0; // save to file /// Build the index virtual void build (IndexOracle const &oracle, IndexParams const &params, IndexInfo *info = 0) = 0; /// Prune the index /** * Pruning makes the index smaller to save memory, and makes online search on the pruned index faster. * (The cost parameters of online search must be enlarged so accuracy is not reduced.) * * Currently only two pruning levels are supported: * - PRUNE_LEVEL_1 = 1: Only reduces index size, fast. * - PRUNE_LEVEL_2 = 2: For improve online search speed, slow. * * No pruning is done if level = 0. */ virtual void prune (IndexOracle const &oracle, unsigned level) = 0; /// Online k-NN search. /** * Search results are guaranteed to be ranked in ascending order of distance. * * @param ids Pointer to the memory where neighbor IDs are stored, must have space to save params.K ids. */ unsigned search (SearchOracle const &oracle, SearchParams const &params, unsigned *ids, SearchInfo *info = 0) const { return search(oracle, params, ids, nullptr, info); } /// Online k-NN search. /** * Search results are guaranteed to be ranked in ascending order of distance. * * @param ids Pointer to the memory where neighbor IDs are stored, must have space to save params.K values. * @param dists Pointer to the memory where distances are stored, must have space to save params.K values. */ virtual unsigned search (SearchOracle const &oracle, SearchParams const &params, unsigned *ids, float *dists, SearchInfo *info) const = 0; /// Constructor. static KGraph *create (); /// Returns version string. static char const* version (); /// Get offline computed k-NNs of a given object. /** * See the full version of get_nn. */ virtual void get_nn (unsigned id, unsigned *nns, unsigned *M, unsigned *L) const { get_nn(id, nns, nullptr, M, L); } /// Get offline computed k-NNs of a given object. /** * The user must provide space to save IndexParams::L values. * The actually returned L could be smaller than IndexParams::L, and * M <= L is the number of neighbors KGraph thinks * could be most useful for online search, and is usually < L. * If the index has been pruned, the returned L could be smaller than * IndexParams::L used to construct the index. * * @params id Object ID whose neighbor information are returned. * @params nns Neighbor IDs, must have space to save IndexParams::L values. * @params dists Distance values, must have space to save IndexParams::L values. * @params M Useful number of neighbors, output only. * @params L Actually returned number of neighbors, output only. */ virtual void get_nn (unsigned id, unsigned *nns, float *dists, unsigned *M, unsigned *L) const = 0; virtual void reverse (int) = 0; }; } #if __cplusplus > 199711L #include <functional> namespace kgraph { /// Oracle adapter for datasets stored in a vector-like container. /** * If the dataset is stored in a container of CONTAINER_TYPE that supports * - a size() method that returns the number of objects. * - a [] operator that returns the const reference to an object. * This class can be used to provide a wrapper to facilitate creating * the index and search oracles. * * The user must provide a callback function that takes in two * const references to objects and returns a distance value. */ template <typename CONTAINER_TYPE, typename OBJECT_TYPE> class VectorOracle: public IndexOracle { public: typedef std::function<float(OBJECT_TYPE const &, OBJECT_TYPE const &)> METRIC_TYPE; private: CONTAINER_TYPE const &data; METRIC_TYPE dist; public: class VectorSearchOracle: public SearchOracle { CONTAINER_TYPE const &data; OBJECT_TYPE const query; METRIC_TYPE dist; public: VectorSearchOracle (CONTAINER_TYPE const &p, OBJECT_TYPE const &q, METRIC_TYPE m): data(p), query(q), dist(m) { } virtual unsigned size () const { return data.size(); } virtual float operator () (unsigned i) const { return dist(data[i], query); } }; /// Constructor. /** * @param d: the container that holds the dataset. * @param m: a callback function for distance computation. m(d[i], d[j]) must be * a valid expression to compute distance. */ VectorOracle (CONTAINER_TYPE const &d, METRIC_TYPE m): data(d), dist(m) { } virtual unsigned size () const { return data.size(); } virtual float operator () (unsigned i, unsigned j) const { return dist(data[i], data[j]); } /// Constructs a search oracle for query object q. VectorSearchOracle query (OBJECT_TYPE const &q) const { return VectorSearchOracle(data, q, dist); } }; class invalid_argument: public std::invalid_argument { public: using std::invalid_argument::invalid_argument; }; class runtime_error: public std::runtime_error { public: using std::runtime_error::runtime_error; }; class io_error: public runtime_error { public: using runtime_error::runtime_error; }; } #endif #endif
[ "wdong@wdong.org" ]
wdong@wdong.org
a020e49fb68bf25e1a931e4db51bf6b3209e3a1c
d8cd33d0c457e56e57e95b6959c68f2da991240f
/lib/can/src/CANBus.cpp
76635ce6566a521fd08e9238cbd0d4343c92c8de
[]
no_license
a2seo/MarsRover2020-firmware
32cb235d57019e631aca807a30d99295a2e6e999
74cffa1846ac1cd1b9fd98b7f271e45d9dcfaa46
refs/heads/master
2023-03-10T11:03:47.292259
2021-02-28T00:26:19
2021-02-28T00:26:19
null
0
0
null
null
null
null
UTF-8
C++
false
false
332
cpp
#include "CANBus.h" CANBus::CANBus(PinName rd, PinName td) : CAN(rd, td) {} CANBus::CANBus(PinName rd, PinName td, uint32_t hz) : CAN(rd, td, hz) {} int CANBus::setFilter(HWBRIDGE::CANFILTER canFilter, CANFormat format, uint16_t mask, int handle) { return CAN::filter(static_cast<uint16_t>(canFilter), mask, format, handle); }
[ "noreply@github.com" ]
noreply@github.com
2da716e17bd22525c3fc41298a5ac463d8bde5cd
bac29012481008b4d228ff4393b06c2d2847ca43
/src/consensus/nconsensusmetadata.h
e809522883021f10cefd2d34e60e85b9d3980b45
[]
no_license
fenixnix/Causation-Chain
1b7fba9fa44107a07e6e48b137b24a39172a6c52
ac9631c56045864c58e63b3e7a6e92bbd936bb36
refs/heads/master
2020-03-19T06:09:40.360373
2018-09-25T07:20:43
2018-09-25T07:20:43
135,995,729
2
0
null
null
null
null
UTF-8
C++
false
false
555
h
#ifndef NCAUSE_H #define NCAUSE_H #include <QtCore> class NConsensusMetadata { public: NConsensusMetadata(); NConsensusMetadata(QString json); NConsensusMetadata(quint64 f); NConsensusMetadata(quint64 f,QString addr, QString data); NConsensusMetadata(quint64 f,QString addr, QString data, QByteArray hash); quint64 frame = 0; QString addr; QByteArray hash; QString getData() const; void setData(const QString &value); void randomTestData(quint64 f); QString Print(); private: QString data = "null"; }; #endif // NCAUSE_H
[ "57319138@qq.com" ]
57319138@qq.com
aad429f15cbf4dfe66d21c96b2e29f582455727f
c24e4208e9f3e2d3f3b2f309036dcc7af3ddc6cb
/Module_04/ex00/Peon.hpp
19137a656cae2f724143b856554c156e4ecba49c
[]
no_license
XD-OB/42Pool_Cpp
f5154e8b6481705639856b73a1b28ab98a00891e
2dc52f0d0ed1b0a99f30f1455be0fc378cc0b538
refs/heads/master
2023-03-06T02:56:15.829640
2021-02-22T00:50:53
2021-02-22T00:50:53
324,249,734
2
1
null
null
null
null
UTF-8
C++
false
false
1,299
hpp
/* ************************************************************************** */ /* */ /* ::: :::::::: */ /* Peon.hpp :+: :+: :+: */ /* +:+ +:+ +:+ */ /* By: obelouch <obelouch@student.42.fr> +#+ +:+ +#+ */ /* +#+#+#+#+#+ +#+ */ /* Created: 2021/01/23 16:15:58 by obelouch #+# #+# */ /* Updated: 2021/01/28 02:21:32 by obelouch ### ########.fr */ /* */ /* ************************************************************************** */ #ifndef PEON_H # define PEON_H # include "Victim.hpp" class Peon : public Victim { private: Peon( void ); public: Peon( std::string const & name ); Peon( Peon const & src ); virtual ~Peon( void ); // Operators: Peon & operator=( Peon const & rhs ); // Member fcts: void getPolymorphed( void ) const; }; #endif
[ "ob-96@hotmail.com" ]
ob-96@hotmail.com
5685f2b4251fd51cdcd4d00b3e8abe168f97bfb1
eff9ac543ab58b2cc8c5658dab72b424830cc3c5
/DYNAMIC_ARRAY.h
6b0a4ed67e03b8286e6d0a3da3d766a58ba1036f
[]
no_license
ByungJoonLee/2D_Simulator_BackUp
18b576e9a2c2ce4f525fc1d8f75f45491e5ce568
dc711a6a968ac7580a55f274daa729fb30270ac9
refs/heads/master
2016-09-05T23:09:41.612900
2015-08-23T22:48:58
2015-08-23T22:48:58
38,921,093
1
0
null
null
null
null
UTF-8
C++
false
false
3,083
h
#pragma once #include "COMMON_DEFINITION.h" template<class TT> class DYNAMIC_ARRAY { public: // Essenatial Data int num_of_elements; int size_of_array; TT* values; public: // Additional Data int num_of_resize; public: // Constructor and Destructor DYNAMIC_ARRAY(const int size_of_array_input = 0, const int& num_of_resize_input = 1) : values(0) { Initialize(size_of_array_input, num_of_resize_input); } ~DYNAMIC_ARRAY(void) { if (values != 0) { delete [] values; } } public: // Initialization Functions void Initialize(const int& size_of_array_input = 0, const int& num_of_resize_input = 1) { assert(size_of_array_input >= 0 && num_of_resize_input >= 0); size_of_array = size_of_array_input; num_of_resize = num_of_resize_input; if (values != 0) { delete [] values; values = 0; } if (size_of_array > 0) { values = new TT[size_of_array]; } num_of_elements = 0; } public: // Operator Overloading inline TT& operator [](const int& i) const { assert(i >= 0 && i < num_of_elements); return values[i]; } public: // Member Functions void Reallocate(const int& size_of_array_input) { assert(size_of_array_input >= num_of_elements); size_of_array = MAX(size_of_array_input, 0); TT* new_array = new TT[size_of_array]; for (int i = 0; i < num_of_elements; i++) { new_array[i] = values[i]; } delete [] values; values = new_array; } void ResizeAsReserveArray(const int& size_of_array_input) { if (size_of_array < size_of_array_input) { Initialize(size_of_array); } num_elements = size_of_array_input; } void ReserveAndEmptify(const int& size_of_array_input) { if (size_of_array < size_of_array_input) { Initialize(size_of_array_input); } num_of_elements = 0; } void Minimize(void) { assert(num_of_elements <= size_of_array); if (num_of_elements == size_of_array) { return; } TT* new_array = new TT[num_of_elements]; for (int i = 0; i < num_of_elements; i++) { new_array[i] = values[i]; } size_of_array = num_elements; delete [] valuess; values = new_array; } void Push(const TT& data_input) { if (size_of_array > num_of_elements) { values[num_of_elements] = data_input; num_of_elements++; } else { Reallocate(size_of_array + num_of_resize); values[num_of_elements] = data_input; num_of_elements++; } } TT& Push(void) { if (size_of_array > num_of_elements) { num_of_elements++; } else { Reallocate(size_of_array + num_of_resize); num_of_elements++; } return values[num_of_elemetns - 1]; } bool Pop(TT& data_output) { if (num_of_elements > 0) { data_output = values[num_of_elements - 1]; num_of_elements--; return true; } else { return false; } } TT Pop(void) { assert(num_of_elements > 0); return values[--num_of_elements]; } void Emptify(void) { num_of_elements = 0; } inline void Reset(void) { if (values == 0) { return; } delete [] values; values = 0; num_of_elements = 0; size_of_array = 0; } };
[ "asone30@snu.ac.kr" ]
asone30@snu.ac.kr
2f5478cf01e5313d11ba9fe370b08c5b3b9eff0f
3470e780a78e8ae2f6d969a34e04d9a7246b89f7
/tests/my_expectation_test.cpp
e1c1ec00abf7fa9d05fd50f22b347f04955ee062
[]
no_license
huajian1069/monte-carlo
2619f0d9ae0ddbc26c9d9d9b13230ada5c791a00
a1e1c949e773a142015696164afd2c86f51afbae
refs/heads/master
2021-05-24T14:17:21.102308
2018-12-13T20:45:34
2018-12-13T20:45:34
253,601,312
0
0
null
null
null
null
UTF-8
C++
false
false
832
cpp
// // Created by pcsc on 12/13/18. // #include <gtest/gtest.h> #include "../Distribution/Distribution.hpp" #include "../Distribution/Uniform.hpp" #include "../Distribution/Normal.hpp" #include "../Distribution/Exponential.hpp" #include "../Distribution/Geometric.hpp" #include "../Expectation/Expectation.hpp" TEST(MyExpectationTest, Calculation) { Normal my_normal; Expectation my_expectation; std::vector<double> random_vector(my_normal.generate(1000)); ASSERT_LE(*(std::min_element(random_vector.begin(), random_vector.end())) , my_expectation.calculate_sample_mean(random_vector)); ASSERT_GE(*(std::max_element(random_vector.begin(), random_vector.end())) , my_expectation.calculate_sample_mean(random_vector)); ASSERT_GT(my_expectation.calculate_sample_variance(random_vector), 0); }
[ "pcsc@pcsc-2018" ]
pcsc@pcsc-2018
bf573c050c79f7f076840e8ebb3bb953ad21bf08
2a7e77565c33e6b5d92ce6702b4a5fd96f80d7d0
/fuzzedpackages/doc2vec/src/doc2vec/TaggedBrownCorpus.h
3e90ebcc89abd74369b56a9bb86ec7045e20c117
[ "MIT" ]
permissive
akhikolla/testpackages
62ccaeed866e2194652b65e7360987b3b20df7e7
01259c3543febc89955ea5b79f3a08d3afe57e95
refs/heads/master
2023-02-18T03:50:28.288006
2021-01-18T13:23:32
2021-01-18T13:23:32
329,981,898
7
1
null
null
null
null
UTF-8
C++
false
false
1,430
h
#ifndef TAGGED_BROWN_CORPUS_H #define TAGGED_BROWN_CORPUS_H #include "common_define.h" class Doc2Vec; //==================TaggedDocument============================ class TaggedDocument { public: TaggedDocument(); ~TaggedDocument(); public: char * m_tag; char ** m_words; int m_word_num; }; //==================TaggedBrownCorpus============================ class TaggedBrownCorpus { public: TaggedBrownCorpus(const char * train_file, long long seek = 0, long long limit_doc = -1); ~TaggedBrownCorpus(); public: TaggedDocument * next(); void rewind(); long long getDocNum() {return m_doc_num;} long long tell() {return ftell(m_fin);} private: int readWord(char *word); private: FILE* m_fin; TaggedDocument m_doc; long long m_seek; long long m_doc_num; long long m_limit_doc; }; //==================UnWeightedDocument============================ class Doc2Vec; class UnWeightedDocument { public: UnWeightedDocument(); UnWeightedDocument(Doc2Vec * doc2vec, TaggedDocument * doc); virtual ~UnWeightedDocument(); public: void save(FILE * fout); void load(FILE * fin); public: long long * m_words_idx; int m_word_num; }; //==================WeightedDocument============================ class WeightedDocument : public UnWeightedDocument { public: WeightedDocument(Doc2Vec * doc2vec, TaggedDocument * doc); virtual ~WeightedDocument(); public: real * m_words_wei; }; #endif
[ "akhilakollasrinu424jf@gmail.com" ]
akhilakollasrinu424jf@gmail.com
8a70a571e6aa84bc8d5ce4f4a6f91ab976bc0b8c
5e505522141634c6a0ce99fa287d0a8ec4536fba
/linklist.cpp
8b1074416db114745e3959dee374fc96c4e01a71
[]
no_license
deepsikhak/DS-Algo
0c1340115721083d02a7ef0d62adf9e64bea6350
eac45cf9403d4da5c3c6f681e9e45cbee6183dd5
refs/heads/master
2020-03-16T06:15:03.594233
2018-05-23T23:20:04
2018-05-23T23:20:04
132,550,165
0
0
null
null
null
null
UTF-8
C++
false
false
4,054
cpp
#include <iostream> #include <queue> #include <vector> using namespace std; class Node { int data; Node* next; Node(int d){ data = d; next = NULL; } int getVal(){ return data; } void setVal(int d){ data = d; } void setNext(Node* n){ next=n; } Node* getNext(){ return next; } } class linklist{ Node* head; linklist(){ head=NULL; } void setHead(Node* h){ head=h; } Node getHead(){ return head; } void addNode(Node* n){ if(head==NULL){ head=n; } else{ n->setNext(head); head=n; } } void printLinked(){ Node* currNode; currNode=head; cout<<("Node values:"); while(currNode!=NULL){ cout<<"-->" + currNode->getVal(); currNode=currNode->getNext(); } cout<<endl; } void addAtEnd(Node* n){ Node* temp = head; Node* temp2=temp; while(temp!=NULL){ temp2=temp; temp=temp->getNext(); } temp2->setNext(n); } void AddAtPosition(Node* z){ int n; cout<<"Enter the position to insert node : "; cin>>n; Node* temp=head; while(n!=0){ if(temp==NULL){ cout<<"Not found"; return; } else{ temp=temp->getNext(); n--; } } Node* temp2=temp->getNext(); temp->setNext(z); z->setNext(temp2); } void recdis(){ cout<<"Printing Node Values "; recPrint(head); } void recPrint(Node* currNode){ if(currNode==NULL){ return; } else{ cout<<"--> " << currNode->getVal(); recPrint(currNode->getNext()); } } void DeleteBeg(){ if(head==NULL){ cout<<"Linked list is empty->"; } else{ cout<<"1st node is deleted from the beginning->"; head=head->getNext(); } } void DeleteEnd(){ if(head==NULL){ cout<<"Linked list is empty->"; } else{ Node* curr; Node* prev; prev=head; curr=head; while(curr->getNext()!=NULL){ prev=curr; curr=curr->getNext(); } cout<<"Last node is deleted from the beginning->"; curr=NULL; prev->setNext(NULL); } } } class linklist{ static void main(String[] arg){ // linklist ll=new linklist(); // Node n=new Node(1); // ll->addNode(n); // n=new Node(2); // ll->addNode(n); // n=new Node(3); // ll->addNode(n); // n=new Node(4); // ll->addNode(n); // n=new Node(5); // ll->printLinked(); linklist ll=null; while(true){ cout<<"1. To create a linked list."; cout<<"2. To add a node at beginning."; cout<<"3. To add a node at end."; cout<<"4. To add a node at position."; cout<<"5. To display linked list."; cout<<"6. To display linked list using recursion."; cout<<"7. To delete node from beginning."; cout<<"8. To delete node from end."; cout<<"0. To exit."; int n; cin>>n; switch(n){ case 1: cout<<"Linked list created: "; ll=new linklist(); break; case 2: if(ll==NULL){ cout<<"Linked list is empty.\nCreate linked list first."; //warning } else{ cout<<"Insert the node."; int q = scanner.nextInt(); Node x=new Node(q); ll->addNode(x); } break; case 3: if(ll==NULL){ cout<<"Linked list is empty->\nCreate linked list first->"; } else{ cout<<"Insert the node->"; int r = scanner->nextInt(); Node* y=new Node(r); ll->addAtEnd(y); } break ; case 4: if(ll==NULL){ cout<<"Linked list is empty->\nCreate linked list first->"; } else{ cout<<"Insert the node."; int r = scanner->nextInt(); Node* y=new Node(r); ll->AddAtPosition(y); } break ; case 5: if(ll==NULL){ cout<<"Linked list is empty->\n Create linked list first->"; //warning } else{ cout<<"Linked list is: \n"; ll->printLinked(); } break; case 6: if(ll==NULL){ cout<<"Linked list is empty->\n Create linked list first->"; return ; //warning } else{ ll->recdis(); } break; case 7: ll->DeleteBeg(); break; case 8: ll->DeleteEnd(); break; default: return ; } } }
[ "deepsikhakar.dak@gmail.com" ]
deepsikhakar.dak@gmail.com
aa6f84063e49e8052b6ec5ae4af5f5d5068afbdf
77d3fee5704fba2e937a42e4c1502f939c69d9e8
/w8/w8_at_home/Account.h
36246184a48a8f941978437e35424bea163ef243
[]
no_license
Hibrahim21/OOP244
4de338babdfefd11ebf58cff8d219aa2d2d0e6cc
7f201a6cfbdc3a2d1cff0eb9d427b77f0430a2e9
refs/heads/master
2021-08-01T01:09:08.419143
2021-07-31T15:50:48
2021-07-31T15:50:48
189,293,364
0
0
null
null
null
null
UTF-8
C++
false
false
467
h
/* Name: Hamza Ibrahim Seneca ID: 107467185 Seneca Email: hibrahim21@myseneca.ca */ #ifndef SICT_ACCOUNT_H #define SICT_ACCOUNT_H #include "iAccount.h" namespace sict { class Account : public iAccount { protected: double a_balance; double balance() const; public: Account(); Account(double balance); bool credit(double amount); bool debit(double amount); }; iAccount* CreateAccount(const char* type, double balance); } #endif // !SICT_ACCOUNT_H
[ "hibrahim21@myseneca.ca" ]
hibrahim21@myseneca.ca
e21f0918f699e80ada0f356a25c82dbdaeae7c06
c8b39acfd4a857dc15ed3375e0d93e75fa3f1f64
/Engine/Source/ThirdParty/IntelTBB/IntelTBB-4.4u3/examples/parallel_for/polygon_overlay/rpolygon.h
2d62c211c0d624eea5d3ca6988967985ab7ba9c2
[ "MIT", "LicenseRef-scancode-proprietary-license" ]
permissive
windystrife/UnrealEngine_NVIDIAGameWorks
c3c7863083653caf1bc67d3ef104fb4b9f302e2a
b50e6338a7c5b26374d66306ebc7807541ff815e
refs/heads/4.18-GameWorks
2023-03-11T02:50:08.471040
2022-01-13T20:50:29
2022-01-13T20:50:29
124,100,479
262
179
MIT
2022-12-16T05:36:38
2018-03-06T15:44:09
C++
UTF-8
C++
false
false
6,011
h
/* Copyright 2005-2016 Intel Corporation. All Rights Reserved. This file is part of Threading Building Blocks. Threading Building Blocks is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 as published by the Free Software Foundation. Threading Building Blocks 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 Threading Building Blocks; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA As a special exception, you may use this file as part of a free software library without restriction. Specifically, if other files instantiate templates or use macros or inline functions from this file, or you compile this file and link it with other files to produce an executable, this file does not by itself cause the resulting executable to be covered by the GNU General Public License. This exception does not however invalidate any other reasons why the executable file might be covered by the GNU General Public License. */ // rpolygon.h // #ifndef _RPOLYGON_H_ #define _RPOLYGON_H_ #include <vector> #include <iostream> #include "pover_video.h" #include "tbb/scalable_allocator.h" #include "tbb/concurrent_vector.h" #include "tbb/enumerable_thread_specific.h" using namespace std; using namespace tbb; class RPolygon; typedef scalable_allocator<RPolygon> RPolygon_allocator; DEFINE RPolygon_allocator rAlloc; enum MallocBehavior { UseMalloc, UseScalableAllocator }; DEFINE MallocBehavior gMBehavior INIT(UseScalableAllocator); class RPolygon { public: RPolygon() {m_XMin = m_YMin = m_XMax = m_YMax = 0; m_r = m_g = m_b = 0; } RPolygon(int xMin, int yMin, int xMax, int yMax, int r=-1, int g=-1, int b=-1) : m_XMin(xMin), m_YMin(yMin), m_XMax(xMax), m_YMax(yMax) { if( r >= 0) { m_r=(colorcomp_t)r; m_g=(colorcomp_t)g; m_b=(colorcomp_t)b; if(gDoDraw) drawPoly(); } } void set_nodraw(int xMin, int yMin, int xMax, int yMax) {m_XMin=xMin; m_YMin=yMin; m_XMax=xMax; m_YMax=yMax;} RPolygon &intersect(RPolygon &otherPoly); void set(int xMin, int yMin, int xMax, int yMax) { set_nodraw(xMin,yMin,xMax,yMax); if(gDoDraw) { drawPoly(); } } void get(int *xMin, int *yMin, int *xMax, int *yMax) const {*xMin=m_XMin;*yMin=m_YMin;*xMax=m_XMax;*yMax=m_YMax;} int xmax() const { return m_XMax; } int xmin() const { return m_XMin; } int ymax() const { return m_YMax; } int ymin() const { return m_YMin; } void setColor(colorcomp_t newr, colorcomp_t newg, colorcomp_t newb) {m_r = newr; m_g=newg; m_b=newb;} void getColor(int *myr, int *myg, int *myb) {*myr=m_r; *myg=m_g; *myb=m_b;} color_t myColor() {return gVideo->get_color(m_r, m_g, m_b);} void drawPoly() { if(gVideo->running) { if(g_next_frame()) { // Shouldn't call next_frame each time drawing_area ldrawing( gDrawXOffset+m_XMin*gPolyXBoxSize, //x gDrawYOffset+m_YMin*gPolyYBoxSize, //y (m_XMax-m_XMin+1)*gPolyXBoxSize, //sizex (m_YMax-m_YMin+1)*gPolyYBoxSize); //sizey for(int y=0; y<ldrawing.size_y; y++) { ldrawing.set_pos(0,y); color_t my_color = myColor(); for(int x=0;x < ldrawing.size_x; x++) { ldrawing.put_pixel(my_color); } } } } } int area() {return ((m_XMax-m_XMin+1)*(m_YMax-m_YMin+1));} void print(int i) { cout << "RPolygon " << i << " (" << m_XMin << ", " << m_YMin << ")-(" << m_XMax << ", " << m_YMax << ") " << endl; fflush(stdout);} private: int m_XMin; int m_YMin; int m_XMax; int m_YMax; colorcomp_t m_r; colorcomp_t m_g; colorcomp_t m_b; }; #if _MAIN_C_ bool operator<(const RPolygon& a, const RPolygon& b) { if(a.ymin() > b.ymin()) return false; if(a.ymin() < b.ymin()) return true; return a.xmin() < b.xmin(); } #else extern bool operator<(const RPolygon& a, const RPolygon& b); #endif extern ostream& operator<<(ostream& s, const RPolygon &p); class RPolygon_flagged { RPolygon *myPoly; bool is_duplicate; public: RPolygon_flagged() {myPoly = NULL; is_duplicate = false;} RPolygon_flagged(RPolygon* _p, bool _is_duplicate) : myPoly(_p), is_duplicate(_is_duplicate) { } bool isDuplicate() {return is_duplicate;} void setDuplicate(bool newValue) {is_duplicate = newValue;} RPolygon *p() {return myPoly;} void setp(RPolygon *newp) {myPoly = newp;} }; typedef class vector<RPolygon, RPolygon_allocator> Polygon_map_t; typedef class concurrent_vector<RPolygon, RPolygon_allocator> concurrent_Polygon_map_t; typedef class enumerable_thread_specific<Polygon_map_t> ETS_Polygon_map_t; typedef class vector<RPolygon_flagged, scalable_allocator<RPolygon_flagged> > Flagged_map_t; // we'll make shallow copies inline bool PolygonsOverlap(RPolygon *p1, RPolygon *p2, int &xl, int &yl, int &xh, int &yh) { int xl1, yl1, xh1, yh1, xl2, yl2, xh2, yh2; #if _DEBUG rt_sleep(1); // slow down the process so we can see it. #endif p1->get(&xl1, &yl1, &xh1, &yh1); p2->get(&xl2, &yl2, &xh2, &yh2); if(xl1 > xh2) return false; if(xh1 < xl2) return false; if(yl1 > yh2) return false; if(yh1 < yl2) return false; xl = (xl1 < xl2) ? xl2 : xl1; xh = (xh1 < xh2) ? xh1 : xh2; yl = (yl1 < yl2) ? yl2 : yl1; yh = (yh1 < yh2) ? yh1 : yh2; return true; } #endif // _RPOLYGON_H_
[ "tungnt.rec@gmail.com" ]
tungnt.rec@gmail.com
370547fd4d1b0489517c2898335149ab265f1824
29ba7eebb5f721aac9c8299cee90a009ea9b4cf2
/Types/SoccerTypes.h
c3a99d820b66529b9fff0d6fe105960bed78ecf8
[]
no_license
mmazinani2/Robocup
4c25c08bf8c65bc355503ffa5026e469e3c501d0
26e625bb2bf502dc65564134305113848e32cc8a
refs/heads/master
2020-05-25T14:04:47.454122
2019-05-21T12:48:44
2019-05-21T12:48:44
187,835,617
2
0
null
null
null
null
UTF-8
C++
false
false
12,361
h
/************************************ Create by Mohammad Mazinani Mohammad Ali Kamkar Mehdi Torshani *************************************/ #ifndef _SOCCERTYPES_ #define _SOCCERTYPES_ #include "../Geometry/Geometry.h" #define MAX_TEAMMATES 11 #define MAX_OPPONENTS 11 #define MAX_HETERO_PLAYERS 18 #define MAX_MSG 4096 #define MAX_SAY_MSG 10 #define MAX_TEAM_NAME_LENGTH 64 #define MAX_FLAGS 55 #define MAX_LINES 4 #define DEFAULT_TEAM_NAME "Mars" #define DEFAULT_OPPONENT_NAME "Unknown" #define PITCH_LENGTH 105.0 #define PITCH_WIDTH 68.0 #define PITCH_MARGIN 5.0 #define PENALTY_AREA_LENGTH 16.5 #define PENALTY_AREA_WIDTH 40.32 #define PENALTY_X (PITCH_LENGTH/2.0-PENALTY_AREA_LENGTH) #define QUALITY 10.0 typedef double AngDeg; typedef int Cycle; enum CollisionT { CLL_BALL, CLL_PLAYER, CLL_POST, CLL_NONE }; /** in baraye moshakhas kardane vazuyate baziye **/ enum PlayerType { PLAYER_TEAMMATE, PLAYER_UNKNOWN_TEAMMATE, PLAYER_OPPONENT, PLAYER_UNKNOWN_OPPONENT, PLAYER_UNKNOWN, PLAYER_GOLA, PLAYER_NORMALL, PLAYER_ILLEGAL }; /** in moshakhas mikone Ball daste kiye **/ enum BallStatus { BALL_ILLEGAL, BALL_TEAMMATES, BALL_OPPONENTS }; enum Command_Prabi { CP_BALL_ME, CP_BALL_OPP, CP_BALL_TEAM, CP_BALL_FREE, CP_PLAY_AGAIN, CP_FAST_PLAYER, }; enum Server_Pram2 { SP_AUDIO_CUT_DIST = 0, SP_AUTO_MODE, SP_BACK_PASSES, SP_BALL_ACCEL_MAX, SP_BALL_DECAY, SP_BALL_RAND, SP_BALL_SIZE, SP_BALL_SPEED_MAX, SP_BALL_STUCK_AREA, SP_BALL_WEIGHT, SP_CATCH_BAN_CYCLE, SP_CATCH_PROBABILITY, SP_CATCHABLE_AREA_L, SP_CATCHABLE_AREA_W, SP_CKICK_MARGIN, SP_CLANG_ADVICE_WIN, SP_CLANG_DEFINE_WIN, SP_CLANG_DEL_WIN, SP_CLANG_INFO_WIN, SP_CLANG_MESS_DELAY, SP_CLANG_MESS_PER_CYCLE, SP_CLANG_META_WIN, SP_CLANG_RULE_WIN, SP_CLANG_WIN_SIZE, SP_COACH, SP_COACH_PORT, SP_COACH_W_REFEREE, SP_CONNECT_WAIT, SP_CONTROL_RADIUS, SP_DASH_POWER_RATE, SP_DROP_BALL_TIME, SP_EFFORT_DEC, SP_EFFORT_DEC_THR, SP_EFFORT_INC, SP_EFFORT_INC_THR, SP_EFFORT_INIT, SP_EFFORT_MIN, SP_EXTRA_STAMINA, SP_FORBID_KICK_OFF_OFFSIDE, SP_FREE_KICK_FAULTS, SP_FREEFORM_SEND_PERIOD, SP_FREEFORM_WAIT_PERIOD, SP_FULLSTATE_L, SP_FULLSTATE_R, SP_GAME_LOG_COMPRESSION, SP_GAME_LOG_DATED, SP_GAME_LOG_DIR, SP_GAME_LOG_FIXED, SP_GAME_LOG_FIXED_NAME, SP_GAME_LOG_VERSION, SP_GAME_LOGGING, SP_GAME_OVER_WAIT, SP_GOAL_WIDTH, SP_GOALIE_MAX_MOVES, SP_HALF_TIME, SP_HEAR_DECAY, SP_HEAR_INC, SP_HEAR_MAX, SP_INERTIA_MOMENT, SP_KEEPAWAY, SP_KEEPAWAY_LENGTH, SP_KEEPAWAY_LOG_DATED, SP_KEEPAWAY_LOG_DIR, SP_KEEPAWAY_LOG_FIXED, SP_KEEPAWAY_LOG_FIXED_NAME, SP_KEEPAWAY_LOGGING, SP_KEEPAWAY_START, SP_KEEPAWAY_WIDTH, SP_KICK_OFF_WAIT, SP_KICK_POWER_RATE, SP_KICK_RAND, SP_KICK_RAND_FACTOR_L, SP_KICK_RAND_FACTOR_R, SP_KICKABLE_MARGIN, SP_LANDMARK_FILE, SP_LOG_DATE_FORMAT, SP_LOG_TIMES, SP_MAX_BACK_TACKLE_POWER, SP_MAX_GOAL_KICKS, SP_MAX_TACKLE_POWER, SP_MAXMOMENT, SP_MAXNECKANG, SP_MAXNECKMOMENT, SP_MAXPOWER, SP_MINMOMENT, SP_MINNECKANG, SP_MINNECKMOMENT, SP_MINPOWER, SP_NR_EXTRA_HALFS, SP_NR_NORMAL_HALFS, SP_OFFSIDE_ACTIVE_AREA_SIZE, SP_OFFSIDE_KICK_MARGIN, SP_OLCOACH_PORT, SP_OLD_COACH_HEAR, SP_PEN_ALLOW_MULT_KICKS, SP_PEN_BEFORE_SETUP_WAIT, SP_PEN_COACH_MOVES_PLAYERS, SP_PEN_DIST_X, SP_PEN_MAX_EXTRA_KICKS, SP_PEN_MAX_GOALIE_DIST_X, SP_PEN_NR_KICKS, SP_PEN_RANDOM_WINNER, SP_PEN_READY_WAIT, SP_PEN_SETUP_WAIT, SP_PEN_TAKEN_WAIT, SP_PENALTY_SHOOT_OUTS, SP_PLAYER_ACCEL_MAX, SP_PLAYER_DECAY, SP_PLAYER_RAND, SP_PLAYER_SIZE, SP_PLAYER_SPEED_MAX, SP_PLAYER_SPEED_MAX_MIN, SP_PLAYER_WEIGHT, SP_POINT_TO_BAN, SP_POINT_TO_DURATION, SP_PORT, SP_PRAND_FACTOR_L, SP_PRAND_FACTOR_R, SP_PROFILE, SP_PROPER_GOAL_KICKS, SP_QUANTIZE_STEP, SP_QUANTIZE_STEP_L, SP_RECORD_MESSAGES, SP_RECOVER_DEC, SP_RECOVER_DEC_THR, SP_RECOVER_INIT, SP_RECOVER_MIN, SP_RECV_STEP, SP_SAY_COACH_CNT_MAX, SP_SAY_COACH_MSG_SIZE, SP_SAY_MSG_SIZE, SP_SEND_COMMS, SP_SEND_STEP, SP_SEND_VI_STEP, SP_SENSE_BODY_STEP, SP_SIMULATOR_STEP, SP_SLOW_DOWN_FACTOR, SP_SLOWNESS_ON_TOP_FOR_LEFT_TEAM, SP_SLOWNESS_ON_TOP_FOR_RIGHT_TEAM, SP_STAMINA_INC_MAX, SP_STAMINA_MAX, SP_START_GOAL_L, SP_START_GOAL_R, SP_STOPPED_BALL_VEL, SP_SYNCH_MICRO_SLEEP, SP_SYNCH_MODE, SP_SYNCH_OFFSET, SP_SYNCH_SEE_OFFSET, SP_TACKLE_BACK_DIST, SP_TACKLE_CYCLES, SP_TACKLE_DIST, SP_TACKLE_EXPONENT, SP_TACKLE_POWER_RATE, SP_TACKLE_WIDTH, SP_TEAM_ACTUATOR_NOISE, SP_TEAM_L_START, SP_TEAM_R_START, SP_TEXT_LOG_COMPRESSION, SP_TEXT_LOG_DATED, SP_TEXT_LOG_DIR, SP_TEXT_LOG_FIXED, SP_TEXT_LOG_FIXED_NAME, SP_TEXT_LOGGING, SP_USE_OFFSIDE, SP_VERBOSE, SP_VISIBLE_ANGLE, SP_VISIBLE_DISTANCE, SP_WIND_ANG, SP_WIND_DIR, SP_WIND_FORCE, SP_WIND_NONE, SP_WIND_RAND, SP_WIND_RANDOM }; enum PlayerT { PT_MY_PLAYER_1 = 1, PT_MY_PLAYER_2 = 2, PT_MY_PLAYER_3 = 3, PT_MY_PLAYER_4 = 4, PT_MY_PLAYER_5 = 5, PT_MY_PLAYER_6 = 6, PT_MY_PLAYER_7 = 7, PT_MY_PLAYER_8 = 8, PT_MY_PLAYER_9 = 9, PT_MY_PLAYER_10 = 10, PT_MY_PLAYER_11 = 11, PT_OPPONENT_PLAYER_1 = 12, PT_OPPONENT_PLAYER_2 = 13, PT_OPPONENT_PLAYER_3 = 14, PT_OPPONENT_PLAYER_4 = 15, PT_OPPONENT_PLAYER_5 = 16, PT_OPPONENT_PLAYER_6 = 17, PT_OPPONENT_PLAYER_7 = 18, PT_OPPONENT_PLAYER_8 = 19, PT_OPPONENT_PLAYER_9 = 20, PT_OPPONENT_PLAYER_10 = 21, PT_OPPONENT_PLAYER_11 = 22, PT_TEAMMATES = 23, PT_OPPONENTS = 24, PT_UNKNOWN = 25 }; enum ObjectType { OBJ_FLAG, OBJ_LINE, OBJ_UNKNOWN }; /** in bazikonaye mast **/ enum MyPlayer { MY_PLAYER_1 = 0, MY_PLAYER_2, MY_PLAYER_3, MY_PLAYER_4, MY_PLAYER_5, MY_PLAYER_6, MY_PLAYER_7, MY_PLAYER_8, MY_PLAYER_9, MY_PLAYER_10, MY_PLAYER_11, MY_PLAYER_GOALIE, MY_PLAYER_UNKNOWN }; /** in bazikonaye opponenets **/ enum OpponentPlayer { OPPONENT_PLAYER_1 = 0, OPPONENT_PLAYER_2, OPPONENT_PLAYER_3, OPPONENT_PLAYER_4, OPPONENT_PLAYER_5, OPPONENT_PLAYER_6, OPPONENT_PLAYER_7, OPPONENT_PLAYER_8, OPPONENT_PLAYER_9, OPPONENT_PLAYER_10, OPPONENT_PLAYER_11, OPPONENT_PLAYER_GOALIE, OPPONENT_PLAYER_UNKNOWN }; /** in parchamas **/ enum Flag { FT_GOAL_L = 0, FT_GOAL_R, FT_LINE_L, FT_LINE_R, FT_LINE_B, FT_LINE_T, FT_FLAG_L_T, FT_FLAG_T_L_50, FT_FLAG_T_L_40, FT_FLAG_T_L_30, FT_FLAG_T_L_20, FT_FLAG_T_L_10, FT_FLAG_T_0, FT_FLAG_C_T, FT_FLAG_T_R_10, FT_FLAG_T_R_20, FT_FLAG_T_R_30, FT_FLAG_T_R_40, FT_FLAG_T_R_50, FT_FLAG_R_T, FT_FLAG_R_T_30, FT_FLAG_R_T_20, FT_FLAG_R_T_10, FT_FLAG_G_R_T, FT_FLAG_R_0, FT_FLAG_G_R_B, FT_FLAG_R_B_10, FT_FLAG_R_B_20, FT_FLAG_R_B_30, FT_FLAG_R_B, FT_FLAG_B_R_50, FT_FLAG_B_R_40, FT_FLAG_B_R_30, FT_FLAG_B_R_20, FT_FLAG_B_R_10, FT_FLAG_C_B, FT_FLAG_B_0, FT_FLAG_B_L_10, FT_FLAG_B_L_20, FT_FLAG_B_L_30, FT_FLAG_B_L_40, FT_FLAG_B_L_50, FT_FLAG_L_B, FT_FLAG_L_B_30, FT_FLAG_L_B_20, FT_FLAG_L_B_10, FT_FLAG_G_L_B, FT_FLAG_L_0, FT_FLAG_G_L_T, FT_FLAG_L_T_10, FT_FLAG_L_T_20, FT_FLAG_L_T_30, FT_FLAG_P_L_T, FT_FLAG_P_L_C, FT_FLAG_P_L_B, FT_FLAG_P_R_T, FT_FLAG_P_R_C, FT_FLAG_P_R_B, FT_FLAG_C, FT_UNKNOWN }; enum ObjectName { OBJECT_BALL, OBJECT_GOAL_L, OBJECT_GOAL_R, OBJECT_GOAL_UNKNOWN, OBJECT_LINE_L, OBJECT_LINE_R, OBJECT_LINE_B, OBJECT_LINE_T, OBJECT_ILLEGAL, OBJECT_MAX_OBJECTS }; enum PlayModeT { PM_ILLEGAL = 0, PM_BEFORE_KICK_OFF, PM_KICK_OFF_LEFT, PM_KICK_OFF_RIGHT, PM_KICK_IN_LEFT, PM_KICK_IN_RIGHT, PM_CORNER_KICK_LEFT, PM_CORNER_KICK_RIGHT, PM_GOAL_KICK_LEFT, PM_GOAL_KICK_RIGHT, PM_GOAL_LEFT, PM_GOAL_RIGHT, PM_FREE_KICK_FAULT_LEFT, PM_FREE_KICK_FAULT_RIGHT, PM_FREE_KICK_LEFT, PM_FREE_KICK_RIGHT, PM_INDIRECT_FREE_KICK_RIGHT, PM_INDIRECT_FREE_KICK_LEFT, PM_BACK_PASS_LEFT, PM_BACK_PASS_RIGHT, PM_OFFSIDE_LEFT, PM_OFFSIDE_RIGHT, PM_PLAY_ON, PM_TIME_OVER, PM_PENALTY_SETUP_LEFT, PM_PENALTY_SETUP_RIGHT, PM_PENALTY_READY_LEFT, PM_PENALTY_READY_RIGHT, PM_PENALTY_TAKEN_LEFT, PM_PENALTY_TAKEN_RIGHT, PM_FROZEN, PM_QUIT }; enum RefereeMessageT { REFC_ILLEGAL = 0, REFC_BEFORE_KICK_OFF = 1, REFC_KICK_OFF_LEFT = 2, REFC_KICK_OFF_RIGHT = 3, REFC_KICK_IN_LEFT = 4, REFC_KICK_IN_RIGHT = 5, REFC_CORNER_KICK_LEFT = 6, REFC_CORNER_KICK_RIGHT = 7, REFC_GOAL_KICK_LEFT = 8, REFC_GOAL_KICK_RIGHT = 9, REFC_FREE_KICK_LEFT = 10, REFC_FREE_KICK_RIGHT = 11, REFC_INDIRECT_FREE_KICK_RIGHT = 12, REFC_INDIRECT_FREE_KICK_LEFT = 13, REFC_FREE_KICK_FAULT_LEFT = 14, REFC_FREE_KICK_FAULT_RIGHT = 15, REFC_BACK_PASS_LEFT = 16, REFC_BACK_PASS_RIGHT = 17, REFC_PLAY_ON = 18, REFC_TIME_OVER = 19, REFC_FROZEN = 20, REFC_QUIT = 21, REFC_OFFSIDE_LEFT = 22, REFC_OFFSIDE_RIGHT = 23, REFC_HALF_TIME = 24, REFC_TIME_UP = 25, REFC_TIME_UP_WITHOUT_A_TEAM = 26, REFC_TIME_EXTENDED = 27, REFC_FOUL_LEFT = 28, REFC_FOUL_RIGHT = 29, REFC_GOAL_LEFT = 30, REFC_GOAL_RIGHT = 31, REFC_DROP_BALL = 32, REFC_GOALIE_CATCH_BALL_LEFT = 33, REFC_GOALIE_CATCH_BALL_RIGHT = 34, REFC_PENALTY_SETUP_LEFT = 35, REFC_PENALTY_SETUP_RIGHT = 36, REFC_PENALTY_READY_LEFT = 37, REFC_PENALTY_READY_RIGHT = 38, REFC_PENALTY_TAKEN_LEFT = 39, REFC_PENALTY_TAKEN_RIGHT = 40, REFC_PENALTY_MISS_LEFT = 41, REFC_PENALTY_MISS_RIGHT = 42, REFC_PENALTY_SCORE_LEFT = 43, REFC_PENALTY_SCORE_RIGHT = 44, REFC_PENALTY_FOUL_LEFT = 45, REFC_PENALTY_FOUL_RIGHT = 46, REFC_PENALTY_ONFIELD_LEFT = 47, REFC_PENALTY_ONFIELD_RIGHT = 48, REFC_PENALTY_WINNER_LEFT = 49, REFC_PENALTY_WINNER_RIGHT = 50, REFC_PENALTY_DRAW = 51, REFC_YELLOW_CARD_R_1 = 52, REFC_YELLOW_CARD_R_2 = 53, REFC_YELLOW_CARD_R_3 = 54, REFC_YELLOW_CARD_R_4 = 55, REFC_YELLOW_CARD_R_5 = 56, REFC_YELLOW_CARD_R_6 = 57, REFC_YELLOW_CARD_R_7 = 58, REFC_YELLOW_CARD_R_8 = 59, REFC_YELLOW_CARD_R_9 = 60, REFC_YELLOW_CARD_R_10 = 61, REFC_YELLOW_CARD_R_11 = 62, REFC_YELLOW_CARD_L_1 = 63, REFC_YELLOW_CARD_L_2 = 64, REFC_YELLOW_CARD_L_3 = 65, REFC_YELLOW_CARD_L_4 = 66, REFC_YELLOW_CARD_L_5 = 67, REFC_YELLOW_CARD_L_6 = 68, REFC_YELLOW_CARD_L_7 = 69, REFC_YELLOW_CARD_L_8 = 70, REFC_YELLOW_CARD_L_9 = 71, REFC_YELLOW_CARD_L_10 = 72, REFC_YELLOW_CARD_L_11 = 73, REFC_RED_CARD_R_1 = 74, REFC_RED_CARD_R_2 = 75, REFC_RED_CARD_R_3 = 76, REFC_RED_CARD_R_4 = 77, REFC_RED_CARD_R_5 = 78, REFC_RED_CARD_R_6 = 79, REFC_RED_CARD_R_7 = 80, REFC_RED_CARD_R_8 = 81, REFC_RED_CARD_R_9 = 82, REFC_RED_CARD_R_10 = 83, REFC_RED_CARD_R_11 = 84, REFC_RED_CARD_L_1 = 85, REFC_RED_CARD_L_2 = 86, REFC_RED_CARD_L_3 = 87, REFC_RED_CARD_L_4 = 88, REFC_RED_CARD_L_5 = 89, REFC_RED_CARD_L_6 = 90, REFC_RED_CARD_L_7 = 91, REFC_RED_CARD_L_8 = 92, REFC_RED_CARD_L_9 = 93, REFC_RED_CARD_L_10 = 94, REFC_RED_CARD_L_11 = 95, } ; enum ViewAngleT { VA_NARROW, VA_NORMAL, VA_WIDE, VA_ILLEGAL }; enum Mode { NORMAL = 0, EXHAUST = 100, }; enum ViewQualityT { VQ_HIGH, VQ_LOW, VQ_ILLEGAL }; enum SideT { SIDE_LEFT = 0, SIDE_RIGHT, SIDE_ILLEGAL } ; enum CommandT { CMD_ILLEGAL, CMD_DASH, CMD_DASH_SIDE, CMD_TURN, CMD_TURNNECK, CMD_CHANGEVIEW, CMD_CATCH, CMD_KICK, CMD_MOVE, CMD_SENSEBODY, CMD_SAY, CMD_SYNCH_SEE, CMD_CHANGEPLAYER, CMD_ATTENTIONTO, CMD_TACKLE, CMD_POINTTO, CMD_BYE, CMD_INIT, CMD_RECONNECT, CMD_MAX_COMMANDS } ; enum Card { CARD_NONE, CARD_YELLOW, CARD_RED }; struct ObjectPlayer { PlayerT player_Type; Vector2D RealPosition; double Angel; double Speed; double NeckAng; double BodyAng; }; struct Ball { BallStatus BS; Vector2D BallPos; }; struct ObjectFlag { Flag fl; Vector2D flPos; bool operator>(const ObjectFlag &ObjFlag) const {return (fl > ObjFlag.fl);} bool operator==(const ObjectFlag &ObjFlag) const {return (fl == ObjFlag.fl);} }; struct _MapValue { double PAR1; double PAR2; bool operator!() {return !((PAR1 == -1000&&PAR2==-1000));} }; struct ObjectStamina { double Stamina; double Effort; double Recovery; public: ObjectStamina():Stamina ( 0.00 ) ,Effort ( 0.00 ) ,Recovery( 0.00 ) { } }; #endif
[ "mohammad@Mohammads-MacBook-Air.local" ]
mohammad@Mohammads-MacBook-Air.local
7c70a08f3253a9e257ba92a5fd044ac64e6a2c73
a0520d443820a89a26e51f6cf6f8d5623615258c
/src/gqfast/loader/temp/q3_tag_array_1threads_231_4366.cpp
6d7b15242c5bfaf619e380c3791f763e49014dc8
[]
no_license
lusuon/GQ-Fast
bcc9afc0350cbf2e310d4774f2fcf25b885fa1bb
e696945281759c4eb33cf370df0b2e92ba592f91
refs/heads/master
2023-03-17T17:52:11.550878
2016-08-15T21:01:52
2016-08-15T21:01:52
null
0
0
null
null
null
null
UTF-8
C++
false
false
8,838
cpp
#ifndef q3_tag_array_1threads_231_4366_ #define q3_tag_array_1threads_231_4366_ #include "../fastr_index.hpp" #include "../global_vars.hpp" #define NUM_THREADS 10 #define BUFFER_POOL_SIZE 2 using namespace std; static args_threading arguments[NUM_THREADS]; static int* R; static int* RC; static uint64_t* q3_tag_array_1threads_231_4366_intersection_buffer; extern inline void q3_tag_array_1threads_231_4366_doc1_col0_intersection0_decode_UA(uint32_t* doc1_col0_intersection_ptr_0, uint32_t doc1_col0_bytes_intersection0, uint32_t & doc1_intersection0_fragment_size) __attribute__((always_inline)); extern inline void q3_tag_array_1threads_231_4366_doc1_col0_intersection1_decode_UA(uint32_t* doc1_col0_intersection_ptr_1, uint32_t doc1_col0_bytes_intersection1, uint32_t & doc1_intersection1_fragment_size) __attribute__((always_inline)); extern inline void q3_tag_array_1threads_231_4366_intersection(uint32_t doc1_intersection0_fragment_size, uint32_t doc1_intersection1_fragment_size, uint32_t & q3_tag_array_1threads_231_4366_intersection_size) __attribute__((always_inline)); void* pthread_q3_tag_array_1threads_231_4366_worker(void* arguments); extern inline void q3_tag_array_1threads_231_4366_author1_col0_decode_UA_threaded(int thread_id, uint32_t* author1_col0_ptr, uint32_t author1_col0_bytes, uint32_t & author1_fragment_size) __attribute__((always_inline)); void q3_tag_array_1threads_231_4366_doc1_col0_intersection0_decode_UA(uint32_t* doc1_col0_intersection_ptr_0, uint32_t doc1_col0_bytes_intersection0, uint32_t & doc1_intersection0_fragment_size) { doc1_intersection0_fragment_size = doc1_col0_bytes_intersection0/4; for (uint32_t i=0; i<doc1_intersection0_fragment_size; i++) { buffer_arrays[3][0][0][0][i] = *doc1_col0_intersection_ptr_0++; } } void q3_tag_array_1threads_231_4366_doc1_col0_intersection1_decode_UA(uint32_t* doc1_col0_intersection_ptr_1, uint32_t doc1_col0_bytes_intersection1, uint32_t & doc1_intersection1_fragment_size) { doc1_intersection1_fragment_size = doc1_col0_bytes_intersection1/4; for (uint32_t i=0; i<doc1_intersection1_fragment_size; i++) { buffer_arrays[3][0][0][1][i] = *doc1_col0_intersection_ptr_1++; } } void q3_tag_array_1threads_231_4366_intersection(uint32_t doc1_intersection0_fragment_size, uint32_t doc1_intersection1_fragment_size, uint32_t & q3_tag_array_1threads_231_4366_intersection_size) { if (doc1_intersection0_fragment_size == 0) { return; } if (doc1_intersection1_fragment_size == 0) { return; } uint32_t intersection_index = 0; uint32_t* its = new uint32_t[2](); bool end = false; while(!end) { bool match = true; while (1) { if (buffer_arrays[3][0][0][0][its[0]] != buffer_arrays[3][0][0][1][its[1]]) { match = false; break; } break; } if (match) { q3_tag_array_1threads_231_4366_intersection_buffer[intersection_index++] = buffer_arrays[3][0][0][0][its[0]]; while(1) { if (++its[0] == doc1_intersection0_fragment_size) { end = true; break; } if (++its[1] == doc1_intersection1_fragment_size) { end = true; break; } break; } } else { uint64_t smallest = buffer_arrays[3][0][0][0][its[0]]; int index_of_smallest = 0; uint32_t fragment_size_of_smallest = doc1_intersection0_fragment_size; if (smallest > buffer_arrays[3][0][0][1][its[1]]) { smallest = buffer_arrays[3][0][0][1][its[1]]; index_of_smallest = 1; fragment_size_of_smallest = doc1_intersection1_fragment_size; } if (++its[index_of_smallest] == fragment_size_of_smallest) { end = true; } } } delete[] its; q3_tag_array_1threads_231_4366_intersection_size = intersection_index; } void* pthread_q3_tag_array_1threads_231_4366_worker(void* arguments) { args_threading* args = (args_threading *) arguments; uint32_t q3_tag_array_1threads_231_4366_intersection_it = args->start; uint32_t q3_tag_array_1threads_231_4366_intersection_size = args->end; int thread_id = args->thread_id; for (; q3_tag_array_1threads_231_4366_intersection_it<q3_tag_array_1threads_231_4366_intersection_size; q3_tag_array_1threads_231_4366_intersection_it++) { uint32_t* row_author1 = idx[4]->index_map[q3_tag_array_1threads_231_4366_intersection_buffer[q3_tag_array_1threads_231_4366_intersection_it]]; uint32_t author1_col0_bytes = idx[4]->index_map[q3_tag_array_1threads_231_4366_intersection_buffer[q3_tag_array_1threads_231_4366_intersection_it]+1][0] - row_author1[0]; if(author1_col0_bytes) { uint32_t* author1_col0_ptr = reinterpret_cast<uint32_t *>(&(idx[4]->fragment_data[0][row_author1[0]])); uint32_t author1_fragment_size = 0; q3_tag_array_1threads_231_4366_author1_col0_decode_UA_threaded(thread_id, author1_col0_ptr, author1_col0_bytes, author1_fragment_size); for (uint32_t author1_it = 0; author1_it < author1_fragment_size; author1_it++) { uint32_t author1_col0_element = buffer_arrays[4][0][thread_id][0][author1_it]; RC[author1_col0_element] = 1; pthread_spin_lock(&spin_locks[4][author1_col0_element]); R[author1_col0_element] += 1; pthread_spin_unlock(&spin_locks[4][author1_col0_element]); } } } return nullptr; } void q3_tag_array_1threads_231_4366_author1_col0_decode_UA_threaded(int thread_id, uint32_t* author1_col0_ptr, uint32_t author1_col0_bytes, uint32_t & author1_fragment_size) { author1_fragment_size = author1_col0_bytes/4; for (uint32_t i=0; i<author1_fragment_size; i++) { buffer_arrays[4][0][thread_id][0][i] = *author1_col0_ptr++; } } extern "C" int* q3_tag_array_1threads_231_4366(int** null_checks) { benchmark_t1 = chrono::steady_clock::now(); int max_frag; max_frag = metadata.idx_max_fragment_sizes[3]; for(int i=0; i<metadata.idx_num_encodings[3]; i++) { for (int j=0; j<NUM_THREADS; j++) { buffer_arrays[3][i][j] = new uint64_t*[BUFFER_POOL_SIZE]; for (int k=0; k<BUFFER_POOL_SIZE; k++) { buffer_arrays[3][i][j][k] = new uint64_t[max_frag]; } } } max_frag = metadata.idx_max_fragment_sizes[4]; for(int i=0; i<metadata.idx_num_encodings[4]; i++) { for (int j=0; j<NUM_THREADS; j++) { buffer_arrays[4][i][j] = new uint64_t*[BUFFER_POOL_SIZE]; for (int k=0; k<BUFFER_POOL_SIZE; k++) { buffer_arrays[4][i][j][k] = new uint64_t[max_frag]; } } } RC = new int[metadata.idx_domains[4][0]](); R = new int[metadata.idx_domains[4][0]](); q3_tag_array_1threads_231_4366_intersection_buffer = new uint64_t[metadata.idx_max_fragment_sizes[3]]; uint32_t* row_doc1_intersection0 = idx[3]->index_map[231]; uint32_t doc1_col0_bytes_intersection0 = idx[3]->index_map[231+1][0] - row_doc1_intersection0[0]; uint32_t* doc1_col0_intersection_ptr_0 = reinterpret_cast<uint32_t *>(&(idx[3]->fragment_data[0][row_doc1_intersection0[0]])); uint32_t doc1_intersection0_fragment_size = 0; q3_tag_array_1threads_231_4366_doc1_col0_intersection0_decode_UA(doc1_col0_intersection_ptr_0, doc1_col0_bytes_intersection0, doc1_intersection0_fragment_size); uint32_t* row_doc1_intersection1 = idx[3]->index_map[4366]; uint32_t doc1_col0_bytes_intersection1 = idx[3]->index_map[4366+1][0] - row_doc1_intersection1[0]; uint32_t* doc1_col0_intersection_ptr_1 = reinterpret_cast<uint32_t *>(&(idx[3]->fragment_data[0][row_doc1_intersection1[0]])); uint32_t doc1_intersection1_fragment_size = 0; q3_tag_array_1threads_231_4366_doc1_col0_intersection1_decode_UA(doc1_col0_intersection_ptr_1, doc1_col0_bytes_intersection1, doc1_intersection1_fragment_size); uint32_t q3_tag_array_1threads_231_4366_intersection_size = 0; q3_tag_array_1threads_231_4366_intersection(doc1_intersection0_fragment_size, doc1_intersection1_fragment_size, q3_tag_array_1threads_231_4366_intersection_size); uint32_t thread_size = q3_tag_array_1threads_231_4366_intersection_size/NUM_THREADS; uint32_t position = 0; for (int i=0; i<NUM_THREADS; i++) { arguments[i].start = position; position += thread_size; arguments[i].end = position; arguments[i].thread_id = i; } arguments[NUM_THREADS-1].end = q3_tag_array_1threads_231_4366_intersection_size; for (int i=0; i<NUM_THREADS; i++) { pthread_create(&threads[i], NULL, &pthread_q3_tag_array_1threads_231_4366_worker, (void *) &arguments[i]); } for (int i=0; i<NUM_THREADS; i++) { pthread_join(threads[i], NULL); } for (int j=0; j<metadata.idx_num_encodings[3]; j++) { for (int k=0; k<NUM_THREADS; k++) { for (int l=0; l<BUFFER_POOL_SIZE; l++) { delete[] buffer_arrays[3][j][k][l]; } delete[] buffer_arrays[3][j][k]; } } for (int j=0; j<metadata.idx_num_encodings[4]; j++) { for (int k=0; k<NUM_THREADS; k++) { for (int l=0; l<BUFFER_POOL_SIZE; l++) { delete[] buffer_arrays[4][j][k][l]; } delete[] buffer_arrays[4][j][k]; } } delete[] q3_tag_array_1threads_231_4366_intersection_buffer; *null_checks = RC; return R; } #endif
[ "bmandel@eng.ucsd.edu" ]
bmandel@eng.ucsd.edu
4ec7c50d75376da13da832e7168d46093c17c1c1
8cf32b4cbca07bd39341e1d0a29428e420b492a6
/contracts/libc++/upstream/test/std/containers/unord/unord.multimap/unord.multimap.cnstr/range.pass.cpp
c00234e1d65029b2523c49e5e94484b4a1df29d9
[ "NCSA", "MIT" ]
permissive
cubetrain/CubeTrain
e1cd516d5dbca77082258948d3c7fc70ebd50fdc
b930a3e88e941225c2c54219267f743c790e388f
refs/heads/master
2020-04-11T23:00:50.245442
2018-12-17T16:07:16
2018-12-17T16:07:16
156,970,178
0
0
null
null
null
null
UTF-8
C++
false
false
10,065
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. // //===----------------------------------------------------------------------===// // <unordered_map> // template <class Key, class T, class Hash = hash<Key>, class Pred = equal_to<Key>, // class Alloc = allocator<pair<const Key, T>>> // class unordered_multimap // template <class InputIterator> // unordered_multimap(InputIterator first, InputIterator last); #include <unordered_map> #include <string> #include <cassert> #include <cfloat> #include <cstddef> #include "test_macros.h" #include "test_iterators.h" #include "../../../NotConstructible.h" #include "../../../test_compare.h" #include "../../../test_hash.h" #include "test_allocator.h" #include "min_allocator.h" int main() { { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, test_compare<std::equal_to<int> >, test_allocator<std::pair<const int, std::string> > > C; typedef std::pair<int, std::string> P; P a[] = { P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four"), }; C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0]))); assert(c.bucket_count() >= 7); assert(c.size() == 6); typedef std::pair<C::const_iterator, C::const_iterator> Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); C::const_iterator i = eq.first; assert(i->first == 1); assert(i->second == "one"); ++i; assert(i->first == 1); assert(i->second == "four"); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); i = eq.first; assert(i->first == 2); assert(i->second == "two"); ++i; assert(i->first == 2); assert(i->second == "four"); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 4); assert(i->second == "four"); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == test_allocator<std::pair<const int, std::string> >())); } #if TEST_STD_VER >= 11 { typedef std::unordered_multimap<int, std::string, test_hash<std::hash<int> >, test_compare<std::equal_to<int> >, min_allocator<std::pair<const int, std::string> > > C; typedef std::pair<int, std::string> P; P a[] = { P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four"), }; C c(input_iterator<P*>(a), input_iterator<P*>(a + sizeof(a)/sizeof(a[0]))); assert(c.bucket_count() >= 7); assert(c.size() == 6); typedef std::pair<C::const_iterator, C::const_iterator> Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); C::const_iterator i = eq.first; assert(i->first == 1); assert(i->second == "one"); ++i; assert(i->first == 1); assert(i->second == "four"); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); i = eq.first; assert(i->first == 2); assert(i->second == "two"); ++i; assert(i->first == 2); assert(i->second == "four"); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 4); assert(i->second == "four"); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c.hash_function() == test_hash<std::hash<int> >()); assert(c.key_eq() == test_compare<std::equal_to<int> >()); assert((c.get_allocator() == min_allocator<std::pair<const int, std::string> >())); } #if TEST_STD_VER > 11 { typedef std::pair<int, std::string> P; typedef test_allocator<std::pair<const int, std::string>> A; typedef test_hash<std::hash<int>> HF; typedef test_compare<std::equal_to<int>> Comp; typedef std::unordered_multimap<int, std::string, HF, Comp, A> C; P arr[] = { P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four"), }; A a(42); C c(input_iterator<P*>(arr), input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 14, a); assert(c.bucket_count() >= 14); assert(c.size() == 6); typedef std::pair<C::const_iterator, C::const_iterator> Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); C::const_iterator i = eq.first; assert(i->first == 1); assert(i->second == "one"); ++i; assert(i->first == 1); assert(i->second == "four"); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); i = eq.first; assert(i->first == 2); assert(i->second == "two"); ++i; assert(i->first == 2); assert(i->second == "four"); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 4); assert(i->second == "four"); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c.hash_function() == HF()); assert(c.key_eq() == Comp()); assert(c.get_allocator() == a); assert(!(c.get_allocator() == A())); } { typedef std::pair<int, std::string> P; typedef test_allocator<std::pair<const int, std::string>> A; typedef test_hash<std::hash<int>> HF; typedef test_compare<std::equal_to<int>> Comp; typedef std::unordered_multimap<int, std::string, HF, Comp, A> C; P arr[] = { P(1, "one"), P(2, "two"), P(3, "three"), P(4, "four"), P(1, "four"), P(2, "four"), }; A a(42); HF hf (43); C c(input_iterator<P*>(arr), input_iterator<P*>(arr + sizeof(arr)/sizeof(arr[0])), 12, hf, a ); assert(c.bucket_count() >= 12); assert(c.size() == 6); typedef std::pair<C::const_iterator, C::const_iterator> Eq; Eq eq = c.equal_range(1); assert(std::distance(eq.first, eq.second) == 2); C::const_iterator i = eq.first; assert(i->first == 1); assert(i->second == "one"); ++i; assert(i->first == 1); assert(i->second == "four"); eq = c.equal_range(2); assert(std::distance(eq.first, eq.second) == 2); i = eq.first; assert(i->first == 2); assert(i->second == "two"); ++i; assert(i->first == 2); assert(i->second == "four"); eq = c.equal_range(3); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 3); assert(i->second == "three"); eq = c.equal_range(4); assert(std::distance(eq.first, eq.second) == 1); i = eq.first; assert(i->first == 4); assert(i->second == "four"); assert(static_cast<std::size_t>(std::distance(c.begin(), c.end())) == c.size()); assert(static_cast<std::size_t>(std::distance(c.cbegin(), c.cend())) == c.size()); assert(fabs(c.load_factor() - (float)c.size()/c.bucket_count()) < FLT_EPSILON); assert(c.max_load_factor() == 1); assert(c.hash_function() == hf); assert(!(c.hash_function() == HF())); assert(c.key_eq() == Comp()); assert(c.get_allocator() == a); assert(!(c.get_allocator() == A())); } #endif #endif }
[ "1848@shanchain.com" ]
1848@shanchain.com
8f31210e2285e5f44660d7999095c9c54cbcd6dc
41b4adb10cc86338d85db6636900168f55e7ff18
/aws-cpp-sdk-iot/include/aws/iot/model/Certificate.h
5662b8b0434865f29c623eb5b99abc3e8d52cf94
[ "JSON", "MIT", "Apache-2.0" ]
permissive
totalkyos/AWS
1c9ac30206ef6cf8ca38d2c3d1496fa9c15e5e80
7cb444814e938f3df59530ea4ebe8e19b9418793
refs/heads/master
2021-01-20T20:42:09.978428
2016-07-16T00:03:49
2016-07-16T00:03:49
63,465,708
1
1
null
null
null
null
UTF-8
C++
false
false
6,100
h
/* * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. 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. * A copy of the License is located at * * http://aws.amazon.com/apache2.0 * * or in the "license" file accompanying this file. This file is distributed * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ #pragma once #include <aws/iot/IoT_EXPORTS.h> #include <aws/core/utils/memory/stl/AWSString.h> #include <aws/iot/model/CertificateStatus.h> #include <aws/core/utils/DateTime.h> namespace Aws { namespace Utils { namespace Json { class JsonValue; } // namespace Json } // namespace Utils namespace IoT { namespace Model { /** * <p>Information about a certificate.</p> */ class AWS_IOT_API Certificate { public: Certificate(); Certificate(const Aws::Utils::Json::JsonValue& jsonValue); Certificate& operator=(const Aws::Utils::Json::JsonValue& jsonValue); Aws::Utils::Json::JsonValue Jsonize() const; /** * <p>The ARN of the certificate.</p> */ inline const Aws::String& GetCertificateArn() const{ return m_certificateArn; } /** * <p>The ARN of the certificate.</p> */ inline void SetCertificateArn(const Aws::String& value) { m_certificateArnHasBeenSet = true; m_certificateArn = value; } /** * <p>The ARN of the certificate.</p> */ inline void SetCertificateArn(Aws::String&& value) { m_certificateArnHasBeenSet = true; m_certificateArn = value; } /** * <p>The ARN of the certificate.</p> */ inline void SetCertificateArn(const char* value) { m_certificateArnHasBeenSet = true; m_certificateArn.assign(value); } /** * <p>The ARN of the certificate.</p> */ inline Certificate& WithCertificateArn(const Aws::String& value) { SetCertificateArn(value); return *this;} /** * <p>The ARN of the certificate.</p> */ inline Certificate& WithCertificateArn(Aws::String&& value) { SetCertificateArn(value); return *this;} /** * <p>The ARN of the certificate.</p> */ inline Certificate& WithCertificateArn(const char* value) { SetCertificateArn(value); return *this;} /** * <p>The ID of the certificate.</p> */ inline const Aws::String& GetCertificateId() const{ return m_certificateId; } /** * <p>The ID of the certificate.</p> */ inline void SetCertificateId(const Aws::String& value) { m_certificateIdHasBeenSet = true; m_certificateId = value; } /** * <p>The ID of the certificate.</p> */ inline void SetCertificateId(Aws::String&& value) { m_certificateIdHasBeenSet = true; m_certificateId = value; } /** * <p>The ID of the certificate.</p> */ inline void SetCertificateId(const char* value) { m_certificateIdHasBeenSet = true; m_certificateId.assign(value); } /** * <p>The ID of the certificate.</p> */ inline Certificate& WithCertificateId(const Aws::String& value) { SetCertificateId(value); return *this;} /** * <p>The ID of the certificate.</p> */ inline Certificate& WithCertificateId(Aws::String&& value) { SetCertificateId(value); return *this;} /** * <p>The ID of the certificate.</p> */ inline Certificate& WithCertificateId(const char* value) { SetCertificateId(value); return *this;} /** * <p>The status of the certificate.</p> <p>The status value REGISTER_INACTIVE is * deprecated and should not be used.</p> */ inline const CertificateStatus& GetStatus() const{ return m_status; } /** * <p>The status of the certificate.</p> <p>The status value REGISTER_INACTIVE is * deprecated and should not be used.</p> */ inline void SetStatus(const CertificateStatus& value) { m_statusHasBeenSet = true; m_status = value; } /** * <p>The status of the certificate.</p> <p>The status value REGISTER_INACTIVE is * deprecated and should not be used.</p> */ inline void SetStatus(CertificateStatus&& value) { m_statusHasBeenSet = true; m_status = value; } /** * <p>The status of the certificate.</p> <p>The status value REGISTER_INACTIVE is * deprecated and should not be used.</p> */ inline Certificate& WithStatus(const CertificateStatus& value) { SetStatus(value); return *this;} /** * <p>The status of the certificate.</p> <p>The status value REGISTER_INACTIVE is * deprecated and should not be used.</p> */ inline Certificate& WithStatus(CertificateStatus&& value) { SetStatus(value); return *this;} /** * <p>The date and time the certificate was created.</p> */ inline const Aws::Utils::DateTime& GetCreationDate() const{ return m_creationDate; } /** * <p>The date and time the certificate was created.</p> */ inline void SetCreationDate(const Aws::Utils::DateTime& value) { m_creationDateHasBeenSet = true; m_creationDate = value; } /** * <p>The date and time the certificate was created.</p> */ inline void SetCreationDate(Aws::Utils::DateTime&& value) { m_creationDateHasBeenSet = true; m_creationDate = value; } /** * <p>The date and time the certificate was created.</p> */ inline Certificate& WithCreationDate(const Aws::Utils::DateTime& value) { SetCreationDate(value); return *this;} /** * <p>The date and time the certificate was created.</p> */ inline Certificate& WithCreationDate(Aws::Utils::DateTime&& value) { SetCreationDate(value); return *this;} private: Aws::String m_certificateArn; bool m_certificateArnHasBeenSet; Aws::String m_certificateId; bool m_certificateIdHasBeenSet; CertificateStatus m_status; bool m_statusHasBeenSet; Aws::Utils::DateTime m_creationDate; bool m_creationDateHasBeenSet; }; } // namespace Model } // namespace IoT } // namespace Aws
[ "henso@amazon.com" ]
henso@amazon.com
3f24265c9a3c115c40bd74d41c879e40b2b55be9
04b1803adb6653ecb7cb827c4f4aa616afacf629
/content/browser/renderer_host/pepper/pepper_proxy_lookup_helper_unittest.cc
7cb810b21fbc091d1bf90b7559ec8ff929a597c6
[ "BSD-3-Clause" ]
permissive
Samsung/Castanets
240d9338e097b75b3f669604315b06f7cf129d64
4896f732fc747dfdcfcbac3d442f2d2d42df264a
refs/heads/castanets_76_dev
2023-08-31T09:01:04.744346
2021-07-30T04:56:25
2021-08-11T05:45:21
125,484,161
58
49
BSD-3-Clause
2022-10-16T19:31:26
2018-03-16T08:07:37
null
UTF-8
C++
false
false
6,851
cc
// Copyright 2018 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #include "content/browser/renderer_host/pepper/pepper_proxy_lookup_helper.h" #include <memory> #include <string> #include "base/bind.h" #include "base/callback.h" #include "base/logging.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" #include "base/optional.h" #include "base/run_loop.h" #include "base/task/post_task.h" #include "content/public/browser/browser_task_traits.h" #include "content/public/browser/browser_thread.h" #include "content/public/test/test_browser_thread_bundle.h" #include "net/base/net_errors.h" #include "net/proxy_resolution/proxy_info.h" #include "services/network/public/mojom/proxy_lookup_client.mojom.h" #include "testing/gtest/include/gtest/gtest.h" #include "url/gurl.h" namespace content { namespace { constexpr char kTestURL[] = "http://foo/"; class PepperProxyLookupHelperTest : public testing::Test { public: PepperProxyLookupHelperTest() = default; ~PepperProxyLookupHelperTest() override = default; // Initializes |lookup_helper_| on the IO thread, and starts it there. Returns // once it has called into LookUpProxyForURLOnUIThread on the UI thread. void StartLookup() { DCHECK_CURRENTLY_ON(BrowserThread::UI); base::RunLoop run_loop; base::PostTaskWithTraits( FROM_HERE, {BrowserThread::IO}, base::BindOnce(&PepperProxyLookupHelperTest::StartLookupOnIOThread, base::Unretained(this), run_loop.QuitClosure())); run_loop.Run(); EXPECT_TRUE(lookup_helper_); if (!fail_to_start_request_) EXPECT_TRUE(proxy_lookup_client_); } // Takes the |ProxyLookupClientPtr| passed by |lookup_helper_| to // LookUpProxyForURLOnUIThread(). May only be called after |lookup_helper_| // has successfully called into LookUpProxyForURLOnUIThread(). network::mojom::ProxyLookupClientPtr ClaimProxyLookupClient() { EXPECT_TRUE(proxy_lookup_client_); return std::move(proxy_lookup_client_); } void DestroyLookupHelper() { DCHECK_CURRENTLY_ON(BrowserThread::UI); base::RunLoop run_loop; base::PostTaskWithTraitsAndReply( FROM_HERE, {BrowserThread::IO}, base::BindOnce( &PepperProxyLookupHelperTest::DestroyLookupHelperOnIOThread, base::Unretained(this)), run_loop.QuitClosure()); run_loop.Run(); } // Waits for |lookup_helper_| to call into OnLookupCompleteOnIOThread(), // signally proxy lookup completion. void WaitForLookupCompletion() { EXPECT_TRUE(lookup_helper_); lookup_complete_run_loop_.Run(); } // Get the proxy information passed into OnLookupCompleteOnIOThread(). const base::Optional<net::ProxyInfo>& proxy_info() const { return proxy_info_; } // Setting this to true will make LookUpProxyForURLOnUIThread, the callback // invoked to start looking up the proxy, return false. void set_fail_to_start_request(bool fail_to_start_request) { fail_to_start_request_ = fail_to_start_request; } private: // Must be called on the IO thread. Initializes |lookup_helper_| and starts a // proxy lookup. Invokes |closure| on the UI thread once the |lookup_helper_| // has invoked LookUpProxyForURLOnUIThread on the UI thread. void StartLookupOnIOThread(base::OnceClosure closure) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(!lookup_helper_); lookup_helper_ = std::make_unique<PepperProxyLookupHelper>(); lookup_helper_->Start( GURL(kTestURL), base::BindOnce( &PepperProxyLookupHelperTest::LookUpProxyForURLOnUIThread, base::Unretained(this), std::move(closure)), base::BindOnce(&PepperProxyLookupHelperTest::OnLookupCompleteOnIOThread, base::Unretained(this))); } // Callback passed to |lookup_helper_| to start the proxy lookup. bool LookUpProxyForURLOnUIThread( base::OnceClosure closure, const GURL& url, network::mojom::ProxyLookupClientPtr proxy_lookup_client) { DCHECK_CURRENTLY_ON(BrowserThread::UI); std::move(closure).Run(); if (fail_to_start_request_) return false; EXPECT_EQ(GURL(kTestURL), url); proxy_lookup_client_ = std::move(proxy_lookup_client); return true; } // Invoked by |lookup_helper_| on the IO thread once the proxy lookup has // completed. void OnLookupCompleteOnIOThread(base::Optional<net::ProxyInfo> proxy_info) { DCHECK_CURRENTLY_ON(BrowserThread::IO); proxy_info_ = std::move(proxy_info); lookup_helper_.reset(); lookup_complete_run_loop_.Quit(); } void DestroyLookupHelperOnIOThread() { DCHECK_CURRENTLY_ON(BrowserThread::IO); lookup_helper_.reset(); } TestBrowserThreadBundle test_browser_thread_bundle_; bool fail_to_start_request_ = false; std::unique_ptr<PepperProxyLookupHelper> lookup_helper_; base::Optional<net::ProxyInfo> proxy_info_; network::mojom::ProxyLookupClientPtr proxy_lookup_client_; base::RunLoop lookup_complete_run_loop_; }; TEST_F(PepperProxyLookupHelperTest, Success) { StartLookup(); net::ProxyInfo proxy_info_response; proxy_info_response.UseNamedProxy("result:80"); ClaimProxyLookupClient()->OnProxyLookupComplete(net::OK, proxy_info_response); WaitForLookupCompletion(); ASSERT_TRUE(proxy_info()); EXPECT_EQ("PROXY result:80", proxy_info()->ToPacString()); } // Basic failure case - an error is passed to the PepperProxyLookupHelper // through the ProxyLookupClient API. TEST_F(PepperProxyLookupHelperTest, Failure) { StartLookup(); ClaimProxyLookupClient()->OnProxyLookupComplete(net::ERR_FAILED, base::nullopt); WaitForLookupCompletion(); EXPECT_FALSE(proxy_info()); } // The mojo pipe is closed before the PepperProxyLookupHelper's callback is // invoked. TEST_F(PepperProxyLookupHelperTest, PipeClosed) { StartLookup(); ClaimProxyLookupClient().reset(); WaitForLookupCompletion(); EXPECT_FALSE(proxy_info()); } // The proxy lookup fails to start - instead, the callback to start the lookup // returns false. TEST_F(PepperProxyLookupHelperTest, FailToStartRequest) { set_fail_to_start_request(true); StartLookup(); WaitForLookupCompletion(); EXPECT_FALSE(proxy_info()); } // Destroy the helper before it completes a lookup. Make sure it cancels the // connection, and memory tools don't detect a leak. TEST_F(PepperProxyLookupHelperTest, DestroyBeforeComplete) { StartLookup(); base::RunLoop run_loop; network::mojom::ProxyLookupClientPtr proxy_lookup_client = ClaimProxyLookupClient(); proxy_lookup_client.set_connection_error_handler(run_loop.QuitClosure()); DestroyLookupHelper(); run_loop.Run(); } } // namespace } // namespace content
[ "sunny.nam@samsung.com" ]
sunny.nam@samsung.com
025493a15ba37630c8f52404eff68e4fc96e29c1
e6e6c81568e0f41831a85490895a7cf5c929d50e
/atcoder/Other/relay2018/relay2018_c.cpp
2a40a73bd1cc6f1a73154098d5c9cfcedac0340a
[]
no_license
mint6421/kyopro
69295cd06ff907cd6cc43887ce964809aa2534d9
f4ef43669352d84bd32e605a40f75faee5358f96
refs/heads/master
2021-07-02T04:57:13.566704
2020-10-23T06:51:20
2020-10-23T06:51:20
182,088,856
0
0
null
null
null
null
UTF-8
C++
false
false
1,393
cpp
#include<bits/stdc++.h> using namespace std; #define inf INT_MAX #define INF LLONG_MAX #define ll long long #define ull unsigned long long #define M (int)(1e9+7) #define P pair<int,int> #define FOR(i,m,n) for(int i=(int)m;i<(int)n;i++) #define RFOR(i,m,n) for(int i=(int)m;i>=(int)n;i--) #define rep(i,n) FOR(i,0,n) #define rrep(i,n) RFOR(i,n,0) #define all(a) a.begin(),a.end() const int vx[4] = {0,1,0,-1}; const int vy[4] = {1,0,-1,0}; #define F first #define S second #define PB push_back #define EB emplace_back #define int ll #define vi vector<int> #define IP pair<int,P> #define PI pair<P,int> #define PP pair<P,P> #define Yes(f){cout<<(f?"Yes":"No")<<endl;} #define YES(f){cout<<(f?"YES":"NO")<<endl;} int Mplus(int x,int y) {return (x+y)%M;} int Msub(int x,int y) {return (x-y+M)%M;} int Mmul(int x,int y) {return (x*y)%M;} signed main(){ cin.tie(0); ios::sync_with_stdio(false); cout<<fixed<<setprecision(20); int n,h; cin>>n>>h; vi a(n); rep(i,n){ cin>>a[i]; } vi v(n); rep(i,n) v[i]=i; int ans=0; do{ bool c[20]={}; bool flag=true; rep(i,n){ int s=0; rep(j,v[i]+1) if(!c[j])s+=a[j]; if(s>h) flag=false; c[v[i]]=true; } if(flag){ /* rep(i,n){ cout<<v[i]<<' '; } cout<<endl; */ ans++; } }while(next_permutation(all(v))); cout<<ans<<endl; }
[ "ee177100@meiji.ac.jp" ]
ee177100@meiji.ac.jp
b89345b1d60c859af616fd6d7f9e355ab046b55a
40aa8314168fe69c6e217912df978a230738c194
/tests/compound_container_tests.cpp
e900538ff3ae9b32debd1b9e718f9a79a8f00258
[ "MIT" ]
permissive
kspinka/discreture
c407dcfad2069741fabaf0561daca2f9fde4154a
ec758378d793c85eac3fa5c8222ed4ad869362fe
refs/heads/master
2020-03-19T19:28:15.693832
2018-06-11T04:01:44
2018-06-11T04:01:44
136,857,427
0
0
null
2018-06-11T01:01:31
2018-06-11T01:01:30
null
UTF-8
C++
false
false
2,031
cpp
#include "CombinationTree.hpp" #include "Combinations.hpp" #include "CompoundContainer.hpp" #include "Permutations.hpp" #include "generate_strings.hpp" #include <gtest/gtest.h> #include <iostream> #include <string> #include <vector> using namespace std; using namespace dscr; template <class CompundContainer, class Objects, class Indices> void check_compound_container(const CompundContainer& U, const Objects& A, const Indices& X) { ASSERT_EQ(U.size(), X.size()); for (auto i : indices(X)) { for (auto j : indices(X[i])) { ASSERT_EQ(U[i][j], A[X[i][j]]); } } size_t i = 0; for (auto u : U) { size_t j = 0; for (auto w : u) { ASSERT_EQ(w, A[X[i][j]]); ++j; } ++i; } } TEST(CompoundContainer, CreationAndSanity) { std::vector<std::string> A = {"hola", "adios", "uch", "bla"}; std::vector<std::vector<int>> X = {{0, 1}, {1, 3}, {0, 1, 2}}; auto U = dscr::compound_container(A, X); check_compound_container(U, A, X); } TEST(CompoundContainer, Combinations) { std::vector<std::string> A = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}; int n = A.size(); for (int k = 0; k <= n; ++k) { using namespace dscr; auto U = combinations(A, k); check_compound_container(U, A, dscr::combinations(n, k)); } } TEST(CompoundContainer, CombinationTree) { std::vector<std::string> A = {"a", "b", "c", "d", "e", "f", "g", "h", "i"}; int n = A.size(); for (auto k : NN(n)) { using namespace dscr; auto U = dscr::combination_tree(A, k); check_compound_container(U, A, dscr::combination_tree(n, k)); } } TEST(CompoundContainer, Permutations) { std::vector<std::string> A = {"a", "b", "c", "d", "e"}; int n = A.size(); using namespace dscr; auto U = dscr::permutations(A); check_compound_container(U, A, dscr::permutations(n)); }
[ "mraggi@gmail.com" ]
mraggi@gmail.com
c84798d3b79a966e776c51d6102983147016874b
d4fb2a6801e816266293f0c43ba52d240bdb15e0
/Level 4/Section 2.4/Exercise 1/Exercise 1/Point.hpp
920d716ac04689b095989a978e87328aaa48e43f
[]
no_license
CliffChen21/C-Learning
cbe929f5a8a5a4d8b4356701fb08349fa4aa8a95
904acff1b7ea843ba47df6b36b47e7df8e85fb63
refs/heads/master
2023-08-20T11:10:48.581559
2021-10-23T06:47:51
2021-10-23T06:47:51
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,666
hpp
// Section 2.4 Exercise 1 // Point.hpp // [Author] Cliff Chen // [Description] Header file declares a class point with: // - Members x and y privately; // - X()/Y()/Distance() functions publicly. // - Also declare default constructor, destructor, copy constructor and constructor accepting x- and y- coordinates. // - User-defined operator -, *, +, ==, = and *=. // [Modifications] // 2021-06-21 CC Establish the 1st Version. // 2021-06-21 CC Add Distance() and DistanceOrigin() functions to compute the distance between any two points and the origin. // 2021-06-26 CC Add copy constructor and constructor accepts x-/y-coordinates. // CC Change call-by-value in Distance to call-by-constant-reference. // CC Overload SetX()/GetX() tO X(), SetY()/GetY() tO Y(), DistanceOrigin() to Distance() // and three constructor to the same name Point. // CC Change the getter functions, ToString() and Distance() to constant member functions. // 2021-07-11 CC Add operator functions based on the mathematically logic. #ifndef POINT_H #define POINT_H #include <iostream> // Library contains count/cin. using namespace std; class Point { private: double x; // x-coordinate. double y; // y-coordinate. public: // Constructors Point(); // Default constructor Point(const Point& p); // Copy constructor Point(double x_val, double y_val); // Constructor with x, y values ~Point(); // Destructor // Accessing functions double X() const; // Getter function for x. double Y() const; // Getter function for y. // Modifiers void X(double x_val); // Setter function for x. void Y(double y_val); // Setter function for y. // Member operator overloading Point operator - () const; // Negate the coordinates. Point operator * (double factor) const; // Scale the coordinates. Point operator + (const Point& p) const; // Add coordinates. bool operator == (const Point& p) const; // Equally compare operator. Point& operator = (const Point& source); // Assignment operator. Point& operator *= (double factor); // Scale the coordinates & assign. // Functionality string ToString() const; // [Description] Return string description of the point. // [Input] None. // [Output] (string) "Point(x, y)". double Distance() const; // [Description] Calculate the distance to the origin (0, 0). // [Input] None. // [Output] Distance between this point and origin. double Distance(const Point& p) const; // [Description] Calculate the distance between two points. // [Input] Pint objects. // [Output] Distance between this point and user input point. }; #endif // POINT_H
[ "c13moutain@gmail.com" ]
c13moutain@gmail.com
4f6a048ba18f7e6c3ff823f1d757e55e2344f724
ab85cfb899de540e4aa2446eedaab4eed4f9b685
/test3.cc
3cb513824ed63fa5eeffd2b1023dbebcef4765a4
[]
no_license
stswl12/testgit
2d6d3d41f57d3dff51a3b033a604e55ada55985a
0988f8521dbb859477ac023683a09374bbf71a83
refs/heads/master
2021-01-11T19:01:19.019322
2017-01-18T07:59:40
2017-01-18T07:59:40
79,293,748
0
0
null
null
null
null
UTF-8
C++
false
false
113
cc
#include<iostream> using namespace std; int main() { cout<<"This is test3! Good afternoon!"<<endl; return 0; }
[ "1260972591@qq.com" ]
1260972591@qq.com
80d9970c54a0dabccfe4cfd4b5398f0f8fc809b9
7ab3757bde602ebe0b2f9e49d7e1d5f672ee150a
/easyicon/src/libicon/Symbol.h
3620ba7c49f9642db82104f0af7c84afa2396ea0
[ "MIT" ]
permissive
brucelevis/easyeditor
310dc05084b06de48067acd7ef5d6882fd5b7bba
d0bb660a491c7d990b0dae5b6fa4188d793444d9
refs/heads/master
2021-01-16T18:36:37.012604
2016-08-11T11:25:20
2016-08-11T11:25:20
null
0
0
null
null
null
null
UTF-8
C++
false
false
836
h
#ifndef _EASYICON_SYMBOL_H_ #define _EASYICON_SYMBOL_H_ #include <ee/Symbol.h> namespace ee { class Image; } namespace eicon { class Icon; class Symbol : public ee::Symbol { public: Symbol(); virtual ~Symbol(); // // Cloneable interface // virtual Symbol* Clone() const { return NULL; } // // Symbol interfaces // virtual void Draw(const s2::RenderParams& params, const ee::Sprite* spr = NULL) const; virtual void ReloadTexture() const; virtual sm::rect GetSize(const ee::Sprite* sprite = NULL) const; static ee::Symbol* Create() { return new Symbol(); } void SetIcon(Icon* icon); const Icon* GetIcon() const { return m_icon; } Icon* GetIcon() { return m_icon; } void SetImage(ee::Image* img); protected: virtual void LoadResources(); private: Icon* m_icon; }; // Symbol } #endif // _EASYICON_SYMBOL_H_
[ "zhuguang@ejoy.com" ]
zhuguang@ejoy.com
0d2d36985fbe08cd05818a5de123a3636b504787
be98c7fe87a9e6e8698da57509f171a3fa4a1c8e
/belik_jua/Practice/Practice8/Matrix.h
bfc0b156c892fa12db4791fe7317e498112ff318
[]
no_license
BelikJulia/mp1-practice
434aa5c689a6b24f16fc92a10962f814dc23d9af
90f4e89b6a5f1b3f8b5648f1f74c76bf8f572522
refs/heads/master
2020-03-28T10:43:44.484160
2019-09-01T05:19:20
2019-09-01T05:19:20
148,138,849
0
0
null
2019-09-01T05:19:21
2018-09-10T10:29:55
C++
UTF-8
C++
false
false
693
h
#pragma once class Matrix { private: double *matr; int x, y; public: Matrix(int _x, int _y); Matrix(double *_matr, int _x, int _y); Matrix(const Matrix& m); ~Matrix(); Matrix operator+ (const Matrix& m) const; Matrix operator- (const Matrix& m) const; Matrix operator* (const Matrix& m) const; Matrix operator+ (double a) const; Matrix operator- (double a) const; Matrix operator* (double a) const; double* operator[] (int a) const; const Matrix& operator= (const Matrix& m); bool operator== (const Matrix& m) const; friend istream& operator>> (istream&, Matrix&); friend ostream& operator<< (ostream&, const Matrix&); };
[ "ybelik2015@yandex.ru" ]
ybelik2015@yandex.ru
de2e56accc695e51ecbe303afa4d16e094925736
15545ef1760ff97e81d44434d7a47c4aaaf33e4f
/leetcode/findItinerary.cpp
7f1154ec2ddcde8ac10c8976fda95fbbd5e87b2e
[ "MIT" ]
permissive
jcpince/algorithms
7c4f852ab0f3159403f68a4e2db69a2b1ddeabf1
bb06bd54b8720908f0a1d5e9154bc36fedbeed79
refs/heads/master
2023-01-24T15:21:19.774448
2023-01-02T15:27:46
2023-01-02T15:27:46
193,212,466
0
0
null
null
null
null
UTF-8
C++
false
false
4,384
cpp
/* https://leetcode.com/problems/reconstruct-itinerary/ 332. Reconstruct Itinerary Medium Given a list of airline tickets represented by pairs of departure and arrival airports [from, to], reconstruct the itinerary in order. All of the tickets belong to a man who departs from JFK. Thus, the itinerary must begin with JFK. Note: If there are multiple valid itineraries, you should return the itinerary that has the smallest lexical order when read as a single string. For example, the itinerary ["JFK", "LGA"] has a smaller lexical order than ["JFK", "LGB"]. All airports are represented by three capital letters (IATA code). You may assume all tickets form at least one valid itinerary. Example 1: Input: [["MUC", "LHR"], ["JFK", "MUC"], ["SFO", "SJC"], ["LHR", "SFO"]] Output: ["JFK", "MUC", "LHR", "SFO", "SJC"] Example 2: Input: [["JFK","SFO"],["JFK","ATL"],["SFO","ATL"],["ATL","JFK"],["ATL","SFO"]] Output: ["JFK","ATL","JFK","SFO","ATL","SFO"] Explanation: Another possible reconstruction is ["JFK","SFO","ATL","JFK","ATL","SFO"]. But it is larger in lexical order. */ #include <bits/stdc++.h> //#define DEBUG 1 #undef DEBUG #define PERFS_TESTS_COUNT 15000 #include <TreeNode.h> #include <UnitTests.h> #include <TestsHelper.h> using namespace std; const bool continue_on_failure = false; class Solution { map<string, priority_queue<string>*> destinations; public: vector<string> findItinerary2(vector<vector<string>>& tickets) { vector<string> route = {"JFK"}; for (vector<string> ticket : tickets) { if (destinations.find(ticket[0]) == destinations.end()) destinations[ticket[0]] = new priority_queue<string>(); destinations[ticket[0]]->emplace(ticket[1]); } map<string, priority_queue<string>*>::iterator it; string start = "JFK"; while ((it = destinations.find(start)) != destinations.end()) { priority_queue<string> *possibilities = it->second; if (possibilities->size() == 0) break; start = possibilities->top(); possibilities->pop(); route.push_back(start); } for (it = destinations.begin(); it != destinations.end() ; it++) delete it->second; return route; } private: void explore(vector<string> &route, unordered_map<string, multiset<string>> &_map, const string &start) { while (!_map[start].empty()) { multiset<string>::iterator it = _map[start].begin(); string dest = *it; _map[start].erase(it); explore(route, _map, dest); } route.push_back(start); } public: vector<string> findItinerary(vector<vector<string>>& tickets) { unordered_map<string, multiset<string>> _map; for (vector<string> ticket : tickets) _map[ticket[0]].insert(ticket[1]); vector<string> route; string start = "JFK"; explore(route, _map, start); reverse(route.begin(), route.end()); return route; } }; int run_test_case(void *_s, TestCase *tc) { UNUSED(_s); vector<vector<string>> tickets = tc->test_case[JSON_TEST_CASE_IN_FIELDNAME]; vector<string> expected = tc->test_case[JSON_TEST_CASE_EXPECTED_FIELDNAME]; Solution s; vector<string> result = s.findItinerary(tickets); if (check_result(result, expected)) return 0; printf("findItinerary(%s) returned %s but expected %s\n", array2str(tickets).c_str(), array2str(result).c_str(), array2str(expected).c_str()); assert(continue_on_failure); return 1; } int main(int argc, char **argv) { int tests_ran = 0; const char *tc_id = NULL; if (argc < 2 || argc > 3) { cerr << "Usage: " << argv[0] << " <json test file> [test case index or name]" << endl; cerr << "Where: [test case index or name] specifies which test to run (all by default)" << endl; return -1; } UnitTests uts(NULL, &run_test_case, argv[1]); if (argc == 3) tc_id = argv[2]; int errors_count = uts.run_test_cases(tc_id, tests_ran); if (errors_count == 0) cout << "All " << tests_ran << " test(s) succeeded!!!" << endl; else cout << errors_count << " test(s) failed over a total of " << tests_ran << endl; return errors_count; }
[ "jean-christophe.pince@intel.com" ]
jean-christophe.pince@intel.com
21a0dcf08c00add7cf527a3fcf55c329d459319f
d50b21402945326975ae2e47bcb3ac1a7cd2d16d
/vs2010/MEng-PIL/datetime.h
90bd0c2058752ef94d03f82b777cbf22fba27b29
[]
no_license
mweschler/MEng
da75e700b3c80e2e8e91173edf21918982da9a18
a769d97cc1f0db127de31b70872225e693daee26
refs/heads/master
2021-01-22T02:58:44.676203
2013-09-06T16:58:46
2013-09-06T16:58:46
null
0
0
null
null
null
null
UTF-8
C++
false
false
286
h
#pragma once #include <string> namespace MEng{ typedef struct _DateTime{ int year; int day; int month; int hour; int minute; int second; } DateTime; DateTime GetDateTime(); std::string GetDateString(); std::string GetTimeString(); std::string GetDateTimeString(); }
[ "mweschler@gmail.com" ]
mweschler@gmail.com
c83bd9aab0a926949ff942857029e70bd82a389b
de92a9a347749d3998a65617668353ec8a3f95e7
/graph_env_scene/Intermediate/Build/Win64/UE4Editor/Inc/graph_env_scene/graph_env_sceneGameMode.gen.cpp
37cd36b736a390b8a844f72697a6abc28d28c4f2
[]
no_license
angelsiv/3dsmax-scene
2866da711c13f065c73547b4e92ac3afeaac5816
17bd9a2ddb407cb50756235ea9395c25168953b8
refs/heads/master
2021-04-23T18:57:22.879119
2020-08-16T16:04:45
2020-08-16T16:04:45
249,972,819
0
0
null
null
null
null
UTF-8
C++
false
false
3,722
cpp
// Copyright 1998-2019 Epic Games, Inc. All Rights Reserved. /*=========================================================================== Generated code exported from UnrealHeaderTool. DO NOT modify this manually! Edit the corresponding .h files instead! ===========================================================================*/ #include "UObject/GeneratedCppIncludes.h" #include "graph_env_scene/graph_env_sceneGameMode.h" #ifdef _MSC_VER #pragma warning (push) #pragma warning (disable : 4883) #endif PRAGMA_DISABLE_DEPRECATION_WARNINGS void EmptyLinkFunctionForGeneratedCodegraph_env_sceneGameMode() {} // Cross Module References GRAPH_ENV_SCENE_API UClass* Z_Construct_UClass_Agraph_env_sceneGameMode_NoRegister(); GRAPH_ENV_SCENE_API UClass* Z_Construct_UClass_Agraph_env_sceneGameMode(); ENGINE_API UClass* Z_Construct_UClass_AGameModeBase(); UPackage* Z_Construct_UPackage__Script_graph_env_scene(); // End Cross Module References void Agraph_env_sceneGameMode::StaticRegisterNativesAgraph_env_sceneGameMode() { } UClass* Z_Construct_UClass_Agraph_env_sceneGameMode_NoRegister() { return Agraph_env_sceneGameMode::StaticClass(); } struct Z_Construct_UClass_Agraph_env_sceneGameMode_Statics { static UObject* (*const DependentSingletons[])(); #if WITH_METADATA static const UE4CodeGen_Private::FMetaDataPairParam Class_MetaDataParams[]; #endif static const FCppClassTypeInfoStatic StaticCppClassTypeInfo; static const UE4CodeGen_Private::FClassParams ClassParams; }; UObject* (*const Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::DependentSingletons[])() = { (UObject* (*)())Z_Construct_UClass_AGameModeBase, (UObject* (*)())Z_Construct_UPackage__Script_graph_env_scene, }; #if WITH_METADATA const UE4CodeGen_Private::FMetaDataPairParam Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::Class_MetaDataParams[] = { { "HideCategories", "Info Rendering MovementReplication Replication Actor Input Movement Collision Rendering Utilities|Transformation" }, { "IncludePath", "graph_env_sceneGameMode.h" }, { "ModuleRelativePath", "graph_env_sceneGameMode.h" }, { "ShowCategories", "Input|MouseInput Input|TouchInput" }, }; #endif const FCppClassTypeInfoStatic Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::StaticCppClassTypeInfo = { TCppClassTypeTraits<Agraph_env_sceneGameMode>::IsAbstract, }; const UE4CodeGen_Private::FClassParams Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::ClassParams = { &Agraph_env_sceneGameMode::StaticClass, "Game", &StaticCppClassTypeInfo, DependentSingletons, nullptr, nullptr, nullptr, UE_ARRAY_COUNT(DependentSingletons), 0, 0, 0, 0x008802ACu, METADATA_PARAMS(Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::Class_MetaDataParams, UE_ARRAY_COUNT(Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::Class_MetaDataParams)) }; UClass* Z_Construct_UClass_Agraph_env_sceneGameMode() { static UClass* OuterClass = nullptr; if (!OuterClass) { UE4CodeGen_Private::ConstructUClass(OuterClass, Z_Construct_UClass_Agraph_env_sceneGameMode_Statics::ClassParams); } return OuterClass; } IMPLEMENT_CLASS(Agraph_env_sceneGameMode, 3260123451); template<> GRAPH_ENV_SCENE_API UClass* StaticClass<Agraph_env_sceneGameMode>() { return Agraph_env_sceneGameMode::StaticClass(); } static FCompiledInDefer Z_CompiledInDefer_UClass_Agraph_env_sceneGameMode(Z_Construct_UClass_Agraph_env_sceneGameMode, &Agraph_env_sceneGameMode::StaticClass, TEXT("/Script/graph_env_scene"), TEXT("Agraph_env_sceneGameMode"), false, nullptr, nullptr, nullptr); DEFINE_VTABLE_PTR_HELPER_CTOR(Agraph_env_sceneGameMode); PRAGMA_ENABLE_DEPRECATION_WARNINGS #ifdef _MSC_VER #pragma warning (pop) #endif
[ "siv.angeline@ymail.com" ]
siv.angeline@ymail.com
2ab7ccb1036f2aee5883b468e7a866e884251e68
578861f514756f2f2835d076633f69be5fd3177b
/src/apple-llvm/src/projects/libtapi/include/tapi/Core/ArchitectureSupport.h
daab792b646b4baf1c5f32f3f84766514d1827bb
[ "NCSA" ]
permissive
Keno/apple-libtapi
245481e7eb9c76d887a6aca6906bbaf3ff2bae55
19694a572cd9c0f6452a8e214682e74197370934
refs/heads/master
2021-05-15T11:13:07.921991
2017-06-28T14:14:53
2017-06-28T14:14:53
108,288,493
1
0
null
2017-10-25T15:23:05
2017-10-25T15:23:05
null
UTF-8
C++
false
false
6,307
h
//===- tapi/Core/ArchitectureSupport.h - Architecture Support ---*- C++ -*-===// // // The LLVM Compiler Infrastructure // // This file is distributed under the University of Illinois Open Source // License. See LICENSE.TXT for details. // //===----------------------------------------------------------------------===// /// /// \file /// \brief Defines architecture specific enums and helper functions. /// //===----------------------------------------------------------------------===// #ifndef TAPI_CORE_ARCHITECTURE_SUPPORT_H #define TAPI_CORE_ARCHITECTURE_SUPPORT_H #include "tapi/tapi.h" #include "tapi/Core/LLVM.h" #include "tapi/PackedVersion32.h" #include <limits> TAPI_NAMESPACE_INTERNAL_BEGIN static constexpr unsigned numPlatformBits = 3; #undef i386 enum Arch : uint32_t { unknown = 0U, armv7 = 1U << 0, armv7s = 1U << 1, armv7k = 1U << 2, arm64 = 1U << 3, i386 = 1U << 4, x86_64 = 1U << 5, x86_64h = 1U << 6, }; class ArchitectureSet { private: typedef uint32_t ArchSetType; const static ArchSetType _endIndexVal = std::numeric_limits<ArchSetType>::max(); ArchSetType _archSet; public: ArchitectureSet() : _archSet(Arch::unknown) {} ArchitectureSet(ArchSetType raw) : _archSet(raw) {} void set(Arch arch) { _archSet |= (ArchSetType)arch; } bool has(Arch arch) const { return _archSet & arch; } size_t count() const { // popcnt size_t cnt = 0; for (unsigned i = 0; i < sizeof(ArchSetType) * 8; ++i) if (_archSet & (1U << i)) ++cnt; return cnt; } bool empty() const { return _archSet == 0; } bool hasX86() const { return _archSet & (i386 | x86_64 | x86_64h); } bool hasABICompatibleSlice(Arch arch) const { switch (arch) { case unknown: return false; case armv7: case armv7s: return has(armv7) || has(armv7s); case armv7k: return has(armv7k); case arm64: return has(arm64); case i386: return has(i386); case x86_64: case x86_64h: return has(x86_64) || has(x86_64h); } } Arch getABICompatibleSlice(Arch arch) const { switch (arch) { case unknown: return unknown; case armv7: case armv7s: case armv7k: if (has(armv7)) return armv7; if (has(armv7s)) return armv7s; if (has(armv7k)) return armv7k; return unknown; case arm64: if (has(arm64)) return arm64; return unknown; case i386: if (has(i386)) return i386; return unknown; case x86_64: case x86_64h: if (has(x86_64)) return x86_64; if (has(x86_64h)) return x86_64h; return unknown; } } template <typename Ty> class arch_iterator : public std::iterator<std::forward_iterator_tag, Arch, size_t> { private: ArchSetType _index; Ty *_archSet; void findNextSetBit() { if (_index == _endIndexVal) return; do { if (*_archSet & (1UL << ++_index)) return; } while (_index < sizeof(Ty) * 8); _index = _endIndexVal; } public: arch_iterator(Ty *archSet, ArchSetType index = 0) : _index(index), _archSet(archSet) { if (index != _endIndexVal && !(*_archSet & (1UL << index))) findNextSetBit(); } Arch operator*() const { return (Arch)(1U << _index); } arch_iterator &operator++() { findNextSetBit(); return *this; } arch_iterator operator++(int) { auto tmp = *this; findNextSetBit(); return tmp; } bool operator==(const arch_iterator &o) const { return std::tie(_index, _archSet) == std::tie(o._index, o._archSet); } bool operator!=(const arch_iterator &o) const { return !(*this == o); } }; ArchitectureSet operator&(const ArchitectureSet &o) { return _archSet & o._archSet; } ArchitectureSet operator|(const ArchitectureSet &o) { return _archSet | o._archSet; } ArchitectureSet &operator|=(const ArchitectureSet &o) { _archSet |= o._archSet; return *this; } bool operator==(const ArchitectureSet &o) const { return _archSet == o._archSet; } bool operator!=(const ArchitectureSet &o) const { return _archSet != o._archSet; } bool operator<(const ArchitectureSet &o) const { return _archSet < o._archSet; } typedef arch_iterator<ArchSetType> iterator; typedef arch_iterator<const ArchSetType> const_iterator; iterator begin() { return iterator(&_archSet); } iterator end() { return iterator(&_archSet, _endIndexVal); } const_iterator begin() const { return const_iterator(&_archSet); } const_iterator end() const { return const_iterator(&_archSet, _endIndexVal); } }; struct PackedVersion { uint32_t _version; PackedVersion() : _version(0) {} PackedVersion(uint32_t version) : _version(version) {} PackedVersion(unsigned major, unsigned minor, unsigned subminor) : _version((major << 16) | ((minor & 0xff) << 8) | (subminor & 0xff)) {} bool empty() const { return _version == 0; } /// \brief Retrieve the major version number. unsigned getMajor() const { return _version >> 16; } /// \brief Retrieve the minor version number, if provided. unsigned getMinor() const { return (_version >> 8) & 0xff; } /// \brief Retrieve the subminor version number, if provided. unsigned getSubminor() const { return _version & 0xff; } bool parse32(StringRef str); std::pair<bool, bool> parse64(StringRef str); bool operator<(const PackedVersion &rhs) const { return _version < rhs._version; } bool operator==(const PackedVersion &rhs) const { return _version == rhs._version; } bool operator!=(const PackedVersion &rhs) const { return _version != rhs._version; } void print(raw_ostream &os) const; operator PackedVersion32() const { return PackedVersion32(getMajor(), getMinor(), getSubminor()); } }; inline raw_ostream &operator<<(raw_ostream &os, const PackedVersion &version) { version.print(os); return os; } StringRef getPlatformName(Platform platform); Arch getArchType(uint32_t CPUType, uint32_t CPUSubType); Arch getArchType(StringRef name); StringRef getArchName(Arch arch); TAPI_NAMESPACE_INTERNAL_END #endif // TAPI_CORE_ARCHITECTURE_SUPPORT_H
[ "t.poechtrager@gmail.com" ]
t.poechtrager@gmail.com
ef5ee3b58b939eba399abc0aaa0f1857c6a30d5e
5b6167f573d3e4097912e3d29e576d9090c9fea3
/basicimg/include/img_stroke_width_transform.h
e55cb0100d09f027dffed6df7bae06293f6a3548
[]
no_license
wuyuanmm/fast-mser
d87e4f1da465d743eace9b607e5a865e6ee1def5
a3096ce5c0167c99c075c3179f647a7d2eadf843
refs/heads/master
2022-11-22T22:12:33.132439
2020-07-12T09:40:23
2020-07-12T09:40:23
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,447
h
#pragma once namespace basicimg { /** Implementation of stroke width transform. For details, see the paper of Detecting Text in Natural Scenes with Stroke Width Transform, Boris Epshtein and Eyal Ofek and Yonatan Wexler, in CVPR2010. */ class img_stroke_width_transform { public: class params { public: params() : m_pair_intersect_angle(45) , m_invalid_stroke_width(mt_I16_Max) , m_dark_on_light(sys_true) { } i32 m_pair_intersect_angle; i16 m_invalid_stroke_width; b8 m_dark_on_light; }; static mt_mat swt(mt_mat& edge, mt_mat& gradient_x, mt_mat& gradient_y, const params& pars = params()); static mt_mat normalize_swt_image(mt_mat& swt_image, i16 invalid_stroke_width); private: class point_memory { public: point_memory() : m_current_block_size(mt_I32_Max) { } ~point_memory() { for (i32 i = 0; i < (i32)m_blocks.size(); ++i) { free(m_blocks[i]); } } vector<mt_point*> m_blocks; i32 m_current_block_size; }; class swt_ray { public: swt_ray() : m_width(0) { } i32 m_width; mt_point* m_start; mt_point* m_stop; }; static void set_ray_width(mt_mat& swt_image, const swt_ray& ray); static void median_stroke_width(mt_mat& swt_image, vector<swt_ray>& rays, const params& pars); static i32 get_next_point(mt_point* next_pts, i32 cur_x, i32 cur_y, i32 last_x, i32 last_y, float gradient_x, float gradient_y); }; }
[ "xhl_student" ]
xhl_student
9564895acd9b97095a1c8600788bfa783dcb815a
fc7f08ead4d779e53aa748308e17699340ef3f8d
/hashtable.h
ca31d30d68d64ec0746ea8b42e60e8ea30118925
[]
no_license
Hepic/Project-Algorithms
d227a231f0a2e40aebc8b4a561b4082b1402b2f4
5a63dab89e4b9393e197cc322ea293ff7d4c4187
refs/heads/master
2021-03-27T15:59:56.144798
2017-12-03T17:17:37
2017-12-03T17:17:37
110,358,712
0
0
null
null
null
null
UTF-8
C++
false
false
574
h
#ifndef HASHTABLE_H #define HASHTABLE_H #include "list.h" class HashTable { int id, len; List *table; public: HashTable(int); HashTable(const HashTable&); ~HashTable(); void set_id(int); int get_id() const; long long get_index(const Curve &curve, const char*) const; void insert(const Curve&, const Curve&, const char*); void search(vector<Curve>&, const Curve&, const Curve&, const char*, const char*, double, vector<bool>&, bool = true) const; void print_bucket(int) const; }; #endif
[ "hepic_@hotmail.com" ]
hepic_@hotmail.com
300579d669cdbfded3692a2e96465e89c36e72f3
117f8523b428f7043bed1ca9aca2942c53383172
/mincost.cpp
388d877605c3249b5739935166abe82a9ff2d683
[]
no_license
vageeswaran/cpp
c152e71e89d106bc0c4e750798742c72b86959c3
ed06ef8cb5657b8ea658f0bb8d43fc193a3725a0
refs/heads/master
2016-09-06T01:49:01.929712
2015-11-13T04:12:10
2015-11-13T04:12:10
39,128,263
1
0
null
null
null
null
UTF-8
C++
false
false
1,167
cpp
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef vector<int> vi; typedef pair<int, int> ii; typedef vector<ii> vii; typedef set<int> si; typedef map <string, int> msi; #define mod 1000000007 #define MAX 500 #define fl(i,a,b) for(long long i=a;i<b;i++) #define fi(i,a,b) for(int i=a;i<b;i++) int minn(int a,int b,int c) { if(a<b) return a<c?a:c; else return b<c?b:c; } int cost[100][100]; int mincost(int m,int n) { if(m<0||n<0) return mod; else if(m==0&&n==0) return cost[m][n]; else return cost[m][n]+minn(mincost(m-1,n),mincost(m-1,n-1),mincost(m,n-1)); } int mincostdp(int r,int c,int m,int n) { int tp[r][c],i,j; tp[0][0]=cost[0][0]; fi(i,1,m+1) tp[i][0]=tp[i-1][0] + cost[i][0]; fi(j,1,n+1) tp[0][j]=tp[0][j-1]+cost[0][j]; fi(i,1,m+1) fi(j,1,n+1) tp[i][j]=minn(tp[i-1][j-1],tp[i-1][j],tp[i][j-1])+cost[i][j]; return tp[m][n]; } int main() { ios_base::sync_with_stdio(false); int r,c,i,j; cin>>r>>c; fi(i,0,r) { fi(j,0,c) { cin>>cost[i][j]; } } int x,y; cin>>x>>y; //int ans=mincost(x,y); int ans2=mincostdp(r,c,x,y); //cout<<ans<<endl; cout<<ans2<<endl; return 0; }
[ "vagee93@gmail.com" ]
vagee93@gmail.com
13e356ed77ea01340fa4e411d4e2c738a9917821
be1545a48c113cc497340a9d68ec05a9e8eedbe1
/gateway/src/device/VirtualDevice.cpp
e5b58229d39c32c990455ed5b1852b53ef8fe558
[ "Apache-2.0" ]
permissive
helena-project/beetle
318d82691391247c6542eb8067b094907cce0cde
6f07d864c38ea6aed962263eca20ecf8436cfb4e
refs/heads/master
2021-01-18T04:00:55.208424
2017-02-04T16:30:25
2017-02-04T16:30:25
59,785,058
16
2
null
2016-07-09T06:15:43
2016-05-26T21:41:51
C++
UTF-8
C++
false
false
26,898
cpp
/* * VirtualDevice.cpp * * Created on: Mar 28, 2016 * Author: James Hong */ #include "device/VirtualDevice.h" #include <assert.h> #include <ble/utils.h> #include <bluetooth/bluetooth.h> #include <bluetooth/hci.h> #include <cstring> #include <map> #include <string> #include <thread> #include <time.h> #include "Beetle.h" #include "ble/att.h" #include "ble/beetle.h" #include "ble/gatt.h" #include "controller/NetworkDiscoveryClient.h" #include "Debug.h" #include "device/socket/tcp/TCPServerProxy.h" #include "device/socket/LEDevice.h" #include "Handle.h" #include "Router.h" #include "sync/Semaphore.h" #include "UUID.h" static uint64_t getCurrentTimeMillis(void) { struct timespec spec; clock_gettime(CLOCK_REALTIME, &spec); return 1000 * spec.tv_sec + round(spec.tv_nsec / 1.0e6); // Convert nanoseconds to milliseconds } VirtualDevice::VirtualDevice(Beetle &beetle, bool isEndpoint_, HandleAllocationTable *hat) : Device(beetle, hat) { isEndpoint = isEndpoint_; currentTransaction = NULL; mtu = ATT_DEFAULT_LE_MTU; unfinishedClientTransactions = 0; lastTransactionMillis = 0; highestForwardedHandle = -1; connectedTime = time(NULL); } VirtualDevice::~VirtualDevice() { transactionMutex.lock(); if (currentTransaction != NULL) { uint8_t err[ATT_ERROR_PDU_LEN]; pack_error_pdu(currentTransaction->buf.get()[0], 0, ATT_ECODE_ABORTED, err); currentTransaction->cb(err, ATT_ERROR_PDU_LEN); currentTransaction.reset(); } while (pendingTransactions.size() > 0) { auto t = pendingTransactions.front(); pendingTransactions.pop(); uint8_t err[ATT_ERROR_PDU_LEN]; pack_error_pdu(t->buf.get()[0], 0, ATT_ECODE_ABORTED, err); t->cb(err, ATT_ERROR_PDU_LEN); } transactionMutex.unlock(); } static std::map<uint16_t, std::shared_ptr<Handle>> discoverAllHandles(VirtualDevice *d); void VirtualDevice::start(bool discoverHandles) { if (debug) { pdebug("starting"); } startInternal(); if (discoverHandles) { /* May throw device exception */ std::map<uint16_t, std::shared_ptr<Handle>> handlesTmp = discoverAllHandles(this); handlesMutex.lock(); handles = handlesTmp; handlesMutex.unlock(); } highestForwardedHandle = getHighestHandle(); if (isEndpoint) { setupBeetleService(highestForwardedHandle + 1); } beetle.updateDevice(getId()); } std::vector<uint64_t> VirtualDevice::getTransactionLatencies() { std::lock_guard<std::mutex> lg(transactionMutex); auto ret = transactionLatencies; transactionLatencies.clear(); return ret; } void VirtualDevice::writeCommand(uint8_t *buf, int len) { assert(buf); assert(len > 0); assert(!is_att_response(buf[0]) && !is_att_request(buf[0]) && buf[0] != ATT_OP_HANDLE_IND && buf[0] != ATT_OP_HANDLE_CNF); write(buf, len); } void VirtualDevice::writeResponse(uint8_t *buf, int len) { assert(buf); assert(len > 0); assert(is_att_response(buf[0]) || buf[0] == ATT_OP_HANDLE_CNF || buf[0] == ATT_OP_ERROR); write(buf, len); } void VirtualDevice::writeTransaction(uint8_t *buf, int len, std::function<void(uint8_t*, int)> cb) { assert(buf); assert(len > 0); assert(is_att_request(buf[0]) || buf[0] == ATT_OP_HANDLE_IND); auto t = std::make_shared<transaction_t>(); t->buf.reset(new uint8_t[len]); memcpy(t->buf.get(), buf, len); t->len = len; t->cb = cb; t->time = time(NULL); std::lock_guard<std::mutex> lg(transactionMutex); if (currentTransaction == NULL) { currentTransaction = t; lastTransactionMillis = getCurrentTimeMillis(); if (!write(t->buf.get(), t->len)) { cb(NULL, -1); } } else { pendingTransactions.push(t); } } int VirtualDevice::writeTransactionBlocking(uint8_t *buf, int len, uint8_t *&resp) { auto sema = std::make_shared<Semaphore>(0); auto respLenPtr = std::make_shared<int>(); auto respPtr = std::make_shared<boost::shared_array<uint8_t>>(); writeTransaction(buf, len, [sema, respPtr, respLenPtr](uint8_t *resp_, int respLen_) { if (resp_ != NULL && respLen_ > 0) { respPtr->reset(new uint8_t[respLen_]); memcpy(respPtr.get()->get(), resp_, respLen_); } *respLenPtr = respLen_; sema->notify(); }); if (sema->try_wait(BLOCKING_TRANSACTION_TIMEOUT)) { int respLen = *respLenPtr; if (respPtr->get() != NULL && respLen > 0) { resp = new uint8_t[respLen]; memcpy(resp, respPtr->get(),respLen); return respLen; } else { resp = NULL; return -1; } } else { if (debug) { pdebug("blocking transaction timed out"); } resp = NULL; return -1; } } int VirtualDevice::getMTU() { return mtu; } int VirtualDevice::getHighestForwardedHandle() { return highestForwardedHandle; } bool VirtualDevice::isLive() { time_t now = time(NULL); std::lock_guard<std::mutex> lk(transactionMutex); if (currentTransaction) { if (difftime(now, currentTransaction->time) > ASYNC_TRANSACTION_TIMEOUT) { return false; } } return true; } void VirtualDevice::handleTransactionResponse(uint8_t *buf, int len) { std::unique_lock<std::mutex> lk(transactionMutex); if (debug_performance) { uint64_t currentTimeMillis = getCurrentTimeMillis(); uint64_t elapsed = currentTimeMillis - lastTransactionMillis; std::stringstream ss; ss << "Transaction" << std::endl; ss << " start:\t" << std::fixed << lastTransactionMillis << std::endl; ss << " end:\t" << std::fixed << currentTimeMillis << std::endl; ss << " len:\t" << std::fixed << elapsed; pdebug(ss.str()); if (transactionLatencies.size() < MAX_TRANSACTION_LATENCIES) { transactionLatencies.push_back(elapsed); } else { pwarn("max latency log capacity reached"); } } if (!currentTransaction) { pwarn("unexpected transaction response when none existed!"); return; } uint8_t reqOpcode = currentTransaction->buf.get()[0]; uint8_t respOpcode = buf[0]; if (respOpcode == ATT_OP_ERROR) { if (len != ATT_ERROR_PDU_LEN) { pwarn("invalid error pdu"); return; } if (buf[1] != reqOpcode) { pwarn("unmatched error: " + std::to_string(buf[1])); return; } } else if (respOpcode == ATT_OP_HANDLE_CNF && reqOpcode != ATT_OP_HANDLE_IND) { pwarn("unmatched confirmation"); return; } else if (respOpcode - 1 != reqOpcode) { pwarn("unmatched transaction: " + std::to_string(respOpcode)); return; } auto t = currentTransaction; if (pendingTransactions.size() > 0) { while (pendingTransactions.size() > 0) { currentTransaction = pendingTransactions.front(); currentTransaction->time = time(NULL); pendingTransactions.pop(); if(!write(currentTransaction->buf.get(), currentTransaction->len)) { currentTransaction->cb(NULL, -1); currentTransaction.reset(); } else { break; } } } else { currentTransaction.reset(); } lk.unlock(); t->cb(buf, len); } void VirtualDevice::readHandler(uint8_t *buf, int len) { uint8_t opCode = buf[0]; if (opCode == ATT_OP_MTU_REQ) { mtu = btohs(*(uint16_t * )(buf + 1)); uint8_t resp[3]; resp[0] = ATT_OP_MTU_RESP; *(uint16_t *) (resp + 1) = htobs(ATT_DEFAULT_LE_MTU); write(resp, sizeof(resp)); } else if (is_att_response(opCode) || opCode == ATT_OP_HANDLE_CNF || opCode == ATT_OP_ERROR) { handleTransactionResponse(buf, len); } else { /* * Discover services in the network */ if (opCode == ATT_OP_FIND_BY_TYPE_REQ && isEndpoint && beetle.discoveryClient) { uint16_t startHandle; uint16_t endHandle; uint16_t attType; uint8_t *attValue; int attValLen; if (!parse_find_by_type_value_request(buf, len, startHandle, endHandle, attType, attValue, attValLen)) { uint8_t err[ATT_ERROR_PDU_LEN]; pack_error_pdu(opCode, 0, ATT_ECODE_INVALID_PDU, err); write(err, sizeof(err)); return; } if (attType == GATT_PRIM_SVC_UUID) { UUID serviceUuid(attValue, attValLen); boost::shared_array<uint8_t> bufCpy(new uint8_t[len]); memcpy(bufCpy.get(), buf, len); beetle.discoveryClient->registerInterestInUuid(getId(), serviceUuid, true, [this, bufCpy, len] { beetle.router->route(bufCpy.get(), len, getId()); }); } } else { beetle.router->route(buf, len, getId()); } } } void VirtualDevice::setupBeetleService(int handleAlloc) { handleAlloc++; auto beetleServiceHandle = std::make_shared<PrimaryService>(); beetleServiceHandle->setHandle(handleAlloc++); auto beetleServiceUUID = boost::shared_array<uint8_t>(new uint8_t[2]); *(uint16_t *) beetleServiceUUID.get() = btohs(BEETLE_SERVICE_UUID); beetleServiceHandle->cache.set(beetleServiceUUID, 2); handles[beetleServiceHandle->getHandle()] = beetleServiceHandle; uint16_t lastHandle = 0; if (type == LE_PERIPHERAL || type == LE_CENTRAL) { /* * Bdaddr characteristic */ LEDevice *le = dynamic_cast<LEDevice *>(this); assert(le); auto beetleBdaddrCharHandle = std::make_shared<Characteristic>(); beetleBdaddrCharHandle->setHandle(handleAlloc++); beetleBdaddrCharHandle->setServiceHandle(beetleServiceHandle->getHandle()); auto beetleBdaddrCharHandleValue = boost::shared_array<uint8_t>(new uint8_t[5]); beetleBdaddrCharHandleValue[0] = GATT_CHARAC_PROP_READ; *(uint16_t *) (beetleBdaddrCharHandleValue.get() + 3) = htobs(BEETLE_CHARAC_BDADDR_UUID); beetleBdaddrCharHandle->cache.set(beetleBdaddrCharHandleValue, 5); handles[beetleBdaddrCharHandle->getHandle()] = beetleBdaddrCharHandle; auto beetleBdaddrAttrHandle = std::make_shared<CharacteristicValue>(true, true); beetleBdaddrAttrHandle->setHandle(handleAlloc++); beetleBdaddrAttrHandle->setUuid(BEETLE_CHARAC_BDADDR_UUID); beetleBdaddrAttrHandle->setServiceHandle(beetleServiceHandle->getHandle()); beetleBdaddrAttrHandle->setCharHandle(beetleBdaddrCharHandle->getHandle()); auto beetleBdaddrAttrHandleValue = boost::shared_array<uint8_t>(new uint8_t[sizeof(bdaddr_t)]); memcpy(beetleBdaddrAttrHandleValue.get(), le->getBdaddr().b, sizeof(bdaddr_t)); beetleBdaddrAttrHandle->cache.set(beetleBdaddrAttrHandleValue, sizeof(bdaddr_t)); handles[beetleBdaddrAttrHandle->getHandle()] = beetleBdaddrAttrHandle; // fill in attr handle for characteristic beetleBdaddrCharHandle->setCharHandle(beetleBdaddrAttrHandle->getHandle()); *(uint16_t *) (beetleBdaddrCharHandleValue.get() + 1) = htobs(beetleBdaddrAttrHandle->getHandle()); auto beetleBdaddrTypeHandle = std::make_shared<Handle>(true, true); beetleBdaddrTypeHandle->setHandle(handleAlloc++); beetleBdaddrTypeHandle->setServiceHandle(beetleServiceHandle->getHandle()); beetleBdaddrTypeHandle->setCharHandle(beetleBdaddrCharHandle->getHandle()); beetleBdaddrTypeHandle->setUuid(UUID(BEETLE_DESC_BDADDR_TYPE_UUID)); auto beetleBdaddrTypeHandleValue = boost::shared_array<uint8_t>(new uint8_t[1]); beetleBdaddrTypeHandleValue[0] = (le->getAddrType() == LEDevice::PUBLIC) ? LE_PUBLIC_ADDRESS : LE_RANDOM_ADDRESS; beetleBdaddrTypeHandle->cache.set(beetleBdaddrTypeHandleValue, 1); handles[beetleBdaddrTypeHandle->getHandle()] = beetleBdaddrTypeHandle; beetleBdaddrCharHandle->setEndGroupHandle(beetleBdaddrTypeHandle->getHandle()); lastHandle = beetleBdaddrTypeHandle->getHandle(); } /* * Handle range characteristic */ { auto beetleHandleRangeCharHandle = std::make_shared<Characteristic>(); beetleHandleRangeCharHandle->setHandle(handleAlloc++); beetleHandleRangeCharHandle->setServiceHandle(beetleServiceHandle->getHandle()); auto beetleHandleRangeCharHandleValue = boost::shared_array<uint8_t>(new uint8_t[5]); beetleHandleRangeCharHandleValue[0] = GATT_CHARAC_PROP_READ; *(uint16_t *) (beetleHandleRangeCharHandleValue.get() + 3) = htobs(BEETLE_CHARAC_HANDLE_RANGE_UUID); beetleHandleRangeCharHandle->cache.set(beetleHandleRangeCharHandleValue, 5); handles[beetleHandleRangeCharHandle->getHandle()] = beetleHandleRangeCharHandle; auto beetleHandleRangeAttrHandle = std::make_shared<CharacteristicValue>(true, true); beetleHandleRangeAttrHandle->setHandle(handleAlloc++); beetleHandleRangeAttrHandle->setUuid(UUID(BEETLE_CHARAC_HANDLE_RANGE_UUID)); beetleHandleRangeAttrHandle->setServiceHandle(beetleServiceHandle->getHandle()); beetleHandleRangeAttrHandle->setCharHandle(beetleHandleRangeCharHandle->getHandle()); auto beetleHandleRangeAttrHandleValue = boost::shared_array<uint8_t>(new uint8_t[4]); memset(beetleHandleRangeAttrHandleValue.get(), 0, 4); beetleHandleRangeAttrHandle->cache.set(beetleHandleRangeAttrHandleValue, 4); handles[beetleHandleRangeAttrHandle->getHandle()] = beetleHandleRangeAttrHandle; // fill in attr handle for characteristic beetleHandleRangeCharHandle->setCharHandle(beetleHandleRangeAttrHandle->getHandle()); *(uint16_t *) (beetleHandleRangeCharHandleValue.get() + 1) = htobs(beetleHandleRangeAttrHandle->getHandle()); beetleHandleRangeCharHandle->setEndGroupHandle(beetleHandleRangeAttrHandle->getHandle()); lastHandle = beetleHandleRangeAttrHandle->getHandle(); } /* * Connected time characteristic */ { auto beetleConnTimeCharHandle = std::make_shared<Characteristic>(); beetleConnTimeCharHandle->setHandle(handleAlloc++); beetleConnTimeCharHandle->setServiceHandle(beetleServiceHandle->getHandle()); auto beetleConnTimeCharHandleValue = boost::shared_array<uint8_t>(new uint8_t[5]); beetleConnTimeCharHandleValue[0] = GATT_CHARAC_PROP_READ; *(uint16_t *) (beetleConnTimeCharHandleValue.get() + 3) = htobs(BEETLE_CHARAC_CONNECTED_TIME_UUID); beetleConnTimeCharHandle->cache.set(beetleConnTimeCharHandleValue, 5); handles[beetleConnTimeCharHandle->getHandle()] = beetleConnTimeCharHandle; auto beetleConnTimeAttrHandle = std::make_shared<CharacteristicValue>(true, true); beetleConnTimeAttrHandle->setHandle(handleAlloc++); beetleConnTimeAttrHandle->setUuid(UUID(BEETLE_CHARAC_CONNECTED_TIME_UUID)); beetleConnTimeAttrHandle->setServiceHandle(beetleServiceHandle->getHandle()); beetleConnTimeAttrHandle->setCharHandle(beetleConnTimeCharHandle->getHandle()); auto beetleConnTimeAttrHandleValue = boost::shared_array<uint8_t>(new uint8_t[sizeof(int32_t)]); *(int32_t *) (beetleConnTimeAttrHandleValue.get()) = htobl(static_cast<int32_t>(connectedTime)); beetleConnTimeAttrHandle->cache.set(beetleConnTimeAttrHandleValue, sizeof(int32_t)); handles[beetleConnTimeAttrHandle->getHandle()] = beetleConnTimeAttrHandle; // fill in attr handle for characteristic beetleConnTimeCharHandle->setCharHandle(beetleConnTimeAttrHandle->getHandle()); *(uint16_t *) (beetleConnTimeCharHandleValue.get() + 1) = htobs(beetleConnTimeAttrHandle->getHandle()); beetleConnTimeCharHandle->setEndGroupHandle(beetleConnTimeAttrHandle->getHandle()); lastHandle = beetleConnTimeAttrHandle->getHandle(); } /* * Gateway name characteristic */ { auto beetleConnGatewayCharHandle = std::make_shared<Characteristic>(); beetleConnGatewayCharHandle->setHandle(handleAlloc++); beetleConnGatewayCharHandle->setServiceHandle(beetleServiceHandle->getHandle()); auto beetleConnGatewayCharHandleValue = boost::shared_array<uint8_t>(new uint8_t[5]); beetleConnGatewayCharHandleValue[0] = GATT_CHARAC_PROP_READ; *(uint16_t *) (beetleConnGatewayCharHandleValue.get() + 3) = htobs(BEETLE_CHARAC_CONNECTED_GATEWAY_UUID); beetleConnGatewayCharHandle->cache.set(beetleConnGatewayCharHandleValue, 5); handles[beetleConnGatewayCharHandle->getHandle()] = beetleConnGatewayCharHandle; auto beetleConnGatewayAttrHandle = std::make_shared<CharacteristicValue>(true, true); beetleConnGatewayAttrHandle->setHandle(handleAlloc++); beetleConnGatewayAttrHandle->setUuid(UUID(BEETLE_CHARAC_CONNECTED_GATEWAY_UUID)); beetleConnGatewayAttrHandle->setServiceHandle(beetleServiceHandle->getHandle()); beetleConnGatewayAttrHandle->setCharHandle(beetleConnGatewayCharHandle->getHandle()); int gatewayNameLen = beetle.name.length(); if (gatewayNameLen >= ATT_DEFAULT_LE_MTU - 3) { gatewayNameLen = ATT_DEFAULT_LE_MTU - 3; } auto beetleConnGatewayAttrHandleValue = boost::shared_array<uint8_t>(new uint8_t[gatewayNameLen]); memcpy(beetleConnGatewayAttrHandleValue.get(), beetle.name.c_str(), gatewayNameLen); beetleConnGatewayAttrHandle->cache.set(beetleConnGatewayAttrHandleValue, gatewayNameLen); handles[beetleConnGatewayAttrHandle->getHandle()] = beetleConnGatewayAttrHandle; // fill in attr handle for characteristic beetleConnGatewayCharHandle->setCharHandle(beetleConnGatewayAttrHandle->getHandle()); *(uint16_t *) (beetleConnGatewayCharHandleValue.get() + 1) = htobs(beetleConnGatewayAttrHandle->getHandle()); beetleConnGatewayCharHandle->setEndGroupHandle(beetleConnGatewayAttrHandle->getHandle()); lastHandle = beetleConnGatewayAttrHandle->getHandle(); } beetleServiceHandle->setEndGroupHandle(lastHandle); } typedef struct { uint16_t handle; uint16_t endGroup; boost::shared_array<uint8_t> value; int len; } group_t; static std::vector<group_t> discoverServices(VirtualDevice *d) { if (debug_discovery) { pdebug("discovering services for " + d->getName()); } uint16_t startHandle = 1; uint16_t endHandle = 0xFFFF; int reqLen = 7; uint8_t req[reqLen]; req[0] = ATT_OP_READ_BY_GROUP_REQ; *(uint16_t *) (req + 3) = htobs(endHandle); *(uint16_t *) (req + 5) = htobs(GATT_PRIM_SVC_UUID); std::vector<group_t> groups; uint16_t currHandle = startHandle; while (true) { *(uint16_t *) (req + 1) = htobs(currHandle); uint8_t *resp; int respLen = d->writeTransactionBlocking(req, reqLen, resp); /* Somewhat of a hack */ boost::shared_array<uint8_t> respOwner(resp); if (resp == NULL || respLen < 2) { throw DeviceException("error on transaction"); } if (resp[0] == ATT_OP_READ_BY_GROUP_RESP) { int attDataLen = resp[1]; for (int i = 2; i < respLen; i += attDataLen) { if (i + attDataLen > respLen) { break; } uint16_t handle = btohs(*(uint16_t *)(resp + i)); if (handle < currHandle || handle > endHandle) { continue; } group_t group; group.handle = handle; group.endGroup = btohs(*(uint16_t *)(resp + i + 2)); group.len = attDataLen - 4; group.value.reset(new uint8_t[group.len]); memcpy(group.value.get(), resp + i + 4, group.len); groups.push_back(group); if (debug_discovery) { pdebug("found service at handles " + std::to_string(group.handle) + " - " + std::to_string(group.endGroup)); } } currHandle = groups.rbegin()->endGroup + 1; if (currHandle == 0) { break; } } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_READ_BY_GROUP_REQ && resp[4] == ATT_ECODE_ATTR_NOT_FOUND) { break; } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_READ_BY_GROUP_REQ && resp[4] == ATT_ECODE_REQ_NOT_SUPP) { break; } else { throw DeviceException("unexpected transaction"); } } return groups; } typedef struct { uint16_t handle; boost::shared_array<uint8_t> value; int len; } handle_value_t; static std::vector<handle_value_t> discoverCharacterisics(VirtualDevice *d, uint16_t startHandle, uint16_t endHandle) { if (debug_discovery) { pdebug("discovering characteristics for " + d->getName()); } std::vector<handle_value_t> handles; int reqLen = 7; uint8_t req[reqLen]; req[0] = ATT_OP_READ_BY_TYPE_REQ; *(uint16_t *) (req + 3) = htobs(endHandle); *(uint16_t *) (req + 5) = htobs(GATT_CHARAC_UUID); uint16_t currHandle = startHandle; while (true) { *(uint16_t *) (req + 1) = htobs(currHandle); uint8_t *resp; int respLen = d->writeTransactionBlocking(req, reqLen, resp); /* Somewhat of a hack */ boost::shared_array<uint8_t> respOwner(resp); if (resp == NULL || respLen < 2) { throw DeviceException("error on transaction"); } if (resp[0] == ATT_OP_READ_BY_TYPE_RESP) { int attDataLen = resp[1]; for (int i = 2; i < respLen; i += attDataLen) { if (i + attDataLen > respLen) { break; } uint16_t handle = btohs(*(uint16_t *)(resp + i)); if (handle < currHandle || handle > endHandle) { continue; } handle_value_t handleValue; handleValue.handle = handle; handleValue.len = attDataLen - 2; handleValue.value.reset(new uint8_t[handleValue.len]); memcpy(handleValue.value.get(), resp + i + 2, handleValue.len); handles.push_back(handleValue); if (debug_discovery) { pdebug("found characteristic at handle " + std::to_string(handleValue.handle)); } } uint16_t nextHandle = handles.rbegin()->handle + 1; if (nextHandle <= currHandle || nextHandle >= endHandle) { break; } currHandle = nextHandle; } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_READ_BY_TYPE_REQ && resp[4] == ATT_ECODE_ATTR_NOT_FOUND) { break; } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_READ_BY_TYPE_REQ && resp[4] == ATT_ECODE_REQ_NOT_SUPP) { break; } else { throw DeviceException("unexpected transaction"); } } return handles; } typedef struct { uint8_t format; uint16_t handle; UUID uuid; } handle_info_t; static std::vector<handle_info_t> discoverHandles(VirtualDevice *d, uint16_t startGroup, uint16_t endGroup) { if (debug_discovery) { pdebug("discovering handles for " + d->getName()); } std::vector<handle_info_t> handles; int reqLen = 5; uint8_t req[reqLen]; req[0] = ATT_OP_FIND_INFO_REQ; *(uint16_t *) (req + 3) = htobs(endGroup); uint16_t currHandle = startGroup; while (true) { *(uint16_t *) (req + 1) = htobs(currHandle); uint8_t *resp; int respLen = d->writeTransactionBlocking(req, reqLen, resp); /* Somewhat of a hack */ boost::shared_array<uint8_t> respOwner(resp); if (resp == NULL || respLen < 2) { throw DeviceException("error on transaction"); } if (resp[0] == ATT_OP_FIND_INFO_RESP) { uint8_t format = resp[1]; int attDataLen = (format == ATT_FIND_INFO_RESP_FMT_16BIT) ? 4 : 18; for (int i = 2; i < respLen; i += attDataLen) { if (i + attDataLen > respLen) { break; } uint16_t handle = btohs(*(uint16_t *)(resp + i)); if (handle < currHandle || handle > endGroup) { continue; } handle_info_t handleInfo; handleInfo.format = format; handleInfo.handle = handle; handleInfo.uuid = UUID(resp + i + 2, attDataLen - 2); handles.push_back(handleInfo); if (debug_discovery) { pdebug("found handle at " + std::to_string(handleInfo.handle)); } } currHandle = handles.rbegin()->handle + 1; if (currHandle == 0 || currHandle >= endGroup) { break; } } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_FIND_INFO_REQ && resp[4] == ATT_ECODE_ATTR_NOT_FOUND) { break; } else if (resp[0] == ATT_OP_ERROR && resp[1] == ATT_OP_FIND_INFO_REQ && resp[4] == ATT_ECODE_REQ_NOT_SUPP) { break; } else { throw DeviceException("unexpected transaction"); } } return handles; } /* * TODO robustly validate GATT server packets */ static std::map<uint16_t, std::shared_ptr<Handle>> discoverAllHandles(VirtualDevice *d) { std::map<uint16_t, std::shared_ptr<Handle>> handles; std::shared_ptr<Handle> lastService = NULL; std::shared_ptr<Handle> lastCharacteristic = NULL; std::vector<group_t> services = discoverServices(d); for (group_t &service : services) { auto serviceHandle = std::make_shared<PrimaryService>(); serviceHandle->setHandle(service.handle); serviceHandle->setEndGroupHandle(service.endGroup); serviceHandle->cache.set(service.value, service.len); assert(handles.find(service.handle) == handles.end()); handles[service.handle] = serviceHandle; std::vector<handle_value_t> characteristics = discoverCharacterisics(d, serviceHandle->getHandle(), serviceHandle->getEndGroupHandle()); for (handle_value_t &characteristic : characteristics) { auto charHandle = std::make_shared<Characteristic>(); charHandle->setHandle(characteristic.handle); charHandle->setServiceHandle(serviceHandle->getHandle()); // let the handle inherit the pointer charHandle->cache.set(characteristic.value, characteristic.len); assert(handles.find(characteristic.handle) == handles.end()); handles[characteristic.handle] = charHandle; // save in case it is the last lastCharacteristic = charHandle; } if (characteristics.size() > 0) { for (int i = 0; i < (int) (characteristics.size() - 1); i++) { handle_value_t characteristic = characteristics[i]; uint16_t startGroup = characteristic.handle + 1; uint16_t endGroup = characteristics[i + 1].handle - 1; auto charHandle = std::dynamic_pointer_cast<Characteristic>(handles[characteristic.handle]); charHandle->setEndGroupHandle(endGroup); std::vector<handle_info_t> handleInfos = discoverHandles(d, startGroup, endGroup); for (handle_info_t &handleInfo : handleInfos) { UUID handleUuid = handleInfo.uuid; std::shared_ptr<Handle> handle; if (handleUuid.isShort() && handleUuid.getShort() == GATT_CLIENT_CHARAC_CFG_UUID) { handle = std::make_shared<ClientCharCfg>(); } else if (handleInfo.handle == charHandle->getAttrHandle()) { handle = std::make_shared<CharacteristicValue>(false, false); handle->setUuid(handleUuid); } else { handle = std::make_shared<Handle>(); handle->setUuid(handleUuid); } handle->setHandle(handleInfo.handle); handle->setServiceHandle(serviceHandle->getHandle()); handle->setCharHandle(characteristic.handle); assert(handles.find(handleInfo.handle) == handles.end()); handles[handleInfo.handle] = handle; } } handle_value_t characteristic = characteristics[characteristics.size() - 1]; uint16_t startGroup = characteristic.handle + 1; uint16_t endGroup = serviceHandle->getEndGroupHandle(); auto charHandle = std::dynamic_pointer_cast<Characteristic>(handles[characteristic.handle]); charHandle->setEndGroupHandle(endGroup); std::vector<handle_info_t> handleInfos = discoverHandles(d, startGroup, endGroup); for (handle_info_t &handleInfo : handleInfos) { UUID handleUuid = handleInfo.uuid; std::shared_ptr<Handle> handle; if (handleUuid.isShort() && handleUuid.getShort() == GATT_CLIENT_CHARAC_CFG_UUID) { handle = std::make_shared<ClientCharCfg>(); } else if (handleInfo.handle == charHandle->getAttrHandle()) { handle = std::make_shared<CharacteristicValue>(false, false); handle->setUuid(handleUuid); } else { handle = std::make_shared<Handle>(); handle->setUuid(handleUuid); } handle->setHandle(handleInfo.handle); handle->setServiceHandle(serviceHandle->getHandle()); handle->setCharHandle(characteristic.handle); assert(handles.find(handleInfo.handle) == handles.end()); handles[handleInfo.handle] = handle; } } // save in case it is the last lastService = serviceHandle; } if (lastService) { handles[lastService->getHandle()]->setEndGroupHandle(handles.rbegin()->second->getHandle()); } if (lastCharacteristic) { handles[lastCharacteristic->getHandle()]->setEndGroupHandle(handles.rbegin()->second->getHandle()); } if (debug_discovery) { pdebug("done discovering handles for " + d->getName()); } return handles; }
[ "james.hong@cs.stanford.edu" ]
james.hong@cs.stanford.edu
f18bbd150663008b7291e4ce48303a83b39e0c87
fb66a5cc43d27f33c85320a6dba8b9a8ff4765a9
/gapputils/gml.dbm/ModelWriter.cpp
1c9b1c2f8d508bfaf0a8917afc2d92fc1bd8e406
[]
no_license
e-thereal/gapputils
7a211c7d92fd2891703cb16bf94e6e05f0fb3b8a
a9eca31373c820c12f4f5f308c0e2005e4672fd0
refs/heads/master
2021-04-26T16:42:58.303603
2015-09-02T21:32:45
2015-09-02T21:32:45
38,838,767
2
0
null
null
null
null
UTF-8
C++
false
false
1,946
cpp
/* * ModelWriter.cpp * * Created on: Nov 23, 2012 * Author: tombr */ #include "ModelWriter.h" #include <capputils/DummyAttribute.h> #include <capputils/EventHandler.h> #include <capputils/Serializer.h> #include <boost/filesystem.hpp> #include <boost/iostreams/filtering_stream.hpp> #include <boost/iostreams/filter/gzip.hpp> #include <boost/iostreams/device/file_descriptor.hpp> namespace bio = boost::iostreams; namespace fs = boost::filesystem; namespace gml { namespace dbm { int ModelWriter::modelId; BeginPropertyDefinitions(ModelWriter) ReflectableBase(DefaultWorkflowElement<ModelWriter>) WorkflowProperty(Model, Input("DBM"), NotNull<Type>(), Dummy(modelId = Id)) WorkflowProperty(Filename, Filename("Compressed DBM (*.dbm.gz)"), NotEmpty<Type>()) WorkflowProperty(AutoSave, Flag(), Description("If checked, the model is saved automatically when a change is detected.")) WorkflowProperty(OutputName, Output("File")) EndPropertyDefinitions ModelWriter::ModelWriter() : _AutoSave(false) { setLabel("Writer"); Changed.connect(EventHandler<ModelWriter>(this, &ModelWriter::changedHandler)); } void ModelWriter::changedHandler(ObservableClass* sender, int eventId) { if (eventId == modelId && getAutoSave()) { this->execute(0); this->writeResults(); } } void ModelWriter::update(IProgressMonitor* monitor) const { Logbook& dlog = getLogbook(); fs::path path(getFilename()); fs::create_directories(path.parent_path()); bio::filtering_ostream file; file.push(boost::iostreams::gzip_compressor()); file.push(bio::file_descriptor_sink(getFilename())); if (!file) { dlog(Severity::Warning) << "Can't open file '" << getFilename() << "' for writing. Aborting!"; return; } Serializer::WriteToFile(*getModel(), file); getHostInterface()->saveDataModel(getFilename() + ".config"); newState->setOutputName(getFilename()); } } /* namespace dbm */ } /* namespace gml */
[ "brosch.tom@gmail.com" ]
brosch.tom@gmail.com
15f1f67d070cf45c35103edc8d8d6219ad653768
67fc9e51437e351579fe9d2d349040c25936472a
/wrappers/7.0.0/vtkBorderRepresentationWrap.h
89992b2191e3b1c46dd2a2f9bcfbfcc4ee5cc413
[]
permissive
axkibe/node-vtk
51b3207c7a7d3b59a4dd46a51e754984c3302dec
900ad7b5500f672519da5aa24c99aa5a96466ef3
refs/heads/master
2023-03-05T07:45:45.577220
2020-03-30T09:31:07
2020-03-30T09:31:07
48,490,707
6
0
BSD-3-Clause
2022-12-07T20:41:45
2015-12-23T12:58:43
C++
UTF-8
C++
false
false
5,604
h
/* this file has been autogenerated by vtkNodeJsWrap */ /* editing this might proof futile */ #ifndef NATIVE_EXTENSION_VTK_VTKBORDERREPRESENTATIONWRAP_H #define NATIVE_EXTENSION_VTK_VTKBORDERREPRESENTATIONWRAP_H #include <nan.h> #include <vtkSmartPointer.h> #include <vtkBorderRepresentation.h> #include "vtkWidgetRepresentationWrap.h" #include "../../plus/plus.h" class VtkBorderRepresentationWrap : public VtkWidgetRepresentationWrap { public: using Nan::ObjectWrap::Wrap; static void Init(v8::Local<v8::Object> exports); static void InitPtpl(); static void ConstructorGetter( v8::Local<v8::String> property, const Nan::PropertyCallbackInfo<v8::Value>& info); VtkBorderRepresentationWrap(vtkSmartPointer<vtkBorderRepresentation>); VtkBorderRepresentationWrap(); ~VtkBorderRepresentationWrap( ); static Nan::Persistent<v8::FunctionTemplate> ptpl; private: static void New(const Nan::FunctionCallbackInfo<v8::Value>& info); static void BuildRepresentation(const Nan::FunctionCallbackInfo<v8::Value>& info); static void ComputeInteractionState(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetActors2D(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetBorderProperty(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetClassName(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetMaximumSize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetMinimumSize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetMoving(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetPosition(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetPosition2(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetPosition2Coordinate(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetPositionCoordinate(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetProportionalResize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetSelectionPoint(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowBorderMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowBorderMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowHorizontalBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowHorizontalBorderMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowHorizontalBorderMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowVerticalBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowVerticalBorderMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetShowVerticalBorderMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetSize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetTolerance(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetToleranceMaxValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void GetToleranceMinValue(const Nan::FunctionCallbackInfo<v8::Value>& info); static void HasTranslucentPolygonalGeometry(const Nan::FunctionCallbackInfo<v8::Value>& info); static void IsA(const Nan::FunctionCallbackInfo<v8::Value>& info); static void MovingOff(const Nan::FunctionCallbackInfo<v8::Value>& info); static void MovingOn(const Nan::FunctionCallbackInfo<v8::Value>& info); static void NewInstance(const Nan::FunctionCallbackInfo<v8::Value>& info); static void ProportionalResizeOff(const Nan::FunctionCallbackInfo<v8::Value>& info); static void ProportionalResizeOn(const Nan::FunctionCallbackInfo<v8::Value>& info); static void ReleaseGraphicsResources(const Nan::FunctionCallbackInfo<v8::Value>& info); static void RenderOpaqueGeometry(const Nan::FunctionCallbackInfo<v8::Value>& info); static void RenderOverlay(const Nan::FunctionCallbackInfo<v8::Value>& info); static void RenderTranslucentPolygonalGeometry(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SafeDownCast(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetMaximumSize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetMinimumSize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetMoving(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetPosition(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetPosition2(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetProportionalResize(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowBorderToActive(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowBorderToOff(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowBorderToOn(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowHorizontalBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetShowVerticalBorder(const Nan::FunctionCallbackInfo<v8::Value>& info); static void SetTolerance(const Nan::FunctionCallbackInfo<v8::Value>& info); static void StartWidgetInteraction(const Nan::FunctionCallbackInfo<v8::Value>& info); static void WidgetInteraction(const Nan::FunctionCallbackInfo<v8::Value>& info); #ifdef VTK_NODE_PLUS_VTKBORDERREPRESENTATIONWRAP_CLASSDEF VTK_NODE_PLUS_VTKBORDERREPRESENTATIONWRAP_CLASSDEF #endif }; #endif
[ "axkibe@gmail.com" ]
axkibe@gmail.com
5c40a18f376750a55b871edf03e6d7b6c970142d
d50b5cc908f06facaed95c4558c296227270f62c
/UVA/AdHoc/FreeSpors.cpp
dc694e3a53874a8817e6869cfaf1a384145a9996
[]
no_license
marcelomata/competitive-programming-1
e24ac3bc129cb4aae2544c03252fc9dd55351c55
c0631e1f0eb52c6f13b0d047ea976ce61bf0991f
refs/heads/master
2023-03-17T17:41:28.636855
2021-02-28T16:44:50
2021-02-28T16:44:50
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,282
cpp
#include <stdio.h> #include <iostream> #include <vector> #include <string> #include <algorithm> #include <bitset> #include <sstream> #include <set> #include <map> #include <queue> #include <stack> #include <cstdio> #include <cmath> #include <cstdlib> #include <stdio.h> #include <ctype.h> #include <stdlib.h> #include<string.h> #include <iostream> using namespace std; int board[500][500]; int main(){ int W, H, N, X1, Y1, X2, Y2, total; while(scanf("%d%d%d", &W, &H, &N)){ if(W == 0 && H == 0 && N == 0) break; total = W * H; for(int i = 0; i < H; i++) for(int j = 0; j < W; j++) board[i][j] = 1; for(int k = 0; k < N; k++){ scanf("%d%d%d%d", &X1, &Y1, &X2, &Y2); X1--, Y1--, X2--, Y2--; if(X1 > X2) swap(X1, X2); if(Y1 > Y2) swap(Y1, Y2); for(int i = Y1; i <= Y2; i++) for(int j = X1; j <= X2; j++) if(board[i][j]) board[i][j] = 0, total--; } if(total) if(total != 1) printf("There are %d empty spots.\n", total); else printf("There is one empty spot.\n"); else printf("There is no empty spots.\n"); } return 0; }
[ "kleiber.ttito@sap.com" ]
kleiber.ttito@sap.com
bce90181854a712cb65385477d2f18c867d1ada5
378e2a63137fe83fe872182872dc0c723809b005
/UnityFix/Classes/Native/AssemblyU2DCSharp_EasyAR_RecorderBehaviour3314683663.h
fed17f44bec0134360f64705de05f401617a4195
[]
no_license
WenslowZhu/UnityTest
62c96676723eb2580fd9bf91c77eef03629be608
13a62f53124243101bb3ebba2a04cacadc135376
refs/heads/master
2020-12-02T07:50:26.328644
2019-04-20T07:44:40
2019-04-20T07:44:40
96,730,475
0
0
null
null
null
null
UTF-8
C++
false
false
555
h
#pragma once #include "il2cpp-config.h" #ifndef _MSC_VER # include <alloca.h> #else # include <malloc.h> #endif #include <stdint.h> #include "EasyAR_Unity_EasyAR_RecorderBaseBehaviour946255784.h" #ifdef __clang__ #pragma clang diagnostic push #pragma clang diagnostic ignored "-Winvalid-offsetof" #pragma clang diagnostic ignored "-Wunused-variable" #endif // EasyAR.RecorderBehaviour struct RecorderBehaviour_t3314683663 : public RecorderBaseBehaviour_t946255784 { public: public: }; #ifdef __clang__ #pragma clang diagnostic pop #endif
[ "wenslow.vip@gmail.com" ]
wenslow.vip@gmail.com
8aa982d81bbd678f9525cd73dc19ce139f39b2a4
91793aafbc10301185df916f174f43937e87433b
/Asteroids/State.h
f69a83607fe577ae45ee4a5fc60fd65527c1f23b
[]
no_license
Valentineed/Asteroid
280d7ba74221d2bc51dd7b21ae0ca17147b94cd7
411c17695b21959d0225b76a986aa496461df52f
refs/heads/main
2023-05-27T15:07:36.720538
2021-06-10T14:18:39
2021-06-10T14:18:39
375,722,100
0
0
null
null
null
null
UTF-8
C++
false
false
293
h
#pragma once #include "Manager.h" namespace Asteroids { class State : public Manager { public: State() = delete; State(GameManager* game); ~State() = default; virtual void OnBegin() = 0; virtual State* OnUpdate(float timeLaps) = 0; virtual void OnEnd() = 0; private: }; }
[ "dol.valentin@hotmail.com" ]
dol.valentin@hotmail.com
23ac365b47c97c0f6879ab533dfc0e1176c16985
b58e0e3eae6e74434bfd00f7a0651862481ea756
/FC_Client/fc_message.h
aaafaf434523a46ac5d7a9aece9469f660d0bc21
[]
no_license
zhouyi19980603/graduation-project
f23057fca6f4ffc49899c0747c67edb764de06d5
ac2009f9e339dcc16101f5bc760d9472252f3964
refs/heads/master
2023-04-11T17:25:28.901748
2021-01-19T12:19:13
2021-01-19T12:19:13
326,991,756
3
0
null
null
null
null
UTF-8
C++
false
false
1,496
h
#ifndef FC_MESSAGE_H #define FC_MESSAGE_H #include <cstdlib> #include "fc_header.h" /* * 消息包括消息头部和消息body * 消息头部包括消息类型和消息body的大小 * 消息body包括消息的具体内容 * * this->_body_length include the last '\0' */ class FC_Message { public: FC_Message(); //构造函数 FC_Message(const FC_Message& msg); FC_Message& operator=(FC_Message const& msg); ~FC_Message(); //getter unsigned header_length()const; //获得头部的长度 unsigned body_length()const; //消息长度 unsigned mess_length()const; unsigned mess_type()const; char* header()const; char* body()const; char* get_friends_identify() const; char* get_self_identify() const; char* get_core_body() const; //setter void set_body_length(unsigned body_len); void set_message_type(unsigned type); void set_body(const char*data,unsigned len); //set new data package design void set_friend_identify(const char* data); void set_self_identify(const char* data); void set_core_body(const char* data,unsigned len); void set_header(unsigned type, unsigned body_len); //reset message void reset_message(); private: void apply_memory(unsigned len); //apply for new memory private: char* _data; // unsigned _header_length; //unsigned 4 byte // unsigned _body_length; //the length include the last '\0' // unsigned _message_type; }; #endif // FC_MESSAGE_H
[ "1937301137@qq.com" ]
1937301137@qq.com
b83e67a99bab2fba62db5c49ebbe600effc1d267
238e16c9a80ed5f2258c188e76531761c90f987b
/MyMainWindow/mymainwindow.cpp
d1a300d067eb0d44e4aed3607e25e594c4718109
[]
no_license
iTXCode/Qt
30e3e77bead3d8d7ca3359066a47964ccc863901
f3e95074114791fbf4a6145c648f4aadbfa457c0
refs/heads/master
2023-08-07T20:01:15.028530
2021-10-07T14:25:56
2021-10-07T14:25:56
393,836,703
0
0
null
null
null
null
UTF-8
C++
false
false
229
cpp
#include "mymainwindow.h" #include "ui_mymainwindow.h" MyMainWindow::MyMainWindow(QWidget *parent) : QWidget(parent), ui(new Ui::MyMainWindow) { ui->setupUi(this); } MyMainWindow::~MyMainWindow() { delete ui; }
[ "1632672310@qq.com" ]
1632672310@qq.com
04830eb756b8c28ffc37117d5e285114ea74b31f
aaf016490460161b49db6794626f9ae64607b916
/lab7/g.cpp
3fcbfa51dc6d00154e04d1e480a1ab06cfed7889
[]
no_license
yerlandana/my_c_solutions
d7bdc140fa30116e89e68ed7813a84a9d201bac3
f0dacebbc607058aeec6623682591762241b876a
refs/heads/main
2023-03-18T21:25:03.258835
2021-02-27T05:21:17
2021-02-27T05:21:17
342,776,062
0
0
null
null
null
null
UTF-8
C++
false
false
238
cpp
#include <iostream> #include <string> using namespace std; int factorial(int a){ if ( a == 1 || a == 0){ return 1; } return a * factorial(a-1); } int main(){ int a; cin>>a; cout<<factorial(a); return 0; }
[ "dyerlanova@gmail.com" ]
dyerlanova@gmail.com
c94293efde61337919ca002da9d12b53da12efa8
2cf838b54b556987cfc49f42935f8aa7563ea1f4
/aws-cpp-sdk-chime/source/model/BatchUpdatePhoneNumberResult.cpp
d079ea1cafd5c691a36f55d9d669f301d0b979cf
[ "Apache-2.0", "MIT", "JSON" ]
permissive
QPC-database/aws-sdk-cpp
d11e9f0ff6958c64e793c87a49f1e034813dac32
9f83105f7e07fe04380232981ab073c247d6fc85
refs/heads/main
2023-06-14T17:41:04.817304
2021-07-09T20:28:20
2021-07-09T20:28:20
384,714,703
1
0
Apache-2.0
2021-07-10T14:16:41
2021-07-10T14:16:41
null
UTF-8
C++
false
false
1,292
cpp
/** * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #include <aws/chime/model/BatchUpdatePhoneNumberResult.h> #include <aws/core/utils/json/JsonSerializer.h> #include <aws/core/AmazonWebServiceResult.h> #include <aws/core/utils/StringUtils.h> #include <aws/core/utils/UnreferencedParam.h> #include <utility> using namespace Aws::Chime::Model; using namespace Aws::Utils::Json; using namespace Aws::Utils; using namespace Aws; BatchUpdatePhoneNumberResult::BatchUpdatePhoneNumberResult() { } BatchUpdatePhoneNumberResult::BatchUpdatePhoneNumberResult(const Aws::AmazonWebServiceResult<JsonValue>& result) { *this = result; } BatchUpdatePhoneNumberResult& BatchUpdatePhoneNumberResult::operator =(const Aws::AmazonWebServiceResult<JsonValue>& result) { JsonView jsonValue = result.GetPayload().View(); if(jsonValue.ValueExists("PhoneNumberErrors")) { Array<JsonView> phoneNumberErrorsJsonList = jsonValue.GetArray("PhoneNumberErrors"); for(unsigned phoneNumberErrorsIndex = 0; phoneNumberErrorsIndex < phoneNumberErrorsJsonList.GetLength(); ++phoneNumberErrorsIndex) { m_phoneNumberErrors.push_back(phoneNumberErrorsJsonList[phoneNumberErrorsIndex].AsObject()); } } return *this; }
[ "aws-sdk-cpp-automation@github.com" ]
aws-sdk-cpp-automation@github.com
392562d0941271540d80f7fa662f6dd0ca7c2edd
4cfab692090829c64e10bed7fb9c1f8ad2f0f528
/Project4/Deque_try.cpp
b2ef3c741857e48a3449acd652c77d5ff1f64c95
[]
no_license
AnastasiyaKuznetsova99/Homework_3
6ac78c25025a12f5a52bccb4590296e20ca4c8f7
896683e85df3e5507598b873a6755dc3d8cebede
refs/heads/master
2021-02-11T01:59:49.640185
2020-03-08T10:31:09
2020-03-08T10:31:09
244,438,453
1
0
null
null
null
null
UTF-8
C++
false
false
117
cpp
#include <iostream> #include <vector> #include <deque> int main() { std::deque<int> dq = { 1, 9, 94 }; return 0; }
[ "kuznetsova.as@phystech.edu" ]
kuznetsova.as@phystech.edu
f98672741a79b794d30d59b8466e18b41e3234a5
2d361696ad060b82065ee116685aa4bb93d0b701
/src/app/multireader/multifile_destination.hpp
53bd2610f570efdce69e274bbe0a8b65761d6148
[ "LicenseRef-scancode-public-domain" ]
permissive
AaronNGray/GenomeWorkbench
5151714257ce73bdfb57aec47ea3c02f941602e0
7156b83ec589e0de8f7b0a85699d2a657f3e1c47
refs/heads/master
2022-11-16T12:45:40.377330
2020-07-10T00:54:19
2020-07-10T00:54:19
278,501,064
1
1
null
null
null
null
UTF-8
C++
false
false
2,006
hpp
#ifndef MULTIFILE_DESTINATION__HPP #define MULTIFILE_DESTINATION__HPP /* $Id: multifile_destination.hpp 481972 2015-10-19 16:42:21Z ludwigf $ * =========================================================================== * * PUBLIC DOMAIN NOTICE * National Center for Biotechnology Information * * This software/database is a "United States Government Work" under the * terms of the United States Copyright Act. It was written as part of * the author's official duties as a United States Government employee and * thus cannot be copyrighted. This software/database is freely available * to the public for use. The National Library of Medicine and the U.S. * Government have not placed any restriction on its use or reproduction. * * Although all reasonable efforts have been taken to ensure the accuracy * and reliability of the software and data, the NLM and the U.S. * Government do not and cannot warrant the performance or results that * may be obtained by using this software or data. The NLM and the U.S. * Government disclaim all warranties, express or implied, including * warranties of performance, merchantability or fitness for any particular * purpose. * * Please cite the author in any work or product based on this material. * * =========================================================================== * * Author: Frank Ludwig * * File Description: Provide output filename, given an input filename. * */ BEGIN_NCBI_SCOPE #include <corelib/ncbifile.hpp> // ============================================================================ class CMultiFileDestination // ============================================================================ { public: CMultiFileDestination( const std::string&); bool Next( const std::string&, string&); protected: const std::string mBaseDir; const std::string mExtension; bool mBaseValid; }; END_NCBI_SCOPE #endif
[ "aaronngray@gmail.com" ]
aaronngray@gmail.com
404b6d7bf1e2862c1082cfe85f1f79698700f02e
9d9bf9a9ebc984406b20f7e313558c3fc39de1dc
/Text01_05/Text01_05/datastruct.cpp
4e78d371f0f81a1e4953994bde5abe2f163c242b
[]
no_license
Bubbblegirl0612/program
d2019b6bc758fe2d1f42c6b25c8b2c0dc26ffbf1
c2765425f99954f052247768b6d9b1091bd37790
refs/heads/master
2020-05-15T20:10:01.607182
2019-04-21T01:56:05
2019-04-21T01:56:05
182,471,728
0
0
null
null
null
null
GB18030
C++
false
false
19,517
cpp
#include<assert.h> #include<iostream> #include<malloc.h> #include<limits.h> #include<vector> using namespace std; typedef int ElemType; typedef struct ListNode { ListNode *next; ElemType data; }ListNode; typedef struct { ListNode *head; int cursize; }List; ListNode * Buynode() { ListNode *s = (ListNode*)malloc(sizeof(ListNode)); if (NULL == s) exit(1);// _exit(1); memset(s, 0, sizeof(ListNode)); return s; } void Freenode(ListNode *p) { free(p); } void InitList(List &Lt)// { Lt.head = Buynode(); Lt.cursize = 0; } bool InsertItem(List &Lt, int pos, ElemType x) { if (pos <= 0 || pos > Lt.cursize + 1) return false; ListNode *p = Lt.head; int i = 1; while (i < pos) { p = p->next; ++i; } ListNode *s = Buynode(); s->data = x; s->next = p->next; p->next = s; Lt.cursize += 1; return true; } void Push_Back(List &Lt, ElemType x) { InsertItem(Lt, Lt.cursize + 1, x); } void Push_Front(List &Lt, ElemType x) { InsertItem(Lt, 1, x); } //删除单链表中第几个位置的元素 bool EraseList(List &Lt, int pos) { if (pos <= 0 || pos > Lt.cursize) return false; ListNode *p = Lt.head; int i = 1; while (i<pos) { ++i; p = p->next; } ListNode *q = p->next; p->next = q->next; Freenode(q); Lt.cursize -= 1; return true; } void Pop_Back(List &Lt) { EraseList(Lt, Lt.cursize); } void Pop_Front(List &Lt) { EraseList(Lt, 1); } int GetSize(List &Lt) { return Lt.cursize; } bool Is_Empty(List &Lt) { return GetSize(Lt) == 0; } void PrintList(List &Lt) { ListNode *p = Lt.head->next; while (p != NULL) { cout << p->data << " "; p = p->next; } cout << endl; } //删除单链表中特定值的节点 void RemoveItem(List &Lt, ElemType x) { ListNode *p = Lt.head->next;//头节点的下一个 ListNode *s = Lt.head;//指向头结点 int num = 0; while (p != NULL) { if (p->data != x) { s->next->data = p->data; s = s->next; num += 1; } p = p->next; } ListNode *p = s->next; s->next = NULL; while (p != NULL) { ListNode *q = p; p = p->next; Freenode(q); } Lt.cursize = num; } //链表的倒置 void ResList(List &Lt) { } //链表的合并 将两个链表的值合并到第三个链表中去,并且按照从小到大合并 void MergeList(List &la, List &lb, List &lc) { ListNode *ap = lb.head->next; ListNode *bp = lc.head->next; ListNode *cp = la.head; while (ap != NULL && bp != NULL) { ListNode *s = Bu if (p1->data > p2->data) { s->next->data = p2->data; s = s->next; } } } //链表的清除 void ClearList(List &Lt) { ListNode *p = Lt.head->next; } //双循环链表 typedef struct DLNode { ElemType data; DLNode *pr; DLNode *next; }; typedef struct DLlist { DLNode head; }; void InitList(Node &lt) { } bool InsertItem(DuLinkList &Lt, DuLNode *ptr, ElemType x) { DuLNode * Buynode(DuLNode *pr = NULL, DuLNode *nt = NULL) { DuLNode *s = (DuLNode*)malloc(sizeof(DulNode)); if (NULL == s) exit(1); } } int main() { int ar[] = { 1,3,5,7,8,11,15 }; int n = sizeof(ar) / sizeof(ar[0]); int br[] = { 2,4,6,8,10,16,18 }; int m = sizeof(ar) / sizeof(ar[0]); List mylist, youlist, helist; InitList(mylist); InitList(youlist); InitList(helist); for (int i = 0; i < n; i++) { Push_Back(mylist, ar[i]); } for (int i = 0; i < m; i++) { Push_Back(youlist, ar[i]); } PrintList(mylist); PrintList(youlist); PrintList(helist); MergeList(helist, mylist, youlist); PrintList(mylist); PrintList(youlist); PrintList(helist); } //int main() //{ // int ar[] = { 12,23,34,45,56,67,78,89,90,100 }; // int n = sizeof(ar) / sizeof(ar[0]); // List mylist; // InitList(mylist); // // for (int i = 0; i<n; ++i) // { // Push_Back(mylist, ar[i]); // PrintList(mylist); // } // while (!Is_Empty(mylist)) // { // Pop_Front(mylist); // PrintList(mylist); // } // return 0; //} /* void main() { vector<int> ivec; for(int i = 0;i<10;++i) { ivec.push_back(rand()%100); } int n = ivec.size(); for(int i = 0;i<n;++i) { cout<<ivec[i]<<" "; } cout<<endl; } void Swap(int &a,int &b) { int x = a; a = b; b = x; } #define SEQ_INIT_SIZE 10 #define SEQ_INC_SIZE 2 typedef enum{ MALLOCFAULT = -1, INITSUCCESS = -2, POSERROR = -3, INCFAULT = -4, SUCCESS = 0, } Status; typedef int ElemType; typedef struct { ElemType *data;// malloc int cursize; int maxsize; }SeqList; Status InitList(SeqList &seq) { seq.data = (ElemType*)malloc(sizeof(ElemType)*SEQ_INIT_SIZE); if(NULL == seq.data) { return MALLOCFAULT; } seq.cursize = 0; seq.maxsize = SEQ_INIT_SIZE; return INITSUCCESS; } void DestroyList(SeqList &seq) { free(seq.data); seq.data = NULL; seq.maxsize = 0; seq.cursize = 0; } int GetSize(SeqList &seq) { return seq.cursize; } int GetCapacity(SeqList &seq) { return seq.maxsize; } // list 元素是0个,Empty; bool Is_Empty(SeqList &seq) { return GetSize(seq) == 0; } bool Is_Full(SeqList &seq) { return GetSize(seq) == GetCapacity(seq); } bool Inc_Size(SeqList &seq) { ElemType *newdata = (ElemType*)realloc(seq.data,sizeof(ElemType)*seq.maxsize * SEQ_INC_SIZE); if(NULL == newdata) { return false; } seq.data = newdata; seq.maxsize= seq.maxsize * SEQ_INC_SIZE; return true; } Status InsertItem(SeqList &seq,const int pos,const ElemType x) { if(pos < 0 || pos > GetSize(seq)) { return POSERROR; } if(Is_Full(seq) && !Inc_Size(seq)) { return INCFAULT; } memmove(&seq.data[pos+1],&seq.data[pos],sizeof(ElemType)*(seq.cursize - pos)); //for(int i = seq.cursize;i>pos;--i) //{ // seq.data[i] = seq.data[i-1]; //} seq.data[pos] = x; seq.cursize+=1; return SUCCESS; } void Push_Back(SeqList &seq,const ElemType x) { InsertItem(seq,seq.cursize,x); } void Push_Front(SeqList &seq,const ElemType x) { InsertItem(seq,0,x); } Status EraseList(SeqList &seq,int pos) { if(pos < 0 || pos >= seq.cursize) { return POSERROR; } memmove(&seq.data[pos],&seq.data[pos+1],sizeof(ElemType)*(seq.cursize - pos -1)); seq.cursize -=1; return SUCCESS; } void Pop_Back(SeqList &seq) { EraseList(seq,seq.cursize-1); } void Pop_Front(SeqList &seq) { EraseList(seq,0); } void RemoveItem(SeqList &seq,ElemType x) { int j = 0; for(int i = 0;i<seq.cursize;++i) { if(seq.data[i] !=x) { seq.data[j] = seq.data[i]; ++j; } } seq.cursize = j; } void PrintList(SeqList &seq) { for(int i = 0;i<seq.cursize;++i) { printf("%d ",seq.data[i]); } printf("\n"); } int FindValue(SeqList &seq,ElemType val) { int pos = -1; for(int i = 0;i<seq.cursize ;++i) { if(seq.data[i] == val) { pos = i; break; } } return pos; } // InsertSort; // SelectSort; void InsertSort(SeqList &seq) {// O(n) => O(n^2) for(int i = 1;i<seq.cursize;++i) { if(seq.data[i] < seq.data[i-1]) { int j = i - 1; ElemType tmp = seq.data[i]; do { seq.data[j+1] = seq.data[j]; --j; }while(j >= 0 && tmp < seq.data[j]); seq.data[j+1] = tmp; } } } void SelectSort(SeqList &seq) { // O(n^2) for(int i = 0;i<seq.cursize;++i) { int minpos = i; for(int j = i+1;j<seq.cursize;++j) { if(seq.data[minpos] > seq.data[j]) { minpos = j; } } ////////////////////// if(i != minpos) { Swap(seq.data[i],seq.data[minpos]); } } } /////////////////////////////////////// void FilterDown(ElemType *ar,int start,int end) { int i = start,j = i*2+1; ElemType item = ar[i]; while(j <= end) { if(j < end && ar[j] < ar[j+1]) ++j; if(item >= ar[j]) break; ar[i] = ar[j]; i = j; j = 2*i+1; } ar[i] = item; } void HeapSort(SeqList &seq) { if(seq.cursize < 2) return ; // 建成大堆 int pos = (seq.cursize-2)/2; while(pos >= 0) { FilterDown(seq.data,pos,seq.cursize-1); --pos; } /// O(n*log2n) for(int i = seq.cursize-1;i>0;--i) { Swap(seq.data[0],seq.data[i]); FilterDown(seq.data,0,i-1); } } int SearchValue2(SeqList &seq,ElemType val) { int pos = -1; int left = 0,right = seq.cursize - 1; while(left <= right) { int mid = (right - left + 1)/2 + left; if(val < seq.data[mid]) { right = mid-1; }else if(val > seq.data[mid]) { left = mid+1; }else { while(mid > left && seq.data[mid-1] == val) --mid; pos = mid; break; } } return pos; } int Search(SeqList &seq,int left,int right,ElemType val) { int pos = -1; if(left <= right) { int mid = (right - left + 1)/2 + left; if(val < seq.data[mid]) { pos = Search(seq,left,mid-1,val); }else if(val > seq.data[mid]) { pos = Search(seq,mid+1,right,val); }else { while(mid > left && seq.data[mid-1] == val) --mid; pos = mid; } } return pos; } int SearchValue(SeqList &seq,ElemType val) { return Search(seq,0,seq.cursize-1,val); } int Partition(SeqList &seq,int left,int right) { int i = left, j = right; ElemType tmp = seq.data[i]; while(i<j) { while(i<j && seq.data[j] > tmp) --j; if(i<j) {seq.data[i] = seq.data[j];} while(i<j && seq.data[i] <= tmp) ++i; if(i<j) { seq.data[j] = seq.data[i];} } seq.data[i] = tmp; return i; } void QuickPass(SeqList &seq,int left,int right) { if(left < right) { int pos = Partition(seq,left,right); QuickPass(seq,left,pos-1); QuickPass(seq,pos+1,right); } } void QuickSort(SeqList &seq) { QuickPass(seq,0,seq.cursize-1); // } ElemType SelectK(SeqList &seq,int left,int right,int k) { if(left == right && k == 1) return seq.data[left]; int index = Partition(seq,left,right); int pos = index - left + 1; if(k <= pos) return SelectK(seq,left,index,k); else return SelectK(seq,index+1,right,k - pos); } ElemType SelectK_Min(SeqList &seq,int k) { assert(k >= 1 && k <= seq.cursize); return SelectK(seq,0,seq.cursize -1,k); } int MaxS(SeqList &seq,int left,int right) { return seq.data[right]; } int MinS(SeqList &seq,int left, int right) { int min = seq.data[left]; for(int i = left + 1; i<=right;++i) { if(min > seq.data[i]) { min = seq.data[i]; } } return min; } int Min3S(int d1,int d2,int d3) { return min(d1,min(d2,d3)); } int Cpair_Ar(SeqList &seq,int left,int right) { if(right - left <= 0) { return INT_MAX; } int k = (right - left + 1)/2; // int index = left + k - 1; SelectK(seq,left,right,k); // s1 s2; int d1 = Cpair_Ar(seq,left,index);// s1; int d2 = Cpair_Ar(seq,index+1,right);// s2; int maxs1 = MaxS(seq,left,index);// s1; int mins2 = MinS(seq,index+1,right);// s2; return Min3S(d1,d2,mins2 - maxs1); } int Cpair(SeqList &seq) { return Cpair_Ar(seq,0,seq.cursize-1); } ///////////////////////////////////////////// void Copy_Ar(int *dst,int *src,int left,int right) { for(int i = left ; i <= right;++i) { dst[i] = src[i]; } } void Merge(int *dst,int *src,int left, int m,int right) { int i = left, j = m+1; int k = left; while(i<=m && j <= right) { dst[k++] = src[i] < src[j]? src[i++]:src[j++]; } while(i<=m ) { dst[k++] = src[i++]; } while(j <= right) { dst[k++] = src[j++]; } } void MergePass(int *br,int *ar,int left,int right) {// 2 2 if(left < right) { int mid = (right - left + 1)/2 + left -1;// MergePass(br,ar,left,mid); MergePass(br,ar,mid+1,right); Merge(br,ar,left,mid,right); cout<<left<<" "<<mid<<" "<<right<<endl; Copy_Ar(ar,br,left,right); } } void MergeSort(SeqList &seq) { int * br = (int*)malloc(sizeof(int)*seq.cursize); MergePass(br,seq.data,0,seq.cursize-1); free(br); } void Merge(int *dst,int *src,int left, int m,int right); // 0 1 2 3 4 5 6 7 8 9 10 11 // n - 1 void MergePass2(int *dst,int *src,int s,int n) {// s = 2 int i = 0; for(; i+2*s -1 <= n -1; i = i+2*s) { Merge(dst,src,i,i+s-1,i+2*s-1);// } if(n-1 >= i+s) { Merge(dst,src,i,i+s-1,n-1); } else { for(int j = i;j<n;++j) { dst[j] = src[j]; } } } void PrintAr(int *ar,int n) { for(int i = 0;i<n;++i) { cout<<ar[i]<<" "; } cout<<endl; } void MergeSort2(SeqList &seq) { int s = 1; int n = seq.cursize; int *br = (int*)malloc(sizeof(int)*n); while(s < n) {// 0 1 2 3 4 5 6 MergePass2(br,seq.data,s,n); cout<<s<<endl; PrintAr(br,n); s+=s; // 2; MergePass2(seq.data,br,s,n); cout<<s<<endl; PrintAr(seq.data,n); s+=s; // 4 } free(br); } int main() { SeqList mylist; InitList(mylist); for(int i = 0;i<6;++i) { Push_Back(mylist,rand()%100); } Push_Back(mylist,23); PrintList(mylist); MergeSort2(mylist); PrintList(mylist); return 0; } ////////////////////////////////// void fun(int *ar,int *br,int i,int n) { if(i == n) { for(int j = 0;j<n;++j) { if(br[j]) { cout<<ar[j]<<" "; } } cout<<endl; } else { br[i] = 1; fun(ar,br,i+1,n); br[i] = 0; fun(ar,br,i+1,n); } } void main() { int ar[]={1,2,3}; int br[]={0,0,0}; fun(ar,br,0,3); } void fun(int &i,int n) { if(i>=n) { return ;} else { fun(i++,n); fun(i++,n); } } int main() { int i = 0; fun(i,3); cout<<i<<endl; } // 子集 // 2// 3 // 4// void Perm(int *ar,int k,int m) { if(k == m) { for(int i = 0;i<=m;++i) { cout<<ar[i]<<" "; } cout<<endl; } else { for(int j = k; j<=m;++j) { Swap(ar[j],ar[k]); Perm(ar,k+1,m); Swap(ar[j],ar[k]); } } } int main() { int ar[]={1,2,3}; Perm(ar,0,2); return 0; } int main() { // 12 12 12 12 23 34 45 56 56 56 56 67 78 89 90 SeqList mylist; InitList(mylist); for(int i = 0;i<10;++i) { Push_Back(mylist,rand()%100); } PrintList(mylist); for(int k = 1;k<=mylist.cursize;++k) { cout<<k<<" => "<<SelectK_Min(mylist,k)<<endl; } cout<<endl; return 0; } // 1 ) malloc // 2 ) // 3 ) // // 1 1 2 3 5 8 13 21 34 55 // 1 2 3 4 5 6 7 8 9 10 // // O(2 ^n) int fac(int n,int a,int b) { if(n <= 2) return a; else return fac(n-1,a+b,a); } int fac(int n) { int a = 1, b = 1; return fac(n,a,b); } int fac(int n) { if(n <= 2) return 1; else return fac(n-1) + fac(n-2); } // O(n) int fun(int n) { int a = 1, b = 1,c = 1; for(int i = 3;i<=n;++i) { c = a+b; b = a; a = c; } return c; } int main() { for(int i = 1;i<=20000;++i) { cout<<i<<" ="<<fun(i)<<endl; } return 0; } // O(n) S(n) // gcc -Ml, --stack = xxxxx; int fac(int n) { if(n<=1) return 1; else return fac(n-1) * n; } // O(n) // S(1) int fun(int n) { int sum = 1; for(int i = 1;i<=n ;++i) { sum = sum *i; } return sum; } int main() { int n,sum; cin>>n; sum = fac(n); cout<<n<<"! => "<<sum<<endl; return 0; } int main() { int *p = (int*)calloc(10,sizeof(int)); free(p); } int main() { int *p = (int*)malloc(sizeof(int)*5); int *s = (int*)malloc(sizeof(int)*5); for(int i=0;i<5;++i) { p[i] = i; } //p = (int*)realloc(p,sizeof(int)*10); int *newdata = (int*)realloc(p,sizeof(int)*10); if(newdata != NULL) { p = newdata; } p = (int*)realloc(p,sizeof(int)*2); // !NULL > < // !NULL 0 // NULL >0 /// NULL =0 free(p); p = NULL; return 0; } bool Inc_Size(SeqList &seq) { ElemType *newdata = (ElemType*)malloc(sizeof(ElemType)*seq.maxsize * SEQ_INC_SIZE); if(NULL == newdata) { return false; } memmove(newdata,seq.data,sizeof(ElemType)*seq.maxsize); free(seq.data); seq.data = newdata; seq.maxsize= seq.maxsize * SEQ_INC_SIZE; return true; } int main() { int *p = (int*)malloc(sizeof(int)); *p = 100; cout<<*p<<endl; free(p); cout<<*p<<endl; *p = 20; cout<<*p<<endl; return 0; } int main() { int *p = (int*)malloc(sizeof(int)*5); for(int i =0;i<5;++i) { p[i] = i; } for(int i = 0;i<5;++i) { *p = i; p = p+1; } free(p); p = NULL; } int main() { int ar[]={34,78,90,12,23,67,18,100}; int n = sizeof(ar)/sizeof(ar[0]); SeqList mylist;// data cursize maxsize; InitList(mylist); for(int i = 0;i<n;++i) { Push_Back(mylist,ar[i]); } PrintList(mylist); HeapSort(mylist); PrintList(mylist); DestroyList(mylist); return 0; } // c > malloc // free // c++ > new // delete int * GetArray(int n) { int *s = (int*)malloc(sizeof(int)*n); //int *s1 = (int*)calloc(sizeof(int),n); // NULL; if(NULL == s) { exit(1); } memset(s,0,sizeof(int)*n); return s; } void Freenode(int *p) { free(p); } int main() { int *p = GetArray(10); Freenode(p); p = NULL; } int main() { int *p = NULL; int n; cin>>n; // 10 4*n p = (int *)malloc(sizeof(int)*n);// for(int i = 0;i<n;++i) { p[i] = i; *(p+i) = i; //*p = i; //++p; } for(int i = 0;i<n;++i) { cout<<p[i]<<" "; } cout<<endl; free(p); p = NULL; return 0; } struct Student { char s_name[20]; int num; int grade[5]; }; // s_name = "yhping",5 ,90,89,78,87,100; void InitStudent(Student *sp) { if(NULL == sp) return; strcpy(sp->s_name,"201801001"); sp->num = 5; sp->grade[0] = 12; } void Init_Student(Student &s) { int ar[]={78,89,78,89,90}; strcpy(s.s_name,"yhping"); s.num = 5; memmove(s.grade,ar,sizeof(ar)); } int main() { Student s1; } struct Student { char s_id[20]; char s_name[20]; char s_sex; int s_age; }; //s ={s_id:"201801001",s_name:"yhping",s_sex:'m',s_age:23}; void InitStudent(Student *sp) // s_id=>"201801001","yhping",'m',23; { if(NULL == sp) return ; strcpy(sp->s_id,"201801001"); strcpy(sp->s_name,"yhping"); sp->s_sex = 'm'; sp->s_age = 23; //*sp = {"201801001","yhping",'m',23};// 2015 c11 c14 //c99 } void Init_Student(Student &s) { strcpy(s.s_id,"201801001"); strcpy(s.s_name,"yhping"); s.s_sex = 'm'; s.s_age = 23; //s ={"201801001","yhping",'m',23}; } int main() { Student s1; InitStudent(s1); return 0; } void Swap(int *ap,int *bp) { if(NULL == ap || NULL == bp) return ; int a = *ap; *ap = *bp; *bp = a; } void Swap2(int &a,int &b) { int tmp = a; a = b; b = tmp; } int main() { int x = 10,y = 20; cout<<"x = "<<x<<" y = "<<y<<endl; Swap2(x,y); cout<<"x = "<<x<<" y = "<<y<<endl; return 0; } int main() { int a = 10; a += 100; type(a) b=0; } typedef int Array[10]; int main() { Array a,b; } #define SINT int * typedef int *PINT; int main() { SINT const a,b;// int * const a,b; PINT const x,y;// x = &a; *x = 100; } void * my_memmove(void *dst,const void *src,int size) { void *p = dst; assert(NULL != dst); assert(NULL != src); assert(size > 0); while(size--) { *(char*)p = *(char*)src; p = (char*)p + 1; src = (char*)src + 1; } return dst; } int my_strlen(const char *str) { int count = 0; if(NULL == str) return count; while(*str != '\0') { ++str; ++count; } return count; } int main() { char str[256] ={"yhping hello"}; memmove(str+1,str,strlen(str)+1); my_memmove(str+1,str,strlen(str)+1); return 0; } int main() { char str1[256]={"yhping hello"}; char str2[256]; char str3[256]; my_memmove(str2,str1,0); return 0; } /// #define DEBUG #undef DEBUG void * my_memmove(void *dst,const void *src,int size) { void *p = dst; #ifdef DEBUG if(NULL == dst || NULL == src || size < 1) { return dst; } #endif while(size--) { *(char*)p = *(char*)src; p = (char*)p + 1; src = (char*)src + 1; } return dst; } int my_strlen(const char *str) { int count = 0; if(NULL == str) return count; while(*str != '\0') { ++str; ++count; } return count; } int main() { char str1[256]={"yhping hello"}; char str2[256]; char str3[256]; my_memmove(str3,my_memmove(str2,str1,my_strlen(str1)+1),my_strlen(str1)+1); //my_memmove(&s2,&s1,sizeof(Student)); return 0; } #include"yhp.h" #include"yhp.h" int main() { int ar[]={ #include"Array.txt" }; return 0; } // # ## #include<stdio.h> #include<iostream> using namespace std; #define CPP 1 int maint() { int a = 10; #if 0 // #ifdef CPP #ifndef CPP printf("%d %x\n",a,&a); #else cout<<a<<" "<<&a<<endl; #endif return 0; } #ifdef YHP #endif #define MUL(x,y) ((x)*(y)) int main() { int a = 3 ,b = 5; printf("%d \n",MUL(a+4,b+6)); printf("%d \n",(a+4*b+6)); return 0; } int Max(int a,int b) { return a>b? a:b; } #define MAX(a,b) (a>b? a:b) int main() { int x = 10,y = 5; double dx = 12.23,dy=34.45; int c = Max(++x,y); c = MAX(++x,y);// c = (++x>y?++x:y); double dc; dc = Max(dx,dy); dc = MAX(dx,dy); } #define PI 3.14; int main() { double r = 10, s= 0; s = r * r * PI; s = PI * r * r; return 0; } #define MAX 10 #define PI 3.14 enum Status { OK = -1, ERROR = 10,NULLPOINT =3}; const int maxint = 10; const double pi = 3.14; int main() { int x = MAX; int y = maxint; int z = ERROR; } struct Student { int id; char name[10]; int age; }; // void *p ; 泛型指针 int main() { void *p = NULL; char *cp = NULL; int a = 10; char ch = 'a'; double dx = 12.23; Student s; p = &a; p = &ch; p = &dx; p = &s; *p; p = (char*)p+1; p = (char*)p+4; p = (int*)p+1; } */
[ "bubblegirl0612@126.com" ]
bubblegirl0612@126.com
79cbb0d0832dc72e572b6a76089591d791283122
90e46b80788f2e77eb68825011c682500cabc59c
/Google/Codejam/2019/Round 1C/B.cpp
7a530a8dd24a97d608373465e933937d2b8a2b6a
[]
no_license
yashsoni501/Competitive-Programming
87a112e681ab0a134b345a6ceb7e817803bee483
3b228e8f9a64ef5f7a8df4af8c429ab17697133c
refs/heads/master
2023-05-05T13:40:15.451558
2021-05-31T10:04:26
2021-05-31T10:04:26
298,651,663
0
0
null
null
null
null
UTF-8
C++
false
false
3,453
cpp
#include<bits/stdc++.h> using namespace std; #define INF 1e18 #define IOS ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); typedef long long int ll; ll t,f,te; map<string,bool> perm; bool isvalid(string s) { char st[6]; for(int i=0;i<5;i++) { st[i]=s[i]; } sort(st,st+5); for(int i=0;i<5;i++) { if(st[i]==st[i+1]) return 0; } return 1; } char charac(int i) { return i+64; } void push(string s,int ind) { if(ind==4) { if(isvalid(s)) perm[s]=0; return; } for(int i=1;i<6;i++) { string st=s; st+=charac(i); push(st,ind+1); } } bool pres(string s,char c) { for(int i=0;i<4;i++) { if(s[i]==c) return 1; } return 0; } void comple(string s) { for(int i=1;i<6;i++) { if(!pres(s,i+64)) { s+=charac(i); perm[s]=1; return; } } } int main() { IOS cin>>te>>f; for(int t=1;t<=te;t++) { perm.clear(); for(int i=1;i<6;i++) { string s=""; s+=charac(i); push(s,0); } /* cout<<perm.size()<<endl; for(map<string,bool>::iterator it=perm.begin();it!=perm.end();it++) { cout<<it->first<<endl; } */ ll ar[4][5]={}; for(int i=0;i<118;i++) { string s=""; for(int j=1;j<5;j++) { char c; cout<<5*i+j<<endl; cin>>c; s+=c; ar[j-1][c-65]++; } comple(s); } char c; int ind; for(int i=0;i<4;i++) { bool num3=1; for(int j=0;j<5;j++) { if(ar[i][j]==23) { num3=0; } } if(num3) { ind=i+1; cout<<118*5+ind<<endl; cin>>c; break; } } char ch[6]; ch[ind-1]=c-64; bool bo[5]={}; bo[ind-1]=1; for(int i=0;i<4;i++) { for(int j=0;j<5;j++) { if(ar[i][j]==22) { ch[i]=charac(j+1); bo[i]=1; } } } for(int i=0;i<5;i++) { if(!bo[i]) { ind=i; break; } } for(int i=1;i<=5;i++) { bool bo=1; for(int j=0;j<5;i++) { if(j!=ind && ch[i]==i+48) bo=0; } if(bo) { ch[ind]=i+48; break; } } string s=""; for(int i=0;i<5;i++) { s+=ch[i]; } perm[s]=1; string ans; for(map<string,bool>::iterator it=perm.begin();it!=perm.end();it++) { if(!(it->second)) { ans=it->first; } } s=""; for(int i=0;i<5;i++) { ans+=charac(ch[i]); } ll res; cout<<ans<<endl; cin>>res; if(res=='n') { exit(0); } } }
[ "yashsoni501@gmail.com" ]
yashsoni501@gmail.com
0c4aca006db4eb1c3bf96c9bf331d68efeb13770
948f4e13af6b3014582909cc6d762606f2a43365
/testcases/juliet_test_suite/testcases/CWE121_Stack_Based_Buffer_Overflow/s02/CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_memcpy_81_bad.cpp
bd6fea82cef687a69934d6e9ce2e8a29a4177b6e
[]
no_license
junxzm1990/ASAN--
0056a341b8537142e10373c8417f27d7825ad89b
ca96e46422407a55bed4aa551a6ad28ec1eeef4e
refs/heads/master
2022-08-02T15:38:56.286555
2022-06-16T22:19:54
2022-06-16T22:19:54
408,238,453
74
13
null
2022-06-16T22:19:55
2021-09-19T21:14:59
null
UTF-8
C++
false
false
1,302
cpp
/* TEMPLATE GENERATED TESTCASE FILE Filename: CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_memcpy_81_bad.cpp Label Definition File: CWE121_Stack_Based_Buffer_Overflow__CWE193.label.xml Template File: sources-sink-81_bad.tmpl.cpp */ /* * @description * CWE: 121 Stack Based Buffer Overflow * BadSource: Point data to a buffer that does not have space for a NULL terminator * GoodSource: Point data to a buffer that includes space for a NULL terminator * Sinks: memcpy * BadSink : Copy string to data using memcpy() * Flow Variant: 81 Data flow: data passed in a parameter to an virtual method called via a reference * * */ #ifndef OMITBAD #include "std_testcase.h" #include "CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_memcpy_81.h" namespace CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_memcpy_81 { void CWE121_Stack_Based_Buffer_Overflow__CWE193_char_declare_memcpy_81_bad::action(char * data) const { { char source[10+1] = SRC_STRING; /* Copy length + 1 to include NUL terminator from source */ /* POTENTIAL FLAW: data may not have enough space to hold source */ memcpy(data, source, (strlen(source) + 1) * sizeof(char)); printLine(data); } } } #endif /* OMITBAD */
[ "yzhang0701@gmail.com" ]
yzhang0701@gmail.com
5bf650b86a73c1cdd39491a09644d9216fd500ed
08f7547be48ffebc552052a9dc1fe6978c30f5be
/Arduino/tmp/app.ino
7fea63c0394e6be836ae1e169c44ca5d6866d514
[]
no_license
tcou82/ardibot
4c3910af34b2e66d18c95d0b4a059a8e5a32fa42
f6f4e6d554b00549ac95ceefa655b33e8fe29849
refs/heads/main
2023-03-25T08:33:38.059371
2021-03-20T19:48:20
2021-03-20T19:48:20
328,046,816
0
0
null
null
null
null
UTF-8
C++
false
false
1,543
ino
#include <Servo.h> int REVERSE = -1; int inters [20] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; const int LED_1_PIN = 7; void setup() { Serial.begin(9600); // Default communication rate of the Bluetooth module Serial.println("Initialisation connexion:"); pinMode(LED_1_PIN, OUTPUT); } void loop() { digitalWrite(LED_1_PIN, HIGH); delay(1*1000); digitalWrite(LED_1_PIN, LOW); delay(1*1000); } float get_SONAR(int npin) { pinMode(npin, OUTPUT); digitalWrite(npin, LOW); delayMicroseconds(2); digitalWrite(npin, HIGH); delayMicroseconds(10); digitalWrite(npin, LOW); pinMode(npin, INPUT); float distance = pulseIn(npin, HIGH) / 58.00; Serial.print(" distance "); Serial.println(distance); return distance; } int get_INTER(int npin) { int val1 = digitalRead(npin); Serial.print("val1 "); Serial.print(val1); delay(20); int val2 = digitalRead(npin); Serial.print(" val2 "); Serial.print(val2); if ( val1 == val2 ) { inters[npin] = val1; } Serial.print(" retenu "); Serial.println(inters[npin]); return inters[npin]; } void set_MOTEUR(int npinA, int npinB, int val) { if ( val == 1) { digitalWrite(npinA, HIGH); digitalWrite(npinB, LOW); } else if ( val == 0 ) { digitalWrite(npinA, LOW); digitalWrite(npinB, LOW); } else if ( val == -1) { digitalWrite(npinA, LOW); digitalWrite(npinB, HIGH); } }
[ "tcou82@gmail.com" ]
tcou82@gmail.com
0c57cb8be11fa9df8dedbd719fdc6159a208c958
4cddb42a961e44e7fdda836031de40fa39d12b87
/b3m_servo/include/b3m_servo.hpp
5c91e0949a04a43d524dd0378149176af5ba3346
[]
no_license
AriYu/ros-kondo-b3m-driver-beta
1c1f1b46b1136c55c04a10afe820b1cb104422d1
d7a353c319f48fd60bf61b166b3b157b31e6b9cd
refs/heads/master
2021-01-17T14:09:20.423680
2016-05-31T08:33:20
2016-05-31T08:33:20
49,501,422
0
0
null
2016-05-31T08:33:20
2016-01-12T13:22:51
C++
UTF-8
C++
false
false
9,262
hpp
#ifndef B3M_SERVO_H_ #define B3M_SERVO_H_ #include <ros/ros.h> #include <boost/thread.hpp> #include <string> #include "serial.hpp" #define NORMAL_MODE 0x00 #define FREE_MODE 0x02 #define HOLD_MODE 0x03 #define TRAJECTORY_NORMAL_MODE 0 #define TRAJECTORY_EVEN_MODE 1 #define TRAJECTORY_THIRDPOLY_MODE 3 #define TRAJECTORY_FORTHPOLY_MODE 4 #define TRAJECTORY_FIFTHPOLY_MODE 5 unsigned char checksum(unsigned char data[], int num); int hexa2dec(unsigned char data1, unsigned char data2); class KondoB3mServo{ public: int min_angle_; int max_angle_; double angle_; unsigned char id_; std::string joint_name_; KondoB3mServo(std::string actuator_name) { ros::NodeHandle nh(std::string("~")+actuator_name); int id_int=0; if(nh.getParam("id", id_int)){ id_ = (unsigned char)id_int; ROS_INFO("id: %d", id_); } if (nh.getParam("joint_name", joint_name_)) { ROS_INFO("joint_name: %s", joint_name_.c_str()); } if (nh.getParam("min_angle", min_angle_)) { ROS_INFO("min_angle: %d", min_angle_); } if (nh.getParam("max_angle", max_angle_)) { ROS_INFO("max_angle: %d", max_angle_); } } void setId(int new_id) { id_ = new_id; } int setNormalPosMode(SerialPort *port) { return setTorquMode(port, NORMAL_MODE); } int setFreePosMode(SerialPort *port) { return setTorquMode(port, FREE_MODE); } int setTorquMode(SerialPort *port, unsigned char mode) { unsigned char sendData[8]; unsigned char receiveData[5]; generateChangeServoStatusCmd(0x00, 1, mode, sendData); write(port->fd_, sendData, sizeof(sendData)); read(port->fd_, receiveData, sizeof(receiveData)); return 0; } void generateChangeServoStatusCmd(unsigned char option, unsigned char count, unsigned char mode, unsigned char data[]) { data[0] = (unsigned char)8; // SIZE data[1] = (unsigned char)0x04; // コマンド(write) data[2] = (unsigned char)0x00; // OPTION data[3] = (unsigned char)id_; //id data[4] = (unsigned char)mode; // DATA data[5] = (unsigned char)0x28; // ADDRESS data[6] = (unsigned char)count; // 指定するデバイスの数 CNT data[7] = checksum(data, 7);// チェックサム } int setTrajectoryMode(SerialPort *port, unsigned char mode) { unsigned char sendData[8]; unsigned char receiveData[5]; generateChangeTrajectoryModeCmd(0x00, 1, mode, sendData); write(port->fd_, sendData, sizeof(sendData)); read(port->fd_, receiveData, sizeof(receiveData)); return 0; } void generateChangeTrajectoryModeCmd(unsigned char option, unsigned char count, unsigned char mode, unsigned char data[]) { data[0] = (unsigned char)8; // SIZE data[1] = (unsigned char)0x04; // コマンド(write) data[2] = (unsigned char)0x00; // OPTION data[3] = (unsigned char)id_; //id data[4] = (unsigned char)mode; // DATA data[5] = (unsigned char)0x29; // ADDRESS data[6] = (unsigned char)count; // 指定するデバイスの数 CNT data[7] = checksum(data, 7);// チェックサム } int setGainParam(SerialPort *port, unsigned char mode) { unsigned char sendData[8]; unsigned char receiveData[5]; generateChangeServoGainCmd(0x00, 1, mode, sendData); write(port->fd_, sendData, sizeof(sendData)); read(port->fd_, receiveData, sizeof(receiveData)); return 0; } void generateChangeServoGainCmd( unsigned char option, unsigned char count, unsigned char mode, unsigned char data[]) { data[0] = (unsigned char)8; // SIZE data[1] = (unsigned char)0x04; // コマンド(write) data[2] = (unsigned char)0x00; // OPTION data[3] = (unsigned char)id_; //id data[4] = (unsigned char)mode; // DATA data[5] = (unsigned char)0x5c; // ADDRESS data[6] = (unsigned char)count; // 指定するデバイスの数 CNT data[7] = checksum(data, 7);// チェックサム } int setPosition(SerialPort *port, short angle, short target_time) { unsigned char sendData[9]; unsigned char receiveData[7]; if(angle > max_angle_*100) { angle = max_angle_*100; } if(angle < min_angle_*100) { angle = min_angle_*100; } generateSetServoPositionCmd(0x00, angle, target_time, sendData); write(port->fd_, sendData, sizeof(sendData)); read(port->fd_, receiveData, sizeof(receiveData)); return 0; } void generateSetServoPositionCmd(unsigned char option, short angle, short target_time, unsigned char data[]) { data[0] = (unsigned char)9; // SIZE data[1] = (unsigned char)0x06; // コマンド(write) data[2] = (unsigned char)0x00; // OPTION data[3] = (unsigned char)id_; //id data[4] = (unsigned char)(angle&0x00FF); // POS_L data[5] = (unsigned char)((angle&0xFF00)>>8); // POS_H data[6] = (unsigned char)(target_time&0x00FF); // TIME_L data[7] = (unsigned char)((target_time&0xFF00)>>8); // TIME_H data[8] = checksum(data, 8);// チェックサム } int readPosition(SerialPort *port) { unsigned char sendData[7] = {}; unsigned char receiveData[7] = {}; int check = 0; generateReadServoPositionCmd(sendData); while(1){ tcflush(port->fd_, TCIFLUSH); // 受信バッファのフラッシュ tcflush(port->fd_, TCOFLUSH); // 送信バッファのフラッシュ write(port->fd_, sendData, sizeof(sendData)); read(port->fd_, receiveData, sizeof(receiveData)); int check = checksum(receiveData, 6); if(check == receiveData[6]) { break; } usleep(5000); } // Data[4]が下位2bit, Data[5]が上位2bit int angle = hexa2dec(receiveData[4], receiveData[5]); angle_ = (double)angle/100.0; angle_ = (angle_/180.0)*M_PI; return angle; } void generateReadServoPositionCmd(unsigned char data[]) { data[0] = (unsigned char)0x07; data[1] = (unsigned char)0x03; data[2] = (unsigned char)0x00; data[3] = (unsigned char)id_; data[4] = (unsigned char)0x2C; data[5] = (unsigned char)0x02; data[6] = checksum(data, 6); } double getAngle() { return angle_; } }; class KondoB3mServoMultiCtrl { private: std::vector<boost::shared_ptr<KondoB3mServo> > actuator_vector_; int size_of_data_; int num_of_servo_; boost::mutex access_mutex_; public: KondoB3mServoMultiCtrl(std::vector<boost::shared_ptr<KondoB3mServo> > actuator_vector) { actuator_vector_ = actuator_vector; num_of_servo_ = actuator_vector_.size(); size_of_data_ = actuator_vector_.size() * 3 + 6; } void setPositionMulti(SerialPort *port, std::vector<short> angles, short target_time) { unsigned char *sendData = new unsigned char[size_of_data_]; setServoPositionMulti(0x00, num_of_servo_, angles, target_time, sendData); { boost::mutex::scoped_lock(access_mutex_); write(port->fd_, sendData, size_of_data_); } } void setServoPositionMulti(unsigned char option, int num, std::vector<short> angles, short target_time, unsigned char data[]) { data[0] = (unsigned char)size_of_data_; // SIZE data[1] = (unsigned char)0x06; // コマンド(write) data[2] = (unsigned char)0x00; // OPTION for (int i = 0; i < num_of_servo_; ++i) { data[3 + 3*i] = (unsigned char)actuator_vector_[i]->id_; if(angles[i] > actuator_vector_[i]->max_angle_*100) { angles[i] = actuator_vector_[i]->max_angle_*100; } if(angles[i] < actuator_vector_[i]->min_angle_*100) { angles[i] = actuator_vector_[i]->min_angle_*100; } data[4 + 3*i] = (unsigned char)(angles[i]&0x00FF); // POS_L data[5 + 3*i] = (unsigned char)((angles[i]&0xFF00)>>8); // POS_H } data[3 + 3*num_of_servo_] = (unsigned char)(target_time&0x00FF); // TIME_L data[3 + 3*num_of_servo_ + 1] = (unsigned char)((target_time&0xFF00)>>8); // TIME_H data[size_of_data_ -1] = checksum(data, size_of_data_-1);// チェックサム } void readPositionMulti(SerialPort *port) { { boost::mutex::scoped_lock(access_mutex_); for (size_t i = 0; i < actuator_vector_.size(); ++i) { actuator_vector_[i]->readPosition(port); } } } }; unsigned char checksum(unsigned char data[], int num) { short sum = 0; for (int i = 0; i < num; ++i) { sum += data[i]; } return (unsigned char)(sum&0x00FF); // SIZE~TIMEまでの総和の下位1Byte } int hexa2dec(unsigned char data1, unsigned char data2) { int return_val = 0; // 負の数(2二進数で最上位ビットが1) if(data2 > 127) { unsigned char minus_data1; unsigned char minus_data2; minus_data1 = ~data1; // ビット反転 minus_data2 = ~data2; // ビット反転 // +1する if(minus_data1 < 255){ minus_data1 = minus_data1 + 1; }else{ minus_data2 = minus_data2 + 1; } return_val = (minus_data1 % 16)*1 + (minus_data1 / 16)*16 + (minus_data2 % 16)*pow(16, 2) + (minus_data2 / 16)*pow(16, 3); return_val = -return_val; }else { return_val = (data1 % 16)*1 + (data1 / 16)*16 + (data2 % 16)*pow(16, 2) + (data2 / 16)*pow(16, 3); } return return_val; } #endif
[ "k104009y@mail.kyutech.jp" ]
k104009y@mail.kyutech.jp
8f8d2e6762f8da9f93ecde01ecb30b8f5289f732
2460b58c65c3ceb8c7103e1c8a151402d26f70db
/include/XmlDocument.h
ed4504e34d7c131c8e34c6b3ede5bd757f12fbef
[]
no_license
whztt07/Tabula_Rasa
cceb185f62cb76b93c9a12453e5eab3269d85a25
2f1e77c34941edb98d276954b196ca94e5adc844
refs/heads/master
2021-01-17T23:15:04.021796
2012-04-20T19:25:08
2012-04-20T19:25:08
null
0
0
null
null
null
null
UTF-8
C++
false
false
350
h
#ifndef __XML_DOCUMENT__ #define __XML_DOCUMENT__ #include "Dependencies.h" namespace TR { namespace Xml { class Document { public: Document() { } Document(std::string filename) { } virtual ~Document() { } virtual TR::Xml::Element* getRootElement() = 0; }; } } #endif
[ "edamiani@gmail.com" ]
edamiani@gmail.com
ebbc1184dda76b3aa294bcb21830e4ee01883cdf
d93159d0784fc489a5066d3ee592e6c9563b228b
/CalibFormats/SiPixelObjects/src/PixelTrimAllPixels.cc
2111fceedad9282e0ce90c69bbacb32eef0bc6a9
[]
permissive
simonecid/cmssw
86396e31d41a003a179690f8c322e82e250e33b2
2559fdc9545b2c7e337f5113b231025106dd22ab
refs/heads/CAallInOne_81X
2021-08-15T23:25:02.901905
2016-09-13T08:10:20
2016-09-13T08:53:42
176,462,898
0
1
Apache-2.0
2019-03-19T08:30:28
2019-03-19T08:30:24
null
UTF-8
C++
false
false
11,700
cc
// // This class provide a base class for the // pixel trim data for the pixel FEC configuration // This is a pure interface (abstract class) that // needs to have an implementation. // // Need to figure out what is 'VMEcommand' below! // // All applications should just use this // interface and not care about the specific // implementation. // #include <sstream> #include <iostream> #include <ios> #include <assert.h> #include <stdexcept> #include "CalibFormats/SiPixelObjects/interface/PixelTrimAllPixels.h" #include "CalibFormats/SiPixelObjects/interface/PixelTimeFormatter.h" #include "CalibFormats/SiPixelObjects/interface/PixelBase64.h" using namespace pos; PixelTrimAllPixels::PixelTrimAllPixels( std::vector <std::vector<std::string> >& tableMat): PixelTrimBase("","","") { std::string mthn = "]\t[PixelTrimAllPixels::PixelTrimAllPixels()]\t\t " ; std::stringstream currentRocName; std::map<std::string , int > colM; std::vector<std::string > colNames; /** EXTENSION_TABLE_NAME: ROC_TRIMS (VIEW: CONF_KEY_ROC_TRIMS_V) CONFIG_KEY NOT NULL VARCHAR2(80) KEY_TYPE NOT NULL VARCHAR2(80) KEY_ALIAS NOT NULL VARCHAR2(80) VERSION VARCHAR2(40) KIND_OF_COND NOT NULL VARCHAR2(40) ROC_NAME NOT NULL VARCHAR2(200) TRIM_BITS NOT NULL VARCHAR2(4000) */ colNames.push_back("CONFIG_KEY" ); colNames.push_back("KEY_TYPE" ); colNames.push_back("KEY_ALIAS" ); colNames.push_back("VERSION" ); colNames.push_back("KIND_OF_COND"); colNames.push_back("ROC_NAME" ); colNames.push_back("TRIM_BITS" ); for(unsigned int c = 0 ; c < tableMat[0].size() ; c++) { for(unsigned int n=0; n<colNames.size(); n++) { if(tableMat[0][c] == colNames[n]) { colM[colNames[n]] = c; break; } } }//end for for(unsigned int n=0; n<colNames.size(); n++) { if(colM.find(colNames[n]) == colM.end()) { std::cerr << __LINE__ << mthn << "Couldn't find in the database the column with name " << colNames[n] << std::endl; assert(0); } } //unsigned char *bits ; /// supose to be " unsigned char bits[tableMat[1][colM["TRIM_BLOB"]].size()] ; " //char c[2080]; std::string bits; trimbits_.clear() ; for(unsigned int r = 1 ; r < tableMat.size() ; r++) //Goes to every row of the Matrix { PixelROCName rocid( tableMat[r][colM["ROC_NAME"]] ); PixelROCTrimBits tmp; tmp.read(rocid, base64_decode(tableMat[r][colM["TRIM_BITS"]])) ; trimbits_.push_back(tmp); }//end for r //std::cout<<trimbits_.size()<<std::endl; } //end contructor with databasa table PixelTrimAllPixels::PixelTrimAllPixels(std::string filename): PixelTrimBase("","",""){ if (filename[filename.size()-1]=='t'){ std::ifstream in(filename.c_str()); if (!in.good()) throw std::runtime_error("Failed to open file "+filename); // std::cout << "filename =" << filename << std::endl; std::string s1; in >> s1; trimbits_.clear(); while (in.good()){ std::string s2; in>>s2; // std::cout << "PixelTrimAllPixels::PixelTrimAllPixels read s1:"<<s1<< " s2:" << s2 << std::endl; assert( s1 == "ROC:" ); PixelROCName rocid(s2); //std::cout << "PixelTrimAllPixels::PixelTrimAllPixels read rocid:"<<rocid<<std::endl; PixelROCTrimBits tmp; tmp.read(rocid, in); trimbits_.push_back(tmp); in >> s1; } in.close(); } else{ std::ifstream in(filename.c_str(),std::ios::binary); if (!in.good()) throw std::runtime_error("Failed to open file "+filename); char nchar; in.read(&nchar,1); std::string s1; //wrote these lines of code without ref. needs to be fixed for(int i=0;i< nchar; i++){ char c; in >>c; s1.push_back(c); } //std::cout << "READ ROC name:"<<s1<<std::endl; trimbits_.clear(); while (!in.eof()){ //std::cout << "PixelTrimAllPixels::PixelTrimAllPixels read s1:"<<s1<<std::endl; PixelROCName rocid(s1); //std::cout << "PixelTrimAllPixels::PixelTrimAllPixels read rocid:"<<rocid<<std::endl; PixelROCTrimBits tmp; tmp.readBinary(rocid, in); trimbits_.push_back(tmp); in.read(&nchar,1); s1.clear(); if (in.eof()) continue; //wrote these lines of code without ref. needs to be fixed for(int i=0;i< nchar; i++){ char c; in >>c; s1.push_back(c); } } in.close(); } //std::cout << "Read trimbits for "<<trimbits_.size()<<" ROCs"<<std::endl; } //std::string PixelTrimAllPixels::getConfigCommand(PixelMaskBase& pixelMask){ // // std::string s; // return s; // //} PixelROCTrimBits PixelTrimAllPixels::getTrimBits(int ROCId) const { return trimbits_[ROCId]; } PixelROCTrimBits* PixelTrimAllPixels::getTrimBits(PixelROCName name){ for(unsigned int i=0;i<trimbits_.size();i++){ if (trimbits_[i].name()==name) return &(trimbits_[i]); } return 0; } void PixelTrimAllPixels::generateConfiguration(PixelFECConfigInterface* pixelFEC, PixelNameTranslation* trans, const PixelMaskBase& pixelMask) const{ for(unsigned int i=0;i<trimbits_.size();i++){ std::vector<unsigned char> trimAndMasks(4160); const PixelROCMaskBits& maskbits=pixelMask.getMaskBits(i); for (unsigned int col=0;col<52;col++){ for (unsigned int row=0;row<80;row++){ unsigned char tmp=trimbits_[i].trim(col,row); if (maskbits.mask(col,row)!=0) tmp|=0x80; trimAndMasks[col*80+row]=tmp; } } // the slow way, one pixel at a time //pixelFEC->setMaskAndTrimAll(*(trans->getHdwAddress(trimbits_[i].name())),trimAndMasks); // the fast way, a full roc in column mode (& block xfer) const PixelHdwAddress* theROC = trans->getHdwAddress(trimbits_[i].name()); pixelFEC->roctrimload(theROC->mfec(), theROC->mfecchannel(), theROC->hubaddress(), theROC->portaddress(), theROC->rocid(), trimAndMasks); } } void PixelTrimAllPixels::writeBinary(std::string filename) const{ std::ofstream out(filename.c_str(),std::ios::binary); for(unsigned int i=0;i<trimbits_.size();i++){ trimbits_[i].writeBinary(out); } } void PixelTrimAllPixels::writeASCII(std::string dir) const{ if (dir!="") dir+="/"; PixelModuleName module(trimbits_[0].name().rocname()); std::string filename=dir+"ROC_Trims_module_"+module.modulename()+".dat"; std::ofstream out(filename.c_str()); for(unsigned int i=0;i<trimbits_.size();i++){ trimbits_[i].writeASCII(out); } } //============================================================================================= void PixelTrimAllPixels::writeXMLHeader(pos::PixelConfigKey key, int version, std::string path, std::ofstream *outstream, std::ofstream *out1stream, std::ofstream *out2stream) const { std::string mthn = "[PixelTrimAllPixels::writeXMLHeader()]\t\t\t " ; std::stringstream maskFullPath ; maskFullPath << path << "/Pixel_RocTrims_" << PixelTimeFormatter::getmSecTime() << ".xml"; std::cout << mthn << "Writing to: " << maskFullPath.str() << std::endl ; outstream->open(maskFullPath.str().c_str()) ; *outstream << "<?xml version='1.0' encoding='UTF-8' standalone='yes'?>" << std::endl ; *outstream << "<ROOT xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <HEADER>" << std::endl ; *outstream << " <TYPE>" << std::endl ; *outstream << " <EXTENSION_TABLE_NAME>ROC_TRIMS</EXTENSION_TABLE_NAME>" << std::endl ; *outstream << " <NAME>ROC Trim Bits</NAME>" << std::endl ; *outstream << " </TYPE>" << std::endl ; *outstream << " <RUN>" << std::endl ; *outstream << " <RUN_TYPE>ROC Trim Bits</RUN_TYPE>" << std::endl ; *outstream << " <RUN_NUMBER>1</RUN_NUMBER>" << std::endl ; *outstream << " <RUN_BEGIN_TIMESTAMP>" << PixelTimeFormatter::getTime() << "</RUN_BEGIN_TIMESTAMP>" << std::endl ; *outstream << " <LOCATION>CERN P5</LOCATION>" << std::endl ; *outstream << " </RUN>" << std::endl ; *outstream << " </HEADER>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <DATA_SET>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <VERSION>" << version << "</VERSION>" << std::endl ; *outstream << " <COMMENT_DESCRIPTION>" << getComment() << "</COMMENT_DESCRIPTION>" << std::endl ; *outstream << " <CREATED_BY_USER>" << getAuthor() << "</CREATED_BY_USER>" << std::endl ; *outstream << "" << std::endl ; *outstream << " <PART>" << std::endl ; *outstream << " <NAME_LABEL>CMS-PIXEL-ROOT</NAME_LABEL>" << std::endl ; *outstream << " <KIND_OF_PART>Detector ROOT</KIND_OF_PART>" << std::endl ; *outstream << " </PART>" << std::endl ; *outstream << "" << std::endl ; } //============================================================================================= void PixelTrimAllPixels::writeXML( std::ofstream *outstream, std::ofstream *out1stream, std::ofstream *out2stream) const { std::string mthn = "[PixelTrimAllPixels::writeXML()]\t\t\t " ; for(unsigned int i=0;i<trimbits_.size();i++){ trimbits_[i].writeXML(outstream); } } //============================================================================================= void PixelTrimAllPixels::writeXMLTrailer(std::ofstream *outstream, std::ofstream *out1stream, std::ofstream *out2stream ) const { std::string mthn = "[PixelTrimAllPixels::writeXMLTrailer()]\t\t\t " ; *outstream << " </DATA_SET>" << std::endl ; *outstream << "</ROOT>" << std::endl ; outstream->close() ; std::cout << mthn << "Data written " << std::endl ; }
[ "giulio.eulisse@gmail.com" ]
giulio.eulisse@gmail.com
6c42e9daf1cfbb3b68bea129da4e9cc1e03d5d17
b5f6d2410a794a9acba9a0f010f941a1d35e46ce
/game/server/hltvdirector.cpp
1971ac1a2be5a567a85e1c54e62f889c7079295d
[]
no_license
chrizonix/RCBot2
0a58591101e4537b166a672821ea28bc3aa486c6
ef0572f45c9542268923d500e64bb4cd037077eb
refs/heads/master
2021-01-19T12:55:49.003814
2018-08-27T08:48:55
2018-08-27T08:48:55
44,916,746
4
0
null
null
null
null
WINDOWS-1252
C++
false
false
29,397
cpp
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============// // // Purpose: // // $NoKeywords: $ // //=============================================================================// // hltvdirector.cpp: implementation of the CHLTVDirector class. // ////////////////////////////////////////////////////////////////////// #include "cbase.h" #include "hltvdirector.h" #include "KeyValues.h" // memdbgon must be the last include file in a .cpp file!!! #include "tier0/memdbgon.h" ////////////////////////////////////////////////////////////////////// // Construction/Destruction ////////////////////////////////////////////////////////////////////// static ConVar tv_delay( "tv_delay", "30", 0, "SourceTV broadcast delay in seconds", true, 0, true, HLTV_MAX_DELAY ); static ConVar tv_allow_static_shots( "tv_allow_static_shots", "1", 0, "Auto director uses fixed level cameras for shots" ); static ConVar tv_allow_camera_man( "tv_allow_camera_man", "1", 0, "Auto director allows spectators to become camera man" ); static bool GameEventLessFunc( CGameEvent const &e1, CGameEvent const &e2 ) { return e1.m_Tick < e2.m_Tick; } #define RANDOM_MAX_ELEMENTS 256 static int s_RndOrder[RANDOM_MAX_ELEMENTS]; static void InitRandomOrder(int nFields) { if ( nFields > RANDOM_MAX_ELEMENTS ) { Assert( nFields > RANDOM_MAX_ELEMENTS ); nFields = RANDOM_MAX_ELEMENTS; } for ( int i=0; i<nFields; i++ ) { s_RndOrder[i]=i; } for ( int i=0; i<(nFields/2); i++ ) { int pos1 = RandomInt( 0, nFields-1 ); int pos2 = RandomInt( 0, nFields-1 ); int temp = s_RndOrder[pos1]; s_RndOrder[pos1] = s_RndOrder[pos2]; s_RndOrder[pos2] = temp; } }; static float WeightedAngle( Vector vec1, Vector vec2) { VectorNormalize( vec1 ); VectorNormalize( vec2 ); float a = DotProduct( vec1, vec2 ); // a = [-1,1] a = (a + 1.0f) / 2.0f; Assert ( a <= 1 && a >= 0 ); return a*a; // vectors are facing opposite direction } #if !defined( CSTRIKE_DLL ) && !defined( DOD_DLL ) && !defined( TF_DLL )// add your mod here if you use your own director static CHLTVDirector s_HLTVDirector; // singleton EXPOSE_SINGLE_INTERFACE_GLOBALVAR(CHLTVDirector, IHLTVDirector, INTERFACEVERSION_HLTVDIRECTOR, s_HLTVDirector ); CHLTVDirector* HLTVDirector() { return &s_HLTVDirector; } IGameSystem* HLTVDirectorSystem() { return &s_HLTVDirector; } #endif // MODs CHLTVDirector::CHLTVDirector() { m_iPVSEntity = 0; m_fDelay = 30.0; m_iLastPlayer = 1; m_pHLTVServer = NULL; m_pHLTVClient = NULL; m_iCameraMan = 0; m_nNumFixedCameras = 0; m_EventHistory.SetLessFunc( GameEventLessFunc ); m_nNextAnalyzeTick = 0; m_iCameraManIndex = 0; } CHLTVDirector::~CHLTVDirector() { } bool CHLTVDirector::Init() { return gameeventmanager->LoadEventsFromFile( "resource/hltvevents.res" ) > 0; } void CHLTVDirector::Shutdown() { RemoveEventsFromHistory(-1); // all } void CHLTVDirector::FireGameEvent( IGameEvent * event ) { if ( !m_pHLTVServer ) return; // don't do anything CGameEvent gameevent; gameevent.m_Event = gameeventmanager->DuplicateEvent( event ); gameevent.m_Priority = event->GetInt( "priority", -1 ); // priorities are leveled between 0..10, -1 means ignore gameevent.m_Tick = gpGlobals->tickcount; m_EventHistory.Insert( gameevent ); } IHLTVServer* CHLTVDirector::GetHLTVServer( void ) { return m_pHLTVServer; } void CHLTVDirector::SetHLTVServer( IHLTVServer *hltv ) { RemoveEventsFromHistory(-1); // all if ( hltv ) { m_pHLTVClient = UTIL_PlayerByIndex( hltv->GetHLTVSlot() + 1 ); if ( m_pHLTVClient && m_pHLTVClient->IsHLTV() ) { m_pHLTVServer = hltv; } else { m_pHLTVServer = NULL; Error( "Couldn't find HLTV client player." ); } // register for events the director needs to know ListenForGameEvent( "player_hurt" ); ListenForGameEvent( "player_death" ); ListenForGameEvent( "round_end" ); ListenForGameEvent( "round_start" ); ListenForGameEvent( "hltv_cameraman" ); ListenForGameEvent( "hltv_rank_entity" ); ListenForGameEvent( "hltv_rank_camera" ); } else { // deactivate HLTV director m_pHLTVServer = NULL; } } bool CHLTVDirector::IsActive( void ) { return (m_pHLTVServer != NULL ); } float CHLTVDirector::GetDelay( void ) { return m_fDelay; } int CHLTVDirector::GetDirectorTick( void ) { // just simple delay it return m_nBroadcastTick; } int CHLTVDirector::GetPVSEntity( void ) { return m_iPVSEntity; } Vector CHLTVDirector::GetPVSOrigin( void ) { return m_vPVSOrigin; } void CHLTVDirector::UpdateSettings() { // set delay m_fDelay = tv_delay.GetFloat(); int newBroadcastTick = gpGlobals->tickcount; if ( m_fDelay < HLTV_MIN_DIRECTOR_DELAY ) { // instant broadcast, no delay m_fDelay = 0.0; } else { // broadcast time is current time - delay time newBroadcastTick -= TIME_TO_TICKS( m_fDelay ); } if( (m_nBroadcastTick == 0) && (newBroadcastTick > 0) ) { // we start broadcasting right now, reset NextShotTimer m_nNextShotTick = 0; } // check if camera man is still valid if ( m_iCameraManIndex > 0 ) { CBasePlayer *pPlayer = UTIL_PlayerByIndex( m_iCameraManIndex ); if ( !pPlayer || pPlayer->GetTeamNumber() != TEAM_SPECTATOR ) { SetCameraMan( 0 ); } } m_nBroadcastTick = MAX( 0, newBroadcastTick ); } const char** CHLTVDirector::GetModEvents() { static const char *s_modevents[] = { "hltv_status", "hltv_chat", "player_connect", "player_disconnect", "player_team", "player_info", "server_cvar", "player_death", "player_chat", "round_start", "round_end", NULL }; return s_modevents; } void CHLTVDirector::BuildCameraList( void ) { m_nNumFixedCameras = 0; memset( m_pFixedCameras, 0, sizeof ( m_pFixedCameras ) ); CBaseEntity *pCamera = gEntList.FindEntityByClassname( NULL, GetFixedCameraEntityName() ); while ( pCamera && m_nNumFixedCameras < MAX_NUM_CAMERAS) { CBaseEntity *pTarget = gEntList.FindEntityByName( NULL, STRING(pCamera->m_target) ); if ( pTarget ) { // look at target if any given QAngle angles; VectorAngles( pTarget->GetAbsOrigin() - pCamera->GetAbsOrigin(), angles ); pCamera->SetAbsAngles( angles ); } m_pFixedCameras[m_nNumFixedCameras] = pCamera; m_nNumFixedCameras++; pCamera = gEntList.FindEntityByClassname( pCamera, GetFixedCameraEntityName() ); } } // this is called with every new map void CHLTVDirector::LevelInitPostEntity( void ) { BuildCameraList(); m_vPVSOrigin.Init(); m_iPVSEntity = 0; m_nNextShotTick = 0; m_nNextAnalyzeTick = 0; m_iCameraManIndex = 0; RemoveEventsFromHistory(-1); // all // DevMsg("HLTV Director: found %i fixed cameras.\n", m_nNumFixedCameras ); } void CHLTVDirector::FrameUpdatePostEntityThink( void ) { if ( !m_pHLTVServer ) return; // don't do anything // This function is called each tick UpdateSettings(); // update settings from cvars if ( (m_nNextAnalyzeTick < gpGlobals->tickcount) && (m_fDelay >= HLTV_MIN_DIRECTOR_DELAY) ) { m_nNextAnalyzeTick = gpGlobals->tickcount + TIME_TO_TICKS( 0.5f ); AnalyzePlayers(); AnalyzeCameras(); } if ( m_nBroadcastTick <= 0 ) { // game start is still in delay loop StartDelayMessage(); } else if ( m_nNextShotTick <= m_nBroadcastTick ) { // game is being broadcasted, generate camera shots StartNewShot(); } } void CHLTVDirector::StartDelayMessage() { if ( m_nNextShotTick > gpGlobals->tickcount ) return; // check the next 8 seconds for interrupts/important events m_nNextShotTick = gpGlobals->tickcount + TIME_TO_TICKS( DEF_SHOT_LENGTH ); // game hasn't started yet, we are still in the broadcast delay hole IGameEvent *msg = gameeventmanager->CreateEvent( "hltv_message", true ); if ( msg ) { msg->SetString("text", "Please wait for broadcast to start ..." ); // send spectators the HLTV director command as a game event m_pHLTVServer->BroadcastEvent( msg ); gameeventmanager->FreeEvent( msg ); } StartBestFixedCameraShot( true ); } void CHLTVDirector::StartBestPlayerCameraShot() { float flPlayerRanking[MAX_PLAYERS]; memset( flPlayerRanking, 0, sizeof(flPlayerRanking) ); int firstIndex = FindFirstEvent( m_nBroadcastTick ); int index = firstIndex; float flBestRank = -1.0f; int iBestCamera = -1; int iBestTarget = -1; // sum all ranking values for the cameras while( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; if ( dc.m_Tick >= m_nNextShotTick ) break; // search for camera ranking events if ( Q_strcmp( dc.m_Event->GetName(), "hltv_rank_entity") == 0 ) { int index = dc.m_Event->GetInt("index"); if ( index < MAX_PLAYERS ) { flPlayerRanking[index] += dc.m_Event->GetFloat("rank" ); // find best camera if ( flPlayerRanking[index] > flBestRank ) { iBestCamera = index; flBestRank = flPlayerRanking[index]; iBestTarget = dc.m_Event->GetInt("target"); } } } index = m_EventHistory.NextInorder( index ); } if ( iBestCamera != -1 ) { // view over shoulder, randomly left or right StartChaseCameraShot( iBestCamera, iBestTarget, 112, 20, (RandomFloat()>0.5)?20:-20, false ); } else { StartBestFixedCameraShot( true ); } } void CHLTVDirector::StartFixedCameraShot(int iCamera, int iTarget) { CBaseEntity *pCamera = m_pFixedCameras[iCamera]; Vector vCamPos = pCamera->GetAbsOrigin(); QAngle aViewAngle = pCamera->GetAbsAngles(); m_iPVSEntity = 0; // don't use camera entity, since it may not been transmitted m_vPVSOrigin = vCamPos; IGameEvent *shot = gameeventmanager->CreateEvent( "hltv_fixed", true ); if ( shot ) { shot->SetInt("posx", (int)vCamPos.x ); shot->SetInt("posy", (int)vCamPos.y ); shot->SetInt("posz", (int)vCamPos.z ); shot->SetInt("theta", (int)aViewAngle.x ); shot->SetInt("phi", (int)aViewAngle.y ); shot->SetInt("target", iTarget ); shot->SetFloat("fov", RandomFloat(50,110) ); // send spectators the HLTV director command as a game event m_pHLTVServer->BroadcastEvent( shot ); gameeventmanager->FreeEvent( shot ); } } void CHLTVDirector::StartChaseCameraShot(int iTarget1, int iTarget2, int distance, int phi, int theta, bool bInEye) { IGameEvent *shot = gameeventmanager->CreateEvent( "hltv_chase", true ); if ( !shot ) return; shot->SetInt("target1", iTarget1 ); shot->SetInt("target2", iTarget2 ); shot->SetInt("distance", distance ); shot->SetInt("phi", phi ); // hi/low shot->SetInt( "theta", theta ); // left/right shot->SetInt( "ineye", bInEye?1:0 ); m_iPVSEntity = iTarget1; // send spectators the HLTV director command as a game event m_pHLTVServer->BroadcastEvent( shot ); gameeventmanager->FreeEvent( shot ); } void CHLTVDirector::StartBestFixedCameraShot( bool bForce ) { float flCameraRanking[MAX_NUM_CAMERAS]; if ( m_nNumFixedCameras <= 0 ) return; memset( flCameraRanking, 0, sizeof(flCameraRanking) ); int firstIndex = FindFirstEvent( m_nBroadcastTick ); int index = firstIndex; float flBestRank = -1.0f; int iBestCamera = -1; int iBestTarget = -1; // sum all ranking values for the cameras while( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; if ( dc.m_Tick >= m_nNextShotTick ) break; // search for camera ranking events if ( Q_strcmp( dc.m_Event->GetName(), "hltv_rank_camera") == 0 ) { int index = dc.m_Event->GetInt("index"); flCameraRanking[index] += dc.m_Event->GetFloat("rank" ); // find best camera if ( flCameraRanking[index] > flBestRank ) { iBestCamera = index; flBestRank = flCameraRanking[index]; iBestTarget = dc.m_Event->GetInt("target"); } } index = m_EventHistory.NextInorder( index ); } if ( !bForce && flBestRank == 0 ) { // if we are not forcing a fixed camera shot, switch to player chase came // if no camera shows any players StartBestPlayerCameraShot(); } else if ( iBestCamera != -1 ) { StartFixedCameraShot( iBestCamera, iBestTarget ); } } void CHLTVDirector::StartRandomShot() { int toTick = m_nBroadcastTick + TIME_TO_TICKS ( DEF_SHOT_LENGTH ); m_nNextShotTick = MIN( m_nNextShotTick, toTick ); if ( RandomFloat(0,1) < 0.25 && tv_allow_static_shots.GetBool() ) { // create a static shot from a level camera StartBestFixedCameraShot( false ); } else { // follow a player StartBestPlayerCameraShot(); } } void CHLTVDirector::CreateShotFromEvent( CGameEvent *event ) { // show event at least for 2 more seconds after it occured const char *name = event->m_Event->GetName(); bool bPlayerHurt = Q_strcmp( "player_hurt", name ) == 0; bool bPlayerKilled = Q_strcmp( "player_death", name ) == 0; bool bRoundStart = Q_strcmp( "round_start", name ) == 0; bool bRoundEnd = Q_strcmp( "round_end", name ) == 0; if ( bPlayerHurt || bPlayerKilled ) { CBaseEntity *victim = UTIL_PlayerByUserId( event->m_Event->GetInt("userid") ); CBaseEntity *attacker = UTIL_PlayerByUserId( event->m_Event->GetInt("attacker") ); if ( !victim ) return; if ( attacker == victim || attacker == NULL ) { // player killed self or by WORLD StartChaseCameraShot( victim->entindex(), 0, 96, 20, 0, false ); } else // attacker != NULL { // check if we would show it from ineye view bool bInEye = (bPlayerKilled && RandomFloat(0,1) > 0.33) || (bPlayerHurt && RandomFloat(0,1) > 0.66); // if we show ineye view, show it more likely from killer if ( RandomFloat(0,1) > (bInEye?0.3f:0.7f) ) { swap( attacker, victim ); } // hurting a victim is shown as chase more often // view from behind over head // lower view point, dramatic // view over shoulder, randomly left or right StartChaseCameraShot( victim->entindex(), attacker->entindex(), 96, -20, (RandomFloat()>0.5)?30:-30, bInEye ); } // shot 2 seconds after death/hurt m_nNextShotTick = MIN( m_nNextShotTick, (event->m_Tick+TIME_TO_TICKS(2.0)) ); } else if ( bRoundStart || bRoundEnd ) { StartBestFixedCameraShot( false ); } else { DevMsg( "No known TV shot for event %s\n", name ); } } void CHLTVDirector::CheckHistory() { int index = m_EventHistory.FirstInorder(); int lastTick = -1; while ( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; Assert( lastTick <= dc.m_Tick ); lastTick = dc.m_Tick; index = m_EventHistory.NextInorder( index ); } } void CHLTVDirector::RemoveEventsFromHistory(int tick) { int index = m_EventHistory.FirstInorder(); while ( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; if ( (dc.m_Tick < tick) || (tick == -1) ) { gameeventmanager->FreeEvent( dc.m_Event ); dc.m_Event = NULL; m_EventHistory.RemoveAt( index ); index = m_EventHistory.FirstInorder(); // start again } else { index = m_EventHistory.NextInorder( index ); } } #ifdef _DEBUG CheckHistory(); #endif } int CHLTVDirector::FindFirstEvent( int tick ) { // TODO cache last queried ticks int index = m_EventHistory.FirstInorder(); if ( index == m_EventHistory.InvalidIndex() ) return index; // no commands in list CGameEvent *event = &m_EventHistory[index]; while ( event->m_Tick < tick ) { index = m_EventHistory.NextInorder( index ); if ( index == m_EventHistory.InvalidIndex() ) break; event = &m_EventHistory[index]; } return index; } bool CHLTVDirector::SetCameraMan( int iPlayerIndex ) { if ( !tv_allow_camera_man.GetBool() ) return false; if ( m_iCameraManIndex == iPlayerIndex ) return true; // check if somebody else is already the camera man if ( m_iCameraManIndex != 0 && iPlayerIndex != 0 ) return false; CBasePlayer *pPlayer = NULL; if ( iPlayerIndex > 0 ) { pPlayer = UTIL_PlayerByIndex( iPlayerIndex ); if ( !pPlayer || pPlayer->GetTeamNumber() != TEAM_SPECTATOR ) return false; } m_iCameraManIndex = iPlayerIndex; // create event for director event history IGameEvent *event = gameeventmanager->CreateEvent( "hltv_cameraman" ); if ( event ) { event->SetInt("index", iPlayerIndex ); gameeventmanager->FireEvent( event ); } CRecipientFilter filter; for ( int i = 1; i <= gpGlobals->maxClients; i++ ) { CBasePlayer *pPlayer = UTIL_PlayerByIndex( i ); if ( pPlayer && pPlayer->GetTeamNumber() == TEAM_SPECTATOR && !pPlayer->IsFakeClient() ) { filter.AddRecipient( pPlayer ); } } filter.MakeReliable(); if ( iPlayerIndex > 0 ) { // tell all spectators that the camera is in use. char szText[200]; Q_snprintf( szText, sizeof(szText), "SourceTV camera is now controlled by %s.", pPlayer->GetPlayerName() ); UTIL_ClientPrintFilter( filter, HUD_PRINTTALK, szText ); } else { // tell all spectators that the camera is available again. UTIL_ClientPrintFilter( filter, HUD_PRINTTALK, "SourceTV camera switched to auto-director mode." ); } return true; } void CHLTVDirector::FinishCameraManShot() { Assert( m_iCameraMan == m_iPVSEntity ); int index = FindFirstEvent( m_nBroadcastTick ); if ( index == m_EventHistory.InvalidIndex() ) { // check next frame again if event history is empty m_nNextShotTick = m_nBroadcastTick+1; return; } m_nNextShotTick = m_nBroadcastTick + TIME_TO_TICKS( MIN_SHOT_LENGTH ); //check if camera turns camera off within broadcast time and game time while( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; if ( dc.m_Tick >= m_nNextShotTick ) break; if ( Q_strcmp( dc.m_Event->GetName(), "hltv_cameraman") == 0 ) { int iNewCameraMan = dc.m_Event->GetInt("index"); if ( iNewCameraMan == 0 ) { // camera man switched camera off m_nNextShotTick = dc.m_Tick+1; m_iCameraMan = 0; return; } } index = m_EventHistory.NextInorder( index ); } // camera man is still recording and live, resend camera man message IGameEvent *msg = gameeventmanager->CreateEvent( "hltv_cameraman", true ); if ( msg ) { msg->SetInt("index", m_iCameraMan ); m_pHLTVServer->BroadcastEvent( msg ); gameeventmanager->FreeEvent( msg ); } } bool CHLTVDirector::StartCameraManShot() { Assert( m_nNextShotTick <= m_nBroadcastTick ); int index = FindFirstEvent( m_nNextShotTick ); // check for cameraman mode while( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; // only check if this is the current tick if ( dc.m_Tick > m_nBroadcastTick ) break; if ( Q_strcmp( dc.m_Event->GetName(), "hltv_cameraman") == 0 ) { if ( dc.m_Event->GetInt("index") > 0 ) { // ok, this guy is now the active camera man m_iCameraMan = dc.m_Event->GetInt("index"); m_iPVSEntity = m_iCameraMan; m_nNextShotTick = m_nBroadcastTick+1; // check setting right on next frame // send camera man command to client m_pHLTVServer->BroadcastEvent( dc.m_Event ); return true; } } index = m_EventHistory.NextInorder( index ); } return false; // no camera man found } void CHLTVDirector::StartInstantBroadcastShot() { m_nNextShotTick = m_nBroadcastTick + TIME_TO_TICKS( MAX_SHOT_LENGTH ); if ( m_iCameraManIndex > 0 ) { // camera man is still recording and live, resend camera man message IGameEvent *msg = gameeventmanager->CreateEvent( "hltv_cameraman", true ); if ( msg ) { msg->SetInt("index", m_iCameraManIndex ); m_pHLTVServer->BroadcastEvent( msg ); gameeventmanager->FreeEvent( msg ); m_iPVSEntity = m_iCameraManIndex; m_nNextShotTick = m_nBroadcastTick+TIME_TO_TICKS( MIN_SHOT_LENGTH ); } } else { RemoveEventsFromHistory(-1); // all AnalyzePlayers(); AnalyzeCameras(); StartRandomShot(); } } void CHLTVDirector::StartNewShot() { // we can remove all events the int smallestTick = MAX(0, gpGlobals->tickcount - TIME_TO_TICKS(HLTV_MAX_DELAY) ); RemoveEventsFromHistory( smallestTick ); // if the delay time is to short for autodirector, just show next best thing if ( m_fDelay < HLTV_MIN_DIRECTOR_DELAY ) { StartInstantBroadcastShot(); return; } if ( m_iCameraMan > 0 ) { // we already have an active camera man, // wait until he releases the "record" lock FinishCameraManShot(); return; } if ( StartCameraManShot() ) { // now we have an active camera man return; } // ok, no camera man active, now check how much time // we have for the next shot, if the time diff to the next // important event we have to switch to is too short (<2sec) // just extent the current shot and don't start a new one // check the next 8 seconds for interrupts/important events m_nNextShotTick = m_nBroadcastTick + TIME_TO_TICKS( MAX_SHOT_LENGTH ); if ( m_nBroadcastTick <= 0 ) { // game hasn't started yet, we are still in the broadcast delay hole IGameEvent *msg = gameeventmanager->CreateEvent( "hltv_message", true ); if ( msg ) { msg->SetString("text", "Please wait for broadcast to start ..." ); // send spectators the HLTV director command as a game event m_pHLTVServer->BroadcastEvent( msg ); gameeventmanager->FreeEvent( msg ); } StartBestFixedCameraShot( true ); return; } int index = FindFirstEvent( m_nBroadcastTick ); while( index != m_EventHistory.InvalidIndex() ) { CGameEvent &dc = m_EventHistory[index]; if ( dc.m_Tick >= m_nNextShotTick ) break; // we have searched enough // a camera man is always interrupting auto director if ( Q_strcmp( dc.m_Event->GetName(), "hltv_cameraman") == 0 ) { if ( dc.m_Event->GetInt("index") > 0 ) { // stop the next cut when this cameraman starts recording m_nNextShotTick = dc.m_Tick; break; } } index = m_EventHistory.NextInorder( index ); } float flDuration = TICKS_TO_TIME(m_nNextShotTick - m_nBroadcastTick); if ( flDuration < MIN_SHOT_LENGTH ) return; // not enough time for a new shot // find the most interesting game event for next shot CGameEvent *dc = FindBestGameEvent(); if ( dc ) { // show the game event CreateShotFromEvent( dc ); } else { // no interesting events found, start random shot StartRandomShot(); } } CGameEvent *CHLTVDirector::FindBestGameEvent() { int bestEvent[4]; int bestEventPrio[4]; Q_memset( bestEvent, 0, sizeof(bestEvent) ); Q_memset( bestEventPrio, 0, sizeof(bestEventPrio) ); int index = FindFirstEvent( m_nBroadcastTick ); // search for next 4 best events within next 8 seconds for (int i = 0; i<4; i ++) { bestEventPrio[i] = 0; bestEvent[i] = 0; int tillTick = m_nBroadcastTick + TIME_TO_TICKS( 2.0f*(1.0f+i) ); if ( tillTick > m_nNextShotTick ) break; // sum all action for the next time while ( index != m_EventHistory.InvalidIndex() ) { CGameEvent &event = m_EventHistory[index]; if ( event.m_Tick > tillTick ) break; int priority = event.m_Priority; if ( priority > bestEventPrio[i] ) { bestEvent[i] = index; bestEventPrio[i] = priority; } index = m_EventHistory.NextInorder( index ); } } if ( !( bestEventPrio[0] || bestEventPrio[1] || bestEventPrio[2] ) ) return NULL; // no event found at all, give generic algorithm a chance // camera cut rules : if ( bestEventPrio[1] >= bestEventPrio[0] && bestEventPrio[1] >= bestEventPrio[2] && bestEventPrio[1] >= bestEventPrio[3] ) { return &m_EventHistory[ bestEvent[1] ]; // best case } else if ( bestEventPrio[0] > bestEventPrio[1] && bestEventPrio[0] > bestEventPrio[2] ) { return &m_EventHistory[ bestEvent[0] ]; // event 0 is very important } else if ( bestEventPrio[2] > bestEventPrio[3] ) { return &m_EventHistory[ bestEvent[2] ]; } else { // event 4 is the best but too far away, so show event 1 if ( bestEvent[0] ) return &m_EventHistory[ bestEvent[0] ]; else return NULL; } } void CHLTVDirector::AnalyzeCameras() { InitRandomOrder( m_nNumFixedCameras ); for ( int i = 0; i<m_nNumFixedCameras; i++ ) { int iCameraIndex = s_RndOrder[i]; CBaseEntity *pCamera = m_pFixedCameras[ iCameraIndex ]; float flRank = 0.0f; int iClosestPlayer = 0; float flClosestPlayerDist = 100000.0f; int nCount = 0; // Number of visible targets Vector vDistribution; vDistribution.Init(); // distribution of targets Vector vCamPos = pCamera->GetAbsOrigin(); for ( int j=0; j<m_nNumActivePlayers; j++ ) { CBasePlayer *pPlayer = m_pActivePlayers[j]; Vector vPlayerPos = pPlayer->GetAbsOrigin(); float dist = VectorLength( vPlayerPos - vCamPos ); if ( dist > 1024.0f || dist < 4.0f ) continue; // too colse or far away // check visibility trace_t tr; UTIL_TraceLine( vCamPos, pPlayer->GetAbsOrigin(), MASK_SOLID, pPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction < 1.0 ) continue; // not visible for camera nCount++; // remember closest player if ( dist < flClosestPlayerDist ) { iClosestPlayer = pPlayer->entindex(); flClosestPlayerDist = dist; } Vector v1; AngleVectors( pPlayer->EyeAngles(), &v1 ); // check players orientation towards camera Vector v2 = vCamPos - vPlayerPos; VectorNormalize( v2 ); // player/camera cost function: flRank += ( 1.0f/sqrt(dist) ) * WeightedAngle( v1, v2 ); vDistribution += v2; } if ( nCount > 0 ) { // normalize distribution flRank *= VectorLength( vDistribution ) / nCount; } IGameEvent *event = gameeventmanager->CreateEvent("hltv_rank_camera"); if ( event ) { event->SetFloat("rank", flRank ); event->SetInt("index", iCameraIndex ); // index in m_pFixedCameras event->SetInt("target", iClosestPlayer ); // ent index gameeventmanager->FireEvent( event ); } } } void CHLTVDirector::BuildActivePlayerList() { // first build list of all active players m_nNumActivePlayers = 0; for ( int i =1; i <= gpGlobals->maxClients; i++ ) { CBasePlayer *pPlayer = UTIL_PlayerByIndex( i ); if ( !pPlayer ) continue; if ( !pPlayer->IsAlive() ) continue; if ( pPlayer->IsObserver() ) continue; if ( pPlayer->GetTeamNumber() <= TEAM_SPECTATOR ) continue; m_pActivePlayers[m_nNumActivePlayers] = pPlayer; m_nNumActivePlayers++; } } void CHLTVDirector::AnalyzePlayers() { // build list of current active players BuildActivePlayerList(); // analyzes every active player InitRandomOrder( m_nNumActivePlayers ); for ( int i = 0; i<m_nNumActivePlayers; i++ ) { int iPlayerIndex = s_RndOrder[i]; CBasePlayer *pPlayer = m_pActivePlayers[ iPlayerIndex ]; float flRank = 0.0f; int iBestFacingPlayer = 0; float flBestFacingPlayer = 0.0f; int nCount = 0; // Number of visible targets Vector vDistribution; vDistribution.Init(); // distribution of targets Vector vCamPos = pPlayer->GetAbsOrigin(); Vector v1; AngleVectors( pPlayer->EyeAngles(), &v1 ); v1 *= -1; // inverted for ( int j=0; j<m_nNumActivePlayers; j++ ) { if ( iPlayerIndex == j ) continue; // don't check against itself CBasePlayer *pOtherPlayer = m_pActivePlayers[j]; Vector vPlayerPos = pOtherPlayer->GetAbsOrigin(); float dist = VectorLength( vPlayerPos - vCamPos ); if ( dist > 1024.0f || dist < 4.0f ) continue; // too close or far away // check visibility trace_t tr; UTIL_TraceLine( vCamPos, pOtherPlayer->GetAbsOrigin(), MASK_SOLID, pOtherPlayer, COLLISION_GROUP_NONE, &tr ); if ( tr.fraction < 1.0 ) continue; // not visible for camera nCount++; // check players orientation towards camera Vector v2; AngleVectors( pOtherPlayer->EyeAngles(), &v2 ); float facing = WeightedAngle( v1, v2 ); // remember closest player if ( facing > flBestFacingPlayer ) { iBestFacingPlayer = pOtherPlayer->entindex(); flBestFacingPlayer = facing; } // player/camera cost function: flRank += ( 1.0f/sqrt(dist) ) * facing; vDistribution += v2; } if ( nCount > 0 ) { float flDistribution = VectorLength( vDistribution ) / nCount; // normalize distribution flRank *= flDistribution; } IGameEvent *event = gameeventmanager->CreateEvent("hltv_rank_entity"); if ( event ) { event->SetInt("index", pPlayer->entindex() ); event->SetFloat("rank", flRank ); event->SetInt("target", iBestFacingPlayer ); // ent index gameeventmanager->FireEvent( event ); } } }
[ "christian.pichler.msc@gmail.com" ]
christian.pichler.msc@gmail.com
f2a4f45c446e3d33679450dcceafec4797587136
d9ed3d42ac11ff4559c4f89c2ca42965d0f740ec
/y/y/serde3/headers.h
4c9ccd58c3bea82cf7a865d4b358e3e564f4a88b
[ "MIT" ]
permissive
ValtoGameEngines/Yave-Engine
a92a1371db1414a19c6731ca6e34c5aa42e37042
aa8850c1e46ba2017db799eca43cee835db3d3b8
refs/heads/master
2022-07-23T06:58:42.875559
2020-05-19T10:31:27
2020-05-19T10:31:27
266,270,223
2
1
null
null
null
null
UTF-8
C++
false
false
5,675
h
/******************************* Copyright (c) 2016-2020 Gr�goire Angerand 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 Y_SERDE3_HEADERS_H #define Y_SERDE3_HEADERS_H #include <y/utils/name.h> #include <y/utils/hash.h> #include "serde.h" #include "poly.h" #define Y_SLIM_POD_HEADER namespace y { namespace serde3 { namespace detail { template<typename T> struct Deconst { using type = remove_cvref_t<T>; }; template<typename... Args> struct Deconst<std::tuple<Args...>> { using type = std::tuple<remove_cvref_t<Args>...>; }; template<typename A, typename B> struct Deconst<std::pair<A, B>> { using type = std::pair<remove_cvref_t<A>, remove_cvref_t<B>>; }; } template<typename T> using deconst_t = typename detail::Deconst<remove_cvref_t<T>>::type; namespace detail { struct TypeHeader { u32 name_hash = 0; u32 type_hash = 0; constexpr bool has_serde() const { return type_hash & 0x01; } constexpr bool is_polymorphic() const { return type_hash & 0x02; } constexpr bool operator==(const TypeHeader& other) const { return name_hash == other.name_hash && type_hash == other.type_hash; } }; struct MembersHeader { u32 member_hash = 0; u32 count = 0; constexpr bool operator==(const MembersHeader& other) const { return member_hash == other.member_hash && count == other.count; } }; struct TrivialHeader { TypeHeader type; constexpr bool operator==(const TrivialHeader& other) const { return type == other.type; } constexpr bool operator!=(const TrivialHeader& other) const { return !operator==(other); } }; struct PolyHeader { TypeHeader type; TypeId type_id; constexpr bool operator==(const PolyHeader& other) const { return type == other.type && type_id == other.type_id; } constexpr bool operator!=(const PolyHeader& other) const { return !operator==(other); } }; struct ObjectHeader { TypeHeader type; MembersHeader members; constexpr bool operator==(const ObjectHeader& other) const { return type == other.type && members == other.members; } constexpr bool operator!=(const ObjectHeader& other) const { return !operator==(other); } }; struct FullHeader { TypeHeader type; MembersHeader members; TypeId type_id; constexpr bool operator==(const TrivialHeader& other) const { return type == other.type; } constexpr bool operator==(const PolyHeader& other) const { return type == other.type && type_id == other.type_id; } constexpr bool operator==(const ObjectHeader& other) const { return type == other.type && members == other.members; } template<typename T> constexpr bool operator!=(const T& other) const { return !operator==(other); } }; static_assert(sizeof(TypeHeader) == sizeof(u64)); static_assert(sizeof(MembersHeader) == sizeof(u64)); constexpr u32 ct_str_hash(std::string_view str) { u32 hash = 0xec81fb49; for(char c : str) { hash_combine(hash, u32(c)); } return hash; } template<typename T> constexpr u32 header_type_hash() { using naked = deconst_t<T>; u32 hash = ct_str_hash(ct_type_name<naked>()); if constexpr(has_serde3_v<T>) { hash |= 0x01; } else { hash &= ~0x01; } if constexpr(has_serde3_poly_v<T>) { hash |= 0x02; } else { hash &= ~0x02; } return hash; } template<typename T, bool R> constexpr TypeHeader build_type_header(const NamedObject<T, R>& obj) { return TypeHeader { ct_str_hash(obj.name), header_type_hash<T>() }; } template<usize I, typename... Args, bool... Refs> constexpr void hash_members(u32& hash, const std::tuple<NamedObject<Args, Refs>...>& objects) { unused(hash, objects); if constexpr(I < sizeof...(Args)) { const TypeHeader tpe = build_type_header(std::get<I>(objects)); hash_combine(hash, tpe.name_hash); hash_combine(hash, tpe.type_hash); hash_members<I + 1>(hash, objects); } } template<typename T, bool R> constexpr MembersHeader build_members_header(const NamedObject<T, R>& obj) { u32 member_hash = 0xafbbc3d1; hash_members<0>(member_hash, members(obj.object)); return MembersHeader { member_hash, member_count<T>(), }; } template<typename T, bool R> constexpr auto build_header(const NamedObject<T, R>& obj) { if constexpr(has_serde3_poly_v<T>) { return PolyHeader { build_type_header(obj), obj.object ? obj.object->_y_serde3_poly_type_id() : 0 }; } else { #ifdef Y_SLIM_POD_HEADER if constexpr(has_serde3_v<T>) { return ObjectHeader { build_type_header(obj), build_members_header(obj) }; } else { return TrivialHeader { build_type_header(obj) }; } #else return ObjectHeader { build_type_header(obj), build_members_header(obj) }; #endif } } } } } #endif // Y_SERDE3_HEADERS_H
[ "gregoire.angerand@gmail.com" ]
gregoire.angerand@gmail.com
be141f18e95dea996ad89b66d683257ce3863099
decefb13f8a603c1f5cc7eb00634b4649915204f
/packages/node-mobile/src/api/utils.cc
f07f9bea234b0db7cc006bb25022a4c625818ab6
[ "Zlib", "CC0-1.0", "ISC", "Apache-2.0", "LicenseRef-scancode-public-domain", "ICU", "MIT", "LicenseRef-scancode-public-domain-disclaimer", "Artistic-2.0", "BSD-3-Clause", "NTP", "LicenseRef-scancode-unknown-license-reference", "BSD-2-Clause", "LicenseRef-scancode-openssl", "LicenseRef-sc...
permissive
open-pwa/open-pwa
f092b377dc6cb04123a16ef96811ad09a9956c26
4c88c8520b4f6e7af8701393fd2cedbe1b209e8f
refs/heads/master
2022-05-28T22:05:19.514921
2022-05-20T07:27:10
2022-05-20T07:27:10
247,925,596
24
1
Apache-2.0
2021-08-10T07:38:42
2020-03-17T09:13:00
C++
UTF-8
C++
false
false
2,210
cc
#include "node.h" #include <csignal> namespace node { const char* signo_string(int signo) { #define SIGNO_CASE(e) \ case e: \ return #e; switch (signo) { #ifdef SIGHUP SIGNO_CASE(SIGHUP); #endif #ifdef SIGINT SIGNO_CASE(SIGINT); #endif #ifdef SIGQUIT SIGNO_CASE(SIGQUIT); #endif #ifdef SIGILL SIGNO_CASE(SIGILL); #endif #ifdef SIGTRAP SIGNO_CASE(SIGTRAP); #endif #ifdef SIGABRT SIGNO_CASE(SIGABRT); #endif #ifdef SIGIOT #if SIGABRT != SIGIOT SIGNO_CASE(SIGIOT); #endif #endif #ifdef SIGBUS SIGNO_CASE(SIGBUS); #endif #ifdef SIGFPE SIGNO_CASE(SIGFPE); #endif #ifdef SIGKILL SIGNO_CASE(SIGKILL); #endif #ifdef SIGUSR1 SIGNO_CASE(SIGUSR1); #endif #ifdef SIGSEGV SIGNO_CASE(SIGSEGV); #endif #ifdef SIGUSR2 SIGNO_CASE(SIGUSR2); #endif #ifdef SIGPIPE SIGNO_CASE(SIGPIPE); #endif #ifdef SIGALRM SIGNO_CASE(SIGALRM); #endif SIGNO_CASE(SIGTERM); #ifdef SIGCHLD SIGNO_CASE(SIGCHLD); #endif #ifdef SIGSTKFLT SIGNO_CASE(SIGSTKFLT); #endif #ifdef SIGCONT SIGNO_CASE(SIGCONT); #endif #ifdef SIGSTOP SIGNO_CASE(SIGSTOP); #endif #ifdef SIGTSTP SIGNO_CASE(SIGTSTP); #endif #ifdef SIGBREAK SIGNO_CASE(SIGBREAK); #endif #ifdef SIGTTIN SIGNO_CASE(SIGTTIN); #endif #ifdef SIGTTOU SIGNO_CASE(SIGTTOU); #endif #ifdef SIGURG SIGNO_CASE(SIGURG); #endif #ifdef SIGXCPU SIGNO_CASE(SIGXCPU); #endif #ifdef SIGXFSZ SIGNO_CASE(SIGXFSZ); #endif #ifdef SIGVTALRM SIGNO_CASE(SIGVTALRM); #endif #ifdef SIGPROF SIGNO_CASE(SIGPROF); #endif #ifdef SIGWINCH SIGNO_CASE(SIGWINCH); #endif #ifdef SIGIO SIGNO_CASE(SIGIO); #endif #ifdef SIGPOLL #if SIGPOLL != SIGIO SIGNO_CASE(SIGPOLL); #endif #endif #ifdef SIGLOST #if SIGLOST != SIGABRT SIGNO_CASE(SIGLOST); #endif #endif #ifdef SIGPWR #if SIGPWR != SIGLOST SIGNO_CASE(SIGPWR); #endif #endif #ifdef SIGINFO #if !defined(SIGPWR) || SIGINFO != SIGPWR SIGNO_CASE(SIGINFO); #endif #endif #ifdef SIGSYS SIGNO_CASE(SIGSYS); #endif default: return ""; } } } // namespace node
[ "frank@lemanschik.com" ]
frank@lemanschik.com
9c686c36705e7cc5accdd1adb0b3947c5520010d
385cb811d346a4d7a285fc087a50aaced1482851
/codechef/CUTPLANT/main.cpp
a67b87c396a2f2c7eb9e567afa97a8a0c35e61b3
[]
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
3,384
cpp
#pragma GCC optimize ("O3") #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 all(A) A.begin(),A.end() #define pb push_back #define mp make_pair #define sz(A) ((int)A.size()) #define vi vector<int> #define vd vector<double> #define vp vector<pair<int,int> > #define ll long long #define pi pair<int,int> #define popcnt(x) __builtin_popcountll(x) #define LSOne(x) ((x) & (-(x))) #define xx first #define yy second #define PQ priority_queue #define print(A,t) cerr << #A << ": "; copy(all(A),ostream_iterator<t>(cerr," " )); cerr << endl #define prp(p) cerr << "(" << (p).first << " ," << (p).second << ")"; #define prArr(A,n,t) cerr << #A << ": "; copy(A,A + n,ostream_iterator<t>(cerr," " )); cerr << endl #define PRESTDIO() cin.tie(0),cerr.tie(0),ios_base::sync_with_stdio(0) #define what_is(x) cerr << #x << " is " << x << endl #define bit_lg(x) (assert(x > 0),__builtin_ffsll(x) - 1) using namespace std; const int MAX = 100*1000 + 10,MAXLG = 20; int A[MAX],B[MAX],H[MAX],n; map<int,int> right_to_left; PQ<pi> pq; int sparse[MAX][MAXLG][2],lg[MAX]; map<int,vi> idx; void build() { lg[0] = -1; range(i,1,n) lg[i] = lg[i-1] + (i==LSOne(i)); loop(i,n) sparse[i][0][0] = sparse[i][0][1] = A[i]; loop(k,MAXLG-1) loop(i,n){ int j = i + (1 << k); if(j >= n) j = i; sparse[i][k+1][0] = min(sparse[i][k][0],sparse[j][k][0]); sparse[i][k+1][1] = max(sparse[i][k][1],sparse[j][k][1]); } } int get_min(int s,int e) { int l = lg[e-s+1]; return min(sparse[s][l][0],sparse[e-(1<<l)+1][l][0]); } int get_max(int s,int e) { int l = lg[e-s+1]; return max(sparse[s][l][1],sparse[e-(1<<l)+1][l][1]); } void insert(int l,int r,int h) { if(l > r) return; H[r] = h; right_to_left[r] = l; } int get_left(int s,int e,int i) { e = i; while(s < e) { int m = (s + e) >> 1; if(get_min(m,i) >= B[i]) e = m; else s = m+1; } vi & V = idx[B[i]]; return *lower_bound(all(V),s); } int get_right(int s,int e,int i) { s = i; while(s < e) { int m = s + (e-s+1)/2; if(get_min(i,m) >= B[i]) s = m; else e=m-1; } vi & V = idx[B[i]]; auto ptr = upper_bound(all(V),e); --ptr; return *ptr; } int get_h(int s,int e,int old) { return min(get_max(s,e),old); } bool cond(int i,int s,int e,int old,int h) { return min(A[i],old) != h; } int solve(){ loop(i,n) if(A[i] < B[i]) return -1; int ans = 0; build(); right_to_left.clear(); insert(0,n-1,INT_MAX); loop(i,n) pq.push(mp(B[i],i)); idx.clear(); loop(i,n) idx[B[i]].push_back(i); while(!pq.empty()) { pi cur = pq.top(); pq.pop(); int i = cur.yy,h = cur.xx; int r = right_to_left.lower_bound(i)->first,l = right_to_left[r]; int s = get_left(l,r,i),e = get_right(l,r,i); int old_h = H[r]; right_to_left.erase(r); // cerr << i << " " << min(A[i],old_h) << " -> " << h << " " << s << " " << e << endl; if(cond(i,s,e,old_h,h)){ // cerr << s << " " << e << " " << h << endl; ans ++; insert(l,s-1,old_h); insert(s,i-1,h); insert(i+1,e,h); insert(e+1,r,old_h); } else { insert(l,i-1,old_h); insert(i+1,r,old_h); } } return ans; } int main(int argc,char **argv){ #ifdef HOME freopen("in.in","r",stdin); #endif int T; scanf("%d",&T); while(T--) { scanf("%d",&n); loop(i,n) scanf("%d",A + i); loop(i,n) scanf("%d",B + i); printf("%d\n",solve()); } return 0; }
[ "noureldinyosri@gmail.com" ]
noureldinyosri@gmail.com
d3e9bf1ca9af4672476f80b8ef9eb9a566e82eb8
f602df258e2aaa02ee2756004f6d22fa40a36b45
/include/FixedPoint/MultiwordIntegerCasts.hpp
56d02e0379bebd218023068f975edc2e22f46c94
[ "MIT" ]
permissive
templeblock/FixedPoint
16b980e93a1e21c71f467438bcb922224dfc6f2c
a0c086a7885e662bb51c1dab3eb9da0406486adf
refs/heads/master
2021-01-06T20:43:17.527829
2017-08-06T23:19:53
2017-08-06T23:19:53
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,754
hpp
#ifndef MULTIWORDINTEGERCASTS_HPP #define MULTIWORDINTEGERCASTS_HPP #include "MultiwordInteger.hpp" template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator bool() const { for (unsigned i = 0; i < size; i++) { if (s[i]) { return true; } } return false; } template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator int8_t() const { return s[0] & 0xFF; } template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator int16_t() const { int16_t r = 0; for (unsigned i = 0, j = 0; i < 16; i += storageSize) { r |= s[j++] << i; } return r; } template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator int32_t() const { int32_t r = 0; for (unsigned i = 0, j = 0; i < 32; i += storageSize) { r |= s[j++] << i; } return r; } template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator int64_t() const { int64_t r = 0; for (unsigned i = 0, j = 0; i < 64; i += storageSize) { r |= s[j++] << i; } return r; } template<unsigned size, typename storageType> constexpr MultiwordInteger<size, storageType>::operator double() const { double r = 0; double m = pow(2., storageSize); double n = 1; if (this->is_positive()) { return -double(-*this); } bigType c = 1; for (unsigned i = 0; i < size; i++) { c += static_cast<storageType>(~s[i]); storageType u = c; r += n * u; n *= m; c >>= storageSize; } return -r; } #endif // MULTIWORDINTEGERCASTS_HPP
[ "a@0au.de" ]
a@0au.de
e09782d2a3f389aa48ab435d4f4922ec7f7f982b
e686aa690c499f4d0abea8e840a89a28760bc90d
/Untitled5.cpp
826f24a8a04a944b0c950206968fab181adf9789
[]
no_license
risnan/Example
79c2182897ecccde0cfe469d9a257c13fca4f568
e1a3371c4da4e1a4c9fd78e00e2150d696612c6a
refs/heads/master
2021-01-01T16:56:50.466219
2017-07-21T14:13:52
2017-07-21T14:13:52
97,954,450
0
0
null
null
null
null
UTF-8
C++
false
false
280
cpp
#include <stdio.h> int main(){ int a[6] = {50, 10, 60, 20, 40, 30}; int i, j, temp; for(i=0; i<6; i++) { for(j=0; j<6-i-1; j++) { if( a[j] > a[j+1]) { temp = a[j]; a[j] = a[j+1]; a[j+1] = temp; } } printf("%d \n",a[i]); } return 0; }
[ "ulrisnan@gmail.com" ]
ulrisnan@gmail.com
b75ae1d9373ac8207f9949178318cd893c3b9917
8e727f701fd1750664e546467ab149be6f63300a
/vulkan_helpers/structs.cpp
eb9ffc7ec19b6addaddf6df9750681521ace1049
[ "Apache-2.0" ]
permissive
nipunG314/vulkan_test_applications
0fd32f40c00e493aeb82062f9914e641d6e3605f
42b01a32a9d4e575d2dae7856bd42cc33bef80e4
refs/heads/master
2022-12-19T22:33:51.838688
2020-08-18T08:41:53
2020-08-18T16:11:38
269,016,878
0
0
Apache-2.0
2020-08-04T17:28:19
2020-06-03T07:15:57
C++
UTF-8
C++
false
false
4,675
cpp
/* Copyright 2017 Google Inc. * * 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 "vulkan_helpers/structs.h" #include <utility> static_assert(VK_VERSION_1_0 == 1 && VK_HEADER_VERSION == 129, "review the following to make sure that all enumerant values are " "covered after updating vulkan.h"); namespace vulkan { containers::vector<::VkFormat> AllVkFormats(containers::Allocator* allocator) { containers::vector<::VkFormat> formats(allocator); // 0: VK_FORMAT_UNDEFINED // 1 - 184: assigned // 1000054000 - 1000054007: assigned // 1000066000 - 1000066013: assigned formats.reserve(VK_FORMAT_RANGE_SIZE + 8 + 14); for (uint64_t i = VK_FORMAT_BEGIN_RANGE; i <= VK_FORMAT_END_RANGE; ++i) { formats.push_back(static_cast<::VkFormat>(i)); } for (uint64_t i = 1000054000ul; i <= 1000054007ul; ++i) { formats.push_back(static_cast<::VkFormat>(i)); } for (uint64_t i = 1000066000ul; i <= 1000066013ul; ++i) { formats.push_back(static_cast<::VkFormat>(i)); } return std::move(formats); } containers::vector<::VkImageType> AllVkImageTypes( containers::Allocator* allocator) { containers::vector<::VkImageType> types(allocator); types.reserve(VK_IMAGE_TYPE_RANGE_SIZE); for (uint64_t i = VK_IMAGE_TYPE_BEGIN_RANGE; i <= VK_IMAGE_TYPE_END_RANGE; ++i) { types.push_back(static_cast<::VkImageType>(i)); } return std::move(types); } containers::vector<::VkImageTiling> AllVkImageTilings( containers::Allocator* allocator) { containers::vector<::VkImageTiling> tilings(allocator); tilings.reserve(VK_IMAGE_TILING_RANGE_SIZE); for (uint64_t i = VK_IMAGE_TILING_BEGIN_RANGE; i <= VK_IMAGE_TILING_END_RANGE; ++i) { tilings.push_back(static_cast<::VkImageTiling>(i)); } return std::move(tilings); } containers::vector<::VkImageUsageFlags> AllVkImageUsageFlagCombinations( containers::Allocator* allocator) { containers::vector<::VkImageUsageFlags> flags(allocator); const uint64_t min = VK_IMAGE_USAGE_TRANSFER_SRC_BIT; const uint64_t max = VK_IMAGE_USAGE_INPUT_ATTACHMENT_BIT << 1; flags.reserve(max - 1); for (uint64_t i = min; i < max; ++i) { flags.push_back(static_cast<::VkImageUsageFlags>(i)); } return std::move(flags); } containers::vector<::VkImageCreateFlags> AllVkImageCreateFlagCombinations( containers::Allocator* allocator) { containers::vector<::VkImageCreateFlags> flags(allocator); const uint64_t min = VK_IMAGE_CREATE_SPARSE_BINDING_BIT; const uint64_t max = VK_IMAGE_CREATE_CUBE_COMPATIBLE_BIT << 1; flags.reserve(max - 1); for (uint64_t i = min; i < max; ++i) { flags.push_back(static_cast<::VkImageCreateFlags>(i)); } return std::move(flags); } containers::vector<::VkSampleCountFlagBits> DecomposeVkSmapleCountFlagBits( const ::VkSampleCountFlags flags, containers::Allocator* allocator) { containers::vector<::VkSampleCountFlagBits> bits(allocator); bits.reserve(7u); // We have 7 possible sample count flag bits till now. for (uint64_t i = VK_SAMPLE_COUNT_1_BIT; i <= VK_SAMPLE_COUNT_64_BIT; i <<= 1) { if (flags & i) bits.push_back(static_cast<::VkSampleCountFlagBits>(i)); } return std::move(bits); } containers::vector<::VkCommandBufferLevel> AllVkCommandBufferLevels( containers::Allocator* allocator) { containers::vector<::VkCommandBufferLevel> levels(allocator); levels.reserve(VK_COMMAND_BUFFER_LEVEL_RANGE_SIZE); for (uint64_t i = VK_COMMAND_BUFFER_LEVEL_BEGIN_RANGE; i <= VK_COMMAND_BUFFER_LEVEL_END_RANGE; ++i) { levels.push_back(static_cast<::VkCommandBufferLevel>(i)); } return std::move(levels); } containers::vector<::VkCommandBufferResetFlags> AllVkCommandBufferResetFlagCombinations(containers::Allocator* allocator) { containers::vector<::VkCommandBufferResetFlags> flags(allocator); const uint64_t min = 0; const uint64_t max = VK_COMMAND_BUFFER_RESET_RELEASE_RESOURCES_BIT << 1; flags.reserve(max); for (uint64_t i = min; i < max; ++i) { flags.push_back(static_cast<::VkCommandBufferResetFlags>(i)); } return std::move(flags); } } // namespace vulkan
[ "awoloszyn@google.com" ]
awoloszyn@google.com
c2d0e360972a6ef1b6e9cfa8bb21393ee53955ae
7beb11adc7f64ce7326fa180726161366a2e22c5
/Payment Control System/PaymentControl.cpp
d853c08b8ec86bd81206308ec48ec02588bff982
[]
no_license
marcospardal/Object-oriented-programming
a938d7ca4d1d4df52838c0f2056a056e0a31b782
4b0655953128dc167d87ff9110d5fa5cddaccde1
refs/heads/master
2022-12-26T14:16:20.859136
2020-09-12T01:35:34
2020-09-12T01:35:34
272,468,934
1
0
null
null
null
null
UTF-8
C++
false
false
795
cpp
#include "PaymentControl.h" PaymentControl::PaymentControl(){ for(int i = 0; i < 10; i++) this->payments[i] = new Payment(); } void PaymentControl::setPayments(Payment * payment, int position){ //checks if the entered position is a valid one if(position >= 0 && position < 10) this->payments[position] = payment; else this->payments[0] = payment; } double PaymentControl::getTotalPayments(){ double total = 0; for(int i = 0; i < 10; i++){ total += this->payments[i]->getPaymentAmount(); } return total; } bool PaymentControl::findEmployee(std::string name){ bool found = false; for(int i = 0; i < 10; i++){ if(this->payments[i]->getEmployeeName() == name) found = true; } return found; }
[ "marcosnascimento@eng.ci.ufpb.br" ]
marcosnascimento@eng.ci.ufpb.br
ad5804cf8046e94a046ef0f81d23e206c210201d
531315d96211c3482a2cd5081b0365450bda6e95
/Engine/Source/FishEditor/UI/UIObjecField.hpp
b1f4d339dfd4cdeba2ba8da76cffae2779226a5d
[ "MIT" ]
permissive
JiangKevin/FishEngine
44da682e7e71ef7e3f852ea8ecb6475bf3de9f01
a4b9fb9b0a6dc202f7990e75f4b7d8d5163209d9
refs/heads/master
2023-03-16T15:55:19.653388
2017-09-25T13:25:27
2017-09-25T13:25:27
null
0
0
null
null
null
null
UTF-8
C++
false
false
593
hpp
#ifndef UIOBJECFIELD_HPP #define UIOBJECFIELD_HPP #include <QWidget> namespace Ui { class UIObjecField; } class UIObjecField : public QWidget { Q_OBJECT public: explicit UIObjecField(std::string const & label, std::string const & objectName, QWidget *parent = 0); ~UIObjecField(); bool CheckUpdate(std::string const & label, std::string const & objectName); private: void OnPickerClicked(); Ui::UIObjecField *ui; bool m_selectButtonClicked = false; std::string m_label; std::string m_objectName; //std::weak_ptr<FishEngine::Object> m_object; }; #endif // UIOBJECFIELD_HPP
[ "yushroom@gmail.com" ]
yushroom@gmail.com
92d1c3bab34f26b9b993dbca1422bb69d883b157
eb37d348399ad2650972eb2da9016d4d4bd0874c
/fte/src/i_ascii.h
dc534eb840da224d760f283b82da120958abc3b2
[]
no_license
tenox7/ntutils
a3493da1ed839ec5b986b1e6aedf580ef1be3fb2
27f4e62b4e72c2321d6cacaf88de6aeabd24b7d5
refs/heads/master
2023-05-24T23:46:50.576696
2023-05-16T09:50:42
2023-05-16T09:50:42
121,488,352
85
10
null
null
null
null
UTF-8
C++
false
false
506
h
/* i_ascii.h * * Copyright (c) 1994-1996, Marko Macek * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. * */ #ifndef I_ASCII_H #define I_ASCII_H #include "console.h" #include "i_oview.h" class ExASCII: public ExViewNext { int Pos, LPos; public: ExASCII(); virtual ~ExASCII(); virtual void HandleEvent(TEvent &Event); virtual void RepaintStatus(); }; #endif // I_ASCII_H
[ "tenox@google.com" ]
tenox@google.com
6d2ff4a4af72a20fab4f005766d32a1d72113c5f
d19bcef9ec00d33d9b5ba94bde3150f92b281161
/src/iau/fw2m.cpp
f8c0460a00e8f5424f21af9aaaae7145941f0d68
[]
no_license
xanthospap/iers2010
e1aeb36d21717af96b57a856842e04adfeefeddc
abe04765d5c27427b959752c749ee6aeba19cb7d
refs/heads/master
2023-07-26T06:01:14.741524
2023-07-21T14:58:35
2023-07-21T14:58:35
28,448,484
10
4
null
null
null
null
UTF-8
C++
false
false
779
cpp
#include "iau.hpp" Eigen::Matrix<double, 3, 3> iers2010::sofa::fw2m(double gamb, double phib, double psi, double eps) noexcept { /*return (Eigen::AngleAxisd(eps, Eigen::Vector3d::UnitX()) * Eigen::AngleAxisd(psi, Eigen::Vector3d::UnitZ()) * Eigen::AngleAxisd(-phib, Eigen::Vector3d::UnitX()) * Eigen::AngleAxisd(-gamb, Eigen::Vector3d::UnitZ())) .toRotationMatrix();*/ Eigen::Matrix<double, 3, 3> R = Eigen::Matrix<double, 3, 3>::Identity(); dso::rotate<dso::RotationAxis::Z>(gamb, R); dso::rotate<dso::RotationAxis::X>(phib, R); dso::rotate<dso::RotationAxis::Z>(-psi, R); dso::rotate<dso::RotationAxis::X>(-eps, R); return R; }
[ "xanthos@mail.ntua.gr" ]
xanthos@mail.ntua.gr
8d6f0a1f2eb102aff8db1164a7ff97b91e7933c3
744d5660fd348444db94a4db403b350e702d059d
/user_exception.hpp
85f4d26f4616066588bda53b830ba91a1aee3803
[]
no_license
Sergey-Marchuk/CI_CD_Lab_3
d2e9b2a0a5f3589f2fde9e28ab66357772895482
eb7456ba5fbcc81f5eda08cb88a4c2b68fbafcb3
refs/heads/main
2023-05-05T16:56:21.488657
2021-05-27T10:02:09
2021-05-27T10:02:09
371,312,944
1
0
null
null
null
null
UTF-8
C++
false
false
138
hpp
#pragma once #include <exception> class UserException: public std::exception { public: const char* what() const noexcept override; };
[ "noreply@github.com" ]
noreply@github.com
6b3012396be095c5fb33b5c1e24cc037ce31c3be
d5d06faddec9ebe284a4847357df14681d67f92b
/examples/sqlite-wrapper/listing.cpp
b68fce512d5ad81f38869c8afca053ccf91ce341
[]
no_license
joseph-montanez/G3DServer
9b938d3b1422d466e718860a9b25795f1f057d78
201786a44ac74f3dd1a018d091d828c6e33b5663
refs/heads/master
2021-01-06T20:46:55.398814
2014-04-25T07:48:21
2014-04-25T07:48:21
null
0
0
null
null
null
null
UTF-8
C++
false
false
524
cpp
#include <string> #include "g3dserver/WebController.h" #include "layout.h" #include "sqlite3.h" #include "PostModel.cpp" using namespace std; class ListingController : public WebController { public: void get() { string html = ""; html.append(Layout::header("List Posts")); PostModel *posts = new PostModel(); if(!posts->canOpen) { html.append("Unable to open the database!"); } delete posts; this->response->body = html; } };
[ "jmontanez@gorilla3d.com" ]
jmontanez@gorilla3d.com
63a300e65ab9778b0a0e639545f2a46f713f2bff
08d2bd601b03e668e51f6fe0c5cec672705bbd42
/src/rendersystem/base/RenderResource.cc
08d43bb0995f9af494262bc970ef194c8fa0e77c
[]
no_license
hatsunemiku02/NGR
dc0d9d56d7680c577eef1564c3cdde4f14f7de9f
6b781a7bf6c550e0f2f98d5c00c4c828ba231210
refs/heads/master
2020-03-29T17:00:11.603909
2018-10-22T07:04:23
2018-10-22T07:04:23
150,138,497
2
1
null
null
null
null
UTF-8
C++
false
false
582
cc
#pragma once #include "stdneb.h" #ifdef __OSX__ #include "../rendersystem/base/RenderResource.h" #else #include "base/RenderResource.h" #endif //------------------------------------------------------------------------------ namespace RenderBase { RenderResource::RenderResource(): usage(UsageDynamic), access(AccessReadWrite) { } RenderResource::~RenderResource() { } void RenderResource::OnDeviceLost() { ///empty. } void RenderResource::OnDeviceReset() { ///empty. } } // namespace Base //------------------------------------------------------------------------------
[ "hangzhao@126.com" ]
hangzhao@126.com
5a9a9c722ec05de9b43c68a7190802739911c31f
38c10c01007624cd2056884f25e0d6ab85442194
/chrome/browser/password_manager/native_backend_libsecret_unittest.cc
c68673ea48e8d909d798dca227e351bb5873bf72
[ "BSD-3-Clause" ]
permissive
zenoalbisser/chromium
6ecf37b6c030c84f1b26282bc4ef95769c62a9b2
e71f21b9b4b9b839f5093301974a45545dad2691
refs/heads/master
2022-12-25T14:23:18.568575
2016-07-14T21:49:52
2016-07-23T08:02:51
63,980,627
0
2
BSD-3-Clause
2022-12-12T12:43:41
2016-07-22T20:14:04
null
UTF-8
C++
false
false
35,686
cc
// Copyright (c) 2015 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 <stdarg.h> #include "base/basictypes.h" #include "base/location.h" #include "base/prefs/pref_service.h" #include "base/single_thread_task_runner.h" #include "base/stl_util.h" #include "base/strings/string_number_conversions.h" #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" #include "base/thread_task_runner_handle.h" #include "base/time/time.h" #include "chrome/browser/password_manager/native_backend_libsecret.h" #include "chrome/test/base/testing_profile.h" #include "components/autofill/core/common/password_form.h" #include "components/password_manager/core/browser/psl_matching_helper.h" #include "components/password_manager/core/common/password_manager_pref_names.h" #include "testing/gtest/include/gtest/gtest.h" using autofill::PasswordForm; using base::UTF8ToUTF16; using base::UTF16ToUTF8; using password_manager::PasswordStoreChange; using password_manager::PasswordStoreChangeList; namespace { // What follows is a very simple implementation of the subset of the Libsecret // API that we actually use. It gets substituted for the real one by // MockLibsecretLoader, which hooks into the facility normally used to load // the libsecret library at runtime to avoid a static dependency on it. struct MockSecretValue { gchar* password; explicit MockSecretValue(gchar* password) : password(password) {} ~MockSecretValue() { g_free(password); } }; struct MockSecretItem { MockSecretValue* value; GHashTable* attributes; MockSecretItem(MockSecretValue* value, GHashTable* attributes) : value(value), attributes(attributes) {} ~MockSecretItem() { delete value; g_hash_table_destroy(attributes); } void RemoveAttribute(const char* keyname) { g_hash_table_remove(attributes, keyname); } }; bool Matches(MockSecretItem* item, GHashTable* query) { GHashTable* attributes = item->attributes; GHashTableIter iter; gchar* name; gchar* query_value; g_hash_table_iter_init(&iter, query); while (g_hash_table_iter_next(&iter, reinterpret_cast<gpointer*>(&name), reinterpret_cast<gpointer*>(&query_value))) { gchar* value = static_cast<gchar*>(g_hash_table_lookup(attributes, name)); if (value == nullptr || strcmp(value, query_value) != 0) return false; } return true; } bool IsStringAttribute(const SecretSchema* schema, const std::string& name) { for (size_t i = 0; schema->attributes[i].name; ++i) if (name == schema->attributes[i].name) return schema->attributes[i].type == SECRET_SCHEMA_ATTRIBUTE_STRING; NOTREACHED() << "Requested type of nonexistent attribute"; return false; } // The list of all libsecret items we have stored. ScopedVector<MockSecretItem>* global_mock_libsecret_items; bool global_mock_libsecret_reject_local_ids = false; gboolean mock_secret_password_store_sync(const SecretSchema* schema, const gchar* collection, const gchar* label, const gchar* password, GCancellable* cancellable, GError** error, ...) { GHashTable* attributes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); va_list ap; va_start(ap, error); char* name; while ((name = va_arg(ap, gchar*))) { char* value; if (IsStringAttribute(schema, name)) { value = g_strdup(va_arg(ap, gchar*)); VLOG(1) << "Adding item attribute " << name << ", value '" << value << "'"; } else { uint32_t intvalue = va_arg(ap, uint32_t); VLOG(1) << "Adding item attribute " << name << ", value " << intvalue; value = g_strdup_printf("%u", intvalue); } g_hash_table_insert(attributes, g_strdup(name), value); } va_end(ap); MockSecretValue* secret_value = new MockSecretValue(g_strdup(password)); MockSecretItem* item = new MockSecretItem(secret_value, attributes); global_mock_libsecret_items->push_back(item); return true; } GList* mock_secret_service_search_sync(SecretService* service, const SecretSchema* schema, GHashTable* attributes, SecretSearchFlags flags, GCancellable* cancellable, GError** error) { GList* result = nullptr; for (MockSecretItem* item : *global_mock_libsecret_items) { if (Matches(item, attributes)) result = g_list_append(result, item); } return result; } gboolean mock_secret_password_clear_sync(const SecretSchema* schema, GCancellable* cancellable, GError** error, ...) { GHashTable* attributes = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); va_list ap; va_start(ap, error); char* name; while ((name = va_arg(ap, gchar*))) { char* value; if (IsStringAttribute(schema, name)) { value = g_strdup(va_arg(ap, gchar*)); VLOG(1) << "Adding item attribute " << name << ", value '" << value << "'"; } else { uint32_t intvalue = va_arg(ap, uint32_t); VLOG(1) << "Adding item attribute " << name << ", value " << intvalue; value = g_strdup_printf("%u", intvalue); } g_hash_table_insert(attributes, g_strdup(name), value); } va_end(ap); ScopedVector<MockSecretItem> kept_mock_libsecret_items; kept_mock_libsecret_items.reserve(global_mock_libsecret_items->size()); for (auto& item : *global_mock_libsecret_items) { if (!Matches(item, attributes)) { kept_mock_libsecret_items.push_back(item); item = nullptr; } } global_mock_libsecret_items->swap(kept_mock_libsecret_items); g_hash_table_unref(attributes); return global_mock_libsecret_items->size() != kept_mock_libsecret_items.size(); } MockSecretValue* mock_secret_item_get_secret(MockSecretItem* self) { return self->value; } const gchar* mock_secret_value_get_text(MockSecretValue* value) { return value->password; } GHashTable* mock_secret_item_get_attributes(MockSecretItem* self) { // Libsecret backend will make unreference of received attributes, so in // order to save them we need to increase their reference number. g_hash_table_ref(self->attributes); return self->attributes; } gboolean mock_secret_item_load_secret_sync(MockSecretItem* self, GCancellable* cancellable, GError** error) { return true; } void mock_secret_value_unref(gpointer value) { } // Inherit to get access to protected fields. class MockLibsecretLoader : public LibsecretLoader { public: static bool LoadMockLibsecret() { secret_password_store_sync = &mock_secret_password_store_sync; secret_service_search_sync = &mock_secret_service_search_sync; secret_password_clear_sync = &mock_secret_password_clear_sync; secret_item_get_secret = (decltype(&::secret_item_get_secret)) & mock_secret_item_get_secret; secret_value_get_text = (decltype(&::secret_value_get_text)) & mock_secret_value_get_text; secret_item_get_attributes = (decltype(&::secret_item_get_attributes)) & mock_secret_item_get_attributes; secret_item_load_secret_sync = (decltype(&::secret_item_load_secret_sync)) & mock_secret_item_load_secret_sync; secret_value_unref = (decltype(&::secret_value_unref)) & mock_secret_value_unref; libsecret_loaded = true; // Reset the state of the mock library. global_mock_libsecret_items->clear(); global_mock_libsecret_reject_local_ids = false; return true; } }; void CheckPasswordChanges(const PasswordStoreChangeList& expected_list, const PasswordStoreChangeList& actual_list) { ASSERT_EQ(expected_list.size(), actual_list.size()); for (size_t i = 0; i < expected_list.size(); ++i) { EXPECT_EQ(expected_list[i].type(), actual_list[i].type()); EXPECT_EQ(expected_list[i].form(), actual_list[i].form()); } } void VerifiedAdd(NativeBackendLibsecret* backend, const PasswordForm& form) { SCOPED_TRACE("VerifiedAdd"); PasswordStoreChangeList changes = backend->AddLogin(form); PasswordStoreChangeList expected(1, PasswordStoreChange(PasswordStoreChange::ADD, form)); CheckPasswordChanges(expected, changes); } void VerifiedUpdate(NativeBackendLibsecret* backend, const PasswordForm& form) { SCOPED_TRACE("VerifiedUpdate"); PasswordStoreChangeList changes; EXPECT_TRUE(backend->UpdateLogin(form, &changes)); PasswordStoreChangeList expected(1, PasswordStoreChange( PasswordStoreChange::UPDATE, form)); CheckPasswordChanges(expected, changes); } void VerifiedRemove(NativeBackendLibsecret* backend, const PasswordForm& form) { SCOPED_TRACE("VerifiedRemove"); PasswordStoreChangeList changes; EXPECT_TRUE(backend->RemoveLogin(form, &changes)); CheckPasswordChanges(PasswordStoreChangeList(1, PasswordStoreChange( PasswordStoreChange::REMOVE, form)), changes); } } // anonymous namespace class NativeBackendLibsecretTest : public testing::Test { protected: enum UpdateType { // Used in CheckPSLUpdate(). UPDATE_BY_UPDATELOGIN, UPDATE_BY_ADDLOGIN, }; enum RemoveBetweenMethod { // Used in CheckRemoveLoginsBetween(). CREATED, SYNCED, }; NativeBackendLibsecretTest() {} void SetUp() override { ASSERT_FALSE(global_mock_libsecret_items); global_mock_libsecret_items = &mock_libsecret_items_; ASSERT_TRUE(MockLibsecretLoader::LoadMockLibsecret()); form_google_.origin = GURL("http://www.google.com/"); form_google_.action = GURL("http://www.google.com/login"); form_google_.username_element = UTF8ToUTF16("user"); form_google_.username_value = UTF8ToUTF16("joeschmoe"); form_google_.password_element = UTF8ToUTF16("pass"); form_google_.password_value = UTF8ToUTF16("seekrit"); form_google_.submit_element = UTF8ToUTF16("submit"); form_google_.signon_realm = "http://www.google.com/"; form_google_.type = PasswordForm::TYPE_GENERATED; form_google_.date_created = base::Time::Now(); form_google_.date_synced = base::Time::Now(); form_google_.display_name = UTF8ToUTF16("Joe Schmoe"); form_google_.icon_url = GURL("http://www.google.com/icon"); form_google_.federation_url = GURL("http://www.google.com/federation_url"); form_google_.skip_zero_click = true; form_google_.generation_upload_status = PasswordForm::POSITIVE_SIGNAL_SENT; form_google_.form_data.name = UTF8ToUTF16("form_name"); form_facebook_.origin = GURL("http://www.facebook.com/"); form_facebook_.action = GURL("http://www.facebook.com/login"); form_facebook_.username_element = UTF8ToUTF16("user"); form_facebook_.username_value = UTF8ToUTF16("a"); form_facebook_.password_element = UTF8ToUTF16("password"); form_facebook_.password_value = UTF8ToUTF16("b"); form_facebook_.submit_element = UTF8ToUTF16("submit"); form_facebook_.signon_realm = "http://www.facebook.com/"; form_facebook_.date_created = base::Time::Now(); form_facebook_.date_synced = base::Time::Now(); form_facebook_.display_name = UTF8ToUTF16("Joe Schmoe"); form_facebook_.icon_url = GURL("http://www.facebook.com/icon"); form_facebook_.federation_url = GURL("http://www.facebook.com/federation"); form_facebook_.skip_zero_click = true; form_facebook_.generation_upload_status = PasswordForm::NO_SIGNAL_SENT; form_isc_.origin = GURL("http://www.isc.org/"); form_isc_.action = GURL("http://www.isc.org/auth"); form_isc_.username_element = UTF8ToUTF16("id"); form_isc_.username_value = UTF8ToUTF16("janedoe"); form_isc_.password_element = UTF8ToUTF16("passwd"); form_isc_.password_value = UTF8ToUTF16("ihazabukkit"); form_isc_.submit_element = UTF8ToUTF16("login"); form_isc_.signon_realm = "http://www.isc.org/"; form_isc_.date_created = base::Time::Now(); form_isc_.date_synced = base::Time::Now(); other_auth_.origin = GURL("http://www.example.com/"); other_auth_.username_value = UTF8ToUTF16("username"); other_auth_.password_value = UTF8ToUTF16("pass"); other_auth_.signon_realm = "http://www.example.com/Realm"; other_auth_.date_created = base::Time::Now(); other_auth_.date_synced = base::Time::Now(); } void TearDown() override { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); base::MessageLoop::current()->Run(); ASSERT_TRUE(global_mock_libsecret_items); global_mock_libsecret_items = nullptr; } void RunUIThread() { base::MessageLoop::current()->Run(); } void CheckUint32Attribute(const MockSecretItem* item, const std::string& attribute, uint32_t value) { gpointer item_value = g_hash_table_lookup(item->attributes, attribute.c_str()); EXPECT_TRUE(item_value) << " in attribute " << attribute; if (item_value) { uint32_t int_value; bool conversion_ok = base::StringToUint((char*)item_value, &int_value); EXPECT_TRUE(conversion_ok); EXPECT_EQ(value, int_value); } } void CheckStringAttribute(const MockSecretItem* item, const std::string& attribute, const std::string& value) { gpointer item_value = g_hash_table_lookup(item->attributes, attribute.c_str()); EXPECT_TRUE(item_value) << " in attribute " << attribute; if (item_value) { EXPECT_EQ(value, static_cast<char*>(item_value)); } } void CheckMockSecretItem(const MockSecretItem* item, const PasswordForm& form, const std::string& app_string) { EXPECT_EQ(UTF16ToUTF8(form.password_value), item->value->password); EXPECT_EQ(22u, g_hash_table_size(item->attributes)); CheckStringAttribute(item, "origin_url", form.origin.spec()); CheckStringAttribute(item, "action_url", form.action.spec()); CheckStringAttribute(item, "username_element", UTF16ToUTF8(form.username_element)); CheckStringAttribute(item, "username_value", UTF16ToUTF8(form.username_value)); CheckStringAttribute(item, "password_element", UTF16ToUTF8(form.password_element)); CheckStringAttribute(item, "submit_element", UTF16ToUTF8(form.submit_element)); CheckStringAttribute(item, "signon_realm", form.signon_realm); CheckUint32Attribute(item, "ssl_valid", form.ssl_valid); CheckUint32Attribute(item, "preferred", form.preferred); // We don't check the date created. It varies. CheckUint32Attribute(item, "blacklisted_by_user", form.blacklisted_by_user); CheckUint32Attribute(item, "type", form.type); CheckUint32Attribute(item, "times_used", form.times_used); CheckUint32Attribute(item, "scheme", form.scheme); CheckStringAttribute( item, "date_synced", base::Int64ToString(form.date_synced.ToInternalValue())); CheckStringAttribute(item, "display_name", UTF16ToUTF8(form.display_name)); CheckStringAttribute(item, "avatar_url", form.icon_url.spec()); CheckStringAttribute(item, "federation_url", form.federation_url.spec()); CheckUint32Attribute(item, "skip_zero_click", form.skip_zero_click); CheckUint32Attribute(item, "generation_upload_status", form.generation_upload_status); CheckStringAttribute(item, "application", app_string); autofill::FormData actual; DeserializeFormDataFromBase64String( static_cast<char*>(g_hash_table_lookup(item->attributes, "form_data")), &actual); EXPECT_TRUE(form.form_data.SameFormAs(actual)); } // Saves |credentials| and then gets logins matching |url| and |scheme|. // Returns true when something is found, and in such case copies the result to // |result| when |result| is not nullptr. (Note that there can be max. 1 // result derived from |credentials|.) bool CheckCredentialAvailability(const PasswordForm& credentials, const GURL& url, const PasswordForm::Scheme& scheme, PasswordForm* result) { NativeBackendLibsecret backend(321); VerifiedAdd(&backend, credentials); PasswordForm target_form; target_form.origin = url; target_form.signon_realm = url.spec(); if (scheme != PasswordForm::SCHEME_HTML) { // For non-HTML forms, the realm used for authentication // (http://tools.ietf.org/html/rfc1945#section-10.2) is appended to the // signon_realm. Just use a default value for now. target_form.signon_realm.append("Realm"); target_form.scheme = scheme; } ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetLogins(target_form, &form_list)); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], credentials, "chrome-321"); global_mock_libsecret_items->clear(); if (form_list.empty()) return false; EXPECT_EQ(1u, form_list.size()); if (result) *result = *form_list[0]; return true; } // Test that updating does not use PSL matching: Add a www.facebook.com // password, then use PSL matching to get a copy of it for m.facebook.com, and // add that copy as well. Now update the www.facebook.com password -- the // m.facebook.com password should not get updated. Depending on the argument, // the credential update is done via UpdateLogin or AddLogin. void CheckPSLUpdate(UpdateType update_type) { NativeBackendLibsecret backend(321); VerifiedAdd(&backend, form_facebook_); // Get the PSL-matched copy of the saved login for m.facebook. const GURL kMobileURL("http://m.facebook.com/"); PasswordForm m_facebook_lookup; m_facebook_lookup.origin = kMobileURL; m_facebook_lookup.signon_realm = kMobileURL.spec(); ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetLogins(m_facebook_lookup, &form_list)); EXPECT_EQ(1u, global_mock_libsecret_items->size()); EXPECT_EQ(1u, form_list.size()); PasswordForm m_facebook = *form_list[0]; form_list.clear(); m_facebook.origin = kMobileURL; m_facebook.signon_realm = kMobileURL.spec(); // Add the PSL-matched copy to saved logins. VerifiedAdd(&backend, m_facebook); EXPECT_EQ(2u, global_mock_libsecret_items->size()); // Update www.facebook.com login. PasswordForm new_facebook(form_facebook_); const base::string16 kOldPassword(form_facebook_.password_value); const base::string16 kNewPassword(UTF8ToUTF16("new_b")); EXPECT_NE(kOldPassword, kNewPassword); new_facebook.password_value = kNewPassword; switch (update_type) { case UPDATE_BY_UPDATELOGIN: VerifiedUpdate(&backend, new_facebook); break; case UPDATE_BY_ADDLOGIN: // This is an overwrite call. backend.AddLogin(new_facebook); break; } EXPECT_EQ(2u, global_mock_libsecret_items->size()); // Check that m.facebook.com login was not modified by the update. EXPECT_TRUE(backend.GetLogins(m_facebook_lookup, &form_list)); // There should be two results -- the exact one, and the PSL-matched one. EXPECT_EQ(2u, form_list.size()); size_t index_non_psl = 0; if (form_list[index_non_psl]->is_public_suffix_match) index_non_psl = 1; EXPECT_EQ(kMobileURL, form_list[index_non_psl]->origin); EXPECT_EQ(kMobileURL.spec(), form_list[index_non_psl]->signon_realm); EXPECT_EQ(kOldPassword, form_list[index_non_psl]->password_value); form_list.clear(); // Check that www.facebook.com login was modified by the update. EXPECT_TRUE(backend.GetLogins(form_facebook_, &form_list)); // There should be two results -- the exact one, and the PSL-matched one. EXPECT_EQ(2u, form_list.size()); index_non_psl = 0; if (form_list[index_non_psl]->is_public_suffix_match) index_non_psl = 1; EXPECT_EQ(form_facebook_.origin, form_list[index_non_psl]->origin); EXPECT_EQ(form_facebook_.signon_realm, form_list[index_non_psl]->signon_realm); EXPECT_EQ(kNewPassword, form_list[index_non_psl]->password_value); form_list.clear(); } // Checks various types of matching for forms with a non-HTML |scheme|. void CheckMatchingWithScheme(const PasswordForm::Scheme& scheme) { ASSERT_NE(PasswordForm::SCHEME_HTML, scheme); other_auth_.scheme = scheme; // Don't match a non-HTML form with an HTML form. EXPECT_FALSE( CheckCredentialAvailability(other_auth_, GURL("http://www.example.com"), PasswordForm::SCHEME_HTML, nullptr)); // Don't match an HTML form with non-HTML auth form. EXPECT_FALSE(CheckCredentialAvailability( form_google_, GURL("http://www.google.com/"), scheme, nullptr)); // Don't match two different non-HTML auth forms with different origin. EXPECT_FALSE(CheckCredentialAvailability( other_auth_, GURL("http://first.example.com"), scheme, nullptr)); // Do match non-HTML forms from the same origin. EXPECT_TRUE(CheckCredentialAvailability( other_auth_, GURL("http://www.example.com/"), scheme, nullptr)); } void CheckRemoveLoginsBetween(RemoveBetweenMethod date_to_test) { NativeBackendLibsecret backend(42); base::Time now = base::Time::Now(); base::Time next_day = now + base::TimeDelta::FromDays(1); form_google_.date_synced = base::Time(); form_isc_.date_synced = base::Time(); form_google_.date_created = now; form_isc_.date_created = now; if (date_to_test == CREATED) { form_google_.date_created = now; form_isc_.date_created = next_day; } else { form_google_.date_synced = now; form_isc_.date_synced = next_day; } VerifiedAdd(&backend, form_google_); VerifiedAdd(&backend, form_isc_); PasswordStoreChangeList expected_changes; expected_changes.push_back( PasswordStoreChange(PasswordStoreChange::REMOVE, form_google_)); PasswordStoreChangeList changes; bool (NativeBackendLibsecret::*method)( base::Time, base::Time, password_manager::PasswordStoreChangeList*) = date_to_test == CREATED ? &NativeBackendLibsecret::RemoveLoginsCreatedBetween : &NativeBackendLibsecret::RemoveLoginsSyncedBetween; EXPECT_TRUE(base::Bind(method, base::Unretained(&backend), base::Time(), next_day, &changes).Run()); CheckPasswordChanges(expected_changes, changes); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty() > 0) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_isc_, "chrome-42"); // Remove form_isc_. expected_changes.clear(); expected_changes.push_back( PasswordStoreChange(PasswordStoreChange::REMOVE, form_isc_)); EXPECT_TRUE(base::Bind(method, base::Unretained(&backend), next_day, base::Time(), &changes).Run()); CheckPasswordChanges(expected_changes, changes); EXPECT_TRUE(global_mock_libsecret_items->empty()); } base::MessageLoopForUI message_loop_; // Provide some test forms to avoid having to set them up in each test. PasswordForm form_google_; PasswordForm form_facebook_; PasswordForm form_isc_; PasswordForm other_auth_; ScopedVector<MockSecretItem> mock_libsecret_items_; }; TEST_F(NativeBackendLibsecretTest, BasicAddLogin) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } TEST_F(NativeBackendLibsecretTest, BasicListLogins) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetAutofillableLogins(&form_list)); ASSERT_EQ(1u, form_list.size()); EXPECT_EQ(form_google_, *form_list[0]); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } // Save a password for www.facebook.com and see it suggested for m.facebook.com. TEST_F(NativeBackendLibsecretTest, PSLMatchingPositive) { PasswordForm result; const GURL kMobileURL("http://m.facebook.com/"); EXPECT_TRUE(CheckCredentialAvailability(form_facebook_, kMobileURL, PasswordForm::SCHEME_HTML, &result)); EXPECT_EQ(form_facebook_.origin, result.origin); EXPECT_EQ(form_facebook_.signon_realm, result.signon_realm); } // Save a password for www.facebook.com and see it not suggested for // m-facebook.com. TEST_F(NativeBackendLibsecretTest, PSLMatchingNegativeDomainMismatch) { EXPECT_FALSE(CheckCredentialAvailability(form_facebook_, GURL("http://m-facebook.com/"), PasswordForm::SCHEME_HTML, nullptr)); } // Test PSL matching is off for domains excluded from it. TEST_F(NativeBackendLibsecretTest, PSLMatchingDisabledDomains) { EXPECT_FALSE(CheckCredentialAvailability(form_google_, GURL("http://one.google.com/"), PasswordForm::SCHEME_HTML, nullptr)); } // Make sure PSL matches aren't available for non-HTML forms. TEST_F(NativeBackendLibsecretTest, PSLMatchingDisabledForNonHTMLForms) { CheckMatchingWithScheme(PasswordForm::SCHEME_BASIC); CheckMatchingWithScheme(PasswordForm::SCHEME_DIGEST); CheckMatchingWithScheme(PasswordForm::SCHEME_OTHER); } TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictUpdateLogin) { CheckPSLUpdate(UPDATE_BY_UPDATELOGIN); } TEST_F(NativeBackendLibsecretTest, PSLUpdatingStrictAddLogin) { // TODO(vabr): if AddLogin becomes no longer valid for existing logins, then // just delete this test. CheckPSLUpdate(UPDATE_BY_ADDLOGIN); } TEST_F(NativeBackendLibsecretTest, BasicUpdateLogin) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); PasswordForm new_form_google(form_google_); new_form_google.times_used = 1; new_form_google.action = GURL("http://www.google.com/different/login"); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) { CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } // Update login VerifiedUpdate(&backend, new_form_google); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], new_form_google, "chrome-42"); } TEST_F(NativeBackendLibsecretTest, BasicRemoveLogin) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); VerifiedRemove(&backend, form_google_); EXPECT_TRUE(global_mock_libsecret_items->empty()); } // Verify fix for http://crbug.com/408783. TEST_F(NativeBackendLibsecretTest, RemoveLoginActionMismatch) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); // Action url match not required for removal. form_google_.action = GURL("https://some.other.url.com/path"); VerifiedRemove(&backend, form_google_); EXPECT_TRUE(global_mock_libsecret_items->empty()); } TEST_F(NativeBackendLibsecretTest, RemoveNonexistentLogin) { NativeBackendLibsecret backend(42); // First add an unrelated login. VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); // Attempt to remove a login that doesn't exist. PasswordStoreChangeList changes; EXPECT_TRUE(backend.RemoveLogin(form_isc_, &changes)); CheckPasswordChanges(PasswordStoreChangeList(), changes); // Make sure we can still get the first form back. ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetAutofillableLogins(&form_list)); // Quick check that we got something back. EXPECT_EQ(1u, form_list.size()); form_list.clear(); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } TEST_F(NativeBackendLibsecretTest, UpdateNonexistentLogin) { NativeBackendLibsecret backend(42); // First add an unrelated login. VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) { CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } // Attempt to update a login that doesn't exist. PasswordStoreChangeList changes; EXPECT_TRUE(backend.UpdateLogin(form_isc_, &changes)); CheckPasswordChanges(PasswordStoreChangeList(), changes); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } TEST_F(NativeBackendLibsecretTest, UpdateSameLogin) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) { CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } // Attempt to update the same login without changing anything. PasswordStoreChangeList changes; EXPECT_TRUE(backend.UpdateLogin(form_google_, &changes)); CheckPasswordChanges(PasswordStoreChangeList(), changes); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) { CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } } TEST_F(NativeBackendLibsecretTest, AddDuplicateLogin) { NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); PasswordStoreChangeList expected_changes; expected_changes.push_back( PasswordStoreChange(PasswordStoreChange::REMOVE, form_google_)); form_google_.times_used++; form_google_.submit_element = UTF8ToUTF16("submit2"); expected_changes.push_back( PasswordStoreChange(PasswordStoreChange::ADD, form_google_)); PasswordStoreChangeList actual_changes = backend.AddLogin(form_google_); CheckPasswordChanges(expected_changes, actual_changes); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } TEST_F(NativeBackendLibsecretTest, AndroidCredentials) { NativeBackendLibsecret backend(42); backend.Init(); PasswordForm observed_android_form; observed_android_form.scheme = PasswordForm::SCHEME_HTML; observed_android_form.signon_realm = "android://7x7IDboo8u9YKraUsbmVkuf1-@net.rateflix.app/"; PasswordForm saved_android_form = observed_android_form; saved_android_form.username_value = base::UTF8ToUTF16("randomusername"); saved_android_form.password_value = base::UTF8ToUTF16("password"); saved_android_form.date_created = base::Time::Now(); VerifiedAdd(&backend, saved_android_form); ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetAutofillableLogins(&form_list)); EXPECT_EQ(1u, form_list.size()); EXPECT_EQ(saved_android_form, *form_list[0]); } TEST_F(NativeBackendLibsecretTest, RemoveLoginsCreatedBetween) { CheckRemoveLoginsBetween(CREATED); } TEST_F(NativeBackendLibsecretTest, RemoveLoginsSyncedBetween) { CheckRemoveLoginsBetween(SYNCED); } TEST_F(NativeBackendLibsecretTest, SomeKeyringAttributesAreMissing) { // Absent attributes should be filled with default values. NativeBackendLibsecret backend(42); VerifiedAdd(&backend, form_google_); EXPECT_EQ(1u, global_mock_libsecret_items->size()); // Remove a string attribute. (*global_mock_libsecret_items)[0]->RemoveAttribute("avatar_url"); // Remove an integer attribute. (*global_mock_libsecret_items)[0]->RemoveAttribute("ssl_valid"); ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetAutofillableLogins(&form_list)); EXPECT_EQ(1u, form_list.size()); EXPECT_EQ(GURL(""), form_list[0]->icon_url); EXPECT_FALSE(form_list[0]->ssl_valid); } TEST_F(NativeBackendLibsecretTest, ReadDuplicateForms) { NativeBackendLibsecret backend(42); // Add 2 slightly different password forms. const char unique_string[] = "unique_unique_string"; const char unique_string_replacement[] = "uniKue_unique_string"; form_google_.origin = GURL(std::string("http://www.google.com/") + unique_string); VerifiedAdd(&backend, form_google_); form_google_.origin = GURL(std::string("http://www.google.com/") + unique_string_replacement); VerifiedAdd(&backend, form_google_); // Read the raw value back. Change the |unique_string| to // |unique_string_replacement| so the forms become unique. ASSERT_EQ(2u, global_mock_libsecret_items->size()); gpointer item_value = g_hash_table_lookup( global_mock_libsecret_items->front()->attributes, "origin_url"); ASSERT_TRUE(item_value); char* substr = strstr(static_cast<char*>(item_value), unique_string); ASSERT_TRUE(substr); ASSERT_EQ(strlen(unique_string), strlen(unique_string_replacement)); strncpy(substr, unique_string_replacement, strlen(unique_string)); // Now test that GetAutofillableLogins returns only one form. ScopedVector<autofill::PasswordForm> form_list; EXPECT_TRUE(backend.GetAutofillableLogins(&form_list)); EXPECT_EQ(1u, form_list.size()); EXPECT_EQ(form_google_, *form_list[0]); EXPECT_EQ(1u, global_mock_libsecret_items->size()); if (!global_mock_libsecret_items->empty()) { CheckMockSecretItem((*global_mock_libsecret_items)[0], form_google_, "chrome-42"); } } // TODO(mdm): add more basic tests here at some point.
[ "zeno.albisser@hemispherian.com" ]
zeno.albisser@hemispherian.com
4e94d6ef8f3cdb17e94747abd88a233dcd3cdd03
493ac26ce835200f4844e78d8319156eae5b21f4
/flow_simulation/ideal_flow/0.96/uniform/cumulativeContErr
45ce334cf8d04f612874cb4972ac7df1a30e19d6
[]
no_license
mohan-padmanabha/worm_project
46f65090b06a2659a49b77cbde3844410c978954
7a39f9384034e381d5f71191122457a740de3ff0
refs/heads/master
2022-12-14T14:41:21.237400
2020-08-21T13:33:10
2020-08-21T13:33:10
289,277,792
0
0
null
null
null
null
UTF-8
C++
false
false
957
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: v1912 | | \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class uniformDimensionedScalarField; location "0.96/uniform"; object cumulativeContErr; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; value 3.30075e-05; // ************************************************************************* //
[ "mohan.2611@gmail.com" ]
mohan.2611@gmail.com
5269bbe3ef978b8ceaa16daf54deb35cf51da6df
b3b9ce533317d3702ddc1c7bca310740bd5405e6
/mainwindow.h
f2b8dbe0c5a900c6e5a8a7cca7d94338e9fdd7b5
[ "MIT" ]
permissive
SMFloris/facialRecognitionGui-cuda
486ee66fefdc4b312ef25534b12ef00570a55fef
3932a140759f9ed56a71acb6b31d42eae481a7f1
refs/heads/master
2016-08-12T13:19:24.091002
2016-01-04T23:47:15
2016-01-04T23:47:15
48,945,343
1
0
null
null
null
null
UTF-8
C++
false
false
391
h
#ifndef MAINWINDOW_H #define MAINWINDOW_H #include <QMainWindow> namespace Ui { class MainWindow; } class Image; class MainWindow : public QMainWindow { Q_OBJECT public: explicit MainWindow(QWidget *parent = 0); ~MainWindow(); private slots: void on_actionQuit_triggered(); void on_start_clicked(); private: Ui::MainWindow *ui; }; #endif // MAINWINDOW_H
[ "floris.sm@gmail.com" ]
floris.sm@gmail.com
d1d60a30bf781978fc929b835a026aa47e5c0cc0
5ec05db9d661aaac51b892573cd236c165eb306d
/project2D/turret.cpp
e2d2c38021e45994cfc070d3509c4a59886b3320
[ "MIT" ]
permissive
Jeffrey-W23/AIE-Assignment-2D-Game
3e5060155a27b65d9e13128bc5713e04d18fd3eb
ad1e95fc76899ae50d7a4073403795b843393ff1
refs/heads/master
2021-01-23T05:24:11.605341
2017-05-14T13:29:54
2017-05-14T13:29:54
86,289,834
0
0
null
null
null
null
UTF-8
C++
false
false
3,460
cpp
// #include, using, etc #include "Input.h" #include "turret.h" #include "VectorCast.h" //-------------------------------------------------------------------------------------- // Default Constructor. // // Param: // textureUrl: Takes in a char for specifying a texture url in texture file location. //-------------------------------------------------------------------------------------- turret::turret(char* textureUrl) : Entity(textureUrl) { // Create an Antenna. antenna = new Antenna("rock_large"); // Set its parent to Turret. antenna->setParent(this); // Set turrets child to Antenna. this->setChild(antenna); // initialize rotSpeed. rotSpeed = 3.14f; // Create 15 bullets. for (int i = 0; i < 15; i++) { Vector2 temp; bullets[i] = new Bullet(nullptr, temp, 5.0f); } // initialize bulletCount. bulletCount = 0; } //-------------------------------------------------------------------------------------- // Default Destructor //-------------------------------------------------------------------------------------- turret::~turret() { // Delete antenna delete antenna; // delete bullets for (int i = 0; i < 15; i++) { delete bullets[i]; } } //-------------------------------------------------------------------------------------- // Update: A virtual function from entity to update objects. // // Param: // deltaTime: Pass in deltaTime. A number that updates per second. //-------------------------------------------------------------------------------------- void turret::Update(float deltaTime) { // A new instance of Input. Input* input = Input::getInstance(); // Create a temp rot float and Maxtrix. Matrix3 rottemp; float rot = 0; // Rotate the turret on these key presses. if (input->isKeyDown(INPUT_KEY_E)) rot = rotSpeed * deltaTime; if (input->isKeyDown(INPUT_KEY_Q)) rot = -rotSpeed * deltaTime; // Fire the turret. Fires Bullets. if (input->wasKeyPressed(INPUT_KEY_SPACE)) { // Move the bullet. Vector3 dir1 = GlobalTrasform[1]; bullets[bulletCount]->SetDir(CastTo<Vector2>(dir1)); bullets[bulletCount]->SetPosition(GetPosition().x, GetPosition().y); ++bulletCount; // If the bullket count get to 15 reset it. if (bulletCount >= 15) { bulletCount = 0; } } // Decouple the hierarchy between turret and antenna. if (input->isKeyDown(INPUT_KEY_LEFT_SHIFT)) { antenna->LocalToGlobal(); antenna->setParent(nullptr); } // Couple the hierarchy between turret and antenna. if (input->isKeyDown(INPUT_KEY_RIGHT_SHIFT)) { antenna->NewMatrix(); antenna->setParent(this); } // Update each bullet. for (int i = 0; i < 15; i++) { bullets[i]->Update(deltaTime); } // Set the rotation and update the local and global transform for turret. rottemp.setRotateZ(rot); localTransform = localTransform * rottemp; updateGlobalTransform(); // Update the antenna. antenna->Update(deltaTime); } //-------------------------------------------------------------------------------------- // Draw: A virtual function from entity to render (or "draw") objects to the screen. // // Param: // renderer2D: a pointer to Renderer2D for rendering objects to screen. //-------------------------------------------------------------------------------------- void turret::Draw(Renderer2D* renderer2D) { // Draw each of the bullets in the array. for (int i = 0; i < 15; i++) { bullets[i]->Draw(renderer2D); } // Call draw on enity. Entity::Draw(renderer2D); }
[ "thomas.wiltshire14@icloud.com" ]
thomas.wiltshire14@icloud.com
f1e4c010670a7080918de3e5601f4292bf8db193
d7987103b7b44ee5ee07dfe7e37e6bb1e6865099
/lab5/part2_1b.cpp
332924ca0eee92a322cf508a699b301e9c5d1a0c
[]
no_license
aasimalikhan/CS-314-Operating-System-Lab
301c248d19c2122cacd42fc1e8ffc2404c1425b8
8fa38bcc3d23a619a171586c560e30065ba5d726
refs/heads/main
2023-04-15T14:05:34.559361
2021-04-30T16:10:57
2021-04-30T16:10:57
null
0
0
null
null
null
null
UTF-8
C++
false
false
4,860
cpp
#include <bits/stdc++.h> #include <vector> #include <chrono> #include <semaphore.h> #include <thread> using namespace std; //Defining global Locks sem_t s; //Creating struct structure for reading pixels easily in ppm3 struct one_pixel { int red; int green; int blue; }; //This function converts an image to Grayscale by iterating over pixels and then rows and updating pixel values void ConvertGrayscale(int w, int h, vector<vector<one_pixel>> &values) { for (int p = 0; p < h; p++) { sem_wait(&s); for (int q = 0; q < w; q++) { //It will wait till the value of semaphore is 1, sets it 0 and then enters critical section. int colour_red = values[p][q].red; int colour_green = values[p][q].green; int colour_blue = values[p][q].blue; values[p][q].red = (colour_blue * 0.114) + (colour_red * 0.299) + (colour_green * 0.587); values[p][q].green = (colour_blue * 0.114) + (colour_red * 0.299) + (colour_green * 0.587); values[p][q].blue = (colour_blue * 0.114) + (colour_red * 0.299) + (colour_green * 0.587); //Unlocks Semaphore; } sem_post(&s); } } //This function does a horizontal blur which makes a photo as if it is in motion. void HorizontalBlur(int w, int h, vector<vector<one_pixel>> &values) { int BLUR_AMOUNT = 50; for (int p = 0; p < h; p++) { for (int q = 0; q < w; q++) { sem_wait(&s); int colour_red = values[p][q].red/2; int colour_green = values[p][q].green/2; int colour_blue = values[p][q].blue/2; if((w-q)<BLUR_AMOUNT) { int NEW_BLUR_AMOUNT = w-q; for(int u = q+1; u < w; u++) { colour_red += values[p][u].red * (0.5/NEW_BLUR_AMOUNT); colour_green += values[p][u].green * (0.5/NEW_BLUR_AMOUNT); colour_blue += values[p][u].blue * (0.5/NEW_BLUR_AMOUNT); } values[p][q].red = colour_red; values[p][q].blue = colour_blue; values[p][q].green = colour_green; sem_post(&s); continue; } for (int i = 1; i < BLUR_AMOUNT; i++) { colour_red += values[p][q+i].red * (0.5/BLUR_AMOUNT); colour_green += values[p][q+i].green * (0.5/BLUR_AMOUNT); colour_blue += values[p][q+i].blue * (0.5/BLUR_AMOUNT); } values[p][q].red = colour_red; values[p][q].blue = colour_blue; values[p][q].green = colour_green; sem_post(&s); } } } int main(int argc, char *argv[]) { int w, h, maxAscii; char PPM_VERSION[10]; FILE *input_image = fopen(argv[1], "r"); fscanf(input_image, "%s%d%d%d", PPM_VERSION, &w, &h, &maxAscii); // reading from file the PPM Version, Width, Height and Maximum Ascii value allowed. vector<vector<one_pixel>> values(h, vector<one_pixel>(w)); //Vector for reading and storing pixels as a matrix. int red, green, blue; for (int i = h - 1; i >= 0; i--) { for (int j = 0; j <= w - 1; j++) { //Storing RGB pixel values into above created matrix. fscanf(input_image, "%d%d%d", &red, &green, &blue); values[i][j].red = red; values[i][j].green = green; values[i][j].blue = blue; } } fclose(input_image); auto begin = chrono::high_resolution_clock::now(); // Starting the clock sem_init(&s, 0, 1); //Initialize Semaphore to 1 to use it as a lock. thread th1(ConvertGrayscale, w, h, std::ref(values));//Creating Thread for T1 thread th2(HorizontalBlur, w, h, std::ref(values));//Creating Thread for T2 th1.join(); th2.join(); //ConvertGrayscale(w, h, values); //T1 function on image //HorizontalBlur(w, h, values); //T2 function on image auto end = chrono::high_resolution_clock::now(); //Stopping the clock auto taken_time = chrono::duration_cast<chrono::microseconds>(end - begin); // Calculating the time taken by T1 and T2. cout << "Time: " << taken_time.count() << " microseconds"<< endl; FILE *output_image = fopen(argv[2], "w"); fprintf(output_image, "%s\n%d %d\n%d\n", PPM_VERSION, w, h, maxAscii); // Printing to the file the PPM Version, Width, Height and Maximum Ascii value allowed. for (int i = h - 1; i >= 0; i--) { for (int j = 0; j <= w - 1; j++) { // Printing RGB pixel values from above updated image matrix. fprintf(output_image, "%d ", values[i][j].red); fprintf(output_image, "%d ", values[i][j].green); fprintf(output_image, "%d ", values[i][j].blue); } fprintf(output_image, "\n"); } fclose(output_image); return 0; }
[ "balshersingh10@gmail.com" ]
balshersingh10@gmail.com
533b2f30f90afb46ca25e541c1e5663d4806116e
98b6b3063c80b82175a1ebe2f0ab35b026967481
/Codeforces/1455/A.cpp
97f09292fbd6e4a50997e957dcf0fa7038d2e539
[ "MIT" ]
permissive
AakashPawanGPS/competitive-programming
02c6f8a2ad55c7274f0d4aa668efe75ee9f39859
b2f1ad3a258c00da71e468316f020a88df5d8872
refs/heads/master
2023-05-27T14:32:01.669785
2021-06-14T04:17:09
2021-06-14T04:17:09
null
0
0
null
null
null
null
UTF-8
C++
false
false
1,227
cpp
#pragma GCC optimize("O3") #pragma GCC target("sse4") #include <bits/stdc++.h> using namespace std; #define deb(x) cout << #x << " is " << x << "\n" #define int long long #define mod 1000000007 #define PI acos(-1) template <typename T> using min_heap = priority_queue<T, vector<T>, greater<T>>; template <typename T> using max_heap = priority_queue<T>; template <typename... T> void read(T &... args) { ((cin >> args), ...); } template <typename... T> void write(T &&... args) { ((cout << args), ...); } template <typename T> void readContainer(T &t) { for (auto &e : t) read(e); } template <typename T> void writeContainer(T &t) { for (const auto &e : t) write(e, " "); write("\n"); } int f(int x) { string s = to_string(x); reverse(s.begin(), s.end()); x = stoi(s); return x; } int g(int x) { return x / f(f(x)); } void solve(int tc) { string s; read(s); write(s.size(), "\n"); } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); #ifndef ONLINE_JUDGE freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout); #endif int tc = 1; read(tc); for (int curr = 1; curr <= tc; curr++) solve(curr); return 0; }
[ "thedevelopersanjeev@gmail.com" ]
thedevelopersanjeev@gmail.com
b62b51d4f38cc01b681cf8f9936cbf99e5439084
e526e984459ebfc4e87e16cbb789a5c87c398c29
/task1.cpp
bb263f1269e6d97fe5ea7299e53baf5d17dc0917
[]
no_license
geetanshsoni1601/mycaptain-task1
bc823dea84a756c2009a241178994d97be94ad29
f2fd0b2b3209422782ff24a28d67a44d6411d8d0
refs/heads/main
2023-05-23T18:59:37.116520
2021-07-05T14:22:25
2021-07-05T14:22:25
383,166,400
0
0
null
null
null
null
UTF-8
C++
false
false
258
cpp
#include <iostream> using namespace std; int main(){ cout<< "size of char:"<< sizeof(char)<< endl ; cout<< "size of int:"<< sizeof(int)<< endl ; cout<< "size of float:"<< sizeof(float)<< endl ; cout << "size of double:"<< sizeof(double)<< endl ; return 0; }
[ "noreply@github.com" ]
noreply@github.com
beff35eb08055738a134d733b781c4caf2d90328
d39ae1b1339634388b0ba8b7cdc1ae8ca7b45a8f
/Exàmens/Exàmens 2017-18/Guerra de plataformes.cc
57edb6f9ea29b9724f0b12715e7ca5ddbece3db2
[]
no_license
delefme/Algorismia
56840375ba866a51731702428f1535b0fd27cf5a
744412a6cc2061b2a15b0d1dd1012cb4c43fc29b
refs/heads/master
2022-12-02T22:10:45.809243
2020-08-08T20:35:11
2020-08-08T20:35:11
286,115,880
1
0
null
2020-08-08T20:38:06
2020-08-08T20:38:05
null
UTF-8
C++
false
false
2,195
cc
#include <iostream> #include <vector> using namespace std; void DFS (vector<vector<int> >& tauler, int& num, int fil, int col, vector<int>& numcas) { int n = tauler.size(); int m = tauler[0].size(); tauler[fil][col] = num; ++numcas[num]; if(fil > 0 and tauler[fil-1][col] == -2) DFS(tauler, num, fil-1, col, numcas); if(fil < n-1 and tauler[fil+1][col] == -2) DFS(tauler, num, fil+1, col, numcas); if(col > 0 and tauler[fil][col-1] == -2) DFS(tauler, num, fil, col-1, numcas); if(col < m-1 and tauler[fil][col+1] == -2) DFS(tauler, num, fil, col+1, numcas); } int main() { int f, c; cin >> f >> c; vector<vector<int> > tauler (f, vector<int> (c)); for (int i = 0; i < f; ++i) { for (int j = 0; j < c; ++j){ char x; cin >> x; if(x == 'X') tauler[i][j] = -2; else tauler[i][j] = -1; } } int num = 0; vector<int> numcas; for (int i = 0; i < f; ++i) { for (int j = 0; j < c; ++j){ if(tauler[i][j] == -2) { numcas.push_back(0); DFS(tauler, num, i, j, numcas); ++num; } } } vector<vector<bool> > tocat(f, vector<bool> (c, false)); int numenfonsats = 0; bool fi = false; bool repeated = false; int x, y; while (cin >> x >> y and fi == false) { cout << x << ' ' << y << ": "; --x; --y; if(tocat[x][y] == true) { cout << "REPEATED" << endl; fi = true; repeated = true; } else { tocat[x][y] = true; if(tauler[x][y] == -1) cout << "miss" << endl; else { --numcas[tauler[x][y]]; if(numcas[tauler[x][y]] > 0) cout << "hit" << endl; else { cout << "hit and sunk" << endl; ++numenfonsats; if(numenfonsats == num) { fi = true; cout << "VICTORY" << endl; } } } } } if (not fi and not repeated) cout << "UNFINISHED" << endl; }
[ "noreply@github.com" ]
noreply@github.com
329b6ec4b9a6b50ee8b8997bbab0cc70b975c141
86e81838f1c5a6d82601923a7f6183caa322c8ec
/Indian_Tales/Plugins/Wwise/Source/AkAudio/Private/AkWaapiBlueprints/AkWaapiUri.cpp
d270b30d876cfb7be2173ee4f75ac6cffcb39306
[]
no_license
AmorHeitor/Indian_Tales
d1af852b7c86d4d460bb741ee05e834b331a032a
063a446c3d1a26ca9778487092d6dd73979b8460
refs/heads/master
2022-12-02T15:49:45.292198
2020-08-14T18:22:04
2020-08-14T18:22:04
286,623,660
2
0
null
null
null
null
UTF-8
C++
false
false
6,240
cpp
// Copyright (c) 2006-2017 Audiokinetic Inc. / All Rights Reserved /*------------------------------------------------------------------------------------ AkWaapiUri.cpp ------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------ includes. ------------------------------------------------------------------------------------*/ #include "AkWaapiBlueprints/AkWaapiUri.h" #include "AkAudioDevice.h" #include "Widgets/Input/SSearchBox.h" #include "Widgets/Input/SButton.h" #include "Misc/ScopedSlowTask.h" #include "Framework/Application/SlateApplication.h" #include "AkAudioStyle.h" /*------------------------------------------------------------------------------------ Defines ------------------------------------------------------------------------------------*/ #define LOCTEXT_NAMESPACE "AkAudio" DEFINE_LOG_CATEGORY(LogAkUri); /*------------------------------------------------------------------------------------ Statics and Globals ------------------------------------------------------------------------------------*/ namespace SAkWaapiUri_Helpers { #include "AkWaapiUriList.inc" } /*------------------------------------------------------------------------------------ Helpers ------------------------------------------------------------------------------------*/ /*------------------------------------------------------------------------------------ UAkWaapiUriConv ------------------------------------------------------------------------------------*/ UAkWaapiUriConv::UAkWaapiUriConv(const class FObjectInitializer& ObjectInitializer) : Super(ObjectInitializer) { // Property initialization } FString UAkWaapiUriConv::Conv_FAkWaapiUriToString(const FAkWaapiUri& INAkWaapiUri) { return INAkWaapiUri.Uri; } FText UAkWaapiUriConv::Conv_FAkWaapiUriToText(const FAkWaapiUri& INAkWaapiUri) { return FText::FromString(*INAkWaapiUri.Uri); } /*------------------------------------------------------------------------------------ SAkWaapiUri ------------------------------------------------------------------------------------*/ SAkWaapiUri::SAkWaapiUri() {} SAkWaapiUri::~SAkWaapiUri() {} void SAkWaapiUri::Construct(const FArguments& InArgs) { OnDragDetected = InArgs._OnDragDetected; OnSelectionChanged = InArgs._OnSelectionChanged; if (InArgs._FocusSearchBoxWhenOpened) { RegisterActiveTimer(0.f, FWidgetActiveTimerDelegate::CreateSP(this, &SAkWaapiUri::SetFocusPostConstruct)); } SearchBoxFilter = MakeShareable(new StringFilter(StringFilter::FItemToStringArray::CreateSP(this, &SAkWaapiUri::PopulateSearchStrings))); SearchBoxFilter->OnChanged().AddSP(this, &SAkWaapiUri::FilterUpdated); ChildSlot [ SNew(SBorder) .Padding(4) .BorderImage(FAkAudioStyle::GetBrush("AudiokineticTools.GroupBorder")) [ SNew(SVerticalBox) // Search + SVerticalBox::Slot() .AutoHeight() .Padding(0, 1, 0, 3) [ SNew(SHorizontalBox) + SHorizontalBox::Slot() .AutoWidth() [ InArgs._SearchContent.Widget ] + SHorizontalBox::Slot() .FillWidth(1.0f) [ SAssignNew(SearchBoxPtr, SSearchBox) .HintText(LOCTEXT("UriSearchHint", "Search a Uri")) .ToolTipText(LOCTEXT("UriSearchTooltip", "Type here to search for a Uri")) .OnTextChanged(SearchBoxFilter.Get(), &StringFilter::SetRawFilterText) .SelectAllTextWhenFocused(false) .DelayChangeNotificationsWhileTyping(true) ] ] // Tree + SVerticalBox::Slot() .FillHeight(1.f) [ SAssignNew(ListViewPtr, SListView< TSharedPtr<FString> >) .ListItemsSource(&UriList) .OnGenerateRow(this, &SAkWaapiUri::GenerateRow) .ItemHeight(18) .SelectionMode(InArgs._SelectionMode) .OnSelectionChanged(this, &SAkWaapiUri::ListSelectionChanged) .ClearSelectionOnClick(false) ] ] ]; for (const auto& Uri : SAkWaapiUri_Helpers::FullUriList) { UriList.Add(MakeShareable(new FString(Uri))); } UriList.Sort([](TSharedPtr< FString > Firststr, TSharedPtr< FString > Secondstr) { return *Firststr.Get() < *Secondstr.Get(); }); ListViewPtr->RequestListRefresh(); } TSharedRef<ITableRow> SAkWaapiUri::GenerateRow(TSharedPtr<FString> in_Uri, const TSharedRef<STableViewBase>& OwnerTable) { check(in_Uri.IsValid()); TSharedPtr<ITableRow> NewRow = SNew(STableRow< TSharedPtr<FString> >, OwnerTable) [ SNew(STextBlock) .Text(FText::FromString(*in_Uri.Get())) .HighlightText(SearchBoxFilter.Get(), &StringFilter::GetRawFilterText) ]; return NewRow.ToSharedRef(); } void SAkWaapiUri::PopulateSearchStrings(const FString& in_Uri, OUT TArray< FString >& OutSearchStrings) const { OutSearchStrings.Add(in_Uri); } void SAkWaapiUri::FilterUpdated() { FScopedSlowTask SlowTask(2.f, LOCTEXT("AK_PopulatingPicker", "Populating Uri Picker...")); SlowTask.MakeDialog(); UriList.Empty(SAkWaapiUri_Helpers::FullUriListSize); FString FilterString = SearchBoxFilter->GetRawFilterText().ToString(); if (FilterString.IsEmpty()) { for (const auto& Uri : SAkWaapiUri_Helpers::FullUriList) { UriList.Add(MakeShareable(new FString(Uri))); } } else { for (const auto& Uri : SAkWaapiUri_Helpers::FullUriList) { if (Uri.Contains(FilterString)) { UriList.Add(MakeShareable(new FString(Uri))); } } } UriList.Sort([](TSharedPtr< FString > Firststr, TSharedPtr< FString > Secondstr) { return *Firststr.Get() < *Secondstr.Get(); }); ListViewPtr->RequestListRefresh(); } void SAkWaapiUri::ListSelectionChanged(TSharedPtr< FString > in_Uri, ESelectInfo::Type /*SelectInfo*/) { if (OnSelectionChanged.IsBound()) OnSelectionChanged.Execute(in_Uri, ESelectInfo::OnMouseClick); } const TArray<TSharedPtr<FString>> SAkWaapiUri::GetSelectedUri() const { return ListViewPtr->GetSelectedItems(); } EActiveTimerReturnType SAkWaapiUri::SetFocusPostConstruct(double InCurrentTime, float InDeltaTime) { FWidgetPath WidgetToFocusPath; FSlateApplication::Get().GeneratePathToWidgetUnchecked(SearchBoxPtr.ToSharedRef(), WidgetToFocusPath); FSlateApplication::Get().SetKeyboardFocus(WidgetToFocusPath, EFocusCause::SetDirectly); return EActiveTimerReturnType::Stop; } #undef LOCTEXT_NAMESPACE
[ "heitornescau@hotmail.com" ]
heitornescau@hotmail.com
d37cfa95d04bde1c7ed3bec2ff23ed8742f2ce8e
0ab72b7740337ec0bcfec102aa7c740ce3e60ca3
/include/simplified/system/interaction/function/pairwise/corelj612/_allocate.h
e31400c852023904772aa889f68b82fdc7253b5a
[]
no_license
junwang-nju/mysimulator
1d1af4ad7ddbe114433ebdadd92de8bb3a45c04f
9c99970173ce87c249d2a2ca6e6df3a29dfc9b86
refs/heads/master
2021-01-10T21:43:01.198526
2012-12-15T23:22:56
2012-12-15T23:22:56
3,367,116
0
0
null
null
null
null
UTF-8
C++
false
false
819
h
#ifndef _System_Interaction_Function_Pairwise_CoreLJ612_Allocate_H_ #define _System_Interaction_Function_Pairwise_CoreLJ612_Allocate_H_ #include "system/vec-type-selector.h" #include "system/interaction/function/pairwise/corelj612/pre-name.h" #include "system/interaction/function/pairwise/corelj612/post-name.h" #include "system/interaction/function/pairwise/corelj612/vec-name.h" #include "array-2d/interface.h" namespace mysimulator { template <unsigned int DIM> void _allocate_func_pair_corelj612( Array<Double>& _pre, Array<Double>& _post, Array2D<Double,ArrayKernelName::SSE,__system_vec_type<DIM>::NAME>& _vec) { _pre.allocate(PairCoreLJ612PreName::NumberPre); _post.allocate(PairCoreLJ612PostName::NumberPost); _vec.allocate(PairCoreLJ612VecName::NumberVec,DIM); } } #endif
[ "junwang.nju@gmai.com" ]
junwang.nju@gmai.com
f1029848bdb7f7cc2fead38d92e61e781ace0683
55540f3e86f1d5d86ef6b5d295a63518e274efe3
/components/network/thread/openthread/src/ncp/ncp_base_mtd.cpp
d51c1f05d197347a36cf798df1e9af0bc98dea1e
[ "Apache-2.0", "BSD-3-Clause", "LicenseRef-scancode-warranty-disclaimer" ]
permissive
bouffalolab/bl_iot_sdk
bc5eaf036b70f8c65dd389439062b169f8d09daa
b90664de0bd4c1897a9f1f5d9e360a9631d38b34
refs/heads/master
2023-08-31T03:38:03.369853
2023-08-16T08:50:33
2023-08-18T09:13:27
307,347,250
244
101
Apache-2.0
2023-08-28T06:29:02
2020-10-26T11:16:30
C
UTF-8
C++
false
false
155,568
cpp
/* * Copyright (c) 2016-2017, The OpenThread Authors. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * 1. Redistributions of source code must retain the above copyright * notice, this list of conditions and the following disclaimer. * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * 3. Neither the name of the copyright holder nor the * names of its contributors may be used to endorse or promote products * derived from this software without specific prior written permission. * * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ /** * @file * This file implements minimal thread device required Spinel interface to the OpenThread stack. */ #include "openthread-core-config.h" #include "ncp_base.hpp" #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #include <openthread/border_router.h> #endif #if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE #include <openthread/channel_monitor.h> #endif #if OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE #include <openthread/child_supervision.h> #endif #include <openthread/diag.h> #include <openthread/icmp6.h> #if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #include <openthread/jam_detection.h> #endif #include <openthread/ncp.h> #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE #include <openthread/network_time.h> #endif #include <openthread/platform/misc.h> #include <openthread/platform/radio.h> #if OPENTHREAD_FTD #include <openthread/thread_ftd.h> #endif #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE #include <openthread/server.h> #endif #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) #include "openthread/backbone_router.h" #endif #if OPENTHREAD_CONFIG_SRP_CLIENT_BUFFERS_ENABLE #include <openthread/srp_client_buffers.h> #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE #include <openthread/trel.h> #endif #include "common/code_utils.hpp" #include "common/debug.hpp" #include "common/instance.hpp" #include "common/string.hpp" #include "net/ip6.hpp" #if OPENTHREAD_MTD || OPENTHREAD_FTD namespace ot { namespace Ncp { static uint8_t BorderRouterConfigToFlagByte(const otBorderRouterConfig &aConfig) { uint8_t flags = 0; if (aConfig.mPreferred) { flags |= SPINEL_NET_FLAG_PREFERRED; } if (aConfig.mSlaac) { flags |= SPINEL_NET_FLAG_SLAAC; } if (aConfig.mDhcp) { flags |= SPINEL_NET_FLAG_DHCP; } if (aConfig.mDefaultRoute) { flags |= SPINEL_NET_FLAG_DEFAULT_ROUTE; } if (aConfig.mConfigure) { flags |= SPINEL_NET_FLAG_CONFIGURE; } if (aConfig.mOnMesh) { flags |= SPINEL_NET_FLAG_ON_MESH; } flags |= (static_cast<uint8_t>(aConfig.mPreference) << SPINEL_NET_FLAG_PREFERENCE_OFFSET); return flags; } static uint8_t BorderRouterConfigToFlagByteExtended(const otBorderRouterConfig &aConfig) { uint8_t flags = 0; if (aConfig.mNdDns) { flags |= SPINEL_NET_FLAG_EXT_DNS; } if (aConfig.mDp) { flags |= SPINEL_NET_FLAG_EXT_DP; } return flags; } static uint8_t ExternalRouteConfigToFlagByte(const otExternalRouteConfig &aConfig) { uint8_t flags = 0; switch (aConfig.mPreference) { case OT_ROUTE_PREFERENCE_LOW: flags |= SPINEL_ROUTE_PREFERENCE_LOW; break; case OT_ROUTE_PREFERENCE_HIGH: flags |= SPINEL_ROUTE_PREFERENCE_HIGH; break; case OT_ROUTE_PREFERENCE_MED: default: flags |= SPINEL_ROUTE_PREFERENCE_MEDIUM; break; } if (aConfig.mNat64) { flags |= SPINEL_ROUTE_FLAG_NAT64; } return flags; } uint8_t NcpBase::LinkFlagsToFlagByte(bool aRxOnWhenIdle, bool aDeviceType, bool aNetworkData) { uint8_t flags(0); if (aRxOnWhenIdle) { flags |= SPINEL_THREAD_MODE_RX_ON_WHEN_IDLE; } if (aDeviceType) { flags |= SPINEL_THREAD_MODE_FULL_THREAD_DEV; } if (aNetworkData) { flags |= SPINEL_THREAD_MODE_FULL_NETWORK_DATA; } return flags; } otError NcpBase::EncodeNeighborInfo(const otNeighborInfo &aNeighborInfo) { otError error; uint8_t modeFlags; modeFlags = LinkFlagsToFlagByte(aNeighborInfo.mRxOnWhenIdle, aNeighborInfo.mFullThreadDevice, aNeighborInfo.mFullNetworkData); SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(aNeighborInfo.mExtAddress)); SuccessOrExit(error = mEncoder.WriteUint16(aNeighborInfo.mRloc16)); SuccessOrExit(error = mEncoder.WriteUint32(aNeighborInfo.mAge)); SuccessOrExit(error = mEncoder.WriteUint8(aNeighborInfo.mLinkQualityIn)); SuccessOrExit(error = mEncoder.WriteInt8(aNeighborInfo.mAverageRssi)); SuccessOrExit(error = mEncoder.WriteUint8(modeFlags)); SuccessOrExit(error = mEncoder.WriteBool(aNeighborInfo.mIsChild)); SuccessOrExit(error = mEncoder.WriteUint32(aNeighborInfo.mLinkFrameCounter)); SuccessOrExit(error = mEncoder.WriteUint32(aNeighborInfo.mMleFrameCounter)); SuccessOrExit(error = mEncoder.WriteInt8(aNeighborInfo.mLastRssi)); SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE otError NcpBase::EncodeLinkMetricsValues(const otLinkMetricsValues *aMetricsValues) { otError error = OT_ERROR_NONE; SuccessOrExit(error = mEncoder.OpenStruct()); if (aMetricsValues->mMetrics.mPduCount) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(SPINEL_THREAD_LINK_METRIC_PDU_COUNT)); SuccessOrExit(error = mEncoder.WriteUint32(aMetricsValues->mPduCountValue)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aMetricsValues->mMetrics.mLqi) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(SPINEL_THREAD_LINK_METRIC_LQI)); SuccessOrExit(error = mEncoder.WriteUint8(aMetricsValues->mLqiValue)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aMetricsValues->mMetrics.mLinkMargin) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(SPINEL_THREAD_LINK_METRIC_LINK_MARGIN)); SuccessOrExit(error = mEncoder.WriteUint8(aMetricsValues->mLinkMarginValue)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aMetricsValues->mMetrics.mRssi) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(SPINEL_THREAD_LINK_METRIC_RSSI)); SuccessOrExit(error = mEncoder.WriteInt8(aMetricsValues->mRssiValue)); SuccessOrExit(error = mEncoder.CloseStruct()); } SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } #endif #if OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_CSL_PERIOD>(void) { uint16_t cslPeriod; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint16(cslPeriod)); error = otLinkCslSetPeriod(mInstance, cslPeriod); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_CSL_PERIOD>(void) { return mEncoder.WriteUint16(otLinkCslGetPeriod(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_CSL_TIMEOUT>(void) { uint32_t cslTimeout; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint32(cslTimeout)); error = otLinkCslSetTimeout(mInstance, cslTimeout); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_CSL_TIMEOUT>(void) { return mEncoder.WriteUint32(otLinkCslGetTimeout(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_CSL_CHANNEL>(void) { uint8_t cslChannel; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint8(cslChannel)); error = otLinkCslSetChannel(mInstance, cslChannel); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_CSL_CHANNEL>(void) { return mEncoder.WriteUint8(otLinkCslGetChannel(mInstance)); } #endif // OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE #if OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MLR_REQUEST>(void) { otError error = OT_ERROR_NONE; otIp6Address addresses[OT_IP6_MAX_MLR_ADDRESSES]; uint8_t addressesCount = 0U; bool timeoutPresent = false; uint32_t timeout; SuccessOrExit(error = mDecoder.OpenStruct()); while (mDecoder.GetRemainingLengthInStruct()) { VerifyOrExit(addressesCount < Ip6AddressesTlv::kMaxAddresses, error = OT_ERROR_NO_BUFS); SuccessOrExit(error = mDecoder.ReadIp6Address(addresses[addressesCount])); ++addressesCount; } SuccessOrExit(error = mDecoder.CloseStruct()); while (mDecoder.GetRemainingLengthInStruct()) { uint8_t paramId; SuccessOrExit(error = mDecoder.OpenStruct()); SuccessOrExit(error = mDecoder.ReadUint8(paramId)); switch (paramId) { case SPINEL_THREAD_MLR_PARAMID_TIMEOUT: SuccessOrExit(error = mDecoder.ReadUint32(timeout)); timeoutPresent = true; break; default: ExitNow(error = OT_ERROR_INVALID_ARGS); } SuccessOrExit(error = mDecoder.CloseStruct()); } SuccessOrExit(error = otIp6RegisterMulticastListeners(mInstance, addresses, addressesCount, timeoutPresent ? &timeout : nullptr, &NcpBase::HandleMlrRegResult_Jump, this)); exit: return error; } void NcpBase::HandleMlrRegResult_Jump(void * aContext, otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum) { static_cast<NcpBase *>(aContext)->HandleMlrRegResult(aError, aMlrStatus, aFailedAddresses, aFailedAddressNum); } void NcpBase::HandleMlrRegResult(otError aError, uint8_t aMlrStatus, const otIp6Address *aFailedAddresses, uint8_t aFailedAddressNum) { SuccessOrExit(mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_THREAD_MLR_RESPONSE)); SuccessOrExit(mEncoder.WriteUint8(static_cast<uint8_t>(ThreadErrorToSpinelStatus(aError)))); SuccessOrExit(mEncoder.WriteUint8(aMlrStatus)); SuccessOrExit(mEncoder.OpenStruct()); if (aError == OT_ERROR_NONE) { for (size_t i = 0U; i < aFailedAddressNum; ++i) { SuccessOrExit(mEncoder.WriteIp6Address(aFailedAddresses[i])); } } SuccessOrExit(mEncoder.CloseStruct()); SuccessOrExit(mEncoder.EndFrame()); exit: return; } #endif // OPENTHREAD_FTD && OPENTHREAD_CONFIG_TMF_PROXY_MLR_ENABLE && OPENTHREAD_CONFIG_COMMISSIONER_ENABLE #if (OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2) template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_BACKBONE_ROUTER_PRIMARY>(void) { otError error = OT_ERROR_NONE; otBackboneRouterConfig bbrConfig; SuccessOrExit(error = otBackboneRouterGetPrimary(mInstance, &bbrConfig)); SuccessOrExit(error = mEncoder.WriteUint16(bbrConfig.mServer16)); SuccessOrExit(error = mEncoder.WriteUint16(bbrConfig.mReregistrationDelay)); SuccessOrExit(error = mEncoder.WriteUint32(bbrConfig.mMlrTimeout)); SuccessOrExit(error = mEncoder.WriteUint8(bbrConfig.mSequenceNumber)); exit: return error; } #endif // OPENTHREAD_CONFIG_THREAD_VERSION >= OT_THREAD_VERSION_1_2 template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_DATA_POLL_PERIOD>(void) { return mEncoder.WriteUint32(otLinkGetPollPeriod(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_DATA_POLL_PERIOD>(void) { uint32_t pollPeriod; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint32(pollPeriod)); error = otLinkSetPollPeriod(mInstance, pollPeriod); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_EXTENDED_ADDR>(void) { return mEncoder.WriteEui64(*otLinkGetExtendedAddress(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>(void) { return mEncoder.WriteUint8(otLinkGetMaxFrameRetriesDirect(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_MAX_RETRY_NUMBER_DIRECT>(void) { uint8_t maxFrameRetriesDirect; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint8(maxFrameRetriesDirect)); otLinkSetMaxFrameRetriesDirect(mInstance, maxFrameRetriesDirect); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_PHY_CHAN_SUPPORTED>(void) { uint32_t newMask = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = DecodeChannelMask(newMask)); error = otLinkSetSupportedChannelMask(mInstance, newMask); exit: return error; } otError NcpBase::CommandHandler_NET_CLEAR(uint8_t aHeader) { return PrepareLastStatusResponse(aHeader, ThreadErrorToSpinelStatus(otInstanceErasePersistentInfo(mInstance))); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_SAVED>(void) { return mEncoder.WriteBool(otDatasetIsCommissioned(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_IF_UP>(void) { return mEncoder.WriteBool(otIp6IsEnabled(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_IF_UP>(void) { bool enabled = false; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadBool(enabled)); error = otIp6SetEnabled(mInstance, enabled); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_STACK_UP>(void) { return mEncoder.WriteBool(otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_STACK_UP>(void) { bool enabled = false; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadBool(enabled)); // If the value has changed... if (enabled != (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED)) { if (enabled) { error = otThreadSetEnabled(mInstance, true); StartLegacy(); } else { error = otThreadSetEnabled(mInstance, false); StopLegacy(); } } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_ROLE>(void) { spinel_net_role_t role(SPINEL_NET_ROLE_DETACHED); switch (otThreadGetDeviceRole(mInstance)) { case OT_DEVICE_ROLE_DISABLED: case OT_DEVICE_ROLE_DETACHED: role = SPINEL_NET_ROLE_DETACHED; break; case OT_DEVICE_ROLE_CHILD: role = SPINEL_NET_ROLE_CHILD; break; case OT_DEVICE_ROLE_ROUTER: role = SPINEL_NET_ROLE_ROUTER; break; case OT_DEVICE_ROLE_LEADER: role = SPINEL_NET_ROLE_LEADER; break; } return mEncoder.WriteUint8(role); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_ROLE>(void) { unsigned int role = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUintPacked(role)); switch (role) { case SPINEL_NET_ROLE_DETACHED: error = otThreadBecomeDetached(mInstance); break; #if OPENTHREAD_FTD case SPINEL_NET_ROLE_ROUTER: error = otThreadBecomeRouter(mInstance); break; case SPINEL_NET_ROLE_LEADER: error = otThreadBecomeLeader(mInstance); break; #endif // OPENTHREAD_FTD case SPINEL_NET_ROLE_CHILD: error = otThreadBecomeChild(mInstance); break; } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_NETWORK_NAME>(void) { return mEncoder.WriteUtf8(otThreadGetNetworkName(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_NETWORK_NAME>(void) { const char *string = nullptr; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUtf8(string)); error = otThreadSetNetworkName(mInstance, string); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_XPANID>(void) { return mEncoder.WriteData(otThreadGetExtendedPanId(mInstance)->m8, sizeof(spinel_net_xpanid_t)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_XPANID>(void) { const uint8_t *ptr = nullptr; uint16_t len; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadData(ptr, len)); VerifyOrExit(len == sizeof(spinel_net_xpanid_t), error = OT_ERROR_PARSE); error = otThreadSetExtendedPanId(mInstance, reinterpret_cast<const otExtendedPanId *>(ptr)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_NETWORK_KEY>(void) { otNetworkKey networkKey; otThreadGetNetworkKey(mInstance, &networkKey); return mEncoder.WriteData(networkKey.m8, OT_NETWORK_KEY_SIZE); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_NETWORK_KEY>(void) { const uint8_t *ptr = nullptr; uint16_t len; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadData(ptr, len)); VerifyOrExit(len == OT_NETWORK_KEY_SIZE, error = OT_ERROR_PARSE); error = otThreadSetNetworkKey(mInstance, reinterpret_cast<const otNetworkKey *>(ptr)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER>(void) { return mEncoder.WriteUint32(otThreadGetKeySequenceCounter(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER>(void) { uint32_t keySeqCounter; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint32(keySeqCounter)); otThreadSetKeySequenceCounter(mInstance, keySeqCounter); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_PARTITION_ID>(void) { return mEncoder.WriteUint32(otThreadGetPartitionId(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME>(void) { return mEncoder.WriteUint32(otThreadGetKeySwitchGuardTime(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_KEY_SWITCH_GUARDTIME>(void) { uint32_t keyGuardTime; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint32(keyGuardTime)); otThreadSetKeySwitchGuardTime(mInstance, keyGuardTime); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_DATA_VERSION>(void) { return mEncoder.WriteUint8(otNetDataGetVersion(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_STABLE_NETWORK_DATA_VERSION>(void) { return mEncoder.WriteUint8(otNetDataGetStableVersion(mInstance)); } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_DATA>(void) { uint8_t networkData[255]; uint8_t networkDataLen = 255; IgnoreError(otBorderRouterGetNetData(mInstance, false, // Stable? networkData, &networkDataLen)); return mEncoder.WriteData(networkData, networkDataLen); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_STABLE_NETWORK_DATA>(void) { uint8_t networkData[255]; uint8_t networkDataLen = 255; IgnoreError(otBorderRouterGetNetData(mInstance, true, // Stable? networkData, &networkDataLen)); return mEncoder.WriteData(networkData, networkDataLen); } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_LEADER_NETWORK_DATA>(void) { uint8_t networkData[255]; uint8_t networkDataLen = 255; IgnoreError(otNetDataGet(mInstance, false, // Stable? networkData, &networkDataLen)); return mEncoder.WriteData(networkData, networkDataLen); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_STABLE_LEADER_NETWORK_DATA>(void) { uint8_t networkData[255]; uint8_t networkDataLen = 255; IgnoreError(otNetDataGet(mInstance, true, // Stable? networkData, &networkDataLen)); return mEncoder.WriteData(networkData, networkDataLen); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_LEADER_RID>(void) { return mEncoder.WriteUint8(otThreadGetLeaderRouterId(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_LEADER_ADDR>(void) { otError error = OT_ERROR_NONE; otIp6Address address; error = otThreadGetLeaderRloc(mInstance, &address); if (error == OT_ERROR_NONE) { error = mEncoder.WriteIp6Address(address); } else { error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error)); } return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_PARENT>(void) { otError error = OT_ERROR_NONE; otRouterInfo parentInfo; error = otThreadGetParentInfo(mInstance, &parentInfo); if (error == OT_ERROR_NONE) { if (parentInfo.mLinkEstablished) { int8_t averageRssi; int8_t lastRssi; IgnoreError(otThreadGetParentAverageRssi(mInstance, &averageRssi)); IgnoreError(otThreadGetParentLastRssi(mInstance, &lastRssi)); SuccessOrExit(error = mEncoder.WriteEui64(parentInfo.mExtAddress)); SuccessOrExit(error = mEncoder.WriteUint16(parentInfo.mRloc16)); SuccessOrExit(error = mEncoder.WriteUint32(parentInfo.mAge)); SuccessOrExit(error = mEncoder.WriteInt8(averageRssi)); SuccessOrExit(error = mEncoder.WriteInt8(lastRssi)); SuccessOrExit(error = mEncoder.WriteUint8(parentInfo.mLinkQualityIn)); SuccessOrExit(error = mEncoder.WriteUint8(parentInfo.mLinkQualityOut)); } else { SuccessOrExit(error = mEncoder.OverwriteWithLastStatusError(SPINEL_STATUS_ITEM_NOT_FOUND)); } } else { error = mEncoder.OverwriteWithLastStatusError(ThreadErrorToSpinelStatus(error)); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NEIGHBOR_TABLE>(void) { otError error = OT_ERROR_NONE; otNeighborInfoIterator iter = OT_NEIGHBOR_INFO_ITERATOR_INIT; otNeighborInfo neighInfo; while (otThreadGetNextNeighborInfo(mInstance, &iter, &neighInfo) == OT_ERROR_NONE) { SuccessOrExit(error = EncodeNeighborInfo(neighInfo)); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NEIGHBOR_TABLE_ERROR_RATES>(void) { otError error = OT_ERROR_NONE; otNeighborInfoIterator iter = OT_NEIGHBOR_INFO_ITERATOR_INIT; otNeighborInfo neighInfo; while (otThreadGetNextNeighborInfo(mInstance, &iter, &neighInfo) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(neighInfo.mExtAddress)); SuccessOrExit(error = mEncoder.WriteUint16(neighInfo.mRloc16)); SuccessOrExit(error = mEncoder.WriteUint16(neighInfo.mFrameErrorRate)); SuccessOrExit(error = mEncoder.WriteUint16(neighInfo.mMessageErrorRate)); SuccessOrExit(error = mEncoder.WriteInt8(neighInfo.mAverageRssi)); SuccessOrExit(error = mEncoder.WriteInt8(neighInfo.mLastRssi)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_ASSISTING_PORTS>(void) { otError error = OT_ERROR_NONE; uint8_t numEntries = 0; const uint16_t *ports = otIp6GetUnsecurePorts(mInstance, &numEntries); for (; numEntries != 0; ports++, numEntries--) { SuccessOrExit(error = mEncoder.WriteUint16(*ports)); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ASSISTING_PORTS>(void) { otError error = OT_ERROR_NONE; // First, we need to remove all of the current assisting ports. otIp6RemoveAllUnsecurePorts(mInstance); while (mDecoder.GetRemainingLengthInStruct() >= sizeof(uint16_t)) { uint16_t port; SuccessOrExit(error = mDecoder.ReadUint16(port)); SuccessOrExit(error = otIp6AddUnsecurePort(mInstance, port)); } exit: if (error != OT_ERROR_NONE) { // We had an error, but we've actually changed // the state of these ports, so we need to report // those incomplete changes via an asynchronous // change event. IgnoreError( WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_PROP_THREAD_ASSISTING_PORTS)); } return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE>(void) { return mEncoder.WriteBool(mAllowLocalNetworkDataChange); } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ALLOW_LOCAL_NET_DATA_CHANGE>(void) { bool value = false; otError error = OT_ERROR_NONE; bool shouldRegisterWithLeader = false; SuccessOrExit(error = mDecoder.ReadBool(value)); // Register any net data changes on transition from `true` to `false`. shouldRegisterWithLeader = mAllowLocalNetworkDataChange && !value; mAllowLocalNetworkDataChange = value; exit: if (shouldRegisterWithLeader) { IgnoreError(otBorderRouterRegister(mInstance)); } return error; } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_ON_MESH_NETS>(void) { otError error = OT_ERROR_NONE; otBorderRouterConfig borderRouterConfig; otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT; // Fill from non-local network data first while (otNetDataGetNextOnMeshPrefix(mInstance, &iter, &borderRouterConfig) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(borderRouterConfig.mPrefix.mPrefix)); SuccessOrExit(error = mEncoder.WriteUint8(borderRouterConfig.mPrefix.mLength)); SuccessOrExit(error = mEncoder.WriteBool(borderRouterConfig.mStable)); SuccessOrExit(error = mEncoder.WriteUint8(BorderRouterConfigToFlagByte(borderRouterConfig))); SuccessOrExit(error = mEncoder.WriteBool(false)); // isLocal SuccessOrExit(error = mEncoder.WriteUint16(borderRouterConfig.mRloc16)); SuccessOrExit(error = mEncoder.WriteUint8(BorderRouterConfigToFlagByteExtended(borderRouterConfig))); SuccessOrExit(error = mEncoder.CloseStruct()); } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE iter = OT_NETWORK_DATA_ITERATOR_INIT; // Fill from local network data last while (otBorderRouterGetNextOnMeshPrefix(mInstance, &iter, &borderRouterConfig) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(borderRouterConfig.mPrefix.mPrefix)); SuccessOrExit(error = mEncoder.WriteUint8(borderRouterConfig.mPrefix.mLength)); SuccessOrExit(error = mEncoder.WriteBool(borderRouterConfig.mStable)); SuccessOrExit(error = mEncoder.WriteUint8(BorderRouterConfigToFlagByte(borderRouterConfig))); SuccessOrExit(error = mEncoder.WriteBool(true)); // isLocal SuccessOrExit(error = mEncoder.WriteUint16(borderRouterConfig.mRloc16)); SuccessOrExit(error = mEncoder.WriteUint8(BorderRouterConfigToFlagByteExtended(borderRouterConfig))); SuccessOrExit(error = mEncoder.CloseStruct()); } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE exit: return error; } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_THREAD_ON_MESH_NETS>(void) { otError error = OT_ERROR_NONE; otBorderRouterConfig borderRouterConfig; bool stable = false; bool isLocal; uint8_t flags = 0; uint8_t flagsExtended = 0; uint8_t prefixLength; uint16_t rloc16; memset(&borderRouterConfig, 0, sizeof(otBorderRouterConfig)); VerifyOrExit(mAllowLocalNetworkDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadIp6Address(borderRouterConfig.mPrefix.mPrefix)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLength)); SuccessOrExit(error = mDecoder.ReadBool(stable)); SuccessOrExit(error = mDecoder.ReadUint8(flags)); borderRouterConfig.mPrefix.mLength = prefixLength; borderRouterConfig.mStable = stable; borderRouterConfig.mPreference = ((flags & SPINEL_NET_FLAG_PREFERENCE_MASK) >> SPINEL_NET_FLAG_PREFERENCE_OFFSET); borderRouterConfig.mPreferred = ((flags & SPINEL_NET_FLAG_PREFERRED) != 0); borderRouterConfig.mSlaac = ((flags & SPINEL_NET_FLAG_SLAAC) != 0); borderRouterConfig.mDhcp = ((flags & SPINEL_NET_FLAG_DHCP) != 0); borderRouterConfig.mConfigure = ((flags & SPINEL_NET_FLAG_CONFIGURE) != 0); borderRouterConfig.mDefaultRoute = ((flags & SPINEL_NET_FLAG_DEFAULT_ROUTE) != 0); borderRouterConfig.mOnMesh = ((flags & SPINEL_NET_FLAG_ON_MESH) != 0); // A new field 'TLV flags extended' has been added to the SPINEL_PROP_THREAD_ON_MESH_NETS property. // To correctly handle a new field for INSERT command, the additional fields 'isLocal' and 'rloc16' are read and // ignored. if ((mDecoder.ReadBool(isLocal) == OT_ERROR_NONE) && (mDecoder.ReadUint16(rloc16) == OT_ERROR_NONE) && (mDecoder.ReadUint8(flagsExtended) == OT_ERROR_NONE)) { borderRouterConfig.mNdDns = ((flagsExtended & SPINEL_NET_FLAG_EXT_DNS) != 0); borderRouterConfig.mDp = ((flagsExtended & SPINEL_NET_FLAG_EXT_DP) != 0); } error = otBorderRouterAddOnMeshPrefix(mInstance, &borderRouterConfig); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_THREAD_ON_MESH_NETS>(void) { otError error = OT_ERROR_NONE; otIp6Prefix ip6Prefix; uint8_t prefixLength; memset(&ip6Prefix, 0, sizeof(otIp6Prefix)); VerifyOrExit(mAllowLocalNetworkDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadIp6Address(ip6Prefix.mPrefix)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLength)); ip6Prefix.mLength = prefixLength; error = otBorderRouterRemoveOnMeshPrefix(mInstance, &ip6Prefix); // If prefix was not on the list, "remove" command can be considred // successful. if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; } exit: return error; } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE #if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE>(void) { return mEncoder.WriteBool(mAllowLocalServerDataChange); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SERVER_ALLOW_LOCAL_DATA_CHANGE>(void) { bool value = false; otError error = OT_ERROR_NONE; bool shouldRegisterWithLeader = false; SuccessOrExit(error = mDecoder.ReadBool(value)); // Register any server data changes on transition from `true` to `false`. shouldRegisterWithLeader = mAllowLocalServerDataChange && !value; mAllowLocalServerDataChange = value; exit: if (shouldRegisterWithLeader) { IgnoreError(otServerRegister(mInstance)); } return error; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_SERVER_SERVICES>(void) { otError error = OT_ERROR_NONE; otServiceConfig cfg; bool stable; const uint8_t * data; uint16_t dataLen; VerifyOrExit(mAllowLocalServerDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadUint32(cfg.mEnterpriseNumber)); SuccessOrExit(error = mDecoder.ReadDataWithLen(data, dataLen)); VerifyOrExit((dataLen <= sizeof(cfg.mServiceData)), error = OT_ERROR_INVALID_ARGS); memcpy(cfg.mServiceData, data, dataLen); static_assert((sizeof(cfg.mServiceData) <= UINT8_MAX), "Cannot handle full range of buffer length"); cfg.mServiceDataLength = static_cast<uint8_t>(dataLen); SuccessOrExit(error = mDecoder.ReadBool(stable)); cfg.mServerConfig.mStable = stable; SuccessOrExit(error = mDecoder.ReadDataWithLen(data, dataLen)); VerifyOrExit((dataLen <= sizeof(cfg.mServerConfig.mServerData)), error = OT_ERROR_INVALID_ARGS); memcpy(cfg.mServerConfig.mServerData, data, dataLen); static_assert((sizeof(cfg.mServerConfig.mServerData) <= UINT8_MAX), "Cannot handle full range of buffer length"); cfg.mServerConfig.mServerDataLength = static_cast<uint8_t>(dataLen); SuccessOrExit(error = otServerAddService(mInstance, &cfg)); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_SERVER_SERVICES>(void) { otError error = OT_ERROR_NONE; uint32_t enterpriseNumber; const uint8_t *serviceData; uint16_t serviceDataLength; VerifyOrExit(mAllowLocalServerDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadUint32(enterpriseNumber)); SuccessOrExit(error = mDecoder.ReadDataWithLen(serviceData, serviceDataLength)); VerifyOrExit(serviceDataLength <= UINT8_MAX, error = OT_ERROR_INVALID_ARGS); SuccessOrExit(error = otServerRemoveService(mInstance, enterpriseNumber, serviceData, static_cast<uint8_t>(serviceDataLength))); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SERVER_SERVICES>(void) { otError error = OT_ERROR_NONE; otNetworkDataIterator iterator = OT_NETWORK_DATA_ITERATOR_INIT; otServiceConfig cfg; while (otServerGetNextService(mInstance, &iterator, &cfg) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint32(cfg.mEnterpriseNumber)); SuccessOrExit(error = mEncoder.WriteDataWithLen(cfg.mServiceData, cfg.mServiceDataLength)); SuccessOrExit(error = mEncoder.WriteBool(cfg.mServerConfig.mStable)); SuccessOrExit( error = mEncoder.WriteDataWithLen(cfg.mServerConfig.mServerData, cfg.mServerConfig.mServerDataLength)); SuccessOrExit(error = mEncoder.WriteUint16(cfg.mServerConfig.mRloc16)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } #endif // OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SERVER_LEADER_SERVICES>(void) { otError error = OT_ERROR_NONE; otNetworkDataIterator iterator = OT_NETWORK_DATA_ITERATOR_INIT; otServiceConfig cfg; while (otNetDataGetNextService(mInstance, &iterator, &cfg) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(cfg.mServiceId)); SuccessOrExit(error = mEncoder.WriteUint32(cfg.mEnterpriseNumber)); SuccessOrExit(error = mEncoder.WriteDataWithLen(cfg.mServiceData, cfg.mServiceDataLength)); SuccessOrExit(error = mEncoder.WriteBool(cfg.mServerConfig.mStable)); SuccessOrExit( error = mEncoder.WriteDataWithLen(cfg.mServerConfig.mServerData, cfg.mServerConfig.mServerDataLength)); SuccessOrExit(error = mEncoder.WriteUint16(cfg.mServerConfig.mRloc16)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG>(void) { return mEncoder.WriteBool(mDiscoveryScanJoinerFlag); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_JOINER_FLAG>(void) { return mDecoder.ReadBool(mDiscoveryScanJoinerFlag); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING>(void) { return mEncoder.WriteBool(mDiscoveryScanEnableFiltering); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_ENABLE_FILTERING>(void) { return mDecoder.ReadBool(mDiscoveryScanEnableFiltering); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_PANID>(void) { return mEncoder.WriteUint16(mDiscoveryScanPanId); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_DISCOVERY_SCAN_PANID>(void) { return mDecoder.ReadUint16(mDiscoveryScanPanId); } otError NcpBase::EncodeOperationalDataset(const otOperationalDataset &aDataset) { otError error = OT_ERROR_NONE; if (aDataset.mComponents.mIsActiveTimestampPresent) { const otTimestamp &activeTimestamp = aDataset.mActiveTimestamp; SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP)); SuccessOrExit(error = mEncoder.WriteUint64(activeTimestamp.mSeconds)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsPendingTimestampPresent) { const otTimestamp &pendingTimestamp = aDataset.mPendingTimestamp; SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_PENDING_TIMESTAMP)); SuccessOrExit(error = mEncoder.WriteUint64(pendingTimestamp.mSeconds)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsNetworkKeyPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_NET_NETWORK_KEY)); SuccessOrExit(error = mEncoder.WriteData(aDataset.mNetworkKey.m8, OT_NETWORK_KEY_SIZE)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsNetworkNamePresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_NET_NETWORK_NAME)); SuccessOrExit(error = mEncoder.WriteUtf8(aDataset.mNetworkName.m8)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsExtendedPanIdPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_NET_XPANID)); SuccessOrExit(error = mEncoder.WriteData(aDataset.mExtendedPanId.m8, OT_EXT_PAN_ID_SIZE)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsMeshLocalPrefixPresent) { otIp6Address addr; memcpy(addr.mFields.m8, aDataset.mMeshLocalPrefix.m8, 8); memset(addr.mFields.m8 + 8, 0, 8); // Zero out the last 8 bytes. SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_IPV6_ML_PREFIX)); SuccessOrExit(error = mEncoder.WriteIp6Address(addr)); // Mesh local prefix SuccessOrExit(error = mEncoder.WriteUint8(OT_IP6_PREFIX_BITSIZE)); // Prefix length (in bits) SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsDelayPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_DELAY_TIMER)); SuccessOrExit(error = mEncoder.WriteUint32(aDataset.mDelay)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsPanIdPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_MAC_15_4_PANID)); SuccessOrExit(error = mEncoder.WriteUint16(aDataset.mPanId)); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsChannelPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_PHY_CHAN)); // The channel is stored in Dataset as `uint16_t` (to accommodate // larger number of channels in sub-GHz band), however the current // definition of `SPINEL_PROP_PHY_CHAN` property limits the channel // to a `uint8_t`. SuccessOrExit(error = mEncoder.WriteUint8(static_cast<uint8_t>(aDataset.mChannel))); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsPskcPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_NET_PSKC)); SuccessOrExit(error = mEncoder.WriteData(aDataset.mPskc.m8, sizeof(spinel_net_pskc_t))); SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsSecurityPolicyPresent) { uint8_t flags[2]; static_cast<const SecurityPolicy &>(aDataset.mSecurityPolicy).GetFlags(flags, sizeof(flags)); SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_DATASET_SECURITY_POLICY)); SuccessOrExit(error = mEncoder.WriteUint16(aDataset.mSecurityPolicy.mRotationTime)); SuccessOrExit(error = mEncoder.WriteUint8(flags[0])); if (otThreadGetVersion() >= OT_THREAD_VERSION_1_2) { SuccessOrExit(error = mEncoder.WriteUint8(flags[1])); } SuccessOrExit(error = mEncoder.CloseStruct()); } if (aDataset.mComponents.mIsChannelMaskPresent) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROP_PHY_CHAN_SUPPORTED)); SuccessOrExit(error = EncodeChannelMask(aDataset.mChannelMask)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_ACTIVE_DATASET>(void) { otOperationalDataset dataset; IgnoreError(otDatasetGetActive(mInstance, &dataset)); return EncodeOperationalDataset(dataset); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_PENDING_DATASET>(void) { otOperationalDataset dataset; IgnoreError(otDatasetGetPending(mInstance, &dataset)); return EncodeOperationalDataset(dataset); } otError NcpBase::DecodeOperationalDataset(otOperationalDataset &aDataset, const uint8_t ** aTlvs, uint8_t * aTlvsLength, const otIp6Address ** aDestIpAddress, bool aAllowEmptyValues) { otError error = OT_ERROR_NONE; memset(&aDataset, 0, sizeof(otOperationalDataset)); if (aTlvs != nullptr) { *aTlvs = nullptr; } if (aTlvsLength != nullptr) { *aTlvsLength = 0; } if (aDestIpAddress != nullptr) { *aDestIpAddress = nullptr; } while (!mDecoder.IsAllReadInStruct()) { unsigned int propKey; SuccessOrExit(error = mDecoder.OpenStruct()); SuccessOrExit(error = mDecoder.ReadUintPacked(propKey)); switch (static_cast<spinel_prop_key_t>(propKey)) { case SPINEL_PROP_DATASET_ACTIVE_TIMESTAMP: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mActiveTimestamp.mSeconds)); aDataset.mActiveTimestamp.mTicks = 0; aDataset.mActiveTimestamp.mAuthoritative = false; } aDataset.mComponents.mIsActiveTimestampPresent = true; break; case SPINEL_PROP_DATASET_PENDING_TIMESTAMP: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUint64(aDataset.mPendingTimestamp.mSeconds)); aDataset.mPendingTimestamp.mTicks = 0; aDataset.mPendingTimestamp.mAuthoritative = false; } aDataset.mComponents.mIsPendingTimestampPresent = true; break; case SPINEL_PROP_NET_NETWORK_KEY: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const uint8_t *key; uint16_t len; SuccessOrExit(error = mDecoder.ReadData(key, len)); VerifyOrExit(len == OT_NETWORK_KEY_SIZE, error = OT_ERROR_INVALID_ARGS); memcpy(aDataset.mNetworkKey.m8, key, len); } aDataset.mComponents.mIsNetworkKeyPresent = true; break; case SPINEL_PROP_NET_NETWORK_NAME: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const char *name; size_t len; SuccessOrExit(error = mDecoder.ReadUtf8(name)); len = strlen(name); VerifyOrExit(len <= OT_NETWORK_NAME_MAX_SIZE, error = OT_ERROR_INVALID_ARGS); memcpy(aDataset.mNetworkName.m8, name, len + 1); } aDataset.mComponents.mIsNetworkNamePresent = true; break; case SPINEL_PROP_NET_XPANID: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const uint8_t *xpanid; uint16_t len; SuccessOrExit(error = mDecoder.ReadData(xpanid, len)); VerifyOrExit(len == OT_EXT_PAN_ID_SIZE, error = OT_ERROR_INVALID_ARGS); memcpy(aDataset.mExtendedPanId.m8, xpanid, len); } aDataset.mComponents.mIsExtendedPanIdPresent = true; break; case SPINEL_PROP_IPV6_ML_PREFIX: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const otIp6Address *addr; uint8_t prefixLen; SuccessOrExit(error = mDecoder.ReadIp6Address(addr)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLen)); VerifyOrExit(prefixLen == OT_IP6_PREFIX_BITSIZE, error = OT_ERROR_INVALID_ARGS); memcpy(aDataset.mMeshLocalPrefix.m8, addr, OT_MESH_LOCAL_PREFIX_SIZE); } aDataset.mComponents.mIsMeshLocalPrefixPresent = true; break; case SPINEL_PROP_DATASET_DELAY_TIMER: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUint32(aDataset.mDelay)); } aDataset.mComponents.mIsDelayPresent = true; break; case SPINEL_PROP_MAC_15_4_PANID: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mPanId)); } aDataset.mComponents.mIsPanIdPresent = true; break; case SPINEL_PROP_PHY_CHAN: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { uint8_t channel; SuccessOrExit(error = mDecoder.ReadUint8(channel)); aDataset.mChannel = channel; } aDataset.mComponents.mIsChannelPresent = true; break; case SPINEL_PROP_NET_PSKC: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const uint8_t *psk; uint16_t len; SuccessOrExit(error = mDecoder.ReadData(psk, len)); VerifyOrExit(len == OT_PSKC_MAX_SIZE, error = OT_ERROR_INVALID_ARGS); memcpy(aDataset.mPskc.m8, psk, OT_PSKC_MAX_SIZE); } aDataset.mComponents.mIsPskcPresent = true; break; case SPINEL_PROP_DATASET_SECURITY_POLICY: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { uint8_t flags[2]; uint8_t flagsLength = 1; SuccessOrExit(error = mDecoder.ReadUint16(aDataset.mSecurityPolicy.mRotationTime)); SuccessOrExit(error = mDecoder.ReadUint8(flags[0])); if (otThreadGetVersion() >= OT_THREAD_VERSION_1_2 && mDecoder.GetRemainingLengthInStruct() > 0) { SuccessOrExit(error = mDecoder.ReadUint8(flags[1])); ++flagsLength; } static_cast<SecurityPolicy &>(aDataset.mSecurityPolicy).SetFlags(flags, flagsLength); } aDataset.mComponents.mIsSecurityPolicyPresent = true; break; case SPINEL_PROP_PHY_CHAN_SUPPORTED: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { uint8_t channel; aDataset.mChannelMask = 0; while (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUint8(channel)); VerifyOrExit(channel <= 31, error = OT_ERROR_INVALID_ARGS); aDataset.mChannelMask |= (1UL << channel); } } aDataset.mComponents.mIsChannelMaskPresent = true; break; case SPINEL_PROP_DATASET_RAW_TLVS: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const uint8_t *tlvs; uint16_t len; SuccessOrExit(error = mDecoder.ReadData(tlvs, len)); VerifyOrExit(len <= 255, error = OT_ERROR_INVALID_ARGS); if (aTlvs != nullptr) { *aTlvs = tlvs; } if (aTlvsLength != nullptr) { *aTlvsLength = static_cast<uint8_t>(len); } } break; case SPINEL_PROP_DATASET_DEST_ADDRESS: if (!aAllowEmptyValues || !mDecoder.IsAllReadInStruct()) { const otIp6Address *addr; SuccessOrExit(error = mDecoder.ReadIp6Address(addr)); if (aDestIpAddress != nullptr) { *aDestIpAddress = addr; } } break; default: break; } SuccessOrExit(error = mDecoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_ACTIVE_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; SuccessOrExit(error = DecodeOperationalDataset(dataset)); error = otDatasetSetActive(mInstance, &dataset); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_PENDING_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; SuccessOrExit(error = DecodeOperationalDataset(dataset)); error = otDatasetSetPending(mInstance, &dataset); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_ACTIVE_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; const uint8_t * extraTlvs; uint8_t extraTlvsLength; SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength)); error = otDatasetSendMgmtActiveSet(mInstance, &dataset, extraTlvs, extraTlvsLength, /* aCallback */ nullptr, /* aContext */ nullptr); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_SET_PENDING_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; const uint8_t * extraTlvs; uint8_t extraTlvsLength; SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength)); error = otDatasetSendMgmtPendingSet(mInstance, &dataset, extraTlvs, extraTlvsLength, /* aCallback */ nullptr, /* aContext */ nullptr); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_ACTIVE_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; const uint8_t * extraTlvs; uint8_t extraTlvsLength; const otIp6Address * destIpAddress; SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength, &destIpAddress, true)); error = otDatasetSendMgmtActiveGet(mInstance, &dataset.mComponents, extraTlvs, extraTlvsLength, destIpAddress); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MGMT_GET_PENDING_DATASET>(void) { otError error = OT_ERROR_NONE; otOperationalDataset dataset; const uint8_t * extraTlvs; uint8_t extraTlvsLength; const otIp6Address * destIpAddress; SuccessOrExit(error = DecodeOperationalDataset(dataset, &extraTlvs, &extraTlvsLength, &destIpAddress, true)); error = otDatasetSendMgmtPendingGet(mInstance, &dataset.mComponents, extraTlvs, extraTlvsLength, destIpAddress); exit: return error; } #if OPENTHREAD_CONFIG_JOINER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MESHCOP_JOINER_STATE>(void) { spinel_meshcop_joiner_state_t state = SPINEL_MESHCOP_JOINER_STATE_IDLE; switch (otJoinerGetState(mInstance)) { case OT_JOINER_STATE_IDLE: state = SPINEL_MESHCOP_JOINER_STATE_IDLE; break; case OT_JOINER_STATE_DISCOVER: state = SPINEL_MESHCOP_JOINER_STATE_DISCOVER; break; case OT_JOINER_STATE_CONNECT: state = SPINEL_MESHCOP_JOINER_STATE_CONNECTING; break; case OT_JOINER_STATE_CONNECTED: state = SPINEL_MESHCOP_JOINER_STATE_CONNECTED; break; case OT_JOINER_STATE_ENTRUST: state = SPINEL_MESHCOP_JOINER_STATE_ENTRUST; break; case OT_JOINER_STATE_JOINED: state = SPINEL_MESHCOP_JOINER_STATE_JOINED; break; } return mEncoder.WriteUint8(state); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MESHCOP_JOINER_COMMISSIONING>(void) { otError error = OT_ERROR_NONE; bool action = false; const char *psk = nullptr; const char *provisioningUrl = nullptr; const char *vendorName = nullptr; const char *vendorModel = nullptr; const char *vendorSwVersion = nullptr; const char *vendorData = nullptr; SuccessOrExit(error = mDecoder.ReadBool(action)); if (!action) { otJoinerStop(mInstance); ExitNow(); } SuccessOrExit(error = mDecoder.ReadUtf8(psk)); // Parse optional fields if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUtf8(provisioningUrl)); } if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUtf8(vendorName)); } if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUtf8(vendorModel)); } if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUtf8(vendorSwVersion)); } if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadUtf8(vendorData)); } // Use OpenThread default values for vendor name, mode, sw version if // not specified or an empty string is given. if ((vendorName == nullptr) || (vendorName[0] == 0)) { vendorName = PACKAGE_NAME; } if ((vendorModel == nullptr) || (vendorModel[0] == 0)) { vendorModel = OPENTHREAD_CONFIG_PLATFORM_INFO; } if ((vendorSwVersion == nullptr) || (vendorSwVersion[0] == 0)) { vendorSwVersion = PACKAGE_VERSION; } error = otJoinerStart(mInstance, psk, provisioningUrl, vendorName, vendorModel, vendorSwVersion, vendorData, &NcpBase::HandleJoinerCallback_Jump, this); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MESHCOP_JOINER_DISCERNER>(void) { otError error; const otJoinerDiscerner *discerner = otJoinerGetDiscerner(mInstance); if (discerner == nullptr) { SuccessOrExit(error = mEncoder.WriteUint8(0)); } else { SuccessOrExit(error = mEncoder.WriteUint8(discerner->mLength)); SuccessOrExit(error = mEncoder.WriteUint64(discerner->mValue)); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MESHCOP_JOINER_DISCERNER>(void) { otError error = OT_ERROR_NONE; otJoinerDiscerner discerner; SuccessOrExit(error = mDecoder.ReadUint8(discerner.mLength)); if (discerner.mLength == 0) { // Clearing any previously set Joiner Discerner error = otJoinerSetDiscerner(mInstance, nullptr); ExitNow(); } SuccessOrExit(error = mDecoder.ReadUint64(discerner.mValue)); error = otJoinerSetDiscerner(mInstance, &discerner); exit: return error; } #endif // OPENTHREAD_CONFIG_JOINER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ML_PREFIX>(void) { otError error = OT_ERROR_NONE; const otMeshLocalPrefix *mlPrefix = otThreadGetMeshLocalPrefix(mInstance); otIp6Address addr; VerifyOrExit(mlPrefix != nullptr); // If `mlPrefix` is nullptr send empty response. memcpy(addr.mFields.m8, mlPrefix->m8, 8); // Zero out the last 8 bytes. memset(addr.mFields.m8 + 8, 0, 8); SuccessOrExit(error = mEncoder.WriteIp6Address(addr)); // Mesh local prefix SuccessOrExit(error = mEncoder.WriteUint8(OT_IP6_PREFIX_BITSIZE)); // Prefix length (in bits) exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_IPV6_ML_PREFIX>(void) { otError error = OT_ERROR_NONE; const otIp6Address *meshLocalPrefix; uint8_t prefixLength; SuccessOrExit(error = mDecoder.ReadIp6Address(meshLocalPrefix)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLength)); VerifyOrExit(prefixLength == OT_IP6_PREFIX_BITSIZE, error = OT_ERROR_INVALID_ARGS); error = otThreadSetMeshLocalPrefix(mInstance, reinterpret_cast<const otMeshLocalPrefix *>(meshLocalPrefix)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ML_ADDR>(void) { otError error = OT_ERROR_NONE; const otIp6Address *ml64 = otThreadGetMeshLocalEid(mInstance); VerifyOrExit(ml64 != nullptr); SuccessOrExit(error = mEncoder.WriteIp6Address(*ml64)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_LL_ADDR>(void) { otError error = OT_ERROR_NONE; const otIp6Address *address = otThreadGetLinkLocalIp6Address(mInstance); VerifyOrExit(address != nullptr); SuccessOrExit(error = mEncoder.WriteIp6Address(*address)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; for (const otNetifAddress *address = otIp6GetUnicastAddresses(mInstance); address; address = address->mNext) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(address->mAddress)); SuccessOrExit(error = mEncoder.WriteUint8(address->mPrefixLength)); SuccessOrExit(error = mEncoder.WriteUint32(address->mPreferred ? 0xffffffff : 0)); SuccessOrExit(error = mEncoder.WriteUint32(address->mValid ? 0xffffffff : 0)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_IPV6_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; otNetifAddress netifAddr; uint32_t preferredLifetime; uint32_t validLifetime; SuccessOrExit(error = mDecoder.ReadIp6Address(netifAddr.mAddress)); SuccessOrExit(error = mDecoder.ReadUint8(netifAddr.mPrefixLength)); SuccessOrExit(error = mDecoder.ReadUint32(preferredLifetime)); SuccessOrExit(error = mDecoder.ReadUint32(validLifetime)); netifAddr.mAddressOrigin = OT_ADDRESS_ORIGIN_MANUAL; netifAddr.mPreferred = (preferredLifetime != 0); netifAddr.mValid = (validLifetime != 0); error = otIp6AddUnicastAddress(mInstance, &netifAddr); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_IPV6_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; const otIp6Address *addrPtr; SuccessOrExit(error = mDecoder.ReadIp6Address(addrPtr)); error = otIp6RemoveUnicastAddress(mInstance, addrPtr); // If address was not on the list, "remove" command is successful. if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ROUTE_TABLE>(void) { // TODO: Implement get route table return mEncoder.OverwriteWithLastStatusError(SPINEL_STATUS_UNIMPLEMENTED); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD>(void) { return mEncoder.WriteBool(otIcmp6GetEchoMode(mInstance) != OT_ICMP6_ECHO_HANDLER_DISABLED); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD>(void) { bool enabled = false; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadBool(enabled)); otIcmp6SetEchoMode(mInstance, enabled ? OT_ICMP6_ECHO_HANDLER_ALL : OT_ICMP6_ECHO_HANDLER_DISABLED); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; const otNetifMulticastAddress *address; for (address = otIp6GetMulticastAddresses(mInstance); address; address = address->mNext) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(address->mAddress)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; const otIp6Address *addrPtr; SuccessOrExit(error = mDecoder.ReadIp6Address(addrPtr)); error = otIp6SubscribeMulticastAddress(mInstance, addrPtr); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; } exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE>(void) { otError error = OT_ERROR_NONE; const otIp6Address *addrPtr; SuccessOrExit(error = mDecoder.ReadIp6Address(addrPtr)); error = otIp6UnsubscribeMulticastAddress(mInstance, addrPtr); // If the address was not on the list, "remove" command is successful, // and we respond with a `SPINEL_STATUS_OK` status. if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD_MODE>(void) { spinel_ipv6_icmp_ping_offload_mode_t mode = SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED; switch (otIcmp6GetEchoMode(mInstance)) { case OT_ICMP6_ECHO_HANDLER_DISABLED: mode = SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED; break; case OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY: mode = SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY; break; case OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY: mode = SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY; break; case OT_ICMP6_ECHO_HANDLER_ALL: mode = SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL; break; }; return mEncoder.WriteUint8(mode); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_IPV6_ICMP_PING_OFFLOAD_MODE>(void) { otError error = OT_ERROR_NONE; otIcmp6EchoMode mode = OT_ICMP6_ECHO_HANDLER_DISABLED; uint8_t spinelMode; SuccessOrExit(error = mDecoder.ReadUint8(spinelMode)); switch (spinelMode) { case SPINEL_IPV6_ICMP_PING_OFFLOAD_DISABLED: mode = OT_ICMP6_ECHO_HANDLER_DISABLED; break; case SPINEL_IPV6_ICMP_PING_OFFLOAD_UNICAST_ONLY: mode = OT_ICMP6_ECHO_HANDLER_UNICAST_ONLY; break; case SPINEL_IPV6_ICMP_PING_OFFLOAD_MULTICAST_ONLY: mode = OT_ICMP6_ECHO_HANDLER_MULTICAST_ONLY; break; case SPINEL_IPV6_ICMP_PING_OFFLOAD_ALL: mode = OT_ICMP6_ECHO_HANDLER_ALL; break; }; otIcmp6SetEchoMode(mInstance, mode); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_RLOC16_DEBUG_PASSTHRU>(void) { // Note reverse logic: passthru enabled = filter disabled return mEncoder.WriteBool(!otIp6IsReceiveFilterEnabled(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_RLOC16_DEBUG_PASSTHRU>(void) { bool enabled = false; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadBool(enabled)); // Note reverse logic: passthru enabled = filter disabled otIp6SetReceiveFilterEnabled(mInstance, !enabled); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_OFF_MESH_ROUTES>(void) { otError error = OT_ERROR_NONE; otExternalRouteConfig routeConfig; otNetworkDataIterator iter = OT_NETWORK_DATA_ITERATOR_INIT; while (otNetDataGetNextRoute(mInstance, &iter, &routeConfig) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(routeConfig.mPrefix.mPrefix)); SuccessOrExit(error = mEncoder.WriteUint8(routeConfig.mPrefix.mLength)); SuccessOrExit(error = mEncoder.WriteBool(routeConfig.mStable)); SuccessOrExit(error = mEncoder.WriteUint8(ExternalRouteConfigToFlagByte(routeConfig))); SuccessOrExit(error = mEncoder.WriteBool(false)); // IsLocal SuccessOrExit(error = mEncoder.WriteBool(routeConfig.mNextHopIsThisDevice)); SuccessOrExit(error = mEncoder.WriteUint16(routeConfig.mRloc16)); SuccessOrExit(error = mEncoder.CloseStruct()); } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE iter = OT_NETWORK_DATA_ITERATOR_INIT; while (otBorderRouterGetNextRoute(mInstance, &iter, &routeConfig) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteIp6Address(routeConfig.mPrefix.mPrefix)); SuccessOrExit(error = mEncoder.WriteUint8(routeConfig.mPrefix.mLength)); SuccessOrExit(error = mEncoder.WriteBool(routeConfig.mStable)); SuccessOrExit(error = mEncoder.WriteUint8(ExternalRouteConfigToFlagByte(routeConfig))); SuccessOrExit(error = mEncoder.WriteBool(true)); // IsLocal SuccessOrExit(error = mEncoder.WriteBool(routeConfig.mNextHopIsThisDevice)); SuccessOrExit(error = mEncoder.WriteUint16(routeConfig.mRloc16)); SuccessOrExit(error = mEncoder.CloseStruct()); } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE exit: return error; } #if OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE static int FlagByteToExternalRoutePreference(uint8_t aFlags) { int route_preference = 0; switch (aFlags & SPINEL_NET_FLAG_PREFERENCE_MASK) { case SPINEL_ROUTE_PREFERENCE_HIGH: route_preference = OT_ROUTE_PREFERENCE_HIGH; break; case SPINEL_ROUTE_PREFERENCE_MEDIUM: route_preference = OT_ROUTE_PREFERENCE_MED; break; case SPINEL_ROUTE_PREFERENCE_LOW: route_preference = OT_ROUTE_PREFERENCE_LOW; break; } return route_preference; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_THREAD_OFF_MESH_ROUTES>(void) { otError error = OT_ERROR_NONE; otExternalRouteConfig routeConfig; bool stable = false; uint8_t flags = 0; uint8_t prefixLength; memset(&routeConfig, 0, sizeof(otExternalRouteConfig)); VerifyOrExit(mAllowLocalNetworkDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadIp6Address(routeConfig.mPrefix.mPrefix)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLength)); SuccessOrExit(error = mDecoder.ReadBool(stable)); SuccessOrExit(error = mDecoder.ReadUint8(flags)); routeConfig.mPrefix.mLength = prefixLength; routeConfig.mStable = stable; routeConfig.mPreference = FlagByteToExternalRoutePreference(flags); routeConfig.mNat64 = ((flags & SPINEL_ROUTE_FLAG_NAT64) != 0); error = otBorderRouterAddRoute(mInstance, &routeConfig); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_THREAD_OFF_MESH_ROUTES>(void) { otError error = OT_ERROR_NONE; otIp6Prefix ip6Prefix; uint8_t prefixLength; memset(&ip6Prefix, 0, sizeof(otIp6Prefix)); VerifyOrExit(mAllowLocalNetworkDataChange, error = OT_ERROR_INVALID_STATE); SuccessOrExit(error = mDecoder.ReadIp6Address(ip6Prefix.mPrefix)); SuccessOrExit(error = mDecoder.ReadUint8(prefixLength)); ip6Prefix.mLength = prefixLength; error = otBorderRouterRemoveRoute(mInstance, &ip6Prefix); // If the route prefix was not on the list, "remove" command is successful. if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; } exit: return error; } #endif // OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_STREAM_NET>(void) { const uint8_t *framePtr = nullptr; uint16_t frameLen = 0; const uint8_t *metaPtr = nullptr; uint16_t metaLen = 0; otMessage * message = nullptr; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadDataWithLen(framePtr, frameLen)); SuccessOrExit(error = mDecoder.ReadData(metaPtr, metaLen)); // We ignore metadata for now. // May later include TX power, allow retransmits, etc... // STREAM_NET requires layer 2 security. message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, nullptr); VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS); error = otIp6Send(mInstance, message); exit: if (error == OT_ERROR_NONE) { mInboundSecureIpFrameCounter++; } else { mDroppedInboundIpFrameCounter++; } return error; } #if OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECT_ENABLE>(void) { return mEncoder.WriteBool(otJamDetectionIsEnabled(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECTED>(void) { return mEncoder.WriteBool(otJamDetectionGetState(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECT_RSSI_THRESHOLD>(void) { return mEncoder.WriteInt8(otJamDetectionGetRssiThreshold(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECT_WINDOW>(void) { return mEncoder.WriteUint8(otJamDetectionGetWindow(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECT_BUSY>(void) { return mEncoder.WriteUint8(otJamDetectionGetBusyPeriod(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_JAM_DETECT_HISTORY_BITMAP>(void) { return mEncoder.WriteUint64(otJamDetectionGetHistoryBitmap(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_JAM_DETECT_ENABLE>(void) { bool enabled; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadBool(enabled)); if (enabled) { IgnoreError(otJamDetectionStart(mInstance, &NcpBase::HandleJamStateChange_Jump, this)); } else { IgnoreError(otJamDetectionStop(mInstance)); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_JAM_DETECT_RSSI_THRESHOLD>(void) { int8_t threshold = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadInt8(threshold)); error = otJamDetectionSetRssiThreshold(mInstance, threshold); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_JAM_DETECT_WINDOW>(void) { uint8_t window = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint8(window)); error = otJamDetectionSetWindow(mInstance, window); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_JAM_DETECT_BUSY>(void) { uint8_t busy = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint8(busy)); error = otJamDetectionSetBusyPeriod(mInstance, busy); exit: return error; } void NcpBase::HandleJamStateChange_Jump(bool aJamState, void *aContext) { static_cast<NcpBase *>(aContext)->HandleJamStateChange(aJamState); } void NcpBase::HandleJamStateChange(bool aJamState) { OT_UNUSED_VARIABLE(aJamState); mChangedPropsSet.AddProperty(SPINEL_PROP_JAM_DETECTED); mUpdateChangedPropsTask.Post(); } #endif // OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE #if OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT>(void) { return mEncoder.WriteUint16(otChildSupervisionGetCheckTimeout(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CHILD_SUPERVISION_CHECK_TIMEOUT>(void) { otError error = OT_ERROR_NONE; uint16_t timeout; SuccessOrExit(error = mDecoder.ReadUint16(timeout)); otChildSupervisionSetCheckTimeout(mInstance, timeout); exit: return error; } #endif // OPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE #if OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_INTERVAL>(void) { return mEncoder.WriteUint32(otChannelMonitorGetSampleInterval(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MONITOR_RSSI_THRESHOLD>(void) { return mEncoder.WriteInt8(otChannelMonitorGetRssiThreshold(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_WINDOW>(void) { return mEncoder.WriteUint32(otChannelMonitorGetSampleWindow(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MONITOR_SAMPLE_COUNT>(void) { return mEncoder.WriteUint32(otChannelMonitorGetSampleCount(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CHANNEL_MONITOR_CHANNEL_OCCUPANCY>(void) { otError error = OT_ERROR_NONE; uint32_t channelMask = otLinkGetSupportedChannelMask(mInstance); uint8_t channelNum = sizeof(channelMask) * CHAR_BIT; for (uint8_t channel = 0; channel < channelNum; channel++) { if (!((1UL << channel) & channelMask)) { continue; } SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint8(channel)); SuccessOrExit(error = mEncoder.WriteUint16(otChannelMonitorGetChannelOccupancy(mInstance, channel))); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } #endif // OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_CCA_FAILURE_RATE>(void) { return mEncoder.WriteUint16(otLinkGetCcaFailureRate(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_TOTAL>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxTotal); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_ACK_REQ>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxAckRequested); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_ACKED>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxAcked); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_NO_ACK_REQ>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxNoAckRequested); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_DATA>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxData); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_DATA_POLL>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxDataPoll); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_BEACON>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxBeacon); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_BEACON_REQ>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxBeaconRequest); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_OTHER>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxOther); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_RETRY>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxRetry); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_ERR_CCA>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxErrCca); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_UNICAST>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxUnicast); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_PKT_BROADCAST>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxBroadcast); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_ERR_ABORT>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mTxErrAbort); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_TOTAL>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxTotal); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_DATA>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxData); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_DATA_POLL>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxDataPoll); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_BEACON>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxBeacon); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_BEACON_REQ>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxBeaconRequest); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_OTHER>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxOther); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_FILT_WL>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxAddressFiltered); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_FILT_DA>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxDestAddrFiltered); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_DUP>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxDuplicated); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_UNICAST>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxUnicast); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_PKT_BROADCAST>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxBroadcast); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_EMPTY>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrNoFrame); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_UKWN_NBR>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrUnknownNeighbor); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_NVLD_SADDR>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrInvalidSrcAddr); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_SECURITY>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrSec); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_BAD_FCS>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrFcs); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_ERR_OTHER>(void) { return mEncoder.WriteUint32(otLinkGetCounters(mInstance)->mRxErrOther); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_IP_SEC_TOTAL>(void) { return mEncoder.WriteUint32(mInboundSecureIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_IP_INSEC_TOTAL>(void) { return mEncoder.WriteUint32(mInboundInsecureIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_IP_DROPPED>(void) { return mEncoder.WriteUint32(mDroppedInboundIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_IP_SEC_TOTAL>(void) { return mEncoder.WriteUint32(mOutboundSecureIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_IP_INSEC_TOTAL>(void) { return mEncoder.WriteUint32(mOutboundInsecureIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_IP_DROPPED>(void) { return mEncoder.WriteUint32(mDroppedOutboundIpFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_TX_SPINEL_TOTAL>(void) { return mEncoder.WriteUint32(mTxSpinelFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_SPINEL_TOTAL>(void) { return mEncoder.WriteUint32(mRxSpinelFrameCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_SPINEL_OUT_OF_ORDER_TID>(void) { return mEncoder.WriteUint32(mRxSpinelOutOfOrderTidCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_RX_SPINEL_ERR>(void) { return mEncoder.WriteUint32(mFramingErrorCounter); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_IP_TX_SUCCESS>(void) { return mEncoder.WriteUint32(otThreadGetIp6Counters(mInstance)->mTxSuccess); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_IP_RX_SUCCESS>(void) { return mEncoder.WriteUint32(otThreadGetIp6Counters(mInstance)->mRxSuccess); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_IP_TX_FAILURE>(void) { return mEncoder.WriteUint32(otThreadGetIp6Counters(mInstance)->mTxFailure); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_IP_RX_FAILURE>(void) { return mEncoder.WriteUint32(otThreadGetIp6Counters(mInstance)->mRxFailure); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MSG_BUFFER_COUNTERS>(void) { otError error = OT_ERROR_NONE; otBufferInfo bufferInfo; otMessageGetBufferInfo(mInstance, &bufferInfo); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mTotalBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mFreeBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.m6loSendQueue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.m6loSendQueue.mNumBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.m6loReassemblyQueue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.m6loReassemblyQueue.mNumBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mIp6Queue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mIp6Queue.mNumBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mMplQueue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mMplQueue.mNumBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mMleQueue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mMleQueue.mNumBuffers)); SuccessOrExit(error = mEncoder.WriteUint16(0)); // Write zero for ARP for backward compatibility. SuccessOrExit(error = mEncoder.WriteUint16(0)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mCoapQueue.mNumMessages)); SuccessOrExit(error = mEncoder.WriteUint16(bufferInfo.mCoapQueue.mNumBuffers)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_ALL_MAC_COUNTERS>(void) { otError error = OT_ERROR_NONE; const otMacCounters *counters = otLinkGetCounters(mInstance); // Encode Tx related counters SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxTotal)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxUnicast)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxBroadcast)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxAckRequested)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxAcked)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxNoAckRequested)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxData)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxDataPoll)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxBeacon)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxBeaconRequest)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxOther)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxRetry)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxErrCca)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxErrAbort)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxErrBusyChannel)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxDirectMaxRetryExpiry)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxIndirectMaxRetryExpiry)); SuccessOrExit(error = mEncoder.CloseStruct()); // Encode Rx related counters SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxTotal)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxUnicast)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxBroadcast)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxData)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxDataPoll)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxBeacon)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxBeaconRequest)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxOther)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxAddressFiltered)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxDestAddrFiltered)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxDuplicated)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrNoFrame)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrUnknownNeighbor)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrInvalidSrcAddr)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrSec)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrFcs)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxErrOther)); SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CNTR_ALL_MAC_COUNTERS>(void) { otLinkResetCounters(mInstance); return OT_ERROR_NONE; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_MLE_COUNTERS>(void) { otError error = OT_ERROR_NONE; const otMleCounters *counters = otThreadGetMleCounters(mInstance); OT_ASSERT(counters != nullptr); SuccessOrExit(error = mEncoder.WriteUint16(counters->mDisabledRole)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mDetachedRole)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mChildRole)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mRouterRole)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mLeaderRole)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mAttachAttempts)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mPartitionIdChanges)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mBetterPartitionAttachAttempts)); SuccessOrExit(error = mEncoder.WriteUint16(counters->mParentChanges)); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CNTR_MLE_COUNTERS>(void) { otThreadResetMleCounters(mInstance); return OT_ERROR_NONE; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_ALL_IP_COUNTERS>(void) { otError error = OT_ERROR_NONE; const otIpCounters *counters = otThreadGetIp6Counters(mInstance); OT_ASSERT(counters != nullptr); // Encode Tx related counters SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxSuccess)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mTxFailure)); SuccessOrExit(error = mEncoder.CloseStruct()); // Encode Rx related counters SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxSuccess)); SuccessOrExit(error = mEncoder.WriteUint32(counters->mRxFailure)); SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } #if OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_CNTR_MAC_RETRY_HISTOGRAM>(void) { otError error = OT_ERROR_NONE; const uint32_t *histogramDirect; const uint32_t *histogramIndirect; uint8_t histogramDirectEntries; uint8_t histogramIndirectEntries; histogramDirect = otLinkGetTxDirectRetrySuccessHistogram(mInstance, &histogramDirectEntries); histogramIndirect = otLinkGetTxIndirectRetrySuccessHistogram(mInstance, &histogramIndirectEntries); OT_ASSERT((histogramDirectEntries == 0) || (histogramDirect != nullptr)); OT_ASSERT((histogramIndirectEntries == 0) || (histogramIndirect != nullptr)); // Encode direct message retries histogram SuccessOrExit(error = mEncoder.OpenStruct()); for (uint8_t i = 0; i < histogramDirectEntries; i++) { SuccessOrExit(error = mEncoder.WriteUint32(histogramDirect[i])); } SuccessOrExit(error = mEncoder.CloseStruct()); // Encode indirect message retries histogram SuccessOrExit(error = mEncoder.OpenStruct()); for (uint8_t i = 0; i < histogramIndirectEntries; i++) { SuccessOrExit(error = mEncoder.WriteUint32(histogramIndirect[i])); } SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CNTR_MAC_RETRY_HISTOGRAM>(void) { otLinkResetTxRetrySuccessHistogram(mInstance); return OT_ERROR_NONE; } #endif // OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CNTR_ALL_IP_COUNTERS>(void) { otThreadResetIp6Counters(mInstance); return OT_ERROR_NONE; } #if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_ALLOWLIST>(void) { otMacFilterEntry entry; otMacFilterIterator iterator = OT_MAC_FILTER_ITERATOR_INIT; otError error = OT_ERROR_NONE; while (otLinkFilterGetNextAddress(mInstance, &iterator, &entry) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(entry.mExtAddress)); SuccessOrExit(error = mEncoder.WriteInt8(entry.mRssIn)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_ALLOWLIST_ENABLED>(void) { return mEncoder.WriteBool(otLinkFilterGetAddressMode(mInstance) == OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_DENYLIST>(void) { otMacFilterEntry entry; otMacFilterIterator iterator = OT_MAC_FILTER_ITERATOR_INIT; otError error = OT_ERROR_NONE; while (otLinkFilterGetNextAddress(mInstance, &iterator, &entry) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(entry.mExtAddress)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_DENYLIST_ENABLED>(void) { return mEncoder.WriteBool(otLinkFilterGetAddressMode(mInstance) == OT_MAC_FILTER_ADDRESS_MODE_DENYLIST); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_MAC_FIXED_RSS>(void) { otMacFilterEntry entry; otMacFilterIterator iterator = OT_MAC_FILTER_ITERATOR_INIT; otError error = OT_ERROR_NONE; while (otLinkFilterGetNextRssIn(mInstance, &iterator, &entry) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(entry.mExtAddress)); SuccessOrExit(error = mEncoder.WriteInt8(entry.mRssIn)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_ALLOWLIST>(void) { otError error = OT_ERROR_NONE; // First, clear the address filter entries. otLinkFilterClearAddresses(mInstance); while (mDecoder.GetRemainingLengthInStruct() > 0) { const otExtAddress *extAddress = nullptr; int8_t rss; SuccessOrExit(error = mDecoder.OpenStruct()); SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadInt8(rss)); } else { rss = OT_MAC_FILTER_FIXED_RSS_DISABLED; } SuccessOrExit(error = mDecoder.CloseStruct()); error = otLinkFilterAddAddress(mInstance, extAddress); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; } SuccessOrExit(error); if (rss != OT_MAC_FILTER_FIXED_RSS_DISABLED) { SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, extAddress, rss)); } } exit: // If we had an error, we may have actually changed // the state of the allowlist, so we need to report // those incomplete changes via an asynchronous // change event. if (error != OT_ERROR_NONE) { IgnoreError(WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_PROP_MAC_ALLOWLIST)); } return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_ALLOWLIST_ENABLED>(void) { bool enabled; otError error = OT_ERROR_NONE; otMacFilterAddressMode mode = OT_MAC_FILTER_ADDRESS_MODE_DISABLED; SuccessOrExit(error = mDecoder.ReadBool(enabled)); if (enabled) { mode = OT_MAC_FILTER_ADDRESS_MODE_ALLOWLIST; } otLinkFilterSetAddressMode(mInstance, mode); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_DENYLIST>(void) { otError error = OT_ERROR_NONE; // First, clear the address filter entries. otLinkFilterClearAddresses(mInstance); while (mDecoder.GetRemainingLengthInStruct() > 0) { const otExtAddress *extAddress = nullptr; SuccessOrExit(error = mDecoder.OpenStruct()); SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); SuccessOrExit(error = mDecoder.CloseStruct()); SuccessOrExit(error = otLinkFilterAddAddress(mInstance, extAddress)); } exit: // If we had an error, we may have actually changed // the state of the denylist, so we need to report // those incomplete changes via an asynchronous // change event. if (error != OT_ERROR_NONE) { IgnoreError(WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_PROP_MAC_DENYLIST)); } return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_DENYLIST_ENABLED>(void) { bool enabled; otError error = OT_ERROR_NONE; otMacFilterAddressMode mode = OT_MAC_FILTER_ADDRESS_MODE_DISABLED; SuccessOrExit(error = mDecoder.ReadBool(enabled)); if (enabled) { mode = OT_MAC_FILTER_ADDRESS_MODE_DENYLIST; } otLinkFilterSetAddressMode(mInstance, mode); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_MAC_FIXED_RSS>(void) { otError error = OT_ERROR_NONE; // First, clear the address filter entries. otLinkFilterClearAllRssIn(mInstance); while (mDecoder.GetRemainingLengthInStruct() > 0) { const otExtAddress *extAddress; int8_t rss; SuccessOrExit(error = mDecoder.OpenStruct()); if (mDecoder.GetRemainingLengthInStruct() > sizeof(otExtAddress)) { SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); } else { extAddress = nullptr; } SuccessOrExit(error = mDecoder.ReadInt8(rss)); SuccessOrExit(error = mDecoder.CloseStruct()); if (extAddress != nullptr) { SuccessOrExit(error = otLinkFilterAddRssIn(mInstance, extAddress, rss)); } else { otLinkFilterSetDefaultRssIn(mInstance, rss); } } exit: // If we had an error, we may have actually changed // the state of the RssIn filter, so we need to report // those incomplete changes via an asynchronous // change event. if (error != OT_ERROR_NONE) { IgnoreError(WritePropertyValueIsFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_PROP_MAC_FIXED_RSS)); } return error; } #endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_LINK_METRICS_QUERY>(void) { otError error = OT_ERROR_NONE; struct otIp6Address address; uint8_t seriesId; otLinkMetrics linkMetrics = {}; SuccessOrExit(error = mDecoder.ReadIp6Address(address)); SuccessOrExit(error = mDecoder.ReadUint8(seriesId)); SuccessOrExit(error = DecodeLinkMetrics(&linkMetrics, /* aAllowPduCount */ true)); error = otLinkMetricsQuery(mInstance, &address, seriesId, &linkMetrics, &NcpBase::HandleLinkMetricsReport_Jump, this); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_LINK_METRICS_PROBE>(void) { otError error = OT_ERROR_NONE; struct otIp6Address address; uint8_t seriesId; uint8_t length; SuccessOrExit(error = mDecoder.ReadIp6Address(address)); SuccessOrExit(error = mDecoder.ReadUint8(seriesId)); SuccessOrExit(error = mDecoder.ReadUint8(length)); error = otLinkMetricsSendLinkProbe(mInstance, &address, seriesId, length); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_LINK_METRICS_MGMT_ENH_ACK>(void) { otError error = OT_ERROR_NONE; struct otIp6Address address; uint8_t controlFlags; otLinkMetrics linkMetrics = {}; SuccessOrExit(error = mDecoder.ReadIp6Address(address)); SuccessOrExit(error = mDecoder.ReadUint8(controlFlags)); SuccessOrExit(error = DecodeLinkMetrics(&linkMetrics, /* aAllowPduCount */ false)); error = otLinkMetricsConfigEnhAckProbing(mInstance, &address, static_cast<otLinkMetricsEnhAckFlags>(controlFlags), controlFlags ? &linkMetrics : nullptr, &NcpBase::HandleLinkMetricsMgmtResponse_Jump, this, &NcpBase::HandleLinkMetricsEnhAckProbingIeReport_Jump, this); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_LINK_METRICS_MGMT_FORWARD>(void) { otError error = OT_ERROR_NONE; struct otIp6Address address; uint8_t seriesId; uint8_t types; otLinkMetrics linkMetrics = {}; otLinkMetricsSeriesFlags seriesFlags = {}; SuccessOrExit(error = mDecoder.ReadIp6Address(address)); SuccessOrExit(error = mDecoder.ReadUint8(seriesId)); SuccessOrExit(error = mDecoder.ReadUint8(types)); SuccessOrExit(error = DecodeLinkMetrics(&linkMetrics, /* aAllowPduCount */ true)); if (types & SPINEL_THREAD_FRAME_TYPE_MLE_LINK_PROBE) { seriesFlags.mLinkProbe = true; } if (types & SPINEL_THREAD_FRAME_TYPE_MAC_DATA) { seriesFlags.mMacData = true; } if (types & SPINEL_THREAD_FRAME_TYPE_MAC_DATA_REQUEST) { seriesFlags.mMacDataRequest = true; } if (types & SPINEL_THREAD_FRAME_TYPE_MAC_ACK) { seriesFlags.mMacAck = true; } error = otLinkMetricsConfigForwardTrackingSeries(mInstance, &address, seriesId, seriesFlags, &linkMetrics, &NcpBase::HandleLinkMetricsMgmtResponse_Jump, this); exit: return error; } #endif // OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_MODE>(void) { uint8_t numericMode; otLinkModeConfig modeConfig = otThreadGetLinkMode(mInstance); numericMode = LinkFlagsToFlagByte(modeConfig.mRxOnWhenIdle, modeConfig.mDeviceType, modeConfig.mNetworkData); return mEncoder.WriteUint8(numericMode); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_MODE>(void) { uint8_t numericMode = 0; otLinkModeConfig modeConfig; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint8(numericMode)); modeConfig.mRxOnWhenIdle = ((numericMode & SPINEL_THREAD_MODE_RX_ON_WHEN_IDLE) == SPINEL_THREAD_MODE_RX_ON_WHEN_IDLE); modeConfig.mDeviceType = ((numericMode & SPINEL_THREAD_MODE_FULL_THREAD_DEV) == SPINEL_THREAD_MODE_FULL_THREAD_DEV); modeConfig.mNetworkData = ((numericMode & SPINEL_THREAD_MODE_FULL_NETWORK_DATA) == SPINEL_THREAD_MODE_FULL_NETWORK_DATA); error = otThreadSetLinkMode(mInstance, modeConfig); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_CHILD_TIMEOUT>(void) { return mEncoder.WriteUint32(otThreadGetChildTimeout(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_CHILD_TIMEOUT>(void) { uint32_t timeout = 0; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadUint32(timeout)); otThreadSetChildTimeout(mInstance, timeout); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_RLOC16>(void) { return mEncoder.WriteUint16(otThreadGetRloc16(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING>(void) { return mEncoder.WriteBool(mRequireJoinExistingNetwork); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING>(void) { return mDecoder.ReadBool(mRequireJoinExistingNetwork); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_STREAM_NET_INSECURE>(void) { const uint8_t * framePtr = nullptr; uint16_t frameLen = 0; const uint8_t * metaPtr = nullptr; uint16_t metaLen = 0; otMessage * message = nullptr; otError error = OT_ERROR_NONE; otMessageSettings msgSettings = {false, OT_MESSAGE_PRIORITY_NORMAL}; SuccessOrExit(error = mDecoder.ReadDataWithLen(framePtr, frameLen)); SuccessOrExit(error = mDecoder.ReadData(metaPtr, metaLen)); // We ignore metadata for now. // May later include TX power, allow retransmits, etc... // STREAM_NET_INSECURE packets are not secured at layer 2. message = otIp6NewMessageFromBuffer(mInstance, framePtr, frameLen, &msgSettings); VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS); // Ensure the insecure message is forwarded using direct transmission. otMessageSetDirectTransmission(message, true); error = otIp6Send(mInstance, message); exit: if (error == OT_ERROR_NONE) { mInboundInsecureIpFrameCounter++; } else { mDroppedInboundIpFrameCounter++; } return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_CNTR_RESET>(void) { otLinkResetCounters(mInstance); #if OPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE otLinkResetTxRetrySuccessHistogram(mInstance); #endif otThreadResetIp6Counters(mInstance); otThreadResetMleCounters(mInstance); ResetCounters(); return OT_ERROR_NONE; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_THREAD_ASSISTING_PORTS>(void) { otError error = OT_ERROR_NONE; uint16_t port; SuccessOrExit(error = mDecoder.ReadUint16(port)); error = otIp6AddUnsecurePort(mInstance, port); exit: return error; } #if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_MAC_ALLOWLIST>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress; int8_t rss = OT_MAC_FILTER_FIXED_RSS_DISABLED; SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); if (!mDecoder.IsAllRead()) { SuccessOrExit(error = mDecoder.ReadInt8(rss)); } error = otLinkFilterAddAddress(mInstance, extAddress); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; } SuccessOrExit(error); if (rss != OT_MAC_FILTER_FIXED_RSS_DISABLED) { error = otLinkFilterAddRssIn(mInstance, extAddress, rss); } exit: return error; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_MAC_DENYLIST>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress; SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); error = otLinkFilterAddAddress(mInstance, extAddress); if (error == OT_ERROR_ALREADY) { error = OT_ERROR_NONE; } exit: return error; } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_MAC_FIXED_RSS>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress = nullptr; int8_t rss = OT_MAC_FILTER_FIXED_RSS_DISABLED; if (mDecoder.GetRemainingLength() > sizeof(int8_t)) { SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); } SuccessOrExit(error = mDecoder.ReadInt8(rss)); if (extAddress != nullptr) { error = otLinkFilterAddRssIn(mInstance, extAddress, rss); } else { otLinkFilterSetDefaultRssIn(mInstance, rss); } exit: return error; } #endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_THREAD_ASSISTING_PORTS>(void) { otError error = OT_ERROR_NONE; uint16_t port; SuccessOrExit(error = mDecoder.ReadUint16(port)); error = otIp6RemoveUnsecurePort(mInstance, port); // If unsecure port was not on the list, "remove" command is successful. if (error == OT_ERROR_NOT_FOUND) { error = OT_ERROR_NONE; } exit: return error; } #if OPENTHREAD_CONFIG_MAC_FILTER_ENABLE template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_MAC_ALLOWLIST>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress = nullptr; SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); otLinkFilterRemoveAddress(mInstance, extAddress); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_MAC_DENYLIST>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress = nullptr; SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); otLinkFilterRemoveAddress(mInstance, extAddress); exit: return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_MAC_FIXED_RSS>(void) { otError error = OT_ERROR_NONE; const otExtAddress *extAddress = nullptr; if (mDecoder.GetRemainingLength() > 0) { SuccessOrExit(error = mDecoder.ReadEui64(extAddress)); } if (extAddress != nullptr) { otLinkFilterRemoveRssIn(mInstance, extAddress); } else { otLinkFilterClearDefaultRssIn(mInstance); } exit: return error; } #endif // OPENTHREAD_CONFIG_MAC_FILTER_ENABLE #if OPENTHREAD_PLATFORM_POSIX template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_RCP_VERSION>(void) { return mEncoder.WriteUtf8(otGetRadioVersionString(mInstance)); } #endif #if OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SLAAC_ENABLED>(void) { return mEncoder.WriteBool(otIp6IsSlaacEnabled(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SLAAC_ENABLED>(void) { otError error = OT_ERROR_NONE; bool enabled; SuccessOrExit(error = mDecoder.ReadBool(enabled)); otIp6SetSlaacEnabled(mInstance, enabled); exit: return error; } #endif // OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SUPPORTED_RADIO_LINKS>(void) { otError error; #if OPENTHREAD_CONFIG_RADIO_LINK_IEEE_802_15_4_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_RADIO_LINK_IEEE_802_15_4)); #endif #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_RADIO_LINK_TREL_UDP6)); #endif exit: return error; } #if OPENTHREAD_CONFIG_MULTI_RADIO otError NcpBase::EncodeNeighborMultiRadioInfo(uint32_t aSpinelRadioLink, const otRadioLinkInfo &aInfo) { otError error; SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUintPacked(aSpinelRadioLink)); SuccessOrExit(error = mEncoder.WriteUint8(aInfo.mPreference)); SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NEIGHBOR_TABLE_MULTI_RADIO_INFO>(void) { otError error = OT_ERROR_NONE; otNeighborInfoIterator iter = OT_NEIGHBOR_INFO_ITERATOR_INIT; otNeighborInfo neighInfo; otMultiRadioNeighborInfo multiRadioInfo; while (otThreadGetNextNeighborInfo(mInstance, &iter, &neighInfo) == OT_ERROR_NONE) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteEui64(neighInfo.mExtAddress)); SuccessOrExit(error = mEncoder.WriteUint16(neighInfo.mRloc16)); if (otMultiRadioGetNeighborInfo(mInstance, &neighInfo.mExtAddress, &multiRadioInfo) == OT_ERROR_NONE) { if (multiRadioInfo.mSupportsIeee802154) { SuccessOrExit(error = EncodeNeighborMultiRadioInfo(SPINEL_RADIO_LINK_IEEE_802_15_4, multiRadioInfo.mIeee802154Info)); } if (multiRadioInfo.mSupportsTrelUdp6) { SuccessOrExit( error = EncodeNeighborMultiRadioInfo(SPINEL_RADIO_LINK_TREL_UDP6, multiRadioInfo.mTrelUdp6Info)); } } SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } #endif // OPENTHREAD_CONFIG_MULTI_RADIO // ---------------------------------------------------------------------------- // SRP Client // ---------------------------------------------------------------------------- #if OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_START>(void) { otError error = OT_ERROR_NONE; bool start; bool callbackEnabled; otSockAddr serverAddr; SuccessOrExit(error = mDecoder.ReadBool(start)); if (!start) { otSrpClientStop(mInstance); ExitNow(); } SuccessOrExit(error = mDecoder.ReadIp6Address(serverAddr.mAddress)); SuccessOrExit(error = mDecoder.ReadUint16(serverAddr.mPort)); SuccessOrExit(error = mDecoder.ReadBool(callbackEnabled)); SuccessOrExit(error = otSrpClientStart(mInstance, &serverAddr)); mSrpClientCallbackEnabled = callbackEnabled; exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_LEASE_INTERVAL>(void) { return mEncoder.WriteUint32(otSrpClientGetLeaseInterval(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_LEASE_INTERVAL>(void) { otError error; uint32_t interval; SuccessOrExit(error = mDecoder.ReadUint32(interval)); otSrpClientSetLeaseInterval(mInstance, interval); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_KEY_LEASE_INTERVAL>(void) { return mEncoder.WriteUint32(otSrpClientGetKeyLeaseInterval(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_KEY_LEASE_INTERVAL>(void) { otError error; uint32_t interval; SuccessOrExit(error = mDecoder.ReadUint32(interval)); otSrpClientSetKeyLeaseInterval(mInstance, interval); exit: return error; } static spinel_srp_client_item_state_t SrpClientItemStatetoSpinel(otSrpClientItemState aItemState) { spinel_srp_client_item_state_t state = SPINEL_SRP_CLIENT_ITEM_STATE_REMOVED; switch (aItemState) { case OT_SRP_CLIENT_ITEM_STATE_TO_ADD: state = SPINEL_SRP_CLIENT_ITEM_STATE_TO_ADD; break; case OT_SRP_CLIENT_ITEM_STATE_ADDING: state = SPINEL_SRP_CLIENT_ITEM_STATE_ADDING; break; case OT_SRP_CLIENT_ITEM_STATE_TO_REFRESH: state = SPINEL_SRP_CLIENT_ITEM_STATE_TO_REFRESH; break; case OT_SRP_CLIENT_ITEM_STATE_REFRESHING: state = SPINEL_SRP_CLIENT_ITEM_STATE_REFRESHING; break; case OT_SRP_CLIENT_ITEM_STATE_TO_REMOVE: state = SPINEL_SRP_CLIENT_ITEM_STATE_TO_REMOVE; break; case OT_SRP_CLIENT_ITEM_STATE_REMOVING: state = SPINEL_SRP_CLIENT_ITEM_STATE_REMOVING; break; case OT_SRP_CLIENT_ITEM_STATE_REGISTERED: state = SPINEL_SRP_CLIENT_ITEM_STATE_REGISTERED; break; case OT_SRP_CLIENT_ITEM_STATE_REMOVED: state = SPINEL_SRP_CLIENT_ITEM_STATE_REMOVED; break; } return state; } otError NcpBase::EncodeSrpClientHostInfo(const otSrpClientHostInfo &aHostInfo) { otError error; SuccessOrExit(error = mEncoder.WriteUtf8(aHostInfo.mName != nullptr ? aHostInfo.mName : "")); SuccessOrExit(error = mEncoder.WriteUint8(SrpClientItemStatetoSpinel(aHostInfo.mState))); SuccessOrExit(error = mEncoder.OpenStruct()); for (uint8_t index = 0; index < aHostInfo.mNumAddresses; index++) { SuccessOrExit(error = mEncoder.WriteIp6Address(aHostInfo.mAddresses[index])); } SuccessOrExit(error = mEncoder.CloseStruct()); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_HOST_INFO>(void) { return EncodeSrpClientHostInfo(*otSrpClientGetHostInfo(mInstance)); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_HOST_NAME>(void) { const char *name = otSrpClientGetHostInfo(mInstance)->mName; return mEncoder.WriteUtf8(name != nullptr ? name : ""); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_HOST_NAME>(void) { otError error; const char *name; uint16_t size; char * hostNameBuffer; SuccessOrExit(error = mDecoder.ReadUtf8(name)); hostNameBuffer = otSrpClientBuffersGetHostNameString(mInstance, &size); VerifyOrExit(StringLength(name, size) < size, error = OT_ERROR_INVALID_ARGS); // We first make sure we can set the name, and if so // we copy it to the persisted buffer and set // the host name again now with the persisted buffer. // This ensures that we do not overwrite a previous // buffer with a host name that cannot be set. SuccessOrExit(error = otSrpClientSetHostName(mInstance, name)); strcpy(hostNameBuffer, name); SuccessOrAssert(error = otSrpClientSetHostName(mInstance, hostNameBuffer)); exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_HOST_ADDRESSES>(void) { otError error = OT_ERROR_NONE; const otSrpClientHostInfo *hostInfo = otSrpClientGetHostInfo(mInstance); for (uint8_t index = 0; index < hostInfo->mNumAddresses; index++) { SuccessOrExit(error = mEncoder.WriteIp6Address(hostInfo->mAddresses[index])); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_HOST_ADDRESSES>(void) { otError error; otIp6Address addresses[kSrpClientMaxHostAddresses]; uint8_t numAddresses = 0; otIp6Address *hostAddressArray; uint8_t hostAddressArrayLength; hostAddressArray = otSrpClientBuffersGetHostAddressesArray(mInstance, &hostAddressArrayLength); OT_ASSERT(hostAddressArrayLength <= kSrpClientMaxHostAddresses); while (!mDecoder.IsAllReadInStruct()) { VerifyOrExit(numAddresses < kSrpClientMaxHostAddresses, error = OT_ERROR_NO_BUFS); SuccessOrExit(error = mDecoder.ReadIp6Address(addresses[numAddresses])); numAddresses++; } // We first make sure we can set the addresses, and if so we copy // the address list into `hostAddressArray` and set it again. This // ensures that we do not overwrite a previous list before we know // it is safe to set/change the address list. SuccessOrExit(error = otSrpClientSetHostAddresses(mInstance, addresses, numAddresses)); memcpy(hostAddressArray, addresses, sizeof(addresses)); SuccessOrAssert(error = otSrpClientSetHostAddresses(mInstance, hostAddressArray, numAddresses)); exit: return error; } otError NcpBase::EncodeSrpClientServices(const otSrpClientService *aServices) { otError error = OT_ERROR_NONE; for (; aServices != nullptr; aServices = aServices->mNext) { SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = mEncoder.WriteUtf8(aServices->mName)); SuccessOrExit(error = mEncoder.WriteUtf8(aServices->mInstanceName)); SuccessOrExit(error = mEncoder.WriteUint16(aServices->mPort)); SuccessOrExit(error = mEncoder.WriteUint16(aServices->mPriority)); SuccessOrExit(error = mEncoder.WriteUint16(aServices->mWeight)); SuccessOrExit(error = mEncoder.CloseStruct()); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_SERVICES>(void) { return EncodeSrpClientServices(otSrpClientGetServices(mInstance)); } template <> otError NcpBase::HandlePropertyInsert<SPINEL_PROP_SRP_CLIENT_SERVICES>(void) { otError error = OT_ERROR_NONE; otSrpClientBuffersServiceEntry *entry = nullptr; const char * serviceName; const char * instanceName; char * stringBuffer; uint16_t size; entry = otSrpClientBuffersAllocateService(mInstance); VerifyOrExit(entry != nullptr, error = OT_ERROR_NO_BUFS); stringBuffer = otSrpClientBuffersGetServiceEntryServiceNameString(entry, &size); SuccessOrExit(error = mDecoder.ReadUtf8(serviceName)); VerifyOrExit(StringLength(serviceName, size) < size, error = OT_ERROR_INVALID_ARGS); strcpy(stringBuffer, serviceName); stringBuffer = otSrpClientBuffersGetServiceEntryInstanceNameString(entry, &size); SuccessOrExit(error = mDecoder.ReadUtf8(instanceName)); VerifyOrExit(StringLength(instanceName, size) < size, error = OT_ERROR_INVALID_ARGS); strcpy(stringBuffer, instanceName); SuccessOrExit(error = mDecoder.ReadUint16(entry->mService.mPort)); SuccessOrExit(error = mDecoder.ReadUint16(entry->mService.mPriority)); SuccessOrExit(error = mDecoder.ReadUint16(entry->mService.mWeight)); SuccessOrExit(error = otSrpClientAddService(mInstance, &entry->mService)); entry = nullptr; exit: if (entry != nullptr) { otSrpClientBuffersFreeService(mInstance, entry); } return error; } template <> otError NcpBase::HandlePropertyRemove<SPINEL_PROP_SRP_CLIENT_SERVICES>(void) { otError error = OT_ERROR_NONE; const char * serviceName; const char * instanceName; bool toClear = false; const otSrpClientService *service; SuccessOrExit(error = mDecoder.ReadUtf8(serviceName)); SuccessOrExit(error = mDecoder.ReadUtf8(instanceName)); if (!mDecoder.IsAllReadInStruct()) { SuccessOrExit(error = mDecoder.ReadBool(toClear)); } for (service = otSrpClientGetServices(mInstance); service != nullptr; service = service->mNext) { if ((strcmp(serviceName, service->mName) == 0) || (strcmp(instanceName, service->mInstanceName) == 0)) { break; } } VerifyOrExit(service != nullptr, error = OT_ERROR_NOT_FOUND); if (toClear) { SuccessOrExit(error = otSrpClientClearService(mInstance, const_cast<otSrpClientService *>(service))); otSrpClientBuffersFreeService( mInstance, reinterpret_cast<otSrpClientBuffersServiceEntry *>(const_cast<otSrpClientService *>(service))); } else { error = otSrpClientRemoveService(mInstance, const_cast<otSrpClientService *>(service)); } exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_HOST_SERVICES_REMOVE>(void) { otError error = OT_ERROR_NONE; bool removeKeyLease; bool sendUnregToServer; SuccessOrExit(error = mDecoder.ReadBool(removeKeyLease)); SuccessOrExit(error = mDecoder.ReadBool(sendUnregToServer)); error = otSrpClientRemoveHostAndServices(mInstance, removeKeyLease, sendUnregToServer); exit: return error; } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_HOST_SERVICES_CLEAR>(void) { otSrpClientClearHostAndServices(mInstance); return OT_ERROR_NONE; } static spinel_srp_client_error_t SrpClientErrorToSpinelError(otError aError) { spinel_srp_client_error_t error = SPINEL_SRP_CLIENT_ERROR_FAILED; switch (aError) { case OT_ERROR_NONE: error = SPINEL_SRP_CLIENT_ERROR_NONE; break; case OT_ERROR_PARSE: error = SPINEL_SRP_CLIENT_ERROR_PARSE; break; case OT_ERROR_NOT_FOUND: error = SPINEL_SRP_CLIENT_ERROR_NOT_FOUND; break; case OT_ERROR_NOT_IMPLEMENTED: error = SPINEL_SRP_CLIENT_ERROR_NOT_IMPLEMENTED; break; case OT_ERROR_SECURITY: error = SPINEL_SRP_CLIENT_ERROR_SECURITY; break; case OT_ERROR_DUPLICATED: error = SPINEL_SRP_CLIENT_ERROR_DUPLICATED; break; case OT_ERROR_RESPONSE_TIMEOUT: error = SPINEL_SRP_CLIENT_ERROR_RESPONSE_TIMEOUT; break; case OT_ERROR_INVALID_ARGS: error = SPINEL_SRP_CLIENT_ERROR_INVALID_ARGS; break; case OT_ERROR_NO_BUFS: error = SPINEL_SRP_CLIENT_ERROR_NO_BUFS; break; case OT_ERROR_FAILED: default: error = SPINEL_SRP_CLIENT_ERROR_FAILED; break; } return error; } void NcpBase::HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, const otSrpClientService * aServices, const otSrpClientService * aRemovedServices, void * aContext) { static_cast<NcpBase *>(aContext)->HandleSrpClientCallback(aError, aHostInfo, aServices, aRemovedServices); } void NcpBase::HandleSrpClientCallback(otError aError, const otSrpClientHostInfo *aHostInfo, const otSrpClientService * aServices, const otSrpClientService * aRemovedServices) { otError error = OT_ERROR_NONE; const otSrpClientService *service; const otSrpClientService *next; VerifyOrExit(mSrpClientCallbackEnabled); SuccessOrExit(error = mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_SRP_CLIENT_EVENT)); SuccessOrExit(error = mEncoder.WriteUint16(SrpClientErrorToSpinelError(aError))); SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = EncodeSrpClientHostInfo(*aHostInfo)); SuccessOrExit(error = mEncoder.CloseStruct()); SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = EncodeSrpClientServices(aServices)); SuccessOrExit(error = mEncoder.CloseStruct()); SuccessOrExit(error = mEncoder.OpenStruct()); SuccessOrExit(error = EncodeSrpClientServices(aRemovedServices)); SuccessOrExit(error = mEncoder.CloseStruct()); SuccessOrExit(error = mEncoder.EndFrame()); exit: if (error != OT_ERROR_NONE) { // Emit a NONMEM status if we fail to send the event. mChangedPropsSet.AddLastStatus(SPINEL_STATUS_NOMEM); mUpdateChangedPropsTask.Post(); } for (service = aRemovedServices; service != nullptr; service = next) { next = service->mNext; otSrpClientBuffersFreeService( mInstance, reinterpret_cast<otSrpClientBuffersServiceEntry *>(const_cast<otSrpClientService *>(service))); } } #if OPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_SRP_CLIENT_SERVICE_KEY_ENABLED>(void) { return mEncoder.WriteBool(otSrpClientIsServiceKeyRecordEnabled(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_SRP_CLIENT_SERVICE_KEY_ENABLED>(void) { otError error = OT_ERROR_NONE; bool enabled; SuccessOrExit(error = mDecoder.ReadBool(enabled)); otSrpClientSetServiceKeyRecordEnabled(mInstance, enabled); exit: return error; } #endif #endif // OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE #if OPENTHREAD_CONFIG_RADIO_LINK_TREL_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_DEBUG_TREL_TEST_MODE_ENABLE>(void) { return mEncoder.WriteBool(!otTrelIsFilterEnabled(mInstance)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_DEBUG_TREL_TEST_MODE_ENABLE>(void) { otError error = OT_ERROR_NONE; bool testMode; SuccessOrExit(error = mDecoder.ReadBool(testMode)); // Note that `TEST_MODE` being `true` indicates that the TREL // interface should be enabled and functional, so filtering // should be disabled. otTrelSetFilterEnabled(mInstance, !testMode); exit: return error; } #endif #if OPENTHREAD_CONFIG_LEGACY_ENABLE void NcpBase::RegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { mLegacyHandlers = aHandlers; bool isEnabled; VerifyOrExit(mLegacyHandlers != nullptr); isEnabled = (otThreadGetDeviceRole(mInstance) != OT_DEVICE_ROLE_DISABLED); if (isEnabled) { if (mLegacyHandlers->mStartLegacy) { mLegacyHandlers->mStartLegacy(); } } else { if (mLegacyHandlers->mStopLegacy) { mLegacyHandlers->mStopLegacy(); } } if (mLegacyHandlers->mSetLegacyUlaPrefix) { mLegacyHandlers->mSetLegacyUlaPrefix(mLegacyUlaPrefix); } exit: return; } void NcpBase::HandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) { memcpy(mLegacyUlaPrefix, aUlaPrefix, OT_NCP_LEGACY_ULA_PREFIX_LENGTH); mChangedPropsSet.AddProperty(SPINEL_PROP_NEST_LEGACY_ULA_PREFIX); mUpdateChangedPropsTask.Post(); } void NcpBase::HandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) { mLegacyNodeDidJoin = true; mLegacyLastJoinedNode = *aExtAddr; mChangedPropsSet.AddProperty(SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED); mUpdateChangedPropsTask.Post(); } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NEST_LEGACY_ULA_PREFIX>(void) { return mEncoder.WriteData(mLegacyUlaPrefix, sizeof(mLegacyUlaPrefix)); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_NEST_LEGACY_ULA_PREFIX>(void) { const uint8_t *ptr = nullptr; uint16_t len; otError error = OT_ERROR_NONE; SuccessOrExit(error = mDecoder.ReadData(ptr, len)); VerifyOrExit(len <= sizeof(mLegacyUlaPrefix), error = OT_ERROR_PARSE); memset(mLegacyUlaPrefix, 0, sizeof(mLegacyUlaPrefix)); memcpy(mLegacyUlaPrefix, ptr, len); if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mSetLegacyUlaPrefix != nullptr)) { mLegacyHandlers->mSetLegacyUlaPrefix(mLegacyUlaPrefix); } exit: return error; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_NEST_LEGACY_LAST_NODE_JOINED>(void) { if (!mLegacyNodeDidJoin) { memset(&mLegacyLastJoinedNode, 0, sizeof(mLegacyLastJoinedNode)); } return mEncoder.WriteEui64(mLegacyLastJoinedNode); } void NcpBase::StartLegacy(void) { mLegacyNodeDidJoin = false; if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mStartLegacy != nullptr)) { mLegacyHandlers->mStartLegacy(); } } void NcpBase::StopLegacy(void) { mLegacyNodeDidJoin = false; if ((mLegacyHandlers != nullptr) && (mLegacyHandlers->mStopLegacy != nullptr)) { mLegacyHandlers->mStopLegacy(); } } #endif // OPENTHREAD_CONFIG_LEGACY_ENABLE #if OPENTHREAD_CONFIG_TIME_SYNC_ENABLE template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_NETWORK_TIME>(void) { otError error = OT_ERROR_NONE; otNetworkTimeStatus networkTimeStatus; uint64_t time; networkTimeStatus = otNetworkTimeGet(mInstance, &time); SuccessOrExit(error = mEncoder.WriteUint64(time)); SuccessOrExit(error = mEncoder.WriteInt8((int8_t)networkTimeStatus)); exit: return error; } void NcpBase::HandleTimeSyncUpdate(void *aContext) { static_cast<NcpBase *>(aContext)->HandleTimeSyncUpdate(); } void NcpBase::HandleTimeSyncUpdate(void) { mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_NETWORK_TIME); mUpdateChangedPropsTask.Post(); } #endif // OPENTHREAD_CONFIG_TIME_SYNC_ENABLE void NcpBase::HandleActiveScanResult_Jump(otActiveScanResult *aResult, void *aContext) { static_cast<NcpBase *>(aContext)->HandleActiveScanResult(aResult); } // ---------------------------------------------------------------------------- // MARK: Scan Results Glue // ---------------------------------------------------------------------------- void NcpBase::HandleActiveScanResult(otActiveScanResult *aResult) { otError error = OT_ERROR_NONE; if (aResult) { uint8_t flags = static_cast<uint8_t>(aResult->mVersion << SPINEL_BEACON_THREAD_FLAG_VERSION_SHIFT); if (aResult->mIsNative) { flags |= SPINEL_BEACON_THREAD_FLAG_NATIVE; } SuccessOrExit(error = mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_INSERTED, SPINEL_PROP_MAC_SCAN_BEACON)); SuccessOrExit(error = mEncoder.WriteUint8(aResult->mChannel)); SuccessOrExit(error = mEncoder.WriteInt8(aResult->mRssi)); SuccessOrExit(error = mEncoder.OpenStruct()); // "mac-layer data" SuccessOrExit(error = mEncoder.WriteEui64(aResult->mExtAddress)); SuccessOrExit(error = mEncoder.WriteUint16(0xffff)); // short address, not given SuccessOrExit(error = mEncoder.WriteUint16(aResult->mPanId)); SuccessOrExit(error = mEncoder.WriteUint8(aResult->mLqi)); SuccessOrExit(error = mEncoder.CloseStruct()); SuccessOrExit(error = mEncoder.OpenStruct()); // "net-layer data" SuccessOrExit(error = mEncoder.WriteUintPacked(SPINEL_PROTOCOL_TYPE_THREAD)); // type SuccessOrExit(error = mEncoder.WriteUint8(flags)); SuccessOrExit(error = mEncoder.WriteUtf8(aResult->mNetworkName.m8)); SuccessOrExit(error = mEncoder.WriteDataWithLen(aResult->mExtendedPanId.m8, OT_EXT_PAN_ID_SIZE)); SuccessOrExit(error = mEncoder.WriteDataWithLen(aResult->mSteeringData.m8, aResult->mSteeringData.mLength)); SuccessOrExit(error = mEncoder.CloseStruct()); SuccessOrExit(error = mEncoder.EndFrame()); } else { // We are finished with the scan, send an unsolicited // scan state update. mChangedPropsSet.AddProperty(SPINEL_PROP_MAC_SCAN_STATE); mUpdateChangedPropsTask.Post(); } exit: if (error != OT_ERROR_NONE) { // We ran out of buffer adding a scan result so remember to send // an async `LAST_STATUS(NOMEM)` when buffer space becomes // available. mChangedPropsSet.AddLastStatus(SPINEL_STATUS_NOMEM); mUpdateChangedPropsTask.Post(); } } void NcpBase::HandleEnergyScanResult_Jump(otEnergyScanResult *aResult, void *aContext) { static_cast<NcpBase *>(aContext)->HandleEnergyScanResult(aResult); } void NcpBase::HandleEnergyScanResult(otEnergyScanResult *aResult) { otError error = OT_ERROR_NONE; if (aResult) { SuccessOrExit(error = mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_INSERTED, SPINEL_PROP_MAC_ENERGY_SCAN_RESULT)); SuccessOrExit(error = mEncoder.WriteUint8(aResult->mChannel)); SuccessOrExit(error = mEncoder.WriteInt8(aResult->mMaxRssi)); SuccessOrExit(error = mEncoder.EndFrame()); } else { // We are finished with the scan, send an unsolicited // scan state update. mChangedPropsSet.AddProperty(SPINEL_PROP_MAC_SCAN_STATE); mUpdateChangedPropsTask.Post(); } exit: if (error != OT_ERROR_NONE) { mChangedPropsSet.AddLastStatus(SPINEL_STATUS_NOMEM); mUpdateChangedPropsTask.Post(); } } #if OPENTHREAD_CONFIG_JOINER_ENABLE void NcpBase::HandleJoinerCallback_Jump(otError aError, void *aContext) { static_cast<NcpBase *>(aContext)->HandleJoinerCallback(aError); } void NcpBase::HandleJoinerCallback(otError aError) { switch (aError) { case OT_ERROR_NONE: mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_SUCCESS); break; case OT_ERROR_SECURITY: mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_SECURITY); break; case OT_ERROR_NOT_FOUND: mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_NO_PEERS); break; case OT_ERROR_RESPONSE_TIMEOUT: mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_RSP_TIMEOUT); break; default: mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_FAILURE); break; } mUpdateChangedPropsTask.Post(); } #endif #if OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE void NcpBase::HandleLinkMetricsReport_Jump(const otIp6Address * aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus, void * aContext) { static_cast<NcpBase *>(aContext)->HandleLinkMetricsReport(aSource, aMetricsValues, aStatus); } void NcpBase::HandleLinkMetricsReport(const otIp6Address * aSource, const otLinkMetricsValues *aMetricsValues, uint8_t aStatus) { SuccessOrExit(mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_THREAD_LINK_METRICS_QUERY_RESULT)); SuccessOrExit(mEncoder.WriteIp6Address(*aSource)); SuccessOrExit(mEncoder.WriteUint8(aStatus)); SuccessOrExit(EncodeLinkMetricsValues(aMetricsValues)); SuccessOrExit(mEncoder.EndFrame()); exit: return; } void NcpBase::HandleLinkMetricsMgmtResponse_Jump(const otIp6Address *aSource, uint8_t aStatus, void *aContext) { static_cast<NcpBase *>(aContext)->HandleLinkMetricsMgmtResponse(aSource, aStatus); } void NcpBase::HandleLinkMetricsMgmtResponse(const otIp6Address *aSource, uint8_t aStatus) { SuccessOrExit(mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_THREAD_LINK_METRICS_MGMT_RESPONSE)); SuccessOrExit(mEncoder.WriteIp6Address(*aSource)); SuccessOrExit(mEncoder.WriteUint8(aStatus)); SuccessOrExit(mEncoder.EndFrame()); exit: return; } void NcpBase::HandleLinkMetricsEnhAckProbingIeReport_Jump(otShortAddress aShortAddress, const otExtAddress * aExtAddress, const otLinkMetricsValues *aMetricsValues, void * aContext) { static_cast<NcpBase *>(aContext)->HandleLinkMetricsEnhAckProbingIeReport(aShortAddress, aExtAddress, aMetricsValues); } void NcpBase::HandleLinkMetricsEnhAckProbingIeReport(otShortAddress aShortAddress, const otExtAddress * aExtAddress, const otLinkMetricsValues *aMetricsValues) { SuccessOrExit(mEncoder.BeginFrame(SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_THREAD_LINK_METRICS_MGMT_ENH_ACK_IE)); SuccessOrExit(mEncoder.WriteUint16(aShortAddress)); SuccessOrExit(mEncoder.WriteEui64(*aExtAddress)); SuccessOrExit(EncodeLinkMetricsValues(aMetricsValues)); SuccessOrExit(mEncoder.EndFrame()); exit: return; } #endif // ---------------------------------------------------------------------------- // MARK: Outbound Datagram Handling // ---------------------------------------------------------------------------- void NcpBase::HandleDatagramFromStack(otMessage *aMessage, void *aContext) { static_cast<NcpBase *>(aContext)->HandleDatagramFromStack(aMessage); } void NcpBase::HandleDatagramFromStack(otMessage *aMessage) { VerifyOrExit(aMessage != nullptr); // Do not forward frames larger than SPINEL payload size. VerifyOrExit(otMessageGetLength(aMessage) <= SPINEL_FRAME_MAX_COMMAND_PAYLOAD_SIZE, otMessageFree(aMessage)); otMessageQueueEnqueue(&mMessageQueue, aMessage); // If there is no queued spinel command response, try to write/send // the datagram message immediately. If there is a queued response // or if currently out of buffer space, the IPv6 datagram message // will be sent from `HandleFrameRemovedFromNcpBuffer()` when buffer // space becomes available and after any pending spinel command // response. if (IsResponseQueueEmpty()) { IgnoreError(SendQueuedDatagramMessages()); } exit: return; } otError NcpBase::SendDatagramMessage(otMessage *aMessage) { otError error = OT_ERROR_NONE; uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0; bool isSecure = otMessageIsLinkSecurityEnabled(aMessage); spinel_prop_key_t propKey = isSecure ? SPINEL_PROP_STREAM_NET : SPINEL_PROP_STREAM_NET_INSECURE; SuccessOrExit(error = mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, propKey)); SuccessOrExit(error = mEncoder.WriteUint16(otMessageGetLength(aMessage))); SuccessOrExit(error = mEncoder.WriteMessage(aMessage)); // Append any metadata (rssi, lqi, channel, etc) here! SuccessOrExit(error = mEncoder.EndFrame()); if (isSecure) { mOutboundSecureIpFrameCounter++; } else { mOutboundInsecureIpFrameCounter++; } exit: return error; } otError NcpBase::SendQueuedDatagramMessages(void) { otError error = OT_ERROR_NONE; otMessage *message; while ((message = otMessageQueueGetHead(&mMessageQueue)) != nullptr) { // Since an `otMessage` instance can be in one queue at a time, // it is first dequeued from `mMessageQueue` before attempting // to include it in a spinel frame by calling `SendDatagramMessage()` // If forming of the spinel frame fails, the message is enqueued // back at the front of `mMessageQueue`. otMessageQueueDequeue(&mMessageQueue, message); error = SendDatagramMessage(message); if (error != OT_ERROR_NONE) { otMessageQueueEnqueueAtHead(&mMessageQueue, message); } SuccessOrExit(error); } exit: return error; } #if OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_UDP_FORWARD_STREAM>(void) { const uint8_t * framePtr = nullptr; uint16_t frameLen = 0; const otIp6Address *peerAddr; uint16_t peerPort; uint16_t sockPort; otMessage * message; otError error = OT_ERROR_NONE; otMessageSettings msgSettings = {false, OT_MESSAGE_PRIORITY_NORMAL}; message = otIp6NewMessage(mInstance, &msgSettings); VerifyOrExit(message != nullptr, error = OT_ERROR_NO_BUFS); SuccessOrExit(error = mDecoder.ReadDataWithLen(framePtr, frameLen)); SuccessOrExit(error = mDecoder.ReadUint16(peerPort)); SuccessOrExit(error = mDecoder.ReadIp6Address(peerAddr)); SuccessOrExit(error = mDecoder.ReadUint16(sockPort)); SuccessOrExit(error = otMessageAppend(message, framePtr, static_cast<uint16_t>(frameLen))); otUdpForwardReceive(mInstance, message, peerPort, peerAddr, sockPort); // `otUdpForwardReceive()` takes ownership of `message` (in both success // or failure cases). `message` is set to nullptr so it is not freed at // exit. message = nullptr; exit: if (message != nullptr) { otMessageFree(message); } return error; } void NcpBase::HandleUdpForwardStream(otMessage * aMessage, uint16_t aPeerPort, otIp6Address *aPeerAddr, uint16_t aSockPort, void * aContext) { static_cast<NcpBase *>(aContext)->HandleUdpForwardStream(aMessage, aPeerPort, *aPeerAddr, aSockPort); } void NcpBase::HandleUdpForwardStream(otMessage *aMessage, uint16_t aPeerPort, otIp6Address &aPeerAddr, uint16_t aPort) { uint16_t length = otMessageGetLength(aMessage); uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0; SuccessOrExit(mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_THREAD_UDP_FORWARD_STREAM)); SuccessOrExit(mEncoder.WriteUint16(length)); SuccessOrExit(mEncoder.WriteMessage(aMessage)); SuccessOrExit(mEncoder.WriteUint16(aPeerPort)); SuccessOrExit(mEncoder.WriteIp6Address(aPeerAddr)); SuccessOrExit(mEncoder.WriteUint16(aPort)); SuccessOrExit(mEncoder.EndFrame()); // The `aMessage` is owned by the outbound frame and NCP buffer // after frame was finished/ended successfully. It will be freed // when the frame is successfully sent and removed. aMessage = nullptr; exit: if (aMessage != nullptr) { otMessageFree(aMessage); } } #endif // OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE // ---------------------------------------------------------------------------- // MARK: Pcap frame handling // ---------------------------------------------------------------------------- void NcpBase::HandlePcapFrame(const otRadioFrame *aFrame, bool aIsTx, void *aContext) { static_cast<NcpBase *>(aContext)->HandlePcapFrame(aFrame, aIsTx); } void NcpBase::HandlePcapFrame(const otRadioFrame *aFrame, bool aIsTx) { uint16_t flags = 0; uint8_t header = SPINEL_HEADER_FLAG | SPINEL_HEADER_IID_0; VerifyOrExit(mPcapEnabled); if (aIsTx) { flags |= SPINEL_MD_FLAG_TX; } SuccessOrExit(mEncoder.BeginFrame(header, SPINEL_CMD_PROP_VALUE_IS, SPINEL_PROP_STREAM_RAW)); SuccessOrExit(mEncoder.WriteUint16(aFrame->mLength)); SuccessOrExit(mEncoder.WriteData(aFrame->mPsdu, aFrame->mLength)); // Append metadata (rssi, etc) SuccessOrExit(mEncoder.WriteInt8(aFrame->mInfo.mRxInfo.mRssi)); // RSSI SuccessOrExit(mEncoder.WriteInt8(-128)); // Noise floor (Currently unused) SuccessOrExit(mEncoder.WriteUint16(flags)); // Flags SuccessOrExit(mEncoder.OpenStruct()); // PHY-data // Empty for now SuccessOrExit(mEncoder.CloseStruct()); SuccessOrExit(mEncoder.OpenStruct()); // Vendor-data // Empty for now SuccessOrExit(mEncoder.CloseStruct()); SuccessOrExit(mEncoder.EndFrame()); exit: return; } template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_PHY_PCAP_ENABLED>(void) { return mEncoder.WriteBool(mPcapEnabled); } template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_PHY_PCAP_ENABLED>(void) { otError error = OT_ERROR_NONE; bool enabled; SuccessOrExit(error = mDecoder.ReadBool(enabled)); VerifyOrExit(enabled != mPcapEnabled); mPcapEnabled = enabled; if (mPcapEnabled) { otLinkSetPcapCallback(mInstance, &NcpBase::HandlePcapFrame, static_cast<void *>(this)); } else { otLinkSetPcapCallback(mInstance, nullptr, nullptr); } exit: return error; } // ---------------------------------------------------------------------------- // MARK: Property/Status Changed // ---------------------------------------------------------------------------- void NcpBase::HandleStateChanged(otChangedFlags aFlags, void *aContext) { NcpBase *ncp = static_cast<NcpBase *>(aContext); ncp->mThreadChangedFlags |= aFlags; ncp->mUpdateChangedPropsTask.Post(); } void NcpBase::ProcessThreadChangedFlags(void) { static const struct { otChangedFlags mThreadFlag; spinel_prop_key_t mPropKey; } kFlags[] = { {OT_CHANGED_IP6_ADDRESS_ADDED, SPINEL_PROP_IPV6_ADDRESS_TABLE}, {OT_CHANGED_IP6_ADDRESS_REMOVED, SPINEL_PROP_IPV6_ADDRESS_TABLE}, {OT_CHANGED_THREAD_ROLE, SPINEL_PROP_NET_ROLE}, {OT_CHANGED_THREAD_LL_ADDR, SPINEL_PROP_IPV6_LL_ADDR}, {OT_CHANGED_THREAD_ML_ADDR, SPINEL_PROP_IPV6_ML_ADDR}, {OT_CHANGED_THREAD_PARTITION_ID, SPINEL_PROP_NET_PARTITION_ID}, {OT_CHANGED_THREAD_KEY_SEQUENCE_COUNTER, SPINEL_PROP_NET_KEY_SEQUENCE_COUNTER}, {OT_CHANGED_THREAD_NETDATA, SPINEL_PROP_THREAD_LEADER_NETWORK_DATA}, {OT_CHANGED_THREAD_CHILD_ADDED, SPINEL_PROP_THREAD_CHILD_TABLE}, {OT_CHANGED_THREAD_CHILD_REMOVED, SPINEL_PROP_THREAD_CHILD_TABLE}, {OT_CHANGED_IP6_MULTICAST_SUBSCRIBED, SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE}, {OT_CHANGED_IP6_MULTICAST_UNSUBSCRIBED, SPINEL_PROP_IPV6_MULTICAST_ADDRESS_TABLE}, {OT_CHANGED_THREAD_CHANNEL, SPINEL_PROP_PHY_CHAN}, {OT_CHANGED_THREAD_PANID, SPINEL_PROP_MAC_15_4_PANID}, {OT_CHANGED_THREAD_NETWORK_NAME, SPINEL_PROP_NET_NETWORK_NAME}, {OT_CHANGED_THREAD_EXT_PANID, SPINEL_PROP_NET_XPANID}, {OT_CHANGED_THREAD_RLOC_ADDED, SPINEL_PROP_IPV6_ADDRESS_TABLE}, {OT_CHANGED_THREAD_RLOC_REMOVED, SPINEL_PROP_IPV6_ADDRESS_TABLE}, {OT_CHANGED_NETWORK_KEY, SPINEL_PROP_NET_NETWORK_KEY}, {OT_CHANGED_PSKC, SPINEL_PROP_NET_PSKC}, {OT_CHANGED_CHANNEL_MANAGER_NEW_CHANNEL, SPINEL_PROP_CHANNEL_MANAGER_NEW_CHANNEL}, {OT_CHANGED_SUPPORTED_CHANNEL_MASK, SPINEL_PROP_PHY_CHAN_SUPPORTED}, }; VerifyOrExit(mThreadChangedFlags != 0); // If thread role has changed, check for possible "join" error. if ((mThreadChangedFlags & OT_CHANGED_THREAD_ROLE) != 0) { if (mRequireJoinExistingNetwork) { switch (otThreadGetDeviceRole(mInstance)) { case OT_DEVICE_ROLE_DETACHED: case OT_DEVICE_ROLE_DISABLED: break; default: mRequireJoinExistingNetwork = false; mChangedPropsSet.AddProperty(SPINEL_PROP_NET_REQUIRE_JOIN_EXISTING); break; } if ((otThreadGetDeviceRole(mInstance) == OT_DEVICE_ROLE_LEADER) && otThreadIsSingleton(mInstance) #if OPENTHREAD_CONFIG_LEGACY_ENABLE && !mLegacyNodeDidJoin #endif ) { mThreadChangedFlags &= ~static_cast<uint32_t>(OT_CHANGED_THREAD_PARTITION_ID); IgnoreError(otThreadSetEnabled(mInstance, false)); mChangedPropsSet.AddProperty(SPINEL_PROP_NET_STACK_UP); mChangedPropsSet.AddLastStatus(SPINEL_STATUS_JOIN_FAILURE); } } } // Convert OT_CHANGED flags to corresponding NCP property update. for (auto &flag : kFlags) { uint32_t threadFlag = flag.mThreadFlag; if (mThreadChangedFlags & threadFlag) { spinel_prop_key_t propKey = flag.mPropKey; bool shouldAddProperty = true; // Child table changes are reported using the `HandleChildAdded()` and // `HandleChildRemoved()` callbacks emitting spinel `VALUE_INSERTED` and // `VALUE_REMOVED` async spinel frames. If the spinel frames could not be // added (e.g., out of NCP buffer) from the above callbacks, the flag // `mShouldEmitChildTableUpdate` is set to `true` so that the entire // child table is emitted as an unsolicited `VALUE_IS` update. if (propKey == SPINEL_PROP_THREAD_CHILD_TABLE) { shouldAddProperty = mShouldEmitChildTableUpdate; mShouldEmitChildTableUpdate = false; } if (shouldAddProperty) { mChangedPropsSet.AddProperty(propKey); } if (threadFlag == OT_CHANGED_THREAD_NETDATA) { mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_ON_MESH_NETS); mChangedPropsSet.AddProperty(SPINEL_PROP_THREAD_OFF_MESH_ROUTES); } mThreadChangedFlags &= ~threadFlag; VerifyOrExit(mThreadChangedFlags != 0); } } // Clear any remaining ThreadFlag that has no matching // NCP property update (e.g., OT_CHANGED_SECURITY_POLICY) mThreadChangedFlags = 0; exit: return; } } // namespace Ncp } // namespace ot // ---------------------------------------------------------------------------- // MARK: Legacy network APIs // ---------------------------------------------------------------------------- void otNcpRegisterLegacyHandlers(const otNcpLegacyHandlers *aHandlers) { #if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != nullptr) { ncp->RegisterLegacyHandlers(aHandlers); } #else OT_UNUSED_VARIABLE(aHandlers); #endif } void otNcpHandleDidReceiveNewLegacyUlaPrefix(const uint8_t *aUlaPrefix) { #if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != nullptr) { ncp->HandleDidReceiveNewLegacyUlaPrefix(aUlaPrefix); } #else OT_UNUSED_VARIABLE(aUlaPrefix); #endif } void otNcpHandleLegacyNodeDidJoin(const otExtAddress *aExtAddr) { #if OPENTHREAD_CONFIG_LEGACY_ENABLE ot::Ncp::NcpBase *ncp = ot::Ncp::NcpBase::GetNcpInstance(); if (ncp != nullptr) { ncp->HandleLegacyNodeDidJoin(aExtAddr); } #else OT_UNUSED_VARIABLE(aExtAddr); #endif } #endif // OPENTHREAD_MTD || OPENTHREAD_FTD
[ "qwang@bouffalolab.com" ]
qwang@bouffalolab.com
b8c91b5820ecaf0df26a8ed334174f31b349c591
20cf6482b7f5a68bd0029414c02f7ec4747c0c5f
/triton2/server/loginserver/erating/EProtocol/AGIPCreateOrUpdateUser.h
48617d5d47dc6dcddeb12590fa6edc8b028bd4a8
[]
no_license
kensniper/triton2
732907c76c001b2454e08ca81ad72ace45625f6c
7ad2a359e85df85be9d87010047a198980c121ae
refs/heads/master
2023-03-23T02:20:56.487117
2017-02-26T00:00:59
2017-02-26T00:00:59
null
0
0
null
null
null
null
UTF-8
C++
false
false
2,103
h
#ifndef __AGIPCREATEORUPDATEUSER_H__ #define __AGIPCREATEORUPDATEUSER_H__ #include "SysProtocol.h" #define CMD_CREATE_OR_UPDATE_USER 0x10003001 #define CMD_CREATE_OR_UPDATE_USER_RES 0x20003001 typedef struct _AGIP_CREATE_OR_UPDATE_USER_ { _AGIP_HEADER_ header; uint32_t user_id; char user_name[AGIP_USER_NAME_LEN]; char password[AGIP_PASSWORD_LEN]; int8_t user_type; int8_t user_class; int16_t pad; int32_t user_point; uint32_t promoter_id; uint32_t user_flag; _AGIP_CHECKSUM_ checksum; } SAGIPCreateOrUpdateUser, *PSAGIPCreateOrUpdateUser; typedef struct _AGIP_CREATE_OR_UPDATE_USER_RES_ { _AGIP_HEADER_ header; int32_t result; _AGIP_CHECKSUM_ checksum; } SAGIPCreateOrUpdateUserRes, *PSAGIPCreateOrUpdateUserRes; class Engine_Export AGIPCreateOrUpdateUser : public SysProtocol { public: AGIPCreateOrUpdateUser(void); virtual ~AGIPCreateOrUpdateUser(void); int GetUserID(uint32_t& user_id); int GetUserName(char* user_name); int GetPassword(char* password); int GetUserType(int8_t& user_type); int GetUserClass(int8_t& user_class); int GetUserPoint(int32_t& user_point); int GetPromoterID(uint32_t& promoter_id); int GetUserFlag(uint32_t& user_flag); int SetUserID(uint32_t user_id); int SetUserName(const char* user_name); int SetPassword(const char* password); int SetUserType(int8_t user_type); int SetUserClass(int8_t user_class); int SetUserPoint(int32_t user_point); int SetPromoterID(uint32_t promoter_id); int SetUserFlag(uint32_t user_flag); virtual int showInfo(); }; class Engine_Export AGIPCreateOrUpdateUserRes : public SysProtocol { public: AGIPCreateOrUpdateUserRes(void); virtual ~AGIPCreateOrUpdateUserRes(void); int GetResultCode(int32_t& result_code); int SetResultCode(int32_t result_code); virtual int showInfo(); }; #endif /*__AGIPCREATEORUPDATEUSER_H__*/
[ "243884919@QQ.COM" ]
243884919@QQ.COM
79c50d1cfabcd394e0f4efde25ec535329864ea6
b656dc19dcd1cbd76ef4d88c879e7f6fa2e885e4
/include/boundingrectangle.h
d41ee832462606f7a7cc222f96e6f2804e76ab22
[]
no_license
setrunk/LiCore
53b19b6c82b1129d10679c9b33c87fb276e00b51
b372688732901bbb6fd45dc0b21b99f8be5e935f
refs/heads/master
2020-05-20T01:16:20.121067
2019-11-19T14:02:46
2019-11-19T14:02:46
185,304,772
1
2
null
null
null
null
UTF-8
C++
false
false
2,290
h
#ifndef BOUNDINGRECTANGLE_H #define BOUNDINGRECTANGLE_H #include "licore_global.h" #include "cartesian3.h" #include "vector3.h" /** * @brief * BoundingRectangle定义了二维平面空间的范围。 */ class LICORE_EXPORT BoundingRectangle { public: /** * @brief * */ BoundingRectangle() : x(0) , y(0) , width(0) , height(0) { } /** * @brief * * @param _x * @param _y * @param _w * @param _h */ BoundingRectangle(double _x, double _y, double _w, double _h) : x(_x) , y(_y) , width(_w) , height(_h) { } /** * @brief * * @return bool */ bool isNull() const { return x == 0 && y == 0 && width == 0 && height == 0; } /** * @brief * * @return Vector3 */ Vector3 center() const { return Vector3(x + width*0.5, y + height*0.5, 0.0); } /** * @brief * * @return Vector3 */ Vector3 minimum() const { return Vector3(x, y, 0); } /** * @brief * * @return Vector3 */ Vector3 maximum() const { return Vector3(x+width, y+height, 0); } /** * @brief * * @param v * @return bool */ bool contains(const Vector3 &v) const { return v.x() > x && v.x() < (x + width) && v.y() > y && v.y() < (y + height); } /** * @brief * * @param left * @param right * @return BoundingRectangle */ static BoundingRectangle unions(const BoundingRectangle &left, const BoundingRectangle &right); /** * @brief * * @param rectangle * @param point * @return BoundingRectangle */ static BoundingRectangle expand(const BoundingRectangle &rectangle, const Cartesian3 &point); /** * @brief * * @param left * @param right * @return int */ static int intersect(const BoundingRectangle &left, const BoundingRectangle &right); public: double x; /**< TODO: describe */ double y; /**< TODO: describe */ double width; /**< TODO: describe */ double height; /**< TODO: describe */ }; #endif // BOUNDINGRECTANGLE_H
[ "setrunk@163.com" ]
setrunk@163.com
f3e9b9aedce57667a88da48a1ac6247a4f37c40a
e47bd67683f5871591f1f94367f72fe50525d359
/final project/include/PortfolioHelp.h
6324b76e580800cd4a17f27847a74e4d8f728af8
[]
no_license
StarryYJ/FE-522-C-Programming-in-Finance
4e88b99f38967d6212af693937ff88a155876e99
99bc10680a922c99cf84dce16e99f482271e407e
refs/heads/master
2022-12-29T23:14:30.795636
2020-10-20T22:34:08
2020-10-20T22:34:08
305,847,141
0
0
null
null
null
null
UTF-8
C++
false
false
4,968
h
// // Created by DELL on 2020/3/6. // #ifndef HOMEWORK1_Q4_Q6_Q4_Q6_H #define HOMEWORK1_Q4_Q6_Q4_Q6_H #include <chrono> template <typename T> class LinkedNode { private: T m_nodeValue; LinkedNode* m_prevNode; LinkedNode* m_nextNode; public: LinkedNode(T value, LinkedNode* prev, LinkedNode* next); T getValue() const; LinkedNode* getPrev() const; LinkedNode* getNext() const; void setPreviousPointerToNull(); void setNextPointerToNull(); void setBeforeAndAfterPointers(); }; template <typename T> LinkedNode<T>::LinkedNode(T value, LinkedNode<T>* prev, LinkedNode<T>* next){ m_nodeValue = value; m_prevNode = prev; m_nextNode = next; } template <typename T> T LinkedNode<T>::getValue() const{ return m_nodeValue; } template <typename T> LinkedNode<T>* LinkedNode<T>::getPrev() const{ return m_prevNode; }; template <typename T> LinkedNode<T>* LinkedNode<T>::getNext() const{ return m_nextNode; }; template <typename T> void LinkedNode<T>::setPreviousPointerToNull(){ m_prevNode = nullptr; }; template <typename T> void LinkedNode<T>::setNextPointerToNull(){ m_nextNode = nullptr; }; template <typename T> void LinkedNode<T>::setBeforeAndAfterPointers(){ if ( m_prevNode == nullptr){ m_nextNode -> m_prevNode = this; } else if (m_nextNode == nullptr) { m_prevNode -> m_nextNode = this; } else{ m_prevNode -> m_nextNode = this; m_nextNode -> m_prevNode = this; } }; template <typename T> class SortedList{ private: LinkedNode<T>* m_head; LinkedNode<T>* m_tail; public: SortedList(){ m_head = nullptr; m_tail = nullptr; } SortedList(const SortedList& source); SortedList& operator=(const SortedList& rhs); int getNumElems() const; void insertValue(T value); void clear(); ~SortedList(); LinkedNode<T>* getStart(){ return m_head; }; }; template <typename T> SortedList<T>::SortedList(const SortedList<T>& source){ m_head = source.m_head; m_tail = source.m_tail; } template <typename T> SortedList<T>& SortedList<T>::operator=(const SortedList<T>& rhs){ m_head = rhs.m_head; m_tail = rhs.m_tail; } template <typename T> int SortedList<T>::getNumElems() const{ int num = 0; LinkedNode<T>* temp = m_head ; while (temp != nullptr){ num++; temp = temp -> getNext(); } return num; } template <typename T> void SortedList<T>::insertValue(T value){ if (getNumElems() == 0){ m_head = new LinkedNode<T>(value, nullptr, nullptr); } else if (getNumElems() == 1){ m_tail = new LinkedNode<T>(value, m_head, nullptr); m_head = new LinkedNode<T>(m_head->getValue(), nullptr, m_tail); m_head->setBeforeAndAfterPointers(); }else{ LinkedNode<T>* result = new LinkedNode<T>(value, m_tail, nullptr); m_tail = new LinkedNode<T>(value, result->getPrev(), nullptr); m_tail ->setBeforeAndAfterPointers(); } } template <typename T> void SortedList<T>::clear(){ LinkedNode<T>* temp = this -> m_head; LinkedNode<T>* tempA; while (temp->getNext() != nullptr){ tempA = temp; temp = temp->getNext(); delete(tempA); } delete(temp); m_head = nullptr; m_tail = nullptr; }; template <typename T> SortedList<T>::~SortedList(){ delete(m_head); delete(m_tail); }; vector<double> normalDist(double mean, double sd, int length){ vector<double> normalVec; unsigned seed = chrono::system_clock::now().time_since_epoch().count(); default_random_engine gen(seed); normal_distribution<double> dis(mean,sd); for (int i=0; i<length; ++i){ normalVec.push_back(dis(gen)); } return normalVec; } double findSum(vector<double> inputVec){ double sum = 0.0; for (int i = 0; i < inputVec.size(); i++) { sum += inputVec[i]; } return sum; } double findMax(vector<double> input){ double value = input[0]; for (int i = 0; i < input.size(); ++i) { if (input[i] > value) value = input[i]; } return value; } double findMin(vector<double> input){ double value = input[0]; for (int i = 0; i < input.size(); ++i) { if (input[i] < value) value = input[i]; } return value; } vector<double> standardize(vector<double> input){ double max = findMax(input); double min = findMin(input); double range = max-min; vector<double> out; for (int i = 0; i < input.size(); ++i) { out.push_back((input[i]-min)/range); } return out; } double cov(vector<double> A1, vector<double> B1){ vector<double> E1; for (int i = 0; i < A1.size(); ++i) { E1.push_back(A1[i]*B1[i]); } return findMean(E1)-findMean(A1)*findMean(B1); } double CorrelationCoefficient(vector<double> A2, vector<double> B2){ return cov(A2,B2)/(sampleSd(A2)*sampleSd(B2)); } #endif //HOMEWORK1_Q4_Q6_Q4_Q6_H
[ "yjin23@stevens.edu" ]
yjin23@stevens.edu
79cb0f4eb6b197e1305986e61bf0253061953629
9ada6ca9bd5e669eb3e903f900bae306bf7fd75e
/case3/ddtFoam_Tutorial/0.001750000/tau
73dddb94cf29fe41450353c805a439e7c11558c8
[]
no_license
ptroyen/DDT
a6c8747f3a924a7039b71c96ee7d4a1618ad4197
6e6ddc7937324b04b22fbfcf974f9c9ea24e48bf
refs/heads/master
2020-05-24T15:04:39.786689
2018-01-28T21:36:40
2018-01-28T21:36:40
null
0
0
null
null
null
null
UTF-8
C++
false
false
112,069
/*--------------------------------*- C++ -*----------------------------------*\ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: 2.1.1 | | \\ / A nd | Web: www.OpenFOAM.org | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "0.001750000"; object tau; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [0 0 0 0 0 0 0]; internalField nonuniform List<scalar> 12384 ( 1 1 1 0.784809 0.0199618 0.000165471 0.000170979 0.000165075 0.000172063 0.000172295 0.000173561 0.000175056 0.00017511 0.000175017 0.000174887 0.000174122 0.000178812 0.000168338 0.000177164 0.000191857 0.000709464 0.00125567 0.00135124 0.00158608 0.00136207 0.00193618 0.00243926 0.00148757 0.000432304 0.000168372 0.000169368 0.00017313 0.0001682 0.000172951 0.00017503 0.000175231 0.000175008 0.000174974 0.000174981 0.000174988 0.000174988 0.000174987 0.000174986 0.000174985 0.000174991 0.00017499 0.00017499 0.00017499 0.000174989 0.000174989 0.000174989 0.00017499 0.000174989 0.000174989 0.000174988 0.000174987 0.000174987 0.000174986 0.000174986 0.000174986 0.000174987 0.000174988 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.00017499 0.000174994 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 0.0892121 0.00212064 0.000569613 0.00305553 0.000760899 0.000160638 0.000167366 0.000172525 0.000174883 0.000175061 0.000173676 0.00017704 0.00025919 0.000751473 0.0103512 0.0375516 0.0593138 0.0799375 0.0788025 0.0885973 0.0847914 0.0892454 0.104799 0.090213 0.0566124 0.016515 0.00169582 0.00152117 0.000785825 0.000189954 0.000171834 0.000174624 0.000175226 0.000175015 0.000174967 0.000174977 0.000174985 0.000174987 0.000174986 0.000174985 0.000174992 0.00017499 0.00017499 0.000174993 0.000174994 0.000174996 0.000174999 0.000174999 0.000175 0.000175 0.000174999 0.000174997 0.000174994 0.000174991 0.00017499 0.000174989 0.000174988 0.000174987 0.000174987 0.000174987 0.000174987 0.000174987 0.000174988 0.000174989 0.000174989 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 0.18863 0.10663 0.0795614 0.119168 0.036024 0.00461492 0.00017837 0.000162796 0.000171877 0.000174762 0.000177055 0.000401128 0.00789329 0.0487913 0.256205 1 1 1 1 1 1 1 1 1 1 0.741572 0.128812 0.075982 0.0531535 0.00936415 0.000174686 0.000170135 0.000174465 0.000175252 0.000175009 0.000174964 0.000174975 0.000174984 0.000174986 0.000174986 0.000174993 0.000174994 0.000174997 0.000175001 0.000175005 0.000175004 0.000175001 0.000174999 0.000174998 0.000175001 0.000175002 0.000175007 0.000175009 0.000175005 0.000174999 0.000174995 0.000174993 0.000174991 0.00017499 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174993 0.000174995 0.000174996 0.000174997 0.000174997 0.000174996 0.000174996 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174997 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 0.338715 0.139215 0.0355885 0.00160026 0.000167591 0.000174664 0.000183069 0.00832645 0.473888 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.178848 0.0103514 0.000170207 0.000167662 0.000174067 0.000175497 0.000175053 0.000174964 0.000174978 0.000174988 0.000174988 0.000174995 0.000174997 0.000175001 0.000175001 0.000174995 0.00017499 0.000174988 0.000174985 0.000174978 0.00017498 0.00017499 0.000174994 0.000174999 0.000175008 0.000175009 0.000175005 0.000174999 0.000174994 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174994 0.000174994 0.000174997 0.000175 0.000175001 0.000175001 0.000175001 0.000175 0.000174998 0.000174997 0.000174996 0.000174996 0.000174996 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 0.38306 0.112887 0.0207206 0.000198956 0.000604454 0.0483077 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.195303 0.0108386 0.000167653 0.000166551 0.000173823 0.000175621 0.000175087 0.000174973 0.000174982 0.00017499 0.000174993 0.000174996 0.000174997 0.000174991 0.000174983 0.000174981 0.000174986 0.000174981 0.000175008 0.000174976 0.000174955 0.000174963 0.000174983 0.000174993 0.000175003 0.00017501 0.000175007 0.000175001 0.000174995 0.000174993 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174993 0.000174998 0.000175001 0.000175001 0.000175001 0.000175002 0.000175004 0.000175003 0.000175001 0.000174999 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.169447 0.00452705 0.000536712 0.110663 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.237844 0.0138538 0.00017432 0.00016609 0.00017307 0.00017556 0.000175099 0.000174962 0.00017499 0.000174992 0.000175017 0.000175003 0.000174984 0.000174972 0.000174979 0.000175052 0.000175017 0.000175481 0.000175056 0.000174954 0.000174934 0.000174941 0.000174979 0.000174992 0.000174999 0.000175008 0.000175008 0.000175002 0.000174996 0.000174993 0.000174992 0.000174992 0.000174991 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174991 0.000174999 0.000174996 0.000174993 0.000174992 0.000174994 0.000174997 0.000175003 0.000175004 0.000175002 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.177913 0.00694188 0.0357599 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.781999 0.0622615 0.000210264 0.000168221 0.000170931 0.000175414 0.000175207 0.000174927 0.000174589 0.00017454 0.00017458 0.000174712 0.000174831 0.000175232 0.000174663 0.000175209 0.000174447 0.000174654 0.000174993 0.000175158 0.000174957 0.000174935 0.000174978 0.000174991 0.000174997 0.000175005 0.000175006 0.000175001 0.000174996 0.000174994 0.000174992 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174991 0.000174998 0.000174992 0.000174988 0.000174986 0.000174985 0.000174988 0.000174994 0.000175002 0.000175004 0.000175002 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000175 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.161693 0.0034348 0.0216035 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.108115 0.00850736 0.00018127 0.000167263 0.000173954 0.000175365 0.000171308 0.000169871 0.000169332 0.000170376 0.000171212 0.000171777 0.000170714 0.000170718 0.000170628 0.000171332 0.000173267 0.000174826 0.000175418 0.000175005 0.000174917 0.000174974 0.000174993 0.000174997 0.000175003 0.000175004 0.000175 0.000174996 0.000174994 0.000174992 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174993 0.000174991 0.000174989 0.000174988 0.000174986 0.000174985 0.000174988 0.000174996 0.000175002 0.000175002 0.000175 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 0.142362 1 1 0.19036 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.124578 0.00459508 0.000179004 0.000163748 0.000169648 0.000183086 0.000195727 0.000189872 0.000186108 0.000188047 0.000187021 0.000172934 0.000171182 0.00016749 0.000169929 0.000165667 0.000168248 0.000171361 0.0001754 0.000175798 0.000174897 0.00017491 0.00017499 0.000174996 0.000174996 0.000175 0.000175002 0.000174999 0.000174995 0.000174993 0.000174992 0.000174991 0.000174992 0.00017499 0.00017499 0.000174989 0.000174989 0.000174991 0.000174991 0.000174991 0.00017499 0.00017499 0.000174989 0.000174988 0.000174988 0.000174992 0.000174998 0.000175001 0.000175 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174998 0.000174999 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.11551 0.00326183 0.00211038 0.00460032 0.00717488 0.00694577 0.00550467 0.00901294 0.0116594 0.00728247 0.00243836 0.000477519 0.000243776 0.000206292 0.000167623 0.000166792 0.000173377 0.000175844 0.000175174 0.000174921 0.000174961 0.000174991 0.000174992 0.000174993 0.000174997 0.000174999 0.000174997 0.000174995 0.000174993 0.000174993 0.000174992 0.000174991 0.000174991 0.000174989 0.000174989 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.000174989 0.000174989 0.00017499 0.000174992 0.000174995 0.000174998 0.000174999 0.000174998 0.000174998 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174999 0.000174999 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.321935 0.130757 0.134287 0.172637 0.149432 0.0783238 0.0456973 0.0352514 0.0219975 0.00605396 0.000203922 0.000165409 0.000173699 0.000175201 0.000174967 0.000174943 0.000174976 0.000174989 0.000174991 0.000174991 0.000174994 0.000174995 0.000174995 0.000174994 0.000174993 0.000174992 0.000174992 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174989 0.00017499 0.00017499 0.000174991 0.000174991 0.000174992 0.000174994 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174996 0.000174997 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.564639 0.354928 0.32043 0.217147 0.0784505 0.011868 0.000161539 0.000167087 0.000174537 0.000175088 0.00017498 0.000174964 0.000174982 0.000174991 0.000174991 0.00017499 0.000174991 0.000174993 0.000174993 0.000174993 0.000174992 0.000174993 0.000174992 0.000174992 0.000174992 0.000174991 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174994 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.303731 0.057883 0.00210729 0.000167636 0.000168232 0.000174651 0.000175108 0.000175011 0.000174985 0.000174986 0.000174988 0.000174988 0.000174989 0.000174989 0.00017499 0.000174991 0.000174991 0.000174992 0.000174991 0.000174992 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.450581 0.104586 0.00764754 0.000158351 0.000167901 0.00017364 0.000174994 0.000175034 0.000174977 0.000174982 0.000174987 0.000174988 0.000174988 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.938078 0.263378 0.0487725 0.00135649 0.000164008 0.000167496 0.000175153 0.000175769 0.000175088 0.000174938 0.000174971 0.000174989 0.000174989 0.000174988 0.000174988 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.175543 0.0588584 0.0347663 0.0136794 0.00203182 0.000165947 0.000160789 0.000169657 0.00017364 0.000174688 0.000174944 0.000174981 0.000174986 0.000174987 0.000174988 0.000174988 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174995 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 0.0762724 0.000555567 0.000146304 0.000165722 0.000164834 0.000170416 0.000174165 0.000174995 0.000175183 0.000174996 0.00017542 0.000173442 0.000161599 0.000170092 0.000180041 0.000713832 0.00181461 0.00299472 0.00236627 0.00124479 0.00164867 0.00198135 0.0016839 0.00105679 0.000364825 0.000175372 0.000170533 0.000168248 0.000174156 0.000172376 0.000174663 0.000175287 0.000175022 0.000174978 0.000174981 0.000174987 0.000174988 0.000174987 0.000174986 0.000174985 0.000174991 0.00017499 0.00017499 0.000174989 0.000174989 0.000174989 0.00017499 0.000174989 0.00017499 0.000174989 0.000174988 0.000174987 0.000174987 0.000174986 0.000174986 0.000174986 0.000174987 0.000174988 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.00017499 0.00017499 0.000174994 0.000174994 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 0.0715192 0.00166877 0.00346857 0.00148998 0.000251296 0.000172463 0.000166824 0.000171558 0.000174514 0.000175241 0.000175211 0.000170634 0.001048 0.0027807 0.0133434 0.0544005 0.0822703 0.0925418 0.0942773 0.0811116 0.0876392 0.0973834 0.0822847 0.0737772 0.0556211 0.0101831 0.000833525 0.000890275 0.000429746 0.000181679 0.000171689 0.000174718 0.000175155 0.000175003 0.000174966 0.000174978 0.000174986 0.000174987 0.000174986 0.000174985 0.000174991 0.000174991 0.000174991 0.000174992 0.000174994 0.000174997 0.000174998 0.000175 0.000175001 0.000175 0.000174999 0.000174997 0.000174994 0.000174992 0.00017499 0.000174989 0.000174987 0.000174987 0.000174987 0.000174986 0.000174987 0.000174987 0.000174988 0.000174989 0.000174989 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174993 0.000174993 0.000174993 0.000174993 0.000174993 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 0.17535 0.0952093 0.122099 0.0895218 0.0413932 0.00825268 0.000191817 0.000168941 0.00017027 0.00017477 0.00016811 0.00504883 0.0673774 0.0600057 0.406269 1 1 1 1 1 1 1 1 1 1 0.347306 0.0882227 0.0646285 0.0494622 0.006267 0.000166651 0.000170169 0.000174997 0.000175217 0.000174982 0.000174964 0.00017498 0.000174986 0.000174986 0.000174986 0.000174993 0.000174994 0.000174997 0.000175 0.000175004 0.000175004 0.000175002 0.000175 0.000174999 0.000175 0.000175003 0.000175007 0.000175009 0.000175005 0.000174999 0.000174995 0.000174992 0.000174991 0.00017499 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174993 0.000174995 0.000174996 0.000174997 0.000174997 0.000174996 0.000174996 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 0.482791 0.179604 0.0388261 0.00143216 0.000174545 0.000168699 0.000457166 0.0771526 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.173514 0.00757233 0.000166613 0.000168477 0.000174762 0.00017553 0.000175064 0.00017496 0.00017498 0.000174988 0.000174987 0.000174993 0.000174996 0.000175001 0.000175001 0.000174995 0.00017499 0.000174987 0.000174988 0.000174986 0.000174984 0.000174988 0.000174994 0.000174999 0.000175008 0.00017501 0.000175005 0.000174999 0.000174994 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174994 0.000174994 0.000174997 0.000175 0.000175001 0.000175001 0.000175001 0.000175 0.000174998 0.000174997 0.000174996 0.000174996 0.000174996 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 0.306434 0.109364 0.0159784 0.000222578 0.000222884 0.0509594 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.179572 0.00821257 0.00016667 0.000166429 0.000173967 0.000175669 0.000175104 0.000174967 0.00017498 0.00017499 0.000174995 0.000174998 0.000174999 0.00017499 0.000174983 0.000174981 0.000174988 0.000174991 0.000174983 0.000174986 0.000174959 0.000174967 0.000174982 0.000174992 0.000175002 0.00017501 0.000175007 0.000175001 0.000174995 0.000174993 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174993 0.000174999 0.000175001 0.000175 0.000175 0.000175001 0.000175004 0.000175003 0.000175001 0.000174999 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174995 0.000174996 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.15048 0.00422938 0.000528819 0.0628342 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.207991 0.0124003 0.000169669 0.00016375 0.000173164 0.000175638 0.000175142 0.000174976 0.000174974 0.000174987 0.000174999 0.000174999 0.000175003 0.000175005 0.000174995 0.000175094 0.000174944 0.000174983 0.000175097 0.000174944 0.000174953 0.000174938 0.000174976 0.000174991 0.000174999 0.000175008 0.000175008 0.000175002 0.000174996 0.000174993 0.000174992 0.000174992 0.000174991 0.000174991 0.000174991 0.00017499 0.00017499 0.000174991 0.000174991 0.000174998 0.000174996 0.000174993 0.000174992 0.000174993 0.000174997 0.000175003 0.000175004 0.000175002 0.000174999 0.000174998 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.148092 0.00609781 0.0259523 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.489986 0.0371473 0.000376797 0.00016433 0.000170491 0.000175408 0.000175389 0.000175009 0.00017454 0.000174134 0.000174525 0.000174604 0.000174402 0.000174404 0.0001748 0.000174094 0.000174752 0.0001745 0.000174803 0.000174989 0.000174964 0.000174936 0.000174977 0.000174991 0.000174997 0.000175006 0.000175007 0.000175001 0.000174996 0.000174994 0.000174992 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.00017499 0.000174999 0.000174992 0.000174988 0.000174986 0.000174986 0.000174988 0.000174995 0.000175002 0.000175004 0.000175002 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000175 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 0.172587 0.00620974 0.042221 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.122333 0.00887198 0.000175517 0.000165186 0.000173764 0.000175169 0.000170069 0.000168566 0.000168104 0.000168591 0.000169933 0.000170719 0.00017097 0.000169824 0.000170758 0.000171399 0.000172603 0.000174404 0.000175493 0.000175063 0.000174908 0.000174973 0.000174992 0.000174997 0.000175003 0.000175004 0.000175 0.000174996 0.000174994 0.000174993 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174992 0.000174991 0.00017499 0.000174988 0.000174986 0.000174986 0.000174989 0.000174996 0.000175001 0.000175002 0.000175 0.000174999 0.000174998 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 0.19812 1 1 0.111536 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.146312 0.0084715 0.0001893 0.00016617 0.000170442 0.000185212 0.000192845 0.000194167 0.000196024 0.00020272 0.000198374 0.000186431 0.00016863 0.000170893 0.000167465 0.000166442 0.00016478 0.000171474 0.000176018 0.000175762 0.000174851 0.000174922 0.000174991 0.000174995 0.000174995 0.000175 0.000175001 0.000174999 0.000174995 0.000174993 0.000174992 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.000174989 0.00017499 0.00017499 0.00017499 0.00017499 0.000174989 0.000174988 0.000174988 0.000174989 0.000174993 0.000174998 0.000175001 0.000175 0.000174999 0.000174998 0.000174998 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174998 0.000174999 0.000175 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.158776 0.00836232 0.00219847 0.00481851 0.0101523 0.00785632 0.00647316 0.0106345 0.0140863 0.00936489 0.00291072 0.000617829 0.000305259 0.000198784 0.000177446 0.000165692 0.000171056 0.00017629 0.000175315 0.000174887 0.000174952 0.000174996 0.00017499 0.000174992 0.000174997 0.000174999 0.000174997 0.000174995 0.000174993 0.000174992 0.000174992 0.000174992 0.00017499 0.00017499 0.00017499 0.00017499 0.00017499 0.00017499 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.000174992 0.000174995 0.000174998 0.000174999 0.000174999 0.000174998 0.000174998 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174997 0.000174998 0.000174999 0.000175 0.000174999 0.000175 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.347526 0.140415 0.141242 0.184096 0.161406 0.0861155 0.0475408 0.039166 0.0263421 0.00904303 0.000433827 0.000161271 0.000171023 0.000176933 0.000175316 0.000174665 0.000174949 0.00017499 0.000174991 0.000174991 0.000174994 0.000174995 0.000174995 0.000174994 0.000174993 0.000174993 0.000174992 0.000174991 0.000174991 0.00017499 0.00017499 0.00017499 0.000174989 0.00017499 0.00017499 0.00017499 0.000174991 0.000174991 0.000174992 0.000174994 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174996 0.000174997 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.591871 0.3741 0.325382 0.258228 0.0986382 0.0186349 0.000185371 0.000165051 0.000172496 0.000175128 0.000175042 0.000174953 0.000174968 0.000174989 0.000174992 0.00017499 0.000174991 0.000174992 0.000174993 0.000174993 0.000174993 0.000174992 0.000174992 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.00017499 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174994 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.378703 0.0799266 0.0048082 0.000162028 0.000170624 0.000174636 0.000175172 0.000175003 0.000174971 0.00017498 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.000174991 0.000174991 0.000174991 0.000174992 0.000174991 0.000174992 0.000174992 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.541804 0.129705 0.0151784 0.000176134 0.000164366 0.000172747 0.000174982 0.000175017 0.00017498 0.00017498 0.000174987 0.000174989 0.000174988 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174995 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.297154 0.0584768 0.00192832 0.000156187 0.000167316 0.000174662 0.000175686 0.000175106 0.000174954 0.000174976 0.000174986 0.000174989 0.000174988 0.000174988 0.000174989 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.000174991 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174995 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0.200274 0.072056 0.0392556 0.0172113 0.00268727 0.000152881 0.000161456 0.000169542 0.000173432 0.000174706 0.000174938 0.00017498 0.000174986 0.000174987 0.000174988 0.000174988 0.000174988 0.000174989 0.000174989 0.000174989 0.00017499 0.00017499 0.00017499 0.000174991 0.00017499 0.000174991 0.000174991 0.000174991 0.000174991 0.000174991 0.000174992 0.000174992 0.000174993 0.000174993 0.000174993 0.000174994 0.000174994 0.000174994 0.000174994 0.000174994 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174995 0.000174996 0.000174996 0.000174996 0.000174996 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174997 0.000174998 0.000174998 0.000174998 0.000174998 0.000174998 0.000174999 0.000174998 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000174999 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 0.000175 ) ; boundaryField { wand { type zeroGradient; } frontAndBack { type empty; } } // ************************************************************************* //
[ "ubuntu@ip-172-31-45-175.eu-west-1.compute.internal" ]
ubuntu@ip-172-31-45-175.eu-west-1.compute.internal
f27438fdacc997e7f019a3a5847ca1165160ac96
e3e1287b7f618c123c9a25eefb0da77bc23d3e1a
/Hummingbird-Base/Vector2d.h
9e09a070c52c6f105abefe9228a11eae0cd6d828
[ "MIT" ]
permissive
Galbar/GGJ-2015
ad814675e630954749bb8a431e5281ba212db1f2
e290362d42db1db34de34fb933240fcfb9d6666c
HEAD
2016-08-06T00:46:36.992284
2015-01-28T11:02:44
2015-01-28T11:02:44
29,761,290
0
0
null
null
null
null
UTF-8
C++
false
false
988
h
#ifndef HB_VECTOR_2D_H #define HB_VECTOR_2D_H namespace hb { class Vector2d { public: double x, y; Vector2d(): x(0), y(0){}; Vector2d(double x, double y): x(x), y(y){}; Vector2d(const Vector2d& v): x(v.x), y(v.y){}; }; } hb::Vector2d operator -(const hb::Vector2d& right); hb::Vector2d& operator +=(hb::Vector2d& left, const hb::Vector2d& right); hb::Vector2d& operator -=(hb::Vector2d& left, const hb::Vector2d& right); hb::Vector2d operator +(const hb::Vector2d& left, const hb::Vector2d& right); hb::Vector2d operator -(const hb::Vector2d& left, const hb::Vector2d& right); hb::Vector2d operator *(const hb::Vector2d& left, double right); hb::Vector2d operator *(double left, const hb::Vector2d& right); hb::Vector2d& operator *=(hb::Vector2d& left, double right); hb::Vector2d operator /(const hb::Vector2d& left, double right); hb::Vector2d& operator /=(hb::Vector2d& left, double right); bool operator ==(const hb::Vector2d& left, const hb::Vector2d& right); #endif
[ "alessio@alessio.cc" ]
alessio@alessio.cc
0460ef06dde185509cb462b551c5a7574c29e373
ef187d259d33e97c7b9ed07dfbf065cec3e41f59
/work/atcoder/abc/abc037/A/answers/18527_kzyKT.cpp
f91cfe72afb2914b09e9557f859f60cd70dac66c
[]
no_license
kjnh10/pcw
847f7295ea3174490485ffe14ce4cdea0931c032
8f677701bce15517fb9362cc5b596644da62dca8
refs/heads/master
2020-03-18T09:54:23.442772
2018-07-19T00:26:09
2018-07-19T00:26:09
134,586,379
0
0
null
null
null
null
UTF-8
C++
false
false
1,198
cpp
#include <bits/stdc++.h> using namespace std; #define all(c) (c).begin(),(c).end() #define rrep(i,n) for(int i=(int)(n)-1;i>=0;i--) #define REP(i,m,n) for(int i=(int)(m);i<(int)(n);i++) #define rep(i,n) REP(i,0,n) #define iter(c) __typeof((c).begin()) #define tr(it,c) for(iter(c) it=(c).begin();it!=(c).end();it++) #define mem(a) memset(a,0,sizeof(a)) #define pd(a) printf("%.10f\n",a) #define pb(a) push_back(a) #define in(a) insert(a) #define pi M_PI #define R cin>> #define F first #define S second #define C class #define ll long long #define ln cout<<'\n' #define _(_1,_2,_3,N,...)N #define pr(...) _(__VA_ARGS__,pr3,pr2,pr1)(__VA_ARGS__) template<C T>void pr1(T a){cout<<a;ln;} template<C T,C T2>void pr2(T a,T2 b){cout<<a<<' '<<b;ln;} template<C T,C T2,C T3>void pr3(T a,T2 b,T3 c){cout<<a<<' '<<b<<' '<<c;ln;} template<C T>void PR(T a,int n){rep(i,n){if(i)cout<<' ';cout<<a[i];}ln;} bool check(int n,int m,int x,int y){return x>=0&&x<n&&y>=0&&y<m;} const ll MAX=1000000007,MAXL=1LL<<60,dx[4]={-1,0,1,0},dy[4]={0,1,0,-1}; typedef pair<int,int> P; void Main() { int a,b,c; cin >> a >> b >> c; pr(c/min(a,b)); } int main() { ios::sync_with_stdio(0);cin.tie(0); Main();return 0; }
[ "kojinho10@gmail.com" ]
kojinho10@gmail.com
cc0bbbbc859fce6cfeb230bbce91b8c3373a5cde
e542522d4bcddbe88a66879a7183a73c1bbdbb17
/Others/USACO/2020-US-open-contest/A/brute.cpp
46d053173ad562811220916727246953b9b52135
[]
no_license
ishank-katiyar/Competitive-programming
1103792f0196284cf24ef3f24bd243d18536f2f6
5240227828d5e94e2587d5d2fd69fa242d9d44ef
refs/heads/master
2023-06-21T17:30:48.855410
2021-08-13T14:51:53
2021-08-13T14:51:53
367,391,580
0
0
null
null
null
null
UTF-8
C++
false
false
776
cpp
#include <bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); #ifndef LOCAL freopen ("socdist1.in", "r", stdin); freopen ("socdist1.out", "w", stdout); #endif int n; cin >> n; string s; cin >> s; int ans = 0; for (int i = 0; i < n; i++) { for (int j = i + 1; j < n; j++) { if (s[i] == '1') continue; if (s[j] == '1') continue; string S = s; S[i] = S[j] = '1'; vector<int> a; for (int I = 0; I < n; I++) { if (S[I] == '1') a.push_back (I); } int cur_ans = INT_MAX; int sz = static_cast <int> (a.size()); for (int I = 1; I < sz; I++) { cur_ans = min (cur_ans, a[I] - a[I - 1]); } assert (cur_ans != INT_MAX); ans = max (ans, cur_ans); } } cout << ans << '\n'; return 0; }
[ "ishankkatiyar162@gmail.com" ]
ishankkatiyar162@gmail.com
b61022eb7e7e1444c6a38fbf442fbbe422de63cf
027b3f6774e9ef58bdccba1e311ab2337a67195a
/WCuda/Tuto_CppTest/src/cpp/test/junit/TestScalarJunit.h
65fec5daf3890658393708af1d2bfc64e84de81c
[]
no_license
Globaxe/CUDALOL
6b1cb552dbaca112fffa8bb6be796fed63b50362
5f2cd4ccdbcb11fd8abf8bd8d62d0666d87634f8
refs/heads/master
2020-03-15T12:08:32.539414
2018-05-04T14:37:34
2018-05-04T14:37:34
132,137,704
1
0
null
null
null
null
UTF-8
C++
false
false
675
h
#pragma once #include "cpptest.h" #include "scalar.h" class TestScalarJunit: public Test::Suite { public: TestScalarJunit(void) { TEST_ADD(TestScalarJunit::testAdd); TEST_ADD(TestScalarJunit::testFois); } private: void testAdd(void) { TEST_ASSERT(sum(2,3)==5); TEST_ASSERT(sum(-2,3)==1.0); } void testFois(void) { TEST_ASSERT(fois(2,3)==6); TEST_ASSERT(fois(-2,3)==-6); } }; /*----------------------------------------------------------------------*\ |* End *| \*---------------------------------------------------------------------*/
[ "cedric.pahud@he-arc.ch" ]
cedric.pahud@he-arc.ch
bffe00b714b11283f385737a38bd49d3f19e6e81
434c099691852cdb55e484d3be33a17b241561e2
/src/main.cpp
392c5758b771a05f922e92735bf26c0fa660438c
[]
no_license
yacineb/shortest-path-poc
aa6bd1b8b65284e3710552605d98934582226484
be8ba0f392d2d87f9e999dc62a03d678a92d0714
refs/heads/main
2022-12-26T10:38:07.368343
2020-10-12T09:23:46
2020-10-12T09:23:46
303,338,603
0
0
null
null
null
null
UTF-8
C++
false
false
906
cpp
#include "file_source.hpp" #include <string> int main(int argc, char **argv) { // parse input arguments const char *fpath; Graph::VertexId src,dest; Graph::MetricType criteria; try { fpath = argv[1]; src = std::stoi(argv[2]); dest = std::stoi(argv[3]); criteria = static_cast<Graph::MetricType>(std::stoi(argv[4])); } catch (...) { std::cout << "cli arguments parse failed. Usage: <json_file> <src_vertex_id> <dest_vertex_id> <metric_type>" << std::endl; return 1; } auto graph = data_source::parse_graph_data(fpath); auto path = graph->find_shortest_path(src, dest, criteria); if (!path.has_value()) { std::cout << "There is no path between the given vertices" << std::endl; return 1; } // print shortest path for(auto& vertex : path.value()) { std::cout << vertex << (vertex == dest ? "\n" : " --> "); } return 0; }
[ "yacine@netkin.fr" ]
yacine@netkin.fr
94822db8df5ae675a0632e9bbe6f02dc2ed52546
76fcfda50393c8d80cf39a0b54c3c0af8ddaff04
/dodo/src/gl-renderer.cpp
64d440e6dc6b27044bc83eedbe1080d89295595f
[]
no_license
fsole/Dodo3D
5e9cce73325dd2e9187d37faf0720ab12f8b2eab
7c19e1c0dc003dedaf441d5a828364636338c83e
refs/heads/master
2020-12-12T17:01:04.791263
2016-11-08T12:34:59
2016-11-08T12:36:24
48,367,402
3
1
null
null
null
null
UTF-8
C++
false
false
38,598
cpp
#include <gl-renderer.h> #include <GL/glew.h> #include <log.h> #include <math.h> #include <assimp/cimport.h> #include <assimp/scene.h> #include <assimp/postprocess.h> #ifdef DEBUG #define CHECK_GL_ERROR(a) (a); CheckGlError(#a, __LINE__ ); #define PRINT_GLSL_COMPILER_LOG(a) PrintGLSLCompilerLog(a) #else #define CHECK_GL_ERROR(a) (a) #define PRINT_GLSL_COMPILER_LOG(a) #endif #define MAX_MESH_COUNT 1000 using namespace Dodo; namespace { struct GLErrorString { const GLenum mError; const char* mString; }; GLErrorString gGlErrorString[] = { { GL_NO_ERROR, "GL_NO_ERROR" }, { GL_INVALID_ENUM, "GL_INVALID_ENUM" }, { GL_INVALID_VALUE, "GL_INVALID_VALUE" }, { GL_INVALID_OPERATION, "GL_INVALID_OPERATION" }, { GL_OUT_OF_MEMORY, "GL_OUT_OF_MEMORY" } }; u32 gErrorCount = sizeof(gGlErrorString) / sizeof(gGlErrorString[0]); const char* GLErrorToString( GLenum error ) { for( u32 i(0); i<gErrorCount; ++i) { if (error == gGlErrorString[i].mError) { return gGlErrorString[i].mString; } } return "Unknown OpenGL error"; } void CheckGlError( const char* operation, int line ) { GLint error = glGetError(); if( error != GL_NO_ERROR ) { std::cout<<"OpenGL error "<<GLErrorToString(error)<<" after "<<operation<<" in line:"<<line<<std::endl; assert(0); } } GLenum GetGLType( Dodo::Type type ) { switch( type ) { case Dodo::U8: return GL_UNSIGNED_BYTE; case Dodo::S8: return GL_BYTE; case Dodo::U32: return GL_UNSIGNED_INT; case Dodo::S32: return GL_INT; case Dodo::F32: return GL_FLOAT; default: return GL_FLOAT; } } void PrintGLSLCompilerLog(GLuint obj) { int infologLength = 0; int maxLength; if(glIsShader(obj)) { glGetShaderiv(obj,GL_INFO_LOG_LENGTH,&maxLength); char* infoLog = new char[maxLength]; glGetShaderInfoLog(obj, maxLength, &infologLength, infoLog); if( infologLength > 0 ) { DODO_LOG("GLSL Error: %s",infoLog ); } delete[] infoLog; } else { glGetProgramiv(obj,GL_INFO_LOG_LENGTH,&maxLength); char* infoLog = new char[maxLength]; glGetProgramInfoLog(obj, maxLength, &infologLength, infoLog); if( infologLength > 0 ) { DODO_LOG( "GLSL Error: %s", infoLog ); } delete[] infoLog; } } bool GetTextureGLFormat( TextureFormat format, GLenum& dataFormat, GLenum& internalFormat, GLenum& dataType ) { dataType = GL_UNSIGNED_BYTE; switch( format ) { case Dodo::FORMAT_GL_DEPTH: { dataFormat = GL_DEPTH_COMPONENT; internalFormat = GL_DEPTH_COMPONENT; break; } case Dodo::FORMAT_GL_DEPTH_STENCIL: { dataFormat = GL_DEPTH_STENCIL; internalFormat = GL_DEPTH24_STENCIL8; dataType = GL_UNSIGNED_INT_24_8; break; } case Dodo::FORMAT_RGB8: { dataFormat = GL_RGB; internalFormat = GL_RGB8; break; } case Dodo::FORMAT_RGBA8: { dataFormat = GL_RGBA; internalFormat = GL_RGBA8; break; } case Dodo::FORMAT_R8: { dataFormat = GL_LUMINANCE; internalFormat = GL_LUMINANCE8; break; } case Dodo::FORMAT_RGB32F: { dataFormat = GL_RGB; internalFormat = GL_RGB32F; dataType = GL_FLOAT; break; } case Dodo::FORMAT_RGBA32F: { dataFormat = GL_RGBA; internalFormat = GL_RGBA32F; dataType = GL_FLOAT; break; } default: //@TODO: Implement the rest { return false; } } return true; } GLenum GetGLPrimitive( u32 primitive ) { switch( primitive ) { case PRIMITIVE_TRIANGLES: { return GL_TRIANGLES; } case PRIMITIVE_POINTS: { return GL_POINTS; } case PRIMITIVE_LINES: { return GL_LINES; } default: { return 0; } } } GLenum GetGLBlendingFunction( BlendingFunction function ) { switch( function ) { case BLENDING_FUNCTION_ZERO: return GL_ZERO; case BLENDING_FUNCTION_ONE: return GL_ONE; case BLENDING_SOURCE_COLOR: return GL_SRC_COLOR; case BLENDING_ONE_MINUS_SOURCE_COLOR: return GL_ONE_MINUS_SRC_COLOR; case BLENDING_DESTINATION_COLOR: return GL_DST_COLOR; case BLENDING_ONE_MINUS_DESTINATION_COLOR: return GL_ONE_MINUS_DST_COLOR; case BLENDING_SOURCE_ALPHA: return GL_SRC_ALPHA; case BLENDING_ONE_MINUS_SOURCE_ALPHA: return GL_ONE_MINUS_SRC_ALPHA; case BLENDING_DESTINATION_ALPHA: return GL_DST_ALPHA; case BLENDING_ONE_MINUS_DESTINATION_ALPHA: return GL_ONE_MINUS_DST_ALPHA; default: return GL_ZERO; } } MeshId AddSubMeshFromFile( const struct aiScene* scene, u32 submesh, GLRenderer* renderer, Material* material = 0) { Mesh newMesh; const struct aiMesh* mesh = scene->mMeshes[submesh]; newMesh.mVertexCount = mesh->mNumVertices; bool bHasUV( mesh->HasTextureCoords(0) ); bool bHasColor( mesh->HasVertexColors(0) ); bool bHasNormal(mesh->HasNormals() ); bool bHasTangent(mesh->HasTangentsAndBitangents() ); u32 vertexSize = 3; if( bHasUV) vertexSize += 2; if( bHasColor ) vertexSize += 4; if(bHasNormal) vertexSize += 3; if(bHasTangent ) vertexSize += 6; size_t vertexBufferSize( newMesh.mVertexCount * vertexSize * sizeof(f32) ); f32* vertexData = new f32[ newMesh.mVertexCount * vertexSize ]; u32 index(0); vec3 vertexMin( F32_MAX, F32_MAX, F32_MAX ); vec3 vertexMax( 0.0f, 0.0f, 0.0f ); for( u32 vertex(0); vertex<newMesh.mVertexCount; ++vertex ) { vertexData[index++] = mesh->mVertices[vertex].x; vertexData[index++] = mesh->mVertices[vertex].y; vertexData[index++] = mesh->mVertices[vertex].z; //Find min and max vertex values if( mesh->mVertices[vertex].x < vertexMin.x ) { vertexMin.x = mesh->mVertices[vertex].x; } if( mesh->mVertices[vertex].x > vertexMax.x ) { vertexMax.x = mesh->mVertices[vertex].x; } if( mesh->mVertices[vertex].y < vertexMin.y ) { vertexMin.y = mesh->mVertices[vertex].y; } if( mesh->mVertices[vertex].y > vertexMax.y ) { vertexMax.y = mesh->mVertices[vertex].y; } if( mesh->mVertices[vertex].z < vertexMin.z ) { vertexMin.z = mesh->mVertices[vertex].z; } if( mesh->mVertices[vertex].z > vertexMax.z ) { vertexMax.z = mesh->mVertices[vertex].z; } if( bHasUV ) { vertexData[index++] = mesh->mTextureCoords[0][vertex].x; vertexData[index++] = mesh->mTextureCoords[0][vertex].y; } if( bHasColor ) { vertexData[index++] = mesh->mColors[0][vertex].r; vertexData[index++] = mesh->mColors[0][vertex].g; vertexData[index++] = mesh->mColors[0][vertex].b; vertexData[index++] = mesh->mColors[0][vertex].a; } if( bHasNormal ) { vertexData[index++] = mesh->mNormals[vertex].x; vertexData[index++] = mesh->mNormals[vertex].y; vertexData[index++] = mesh->mNormals[vertex].z; } if( bHasTangent ) { vertexData[index++] = mesh->mTangents[vertex].x; vertexData[index++] = mesh->mTangents[vertex].y; vertexData[index++] = mesh->mTangents[vertex].z; vertexData[index++] = mesh->mBitangents[vertex].x; vertexData[index++] = mesh->mBitangents[vertex].y; vertexData[index++] = mesh->mBitangents[vertex].z; } } u32* indices(0); size_t indexBufferSize(0); if( mesh->HasFaces() ) { newMesh.mIndexCount = mesh->mNumFaces * 3; //@WARNING: Assuming triangles! indexBufferSize = newMesh.mIndexCount * sizeof( unsigned int ); indices = new u32[newMesh.mIndexCount]; for( u32 face(0); face<mesh->mNumFaces; ++face ) { indices[face*3] = mesh->mFaces[face].mIndices[0]; indices[face*3 + 1] = mesh->mFaces[face].mIndices[1]; indices[face*3 + 2] = mesh->mFaces[face].mIndices[2]; } } //Compute AABB DODO_LOG( "Min: (%f,%f,%f). Max: (%f,%f,%f) ", vertexMin.x, vertexMin.y, vertexMin.z, vertexMax.x, vertexMax.y,vertexMax.z); newMesh.mAABB.mCenter = 0.5f * ( vertexMax + vertexMin ); newMesh.mAABB.mExtents = newMesh.mAABB.mCenter - vertexMin; DODO_LOG( "Center: (%f,%f,%f). Extents: (%f,%f,%f) ", newMesh.mAABB.mCenter.x, newMesh.mAABB.mCenter.y, newMesh.mAABB.mCenter.z, newMesh.mAABB.mExtents.x, newMesh.mAABB.mExtents.y,newMesh.mAABB.mExtents.z); //Create buffers newMesh.mVertexBuffer = renderer->AddBuffer( vertexBufferSize, vertexData ); delete[] vertexData; if( indices ) { newMesh.mIndexBuffer = renderer->AddBuffer( indexBufferSize, indices ); delete[] indices; } newMesh.mVertexFormat.SetAttribute(VERTEX_POSITION, AttributeDescription( F32x3, 0, vertexSize) ); if( bHasUV ) { newMesh.mVertexFormat.SetAttribute(VERTEX_UV, AttributeDescription( F32x2, newMesh.mVertexFormat.VertexSize(), vertexSize) ); } if( bHasColor ) { newMesh.mVertexFormat.SetAttribute(VERTEX_COLOR, AttributeDescription( F32x3, newMesh.mVertexFormat.VertexSize(), vertexSize) ); } if( bHasNormal ) { newMesh.mVertexFormat.SetAttribute(VERTEX_NORMAL, AttributeDescription( F32x3, newMesh.mVertexFormat.VertexSize(), vertexSize) ); } if( bHasTangent ) { newMesh.mVertexFormat.SetAttribute(VERTEX_ATTRIBUTE_4, AttributeDescription( F32x3, newMesh.mVertexFormat.VertexSize(), vertexSize) ); newMesh.mVertexFormat.SetAttribute(VERTEX_ATTRIBUTE_5, AttributeDescription( F32x3, newMesh.mVertexFormat.VertexSize(), vertexSize) ); } //Read material information if( material && scene->HasMaterials() ) { u32 materialIndex = mesh->mMaterialIndex; aiMaterial* m = scene->mMaterials[materialIndex]; aiColor3D color (0.f,0.f,0.f); m->Get(AI_MATKEY_COLOR_DIFFUSE,color); material->mDiffuseColor = vec3( color.r, color.g, color.b ); m->Get(AI_MATKEY_COLOR_SPECULAR,color); material->mSpecularColor = vec3( color.r, color.g, color.b ); } MeshId meshId( renderer->AddMesh( newMesh ) ); return meshId; } } //unnamed namespace GLRenderer::GLRenderer() :mMesh(0) ,mCurrentProgram(-1) ,mCurrentVertexBuffer(-1) ,mCurrentIndexBuffer(-1) ,mCurrentVAO(-1) ,mCurrentFBO(0) ,mIsDepthTestEnabled(false) ,mIsCullFaceEnabled(false) ,mIsBlendingEnabled(false) {} void GLRenderer::Init() { //Init glew glewExperimental = GL_TRUE; glewInit(); mMesh = new ComponentList<Mesh>(MAX_MESH_COUNT); //Bind a VAO BindVAO( AddVAO() ); } GLRenderer::~GLRenderer() { CHECK_GL_ERROR( glDeleteVertexArrays(mVAO.size(), mVAO.data() ) ); CHECK_GL_ERROR( glDeleteBuffers( mBuffer.size(), mBuffer.data() ) ); CHECK_GL_ERROR( glDeleteTextures( mTexture.size(), mTexture.data()) ); CHECK_GL_ERROR( glDeleteFramebuffers( mFrameBuffer.size(), mFrameBuffer.data() ) ); for( u32 i(0); i<mProgram.size(); ++i ) { CHECK_GL_ERROR( glDeleteProgram( mProgram[i] ) ); } } BufferId GLRenderer::AddBuffer( size_t size, const void* data ) { BufferId buffer(0); CHECK_GL_ERROR( glGenBuffers( 1, &buffer) ); CHECK_GL_ERROR( glBindBuffer( GL_COPY_WRITE_BUFFER, buffer ) ); CHECK_GL_ERROR( glBufferData( GL_COPY_WRITE_BUFFER, size, data, GL_STATIC_DRAW ) ); mBuffer.push_back( buffer ); mBufferSize.push_back( size ); return buffer; } void GLRenderer::RemoveBuffer(BufferId buffer) { for( u32 i(0); i<mBuffer.size(); ++i ) { if( mBuffer[i] == buffer ) { mBuffer.erase( mBuffer.begin()+i); mBufferSize.erase( mBufferSize.begin()+i); CHECK_GL_ERROR( glDeleteBuffers( 1, &buffer ) ); } } } void GLRenderer::UpdateBuffer(BufferId buffer, size_t size, void* data ) { for( u32 i(0); i<mBuffer.size(); ++i ) { if( mBuffer[i] == buffer ) { if( mBufferSize[i] < size ) { //Not enoguh room CHECK_GL_ERROR( glBindBuffer( GL_COPY_WRITE_BUFFER, buffer ) ); CHECK_GL_ERROR( glBufferData( GL_COPY_WRITE_BUFFER, size, data, GL_STATIC_DRAW ) ); mBufferSize[i] = size; } else { CHECK_GL_ERROR( glBindBuffer( GL_COPY_WRITE_BUFFER, buffer ) ); CHECK_GL_ERROR( glBufferSubData( GL_COPY_WRITE_BUFFER, 0, size, data ) ); } } } } void* GLRenderer::MapBuffer( BufferId buffer, BufferMapMode mode ) { CHECK_GL_ERROR( glBindBuffer( GL_COPY_WRITE_BUFFER, buffer ) ); void* result(0); switch( mode ) { case BUFFER_MAP_READ: result = CHECK_GL_ERROR( glMapBuffer( GL_COPY_WRITE_BUFFER, GL_READ_ONLY ) ); break; case BUFFER_MAP_WRITE: result = CHECK_GL_ERROR( glMapBuffer( GL_COPY_WRITE_BUFFER, GL_WRITE_ONLY ) ); break; case BUFFER_MAP_READ_WRITE: result = CHECK_GL_ERROR( glMapBuffer( GL_COPY_WRITE_BUFFER, GL_READ_WRITE ) ); break; } return result; } void GLRenderer::UnmapBuffer() { CHECK_GL_ERROR( glUnmapBuffer( GL_COPY_WRITE_BUFFER ) ); } void GLRenderer::BindVertexBuffer(BufferId buffer ) { if( mCurrentVertexBuffer == -1 || (u32)mCurrentVertexBuffer != buffer ) { CHECK_GL_ERROR( glBindBuffer( GL_ARRAY_BUFFER, buffer ) ); mCurrentVertexBuffer = buffer; } } void GLRenderer::BindIndexBuffer(BufferId buffer ) { if( mCurrentIndexBuffer == -1 || (u32)mCurrentIndexBuffer != buffer ) { CHECK_GL_ERROR( glBindBuffer( GL_ELEMENT_ARRAY_BUFFER, buffer ) ); mCurrentIndexBuffer = buffer; } } void GLRenderer::BindUniformBuffer( BufferId bufferId, u32 bindingPoint ) { CHECK_GL_ERROR( glBindBufferBase( GL_UNIFORM_BUFFER, bindingPoint, bufferId ) ); } void GLRenderer::BindShaderStorageBuffer( BufferId bufferId, u32 bindingPoint ) { CHECK_GL_ERROR( glBindBufferBase( GL_SHADER_STORAGE_BUFFER, bindingPoint, bufferId ) ); } TextureId GLRenderer::Add2DTexture(const Image& image, bool generateMipmaps) { TextureId texture = 0; GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( image.mFormat, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Unsupported texture format"); return texture; } CHECK_GL_ERROR( glGenTextures(1, &texture ) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, texture) ); u32 numberOfMipmaps = floor( log2(image.mWidth > image.mHeight ? image.mWidth : image.mHeight) ) + 1; CHECK_GL_ERROR( glTexStorage2D( GL_TEXTURE_2D, numberOfMipmaps, internalFormat, image.mWidth, image.mHeight ) ); if( image.mData ) { CHECK_GL_ERROR( glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, image.mWidth, image.mHeight, dataFormat, glDataType, image.mData ) ); } if( generateMipmaps ) { glGenerateMipmap( GL_TEXTURE_2D ); } else { glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); } glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); mTexture.push_back(texture); mTextureSize.push_back( uvec3( image.mWidth, image.mHeight, 0u )); return texture; } TextureId GLRenderer::Add2DTexture(u32 width, u32 height, TextureFormat textureFormat, bool generateMipmaps) { TextureId texture = 0; GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( textureFormat, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Unsupported texture format"); return texture; } CHECK_GL_ERROR( glGenTextures(1, &texture ) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, texture) ); //u32 numberOfMipmaps = 1u; //if(generateMipmaps) //{ u32 numberOfMipmaps = floor( log2(width > height ? width : height) ) + 1; //} CHECK_GL_ERROR( glTexStorage2D( GL_TEXTURE_2D, numberOfMipmaps, internalFormat, width, height ) ); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_S,GL_REPEAT); glTexParameteri(GL_TEXTURE_2D,GL_TEXTURE_WRAP_T,GL_REPEAT); mTexture.push_back(texture); mTextureSize.push_back( uvec3( width, height, 0u )); return texture; } TextureId GLRenderer::Add2DArrayTexture(TextureFormat format, u32 width, u32 height, u32 layers, bool generateMipmaps) { TextureId texture; GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( format, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Unsupported texture format"); return texture; } glGenTextures( 1, &texture ); glBindTexture(GL_TEXTURE_2D_ARRAY, texture); u32 numberOfMipmaps = floor( log2(width > height ? width : height) ) + 1; //Create storage for the texture. (100 layers of 1x1 texels) glTexStorage3D( GL_TEXTURE_2D_ARRAY, numberOfMipmaps, internalFormat, width,height,layers ); if( generateMipmaps ) { glGenerateMipmap( GL_TEXTURE_2D_ARRAY ); } mTexture.push_back(texture); mTextureSize.push_back( uvec3( width, height, layers )); glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MIN_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_MAG_FILTER,GL_LINEAR); glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE); glTexParameteri(GL_TEXTURE_2D_ARRAY,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE); return texture; } TextureId GLRenderer::AddCubeTexture( Image* images, bool generateMipmaps ) { TextureId texture; GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( images[0].mFormat, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Unsupported texture format"); return texture; } CHECK_GL_ERROR(glGenTextures(1, &texture)); CHECK_GL_ERROR(glBindTexture(GL_TEXTURE_CUBE_MAP, texture)); for( u8 i(0); i<6; ++i ) { CHECK_GL_ERROR( glTexImage2D (GL_TEXTURE_CUBE_MAP_POSITIVE_X + i, 0, internalFormat, images[i].mWidth, images[i].mHeight, 0, dataFormat, glDataType, images[i].mData ) ); } if( generateMipmaps ) { glGenerateMipmap( GL_TEXTURE_CUBE_MAP ); } CHECK_GL_ERROR(glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MIN_FILTER,GL_LINEAR)); CHECK_GL_ERROR(glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_MAG_FILTER,GL_LINEAR)); CHECK_GL_ERROR(glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_R,GL_CLAMP_TO_EDGE)); CHECK_GL_ERROR(glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_S,GL_CLAMP_TO_EDGE)); CHECK_GL_ERROR(glTexParameteri(GL_TEXTURE_CUBE_MAP,GL_TEXTURE_WRAP_T,GL_CLAMP_TO_EDGE)); return texture; } void GLRenderer::RemoveTexture(TextureId textureId) { for( u32 i(0); i<mTexture.size(); ++i ) { if( mTexture[i] == textureId ) { mTexture.erase( mTexture.begin()+i); mTextureSize.erase( mTextureSize.begin()+i); CHECK_GL_ERROR( glDeleteTextures( 1, &textureId) ); } } } void GLRenderer::UpdateTexture(TextureId textureId ) {} void GLRenderer::Update2DTextureFromBuffer(TextureId textureId, u32 width, u32 height, TextureFormat format, BufferId bufferId ) { GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( format, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Unsupported texture format"); return; } //Bind the buffer to the GL_PIXEL_UNPACK_BUFFER binding point CHECK_GL_ERROR( glBindBuffer( GL_PIXEL_UNPACK_BUFFER, bufferId ) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, textureId) ); if( glDataType == GL_UNSIGNED_BYTE ) { glPixelStorei( GL_UNPACK_ALIGNMENT, 1 ); } CHECK_GL_ERROR( glTexSubImage2D( GL_TEXTURE_2D, 0, 0, 0, width, height, dataFormat, glDataType, 0 ) ); //Unbind buffer CHECK_GL_ERROR( glBindBuffer( GL_PIXEL_UNPACK_BUFFER, 0 ) ); if( glDataType == GL_UNSIGNED_BYTE ) { glPixelStorei( GL_UNPACK_ALIGNMENT, 4 ); } } void GLRenderer::Update2DArrayTexture( TextureId textureId, u32 layer, const Image& image ) { GLenum dataFormat,internalFormat,glDataType; if( !GetTextureGLFormat( image.mFormat, dataFormat, internalFormat, glDataType ) ) { DODO_LOG("Error: Wrong texture format"); return; } glBindTexture(GL_TEXTURE_2D_ARRAY, textureId); glTexSubImage3D( GL_TEXTURE_2D_ARRAY, 0, 0,0,layer, image.mWidth,image.mHeight,1, dataFormat, glDataType, image.mData); } void GLRenderer::UpdateCubeTexture( TextureId textureId, CubeTextureSide side, const Image& image ) {} void GLRenderer::Bind2DTexture( TextureId textureId, u32 textureUnit ) { CHECK_GL_ERROR( glActiveTexture( GL_TEXTURE0 + textureUnit) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D, textureId) ); } void GLRenderer::Bind2DArrayTexture( TextureId textureId, u32 textureUnit ) { CHECK_GL_ERROR( glActiveTexture( GL_TEXTURE0 + textureUnit) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_2D_ARRAY, textureId) ); } void GLRenderer::BindCubeTexture( TextureId textureId, u32 textureUnit ) { //if( mCurrent2DArrayTexture == -1 || (u32)mCurrent2DArrayTexture != textureId ) { CHECK_GL_ERROR( glActiveTexture( GL_TEXTURE0 + textureUnit) ); CHECK_GL_ERROR( glBindTexture(GL_TEXTURE_CUBE_MAP, textureId) ); } } ProgramId GLRenderer::AddProgram( const u8** vertexShaderSource, const u8** fragmentShaderSource ) { //Compile vertex shader GLuint vertexShader = CHECK_GL_ERROR( glCreateShader( GL_VERTEX_SHADER )); if( vertexShaderSource ) { CHECK_GL_ERROR( glShaderSource( vertexShader, 1, (const GLchar**)vertexShaderSource, NULL ) ); CHECK_GL_ERROR( glCompileShader( vertexShader ) ); PRINT_GLSL_COMPILER_LOG( vertexShader ); } //Compile fragment shader GLuint fragmentShader = CHECK_GL_ERROR( glCreateShader( GL_FRAGMENT_SHADER ) ); if( fragmentShaderSource ) { CHECK_GL_ERROR( glShaderSource( fragmentShader, 1, (const GLchar**)fragmentShaderSource, NULL ) ); CHECK_GL_ERROR( glCompileShader( fragmentShader ) ); PRINT_GLSL_COMPILER_LOG( fragmentShader ); } //Link vertex and fragment shader together ProgramId program = CHECK_GL_ERROR( glCreateProgram() ); PrintGLSLCompilerLog( program ); CHECK_GL_ERROR( glAttachShader( program, vertexShader ) ); CHECK_GL_ERROR( glAttachShader( program, fragmentShader ) ); CHECK_GL_ERROR( glLinkProgram( program ) ); //Delete shaders objects CHECK_GL_ERROR( glDeleteShader( vertexShader ) ); CHECK_GL_ERROR( glDeleteShader( fragmentShader ) ); mProgram.push_back(program); return program; } void GLRenderer::RemoveProgram( u32 program ) { for( u32 i(0); i<mProgram.size(); ++i ) { if( mProgram[i] == program ) { mProgram.erase( mProgram.begin()+i); CHECK_GL_ERROR( glDeleteProgram( program ) ); } } } void GLRenderer::UseProgram( ProgramId programId ) { if( mCurrentProgram != (s32)programId ) { CHECK_GL_ERROR( glUseProgram( programId ) ); mCurrentProgram = programId; } } ProgramId GLRenderer::GetCurrentProgramId() { return mCurrentProgram; } s32 GLRenderer::GetUniformLocation( ProgramId programId, const char* name ) { s32 location = CHECK_GL_ERROR( glGetUniformLocation( programId, name ) ); return location; } void GLRenderer::SetUniform( s32 location, f32 value ) { CHECK_GL_ERROR( glUniform1f( location, value ) ); } void GLRenderer::SetUniform( s32 location, s32 value ) { CHECK_GL_ERROR( glUniform1i( location, value ) ); } void GLRenderer::SetUniform( s32 location, u32 value ) { CHECK_GL_ERROR( glUniform1ui( location, value ) ); } void GLRenderer::SetUniform( s32 location, const vec2& value ) { CHECK_GL_ERROR( glUniform2fv( location, 1, value.data ) ); } void GLRenderer::SetUniform( s32 location, const uvec2& value ) { CHECK_GL_ERROR( glUniform2uiv( location, 1, value.data ) ); } void GLRenderer::SetUniform( s32 location, const vec3& value ) { CHECK_GL_ERROR( glUniform3fv( location, 1, value.data ) ); } void GLRenderer::SetUniform( s32 location, vec3* value, u32 count ) { CHECK_GL_ERROR( glUniform3fv( location, count, value->data ) ); } void GLRenderer::SetUniform( s32 location, const mat4& value ) { CHECK_GL_ERROR( glUniformMatrix4fv( location, 1, GL_FALSE, value.data ) ); } FBOId GLRenderer::AddFrameBuffer() { FBOId fbo(0); CHECK_GL_ERROR( glGenFramebuffers( 1, &fbo ) ); mFrameBuffer.push_back( fbo ); return fbo; } void GLRenderer::RemoveFrameBuffer(FBOId fboId ) { for( u32 i(0); i<mFrameBuffer.size(); ++i ) { if( mFrameBuffer[i] == fboId ) { mFrameBuffer.erase( mFrameBuffer.begin()+i); CHECK_GL_ERROR( glDeleteFramebuffers( 1, &fboId ) ); } } } void GLRenderer::BindFrameBuffer( FBOId fbo ) { if( mCurrentFBO != fbo ) { CHECK_GL_ERROR( glBindFramebuffer( GL_FRAMEBUFFER, fbo ) ); mCurrentFBO = fbo; } } void GLRenderer::SetDrawBuffers( u32 n, u32* buffers ) { if( n == 0u ) { CHECK_GL_ERROR( glDrawBuffers( 0, GL_NONE ) ); } else { GLenum* buffer = new GLenum[n]; for( u32 i(0); i<n; ++i ) { buffer[i] = GL_COLOR_ATTACHMENT0 + buffers[i]; } CHECK_GL_ERROR( glDrawBuffers( n, buffer ) ); delete[] buffer; } } void GLRenderer::Attach2DColorTextureToFrameBuffer( FBOId fbo, u32 index, TextureId texture, u32 level ) { FBOId currentFBO = mCurrentFBO; BindFrameBuffer( fbo ); CHECK_GL_ERROR( glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0 + index, GL_TEXTURE_2D, texture, level ) ); BindFrameBuffer( currentFBO ); } void GLRenderer::AttachDepthStencilTextureToFrameBuffer( FBOId fbo, TextureId texture, u32 level ) { FBOId currentFBO = mCurrentFBO; BindFrameBuffer( fbo ); CHECK_GL_ERROR( glFramebufferTexture2D(GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_TEXTURE_2D, texture, level ) ); BindFrameBuffer( currentFBO ); } void GLRenderer::ClearColorAttachment( u32 index, const vec4& value ) { CHECK_GL_ERROR( glClearBufferfv( GL_COLOR, index, value.data )); } VAOId GLRenderer::AddVAO() { VAOId vao(0); CHECK_GL_ERROR( glGenVertexArrays(1, &vao) ); mVAO.push_back( vao ); return vao; } void GLRenderer::RemoveVAO(VAOId vao) { for( u32 i(0); i<mVAO.size(); ++i ) { if( mVAO[i] == vao ) { mVAO.erase( mVAO.begin()+i); CHECK_GL_ERROR( glDeleteVertexArrays(1, &vao) ); } } } void GLRenderer::BindVAO( VAOId vao) { CHECK_GL_ERROR( glBindVertexArray(vao) ); } MeshId GLRenderer::AddMeshFromFile( const char* path, u32 submesh ) { //Load mesh const struct aiScene* scene = NULL; scene = aiImportFile(path,aiProcessPreset_TargetRealtime_MaxQuality); if( !scene || scene->mNumMeshes <= 0 ) { DODO_LOG("Error loading mesh %s", path ); return INVALID_ID; } return AddSubMeshFromFile( scene, submesh, this ); } MeshId GLRenderer::AddMesh( const Mesh& m ) { return mMesh->Add( m ); } MeshId GLRenderer::AddMesh( const void* vertexData, size_t vertexCount, VertexFormat vertexFormat, const unsigned int* index, size_t indexCount ) { Mesh newMesh; if( vertexData != 0 ) { size_t vertexBufferSize = vertexCount * vertexFormat.VertexSize(); newMesh.mVertexCount = vertexCount; newMesh.mVertexBuffer = AddBuffer( vertexBufferSize, vertexData ); } if( index != 0 ) { size_t indexBufferSize = indexCount * sizeof( unsigned int ); newMesh.mIndexCount = indexCount; newMesh.mIndexBuffer = AddBuffer( indexBufferSize, index ); } newMesh.mVertexFormat = vertexFormat; //TO DO: Compute AABB MeshId meshId( mMesh->Add( newMesh ) ); return meshId; } MeshId GLRenderer::CreateQuad( const uvec2& size, bool generateUV, bool generateNormals, const uvec2& subdivision ) { size_t vertexCount = (subdivision.x + 1)*(subdivision.y + 1); size_t normalOffset(3); u32 vertexSize = 3; if( generateUV ) { vertexSize += 2; normalOffset = 5; } if(generateNormals) vertexSize += 3; f32* vertexData = new f32[ vertexCount * vertexSize ]; f32 deltaX = size.x / (f32)subdivision.x; f32 deltaY = size.y / (f32)subdivision.y; f32 deltaU = 1.0f/(f32)subdivision.x; f32 deltaV = 1.0f/(f32)subdivision.y; f32 x = -(f32)size.x * 0.5f; f32 y = -(f32)size.y * 0.5f; f32 u = 0.0f; f32 v = 0.0f; for(u32 i(0); i<subdivision.y+1; ++i ) { x = -(f32)size.x * 0.5f; u = 0.0f; for( u32 j(0); j<subdivision.x+1; ++j ) { float* vertex = vertexData + ( (i*(subdivision.x+1) + j) )*vertexSize; vec3* position = (vec3*)vertex; *position = Dodo::vec3(x,y,0.0f); if( generateUV ) { vec2* texCoord = (vec2*)(vertex+3); *texCoord = Dodo::vec2(u,v); } if(generateNormals) { vec3* n = (vec3*)(vertex+normalOffset); *n = Dodo::vec3(0.0f,0.0f,1.0f); } x += deltaX; u += deltaU; } y += deltaY; v += deltaV; } u32* index = new u32[6*subdivision.x*subdivision.y]; u32 current = 0; for(u32 i(0); i<6*subdivision.x*subdivision.y; i+=6 ) { index[i] = current; index[i+1] = current+1; index[i+2] = current+subdivision.x+1; index[i+3] = current+subdivision.x+1; index[i+4] = current+1; index[i+5] = current+subdivision.x+2; current++; if( (current % (subdivision.x+1) ) == subdivision.x ) current++; } Dodo::VertexFormat vertexFormat; vertexFormat.SetAttribute(VERTEX_POSITION, AttributeDescription( F32x3, 0, vertexSize) ); if( generateUV ) { vertexFormat.SetAttribute(VERTEX_UV, AttributeDescription( F32x2, vertexFormat.VertexSize(), vertexSize) ); } if( generateNormals ) { vertexFormat.SetAttribute(VERTEX_NORMAL, AttributeDescription( F32x3, vertexFormat.VertexSize(), vertexSize) ); } Dodo::MeshId meshId = AddMesh( vertexData, vertexCount, vertexFormat, index, 6*subdivision.x*subdivision.y); delete[] vertexData; delete[] index; return meshId; } u32 GLRenderer::GetMeshCountFromFile( const char* path ) { u32 result(0); const struct aiScene* scene = NULL; scene = aiImportFile(path,aiProcessPreset_TargetRealtime_MaxQuality); if( !scene || scene->mNumMeshes <= 0 ) { DODO_LOG("Error loading mesh %s", path ); } else { result = scene->mNumMeshes; } return result; } void GLRenderer::AddMultipleMeshesFromFile( const char* path, MeshId* meshId, Material* materials, u32 count ) { const struct aiScene* scene = NULL; scene = aiImportFile(path,aiProcessPreset_TargetRealtime_MaxQuality); if( !scene || scene->mNumMeshes <= 0 ) { DODO_LOG("Error loading mesh %s", path ); return; } if( materials ) { for( u32 i(0); i<count; ++i ) { meshId[i] = AddSubMeshFromFile( scene, i, this, &materials[i] ); } } else { for( u32 i(0); i<count; ++i ) { meshId[i] = AddSubMeshFromFile( scene, i, this, 0 ); } } } Mesh GLRenderer::GetMesh( MeshId meshId ) { Mesh* mesh = mMesh->GetElement(meshId); return *mesh; } void GLRenderer::SetupMeshVertexFormat( MeshId meshId ) { Mesh* mesh = mMesh->GetElement(meshId); if( !mesh ) { DODO_LOG("Error: Invalid Mesh id"); return; } const VertexFormat& vertexFormat( mesh->mVertexFormat ); u32 attributeCount( vertexFormat.AttributeCount() ); size_t vertexSize( vertexFormat.VertexSize() ); BindVertexBuffer( mesh->mVertexBuffer ); for( u32 i(0); i<attributeCount; ++i ) { if( vertexFormat.IsAttributeEnabled( i ) ) { const AttributeDescription& attributeDescription = vertexFormat.GetAttributeDescription(i); CHECK_GL_ERROR( glEnableVertexAttribArray(i) ); CHECK_GL_ERROR( glVertexAttribPointer(i, TypeElementCount(attributeDescription.mComponentType), GetGLType(attributeDescription.mComponentType), false, vertexSize, (void*)attributeDescription.mOffset ) ); } else { CHECK_GL_ERROR( glDisableVertexAttribArray(i) ); } } } void GLRenderer::SetupInstancedAttribute( AttributeType type, const AttributeDescription& description ) { BindVertexBuffer( description.mBuffer ); CHECK_GL_ERROR( glEnableVertexAttribArray(type) ); CHECK_GL_ERROR( glVertexAttribPointer(type, TypeElementCount(description.mComponentType), GetGLType(description.mComponentType), false, description.mStride, (void*)description.mOffset ) ); CHECK_GL_ERROR( glVertexAttribDivisor( type, description.mDivisor)); } void GLRenderer::DrawMesh( MeshId meshId ) { Mesh* mesh = mMesh->GetElement(meshId); if( !mesh ) { DODO_LOG("Error: Invalid Mesh id"); return; } GLenum primitive = GetGLPrimitive( mesh->mPrimitive ); if( !primitive ) { DODO_LOG("DrawUnIndexed error - Wrong primtive type"); return; } if( mesh->mIndexBuffer ) { BindIndexBuffer( mesh->mIndexBuffer ); CHECK_GL_ERROR( glDrawElements( primitive, mesh->mIndexCount, GL_UNSIGNED_INT, (GLvoid*)0) ); } else { CHECK_GL_ERROR( glDrawArrays( primitive, 0, mesh->mVertexCount ) ); } } void GLRenderer::DrawCall( u32 vertexCount ) { CHECK_GL_ERROR( glDrawArrays( GL_TRIANGLES, 0, vertexCount ) ); } void GLRenderer::DrawMeshInstanced( MeshId meshId, u32 instanceCount ) { Mesh* mesh = mMesh->GetElement(meshId); if( !mesh ) { DODO_LOG("Error: Invalid Mesh id"); return; } GLenum primitive = GetGLPrimitive( mesh->mPrimitive ); if( !primitive ) { DODO_LOG("DrawUnIndexed error - Wrong primtive type"); return; } if( mesh->mIndexBuffer ) { BindIndexBuffer( mesh->mIndexBuffer ); CHECK_GL_ERROR( glDrawElementsInstanced( primitive, mesh->mIndexCount, GL_UNSIGNED_INT, (GLvoid*)0, instanceCount) ); } else { CHECK_GL_ERROR( glDrawArraysInstanced( primitive, 0, mesh->mVertexCount, instanceCount ) ); } } void GLRenderer::SetClearColor(const vec4& color) { CHECK_GL_ERROR( glClearColor( color.x, color.y, color.z, color.w ) ); } void GLRenderer::SetClearDepth(f32 value) { CHECK_GL_ERROR( glClearDepth(value) ); } void GLRenderer::ClearBuffers( u32 mask ) { GLbitfield buffers(0); if( mask & COLOR_BUFFER ) buffers |= GL_COLOR_BUFFER_BIT; if( mask & DEPTH_BUFFER ) buffers |= GL_DEPTH_BUFFER_BIT; if( mask & STENCIL_BUFFER ) buffers |= GL_STENCIL_BUFFER_BIT; CHECK_GL_ERROR( glClear( buffers ) ); } void GLRenderer::SetViewport( s32 x, s32 y, size_t width, size_t height ) { CHECK_GL_ERROR( glViewport( x, y, width, height ) ); } void GLRenderer::SetCullFace( CullFace cullFace ) { if( cullFace == CULL_NONE ) { if( mIsCullFaceEnabled ) { CHECK_GL_ERROR(glDisable(GL_CULL_FACE)); mIsCullFaceEnabled = false; } } else { if( !mIsCullFaceEnabled ) { CHECK_GL_ERROR(glEnable(GL_CULL_FACE)); mIsCullFaceEnabled = true; } if( cullFace == CULL_FRONT ) { CHECK_GL_ERROR(glCullFace( GL_FRONT )); } else if(cullFace == CULL_BACK ) { CHECK_GL_ERROR(glCullFace( GL_BACK )); } else if(cullFace == CULL_FRONT_BACK ) { CHECK_GL_ERROR(glCullFace( GL_FRONT_AND_BACK )); } } } void GLRenderer::SetDepthTest( DepthTestFunction function) { if( function == DEPTH_TEST_DISABLED ) { if( mIsDepthTestEnabled ) { CHECK_GL_ERROR(glDisable(GL_DEPTH_TEST)); mIsDepthTestEnabled = false; } } else { if( !mIsDepthTestEnabled ) { CHECK_GL_ERROR(glEnable(GL_DEPTH_TEST)); mIsDepthTestEnabled = true; } switch( function ) { case DEPTH_TEST_NEVER: CHECK_GL_ERROR(glDepthFunc(GL_NEVER)); break; case DEPTH_TEST_ALWAYS: CHECK_GL_ERROR(glDepthFunc(GL_ALWAYS)); break; case DEPTH_TEST_LESS_EQUAL: CHECK_GL_ERROR(glDepthFunc(GL_LEQUAL)); break; case DEPTH_TEST_LESS: CHECK_GL_ERROR(glDepthFunc(GL_LESS)); break; case DEPTH_TEST_GREATER_EQUAL: CHECK_GL_ERROR(glDepthFunc(GL_GEQUAL)); break; case DEPTH_TEST_GREATER: CHECK_GL_ERROR(glDepthFunc(GL_GREATER)); break; case DEPTH_TEST_EQUAL: CHECK_GL_ERROR(glDepthFunc(GL_EQUAL)); break; case DEPTH_TEST_NOT_EQUAL: CHECK_GL_ERROR(glDepthFunc(GL_NOTEQUAL)); break; default: break; } } } void GLRenderer::DisableDepthWrite() { CHECK_GL_ERROR(glDepthMask(false)); } void GLRenderer::EnableDepthWrite() { CHECK_GL_ERROR(glDepthMask(true)); } void GLRenderer::Wired( bool wired) { if( wired ) { CHECK_GL_ERROR(glPolygonMode( GL_FRONT_AND_BACK, GL_LINE )); } else { CHECK_GL_ERROR(glPolygonMode( GL_FRONT_AND_BACK, GL_FILL )); } } void GLRenderer::SetBlendingMode(BlendingMode mode) { if( mode == BLEND_DISABLED ) { if( mIsBlendingEnabled ) { CHECK_GL_ERROR(glDisable(GL_BLEND)); mIsBlendingEnabled = false; } } else { if( !mIsBlendingEnabled ) { CHECK_GL_ERROR(glEnable(GL_BLEND)); mIsBlendingEnabled = true; } switch( mode ) { case BLEND_ADD: CHECK_GL_ERROR(glBlendEquation(GL_FUNC_ADD)); break; case BLEND_SUBTRACT: CHECK_GL_ERROR(glBlendEquation(GL_FUNC_SUBTRACT)); break; case BLEND_REVERSE_SUBTRACT: CHECK_GL_ERROR(glBlendEquation(GL_FUNC_REVERSE_SUBTRACT)); break; case BLEND_MIN: CHECK_GL_ERROR(glBlendEquation(GL_MIN)); break; case BLEND_MAX: CHECK_GL_ERROR(glBlendEquation(GL_MAX)); break; default: break; } } } void GLRenderer::SetBlendingFunction(BlendingFunction sourceColor, BlendingFunction destinationColor, BlendingFunction sourceAlpha, BlendingFunction destinationAlpha ) { CHECK_GL_ERROR( glBlendFuncSeparate( GetGLBlendingFunction(sourceColor), GetGLBlendingFunction(destinationColor), GetGLBlendingFunction(sourceAlpha), GetGLBlendingFunction(destinationAlpha) ) ); } void GLRenderer::PrintInfo() { const GLubyte* glVersion( glGetString(GL_VERSION) ); const GLubyte* glslVersion( glGetString( GL_SHADING_LANGUAGE_VERSION) ); const GLubyte* glRenderer = glGetString(GL_RENDERER); DODO_LOG( "GL %s", (char*)glVersion ); DODO_LOG( "GLSL %s", (char*)glslVersion ); DODO_LOG( "%s", (char*)glRenderer ); }
[ "wfsole@gmail.com" ]
wfsole@gmail.com
b34123f63a5092948193292938bcd8db2c852418
4352b5c9e6719d762e6a80e7a7799630d819bca3
/tutorials/eulerVortex.twitch/eulerVortex.cyclic.twitch.moving/2.44/rho
1f9540270be0e145268a81640ae80b9d55838a41
[]
no_license
dashqua/epicProject
d6214b57c545110d08ad053e68bc095f1d4dc725
54afca50a61c20c541ef43e3d96408ef72f0bcbc
refs/heads/master
2022-02-28T17:20:20.291864
2019-10-28T13:33:16
2019-10-28T13:33:16
184,294,390
1
0
null
null
null
null
UTF-8
C++
false
false
70,708
/*--------------------------------*- C++ -*----------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | Website: https://openfoam.org \\ / A nd | Version: 6 \\/ M anipulation | \*---------------------------------------------------------------------------*/ FoamFile { version 2.0; format ascii; class volScalarField; location "2.44"; object rho; } // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // dimensions [1 -3 0 0 0 0 0]; internalField nonuniform List<scalar> 10000 ( 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.39999 1.39999 1.39999 1.39999 1.39999 1.4 1.4 1.40001 1.40001 1.40002 1.40002 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.39999 1.39999 1.39998 1.39998 1.39998 1.39999 1.39999 1.4 1.40001 1.40002 1.40002 1.40002 1.40002 1.40002 1.40002 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.39999 1.39999 1.39998 1.39997 1.39997 1.39998 1.39998 1.39999 1.4 1.40001 1.40002 1.40003 1.40003 1.40003 1.40003 1.40002 1.40002 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.39999 1.39999 1.39998 1.39997 1.39996 1.39996 1.39996 1.39997 1.39999 1.4 1.40002 1.40004 1.40005 1.40005 1.40005 1.40004 1.40003 1.40002 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.39999 1.39998 1.39997 1.39995 1.39994 1.39994 1.39995 1.39996 1.39998 1.40001 1.40003 1.40005 1.40007 1.40007 1.40007 1.40005 1.40004 1.40003 1.40001 1.4 1.4 1.39999 1.39999 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.39999 1.39997 1.39995 1.39993 1.39992 1.39992 1.39992 1.39995 1.39998 1.40002 1.40005 1.40008 1.4001 1.4001 1.40009 1.40008 1.40006 1.40003 1.40002 1.4 1.39999 1.39999 1.39999 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.39998 1.39996 1.39993 1.39991 1.39989 1.39989 1.3999 1.39993 1.39998 1.40004 1.40009 1.40013 1.40015 1.40015 1.40014 1.40011 1.40008 1.40004 1.40002 1.4 1.39999 1.39999 1.39999 1.39999 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40002 1.40002 1.40002 1.40001 1.39998 1.39995 1.39992 1.39988 1.39986 1.39986 1.39988 1.39993 1.4 1.40008 1.40015 1.4002 1.40023 1.40023 1.4002 1.40015 1.40011 1.40006 1.40003 1.4 1.39999 1.39998 1.39998 1.39999 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40002 1.40003 1.40003 1.40003 1.40001 1.39998 1.39994 1.3999 1.39986 1.39984 1.39985 1.39988 1.39995 1.40005 1.40016 1.40025 1.40032 1.40034 1.40033 1.40029 1.40022 1.40015 1.40009 1.40003 1.4 1.39998 1.39997 1.39997 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40002 1.40003 1.40004 1.40005 1.40005 1.40003 1.39999 1.39994 1.39989 1.39986 1.39985 1.39987 1.39993 1.40003 1.40016 1.4003 1.40042 1.4005 1.40052 1.40049 1.40041 1.40031 1.40021 1.40012 1.40005 1.4 1.39998 1.39997 1.39997 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40002 1.40004 1.40006 1.40007 1.40007 1.40005 1.4 1.39995 1.39991 1.39989 1.39992 1.39998 1.40008 1.40022 1.4004 1.40057 1.40071 1.40078 1.40078 1.40071 1.40059 1.40045 1.4003 1.40017 1.40007 1.40001 1.39997 1.39997 1.39997 1.39996 1.39997 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40002 1.40003 1.40005 1.40008 1.40011 1.40011 1.40008 1.40003 1.39998 1.39996 1.4 1.4001 1.40024 1.40041 1.40062 1.40084 1.40104 1.40118 1.40123 1.40118 1.40105 1.40085 1.40064 1.40042 1.40024 1.4001 1.40002 1.39997 1.39996 1.39996 1.39996 1.39998 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40002 1.39999 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40002 1.40004 1.40007 1.40011 1.40015 1.40016 1.40013 1.40008 1.40005 1.4001 1.40025 1.40049 1.40077 1.40107 1.40137 1.40164 1.40185 1.40195 1.40193 1.40178 1.40153 1.40122 1.40089 1.40059 1.40034 1.40015 1.40003 1.39998 1.39995 1.39994 1.39996 1.39997 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40003 1.40005 1.4001 1.40015 1.40021 1.40022 1.4002 1.40016 1.40019 1.40037 1.40073 1.40121 1.40173 1.40223 1.40267 1.403 1.40319 1.40319 1.40301 1.40267 1.40222 1.40173 1.40125 1.40082 1.40047 1.40022 1.40006 1.39998 1.39994 1.39994 1.39995 1.39996 1.39998 1.39999 1.39999 1.39999 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.4 1.4 1.40002 1.39999 1.40002 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40002 1.40003 1.40007 1.40013 1.40021 1.40028 1.40031 1.40029 1.40028 1.40044 1.40086 1.40156 1.40244 1.40335 1.40416 1.40479 1.4052 1.40533 1.40515 1.40468 1.404 1.40323 1.40246 1.40174 1.40114 1.40065 1.40032 1.4001 1.39998 1.39994 1.39993 1.39994 1.39996 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40002 1.40004 1.40009 1.40017 1.40027 1.40036 1.4004 1.40041 1.40048 1.40085 1.40165 1.4029 1.4044 1.40588 1.40714 1.40807 1.40858 1.40861 1.40813 1.4072 1.40599 1.4047 1.40349 1.40243 1.40157 1.40091 1.40045 1.40016 1.39999 1.39993 1.39992 1.39993 1.39996 1.39996 1.39998 1.39999 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.39999 1.40002 1.39999 1.40002 1.40001 1.39999 1.40002 1.4 1.40001 1.4 1.40001 1.40001 1.39999 1.40002 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40002 1.40005 1.40012 1.40022 1.40035 1.40046 1.40052 1.40057 1.40079 1.40149 1.4029 1.40495 1.40733 1.40962 1.41151 1.41284 1.41352 1.41344 1.41255 1.41094 1.40892 1.40683 1.40494 1.40338 1.40216 1.40125 1.40062 1.40025 1.40003 1.39992 1.3999 1.39992 1.39995 1.39996 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.39999 1.40002 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.39998 1.40002 1.4 1.4 1.4 1.40001 1.40001 1.39999 1.40002 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40002 1.40006 1.40014 1.40027 1.40043 1.40058 1.40066 1.40078 1.40124 1.40247 1.40474 1.40793 1.41149 1.41483 1.41751 1.41939 1.42033 1.42019 1.41882 1.41634 1.41318 1.40992 1.40703 1.4047 1.40297 1.40172 1.40087 1.40034 1.40008 1.39994 1.3999 1.3999 1.39992 1.39997 1.39998 1.39998 1.4 1.4 1.39999 1.40001 1.39999 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.39999 1.40002 1.39999 1.40003 1.39999 1.4 1.40002 1.39999 1.40001 1.4 1.40002 1.4 1.39999 1.40002 1.4 1.40001 1.4 1.40001 1.40001 1.39999 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40003 1.40008 1.40017 1.40033 1.40053 1.4007 1.40082 1.40106 1.40189 1.40388 1.40736 1.41203 1.41708 1.42165 1.42526 1.42778 1.42913 1.42905 1.42728 1.42384 1.41925 1.41438 1.41002 1.40659 1.4041 1.40236 1.40122 1.40051 1.40012 1.39995 1.39989 1.39988 1.39991 1.39995 1.39996 1.39998 1.4 1.39999 1.4 1.4 1.4 1.40001 1.39999 1.40002 1.39999 1.40002 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.39999 1.4 1.40002 1.39999 1.4 1.40001 1.40001 1.4 1.4 1.40002 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40004 1.40009 1.40021 1.4004 1.40062 1.40082 1.40101 1.40145 1.40281 1.40585 1.41091 1.41742 1.42416 1.43002 1.43452 1.4377 1.43958 1.43982 1.43795 1.43371 1.42759 1.4207 1.41434 1.40929 1.4057 1.40327 1.4017 1.40075 1.40021 1.39996 1.39987 1.39988 1.3999 1.39991 1.39995 1.39998 1.39998 1.39999 1.40001 1.39999 1.40002 1.39998 1.40003 1.39999 1.40002 1.39999 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.39999 1.40002 1.39999 1.40001 1.4 1.40002 1.39998 1.40003 1.39999 1.4 1.40001 1.4 1.40002 1.39998 1.40001 1.40002 1.39999 1.40001 1.4 1.40002 1.39999 1.4 1.40002 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40004 1.40011 1.40025 1.40047 1.40073 1.40095 1.40122 1.40197 1.40407 1.40851 1.41552 1.42413 1.43256 1.43948 1.4446 1.44826 1.45067 1.45154 1.45011 1.44571 1.43843 1.42943 1.42053 1.41322 1.408 1.40458 1.40239 1.40107 1.40035 1.39999 1.39986 1.39986 1.39988 1.3999 1.39995 1.39997 1.39998 1.39999 1.39999 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.39998 1.40004 1.39999 1.4 1.40002 1.4 1.40001 1.39999 1.40001 1.40002 1.39999 1.40001 1.4 1.40002 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40004 1.40013 1.40029 1.40053 1.40082 1.40109 1.40149 1.40266 1.40577 1.41196 1.42125 1.43199 1.44178 1.44917 1.45424 1.45785 1.46057 1.46225 1.46198 1.45855 1.45126 1.44078 1.42918 1.41893 1.41138 1.40646 1.40341 1.40157 1.40056 1.40007 1.39986 1.39982 1.39985 1.3999 1.39992 1.39995 1.39999 1.39999 1.39998 1.40001 1.39998 1.40003 1.39998 1.40003 1.39998 1.40002 1.39999 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40002 1.39999 1.40002 1.4 1.4 1.4 1.40003 1.39997 1.40004 1.4 1.4 1.40001 1.39999 1.40004 1.39998 1.4 1.40002 1.4 1.40001 1.39999 1.40002 1.40001 1.4 1.40001 1.39999 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40002 1.40005 1.40015 1.40032 1.40059 1.40091 1.40123 1.40183 1.40359 1.408 1.4163 1.42803 1.4406 1.45093 1.45772 1.46168 1.46431 1.46665 1.46896 1.47048 1.46954 1.4643 1.45413 1.44064 1.42712 1.4164 1.40926 1.40492 1.40234 1.40088 1.40018 1.39988 1.39978 1.3998 1.39986 1.3999 1.39993 1.39996 1.39998 1.4 1.39998 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.39999 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40002 1.39999 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40004 1.39995 1.40005 1.39999 1.4 1.40001 1.4 1.40003 1.39998 1.4 1.40002 1.4 1.40001 1.39999 1.40002 1.40001 1.39999 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40002 1.40006 1.40016 1.40036 1.40065 1.40099 1.40139 1.40226 1.4048 1.41084 1.42155 1.43562 1.44924 1.45882 1.46351 1.46494 1.46527 1.46606 1.46823 1.47161 1.47455 1.47406 1.46736 1.45432 1.4383 1.42381 1.41349 1.40719 1.40354 1.40144 1.40036 1.39991 1.39977 1.39976 1.3998 1.39988 1.39992 1.39994 1.39996 1.39999 1.39998 1.40001 1.39999 1.40001 1.39999 1.40003 1.39998 1.40002 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.4 1.4 1.40002 1.39999 1.4 1.40004 1.39996 1.40002 1.40001 1.4 1.40003 1.39996 1.40006 1.39998 1.4 1.40001 1.4 1.40002 1.39998 1.40001 1.40002 1.39999 1.40002 1.39999 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40002 1.40006 1.40017 1.40039 1.4007 1.40107 1.40158 1.40283 1.40637 1.41437 1.42764 1.44357 1.45697 1.46405 1.46493 1.46226 1.45874 1.45642 1.45707 1.46165 1.46911 1.47578 1.47649 1.46802 1.4521 1.43432 1.41992 1.41065 1.40537 1.40238 1.40075 1.40001 1.39976 1.39972 1.39976 1.39982 1.39988 1.39992 1.39996 1.39996 1.4 1.39998 1.4 1.39999 1.40002 1.39999 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.39999 1.40002 1.39999 1.40001 1.40001 1.4 1.40002 1.4 1.39998 1.40006 1.39994 1.40004 1.4 1.4 1.40001 1.39997 1.40005 1.39998 1.39999 1.40002 1.4 1.40002 1.39999 1.40001 1.40002 1.39999 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40002 1.40007 1.40019 1.4004 1.40073 1.40115 1.40182 1.40357 1.40837 1.4186 1.43437 1.45125 1.46274 1.4654 1.46078 1.45253 1.44362 1.43649 1.43401 1.43855 1.45015 1.46516 1.47654 1.47753 1.46639 1.44783 1.42939 1.41605 1.40818 1.40385 1.40145 1.40026 1.39979 1.39968 1.39971 1.39977 1.39983 1.39989 1.39993 1.39996 1.39998 1.39998 1.39999 1.4 1.40001 1.39998 1.40002 1.39999 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40001 1.40001 1.39998 1.40003 1.4 1.39998 1.40004 1.39998 1.4 1.40002 1.39998 1.40006 1.39994 1.40005 1.4 1.4 1.40001 1.39998 1.40004 1.39999 1.39999 1.40002 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40002 1.40007 1.40019 1.40041 1.40075 1.40125 1.40214 1.40454 1.41084 1.42353 1.44141 1.45793 1.4656 1.46207 1.45057 1.43549 1.4198 1.40639 1.39943 1.40274 1.41751 1.44051 1.46382 1.47794 1.477 1.46247 1.44211 1.42427 1.41262 1.40616 1.40265 1.40078 1.39994 1.39967 1.39964 1.3997 1.39978 1.39985 1.3999 1.39994 1.39996 1.39998 1.39998 1.40001 1.39997 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.39998 1.40002 1.39999 1.4 1.40002 1.39999 1.40002 1.40001 1.39997 1.40006 1.39996 1.40001 1.40001 1.4 1.40003 1.39995 1.40005 1.4 1.39999 1.40002 1.39999 1.40002 1.40001 1.39998 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40002 1.40007 1.40019 1.4004 1.40078 1.40138 1.40258 1.40577 1.41383 1.42902 1.44832 1.46289 1.46497 1.45391 1.43457 1.41167 1.38799 1.36715 1.35489 1.35638 1.37352 1.40342 1.43792 1.46622 1.47936 1.47445 1.45663 1.43573 1.41951 1.40978 1.40455 1.40173 1.40031 1.39974 1.39961 1.39963 1.39971 1.39979 1.39987 1.39991 1.39994 1.39996 1.39999 1.39998 1.39999 1.40001 1.39999 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.39999 1.40001 1.40002 1.39998 1.40002 1.40001 1.39998 1.40003 1.4 1.4 1.40002 1.39997 1.40006 1.39995 1.40002 1.40001 1.39999 1.40002 1.39997 1.40003 1.40002 1.39998 1.40002 1.4 1.40001 1.40001 1.39999 1.4 1.40001 1.40001 1.4 1.40001 1.40006 1.40018 1.40039 1.40081 1.40157 1.40316 1.40731 1.41734 1.43488 1.4546 1.46566 1.46078 1.44141 1.41367 1.38207 1.34925 1.32002 1.30199 1.30155 1.32086 1.35687 1.4012 1.44269 1.47095 1.47968 1.46975 1.4495 1.42944 1.41546 1.40751 1.40328 1.40105 1.4 1.39964 1.39958 1.39964 1.39973 1.39981 1.39987 1.39991 1.39995 1.39997 1.39997 1.4 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.39999 1.40002 1.4 1.4 1.40002 1.39998 1.40002 1.40001 1.39997 1.40004 1.39999 1.4 1.40001 1.39999 1.40005 1.39996 1.40002 1.40002 1.39998 1.40002 1.39999 1.4 1.40003 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40006 1.40017 1.40037 1.40087 1.40184 1.40391 1.4092 1.42131 1.44082 1.45983 1.46604 1.45344 1.42556 1.38911 1.34793 1.30467 1.26585 1.24135 1.23889 1.2606 1.30269 1.35611 1.40948 1.45209 1.47589 1.478 1.46316 1.44194 1.4238 1.41217 1.40574 1.40232 1.40057 1.39981 1.39959 1.39959 1.39966 1.39975 1.39982 1.39988 1.39993 1.39994 1.39997 1.39998 1.39998 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.4 1.4 1.40002 1.39999 1.40001 1.40001 1.39999 1.40001 1.40001 1.4 1.40001 1.39998 1.40004 1.39998 1.40001 1.40002 1.39999 1.40003 1.39998 1.4 1.40003 1.4 1.4 1.40001 1.4 1.40001 1.40002 1.39999 1.39999 1.4 1.39999 1.40004 1.40014 1.40035 1.40097 1.40223 1.40486 1.41143 1.42562 1.44652 1.46372 1.46422 1.44375 1.4076 1.36228 1.3105 1.25517 1.205 1.1727 1.16781 1.19238 1.24106 1.30348 1.36801 1.42391 1.46261 1.47905 1.47395 1.45542 1.43472 1.41907 1.40958 1.40435 1.40158 1.40024 1.3997 1.39957 1.39959 1.39968 1.39976 1.39984 1.39988 1.39992 1.39996 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.39999 1.40002 1.40001 1.39999 1.40002 1.4 1.40001 1.40001 1.39999 1.40003 1.39998 1.4 1.40003 1.39999 1.4 1.40002 1.4 1.4 1.40002 1.4 1.40001 1.4 1.39999 1.40001 1.39997 1.40002 1.40013 1.40034 1.40111 1.40273 1.40603 1.41398 1.4301 1.45166 1.46619 1.46066 1.4327 1.38882 1.3346 1.27117 1.20184 1.13802 1.096 1.08799 1.11593 1.17195 1.24351 1.31874 1.38699 1.43972 1.47133 1.47931 1.46781 1.44741 1.42838 1.41525 1.40751 1.40325 1.40104 1.40001 1.39963 1.39957 1.39961 1.3997 1.39978 1.39984 1.3999 1.39993 1.39995 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40002 1.39999 1.4 1.40002 1.39999 1.40001 1.40001 1.39999 1.40001 1.40002 1.4 1.4 1.39999 1.40001 1.4 1.39999 1.4 1.39994 1.40001 1.40014 1.40035 1.40132 1.40338 1.40741 1.41679 1.43455 1.45604 1.46734 1.45598 1.42126 1.37041 1.30748 1.23165 1.14654 1.06672 1.01279 1.00037 1.03144 1.09504 1.17615 1.2623 1.34222 1.40752 1.45362 1.47658 1.47636 1.46037 1.43986 1.42306 1.41219 1.40588 1.40241 1.40065 1.39988 1.3996 1.39958 1.39964 1.39972 1.3998 1.39987 1.3999 1.39994 1.39996 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40002 1.4 1.39999 1.40002 1.40001 1.4 1.4 1.40001 1.40002 1.39999 1.40002 1.4 1.39996 1.4 1.39992 1.39998 1.40015 1.40038 1.4016 1.40418 1.409 1.41976 1.43875 1.4595 1.46743 1.45085 1.41031 1.35339 1.28243 1.1942 1.0924 0.994841 0.926683 0.90705 0.938514 1.00821 1.09946 1.19825 1.29061 1.36746 1.42627 1.46393 1.47779 1.47088 1.45246 1.43313 1.41875 1.40977 1.40459 1.40178 1.40038 1.39979 1.39961 1.3996 1.39967 1.39975 1.39982 1.39987 1.39992 1.39995 1.39997 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40002 1.39999 1.40001 1.4 1.39994 1.40001 1.39991 1.39994 1.40018 1.40044 1.40193 1.40513 1.41075 1.42275 1.44254 1.46204 1.46671 1.44582 1.40052 1.33858 1.26092 1.16164 1.04384 0.928112 0.843583 0.81229 0.838334 0.909838 1.01072 1.12426 1.23131 1.32049 1.39085 1.44159 1.46995 1.47555 1.46377 1.44477 1.42744 1.41529 1.40784 1.40358 1.40129 1.4002 1.39974 1.39962 1.39964 1.3997 1.39977 1.39984 1.39989 1.39993 1.39995 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.39999 1.40001 1.39999 1.40001 1.40001 1.39992 1.40001 1.39989 1.39991 1.40025 1.40055 1.40232 1.40622 1.41265 1.42564 1.4458 1.46371 1.46544 1.44134 1.39242 1.32654 1.24413 1.13676 1.00583 0.873484 0.771807 0.724852 0.738795 0.805612 0.912472 1.04001 1.16303 1.26629 1.34841 1.41089 1.45264 1.47202 1.47069 1.45603 1.43783 1.42271 1.4125 1.40631 1.4028 1.40095 1.40007 1.39973 1.39965 1.39967 1.39974 1.39981 1.39987 1.39991 1.39994 1.39996 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40002 1.39999 1.4 1.40001 1.3999 1.4 1.3999 1.39987 1.40032 1.40073 1.40274 1.40741 1.41465 1.42829 1.44846 1.46466 1.46383 1.43766 1.38639 1.31761 1.23263 1.1215 0.982555 0.837552 0.720509 0.656966 0.654783 0.710391 0.81568 0.951113 1.08786 1.20569 1.29989 1.37317 1.42683 1.45955 1.47076 1.46429 1.44848 1.43179 1.41881 1.41025 1.40511 1.40221 1.40071 1.40002 1.39975 1.39969 1.39972 1.39978 1.39984 1.39989 1.39993 1.39995 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40002 1.39999 1.39998 1.40001 1.39989 1.39998 1.39992 1.39984 1.4004 1.40097 1.40321 1.40864 1.41673 1.43066 1.45049 1.46507 1.46204 1.43487 1.38274 1.31206 1.22626 1.11602 0.975847 0.8243 0.69594 0.61798 0.599603 0.639965 0.73478 0.867945 1.01197 1.14214 1.24778 1.33073 1.39442 1.43889 1.46287 1.46719 1.4573 1.44153 1.42665 1.4156 1.40842 1.40415 1.40177 1.40055 1.39999 1.39979 1.39975 1.39978 1.39983 1.39987 1.39992 1.39995 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.39999 1.40001 1.39999 1.39998 1.4 1.39989 1.39995 1.39994 1.39983 1.40045 1.40129 1.40373 1.40986 1.41883 1.43274 1.4519 1.46513 1.46031 1.43287 1.38154 1.31026 1.22453 1.1186 0.984105 0.833453 0.699058 0.609866 0.577198 0.601419 0.679463 0.800339 0.942784 1.08046 1.1957 1.28694 1.35855 1.41237 1.44766 1.4635 1.46225 1.45035 1.43534 1.4223 1.41293 1.40693 1.40338 1.40143 1.40044 1.4 1.39984 1.3998 1.39983 1.39987 1.39991 1.39994 1.39996 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.39997 1.39999 1.3999 1.39992 1.39996 1.39987 1.4005 1.40164 1.40433 1.41099 1.42087 1.4346 1.4527 1.46496 1.45895 1.43161 1.38251 1.31264 1.22754 1.12682 1.00272 0.860395 0.726209 0.629296 0.584288 0.59309 0.651878 0.753632 0.885929 1.02502 1.14714 1.24518 1.32283 1.38346 1.42751 1.45373 1.46217 1.45661 1.44376 1.42991 1.41859 1.41068 1.40569 1.40277 1.40117 1.40038 1.40002 1.39989 1.39987 1.39988 1.39991 1.39994 1.39996 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.39999 1.39997 1.39997 1.39991 1.3999 1.39995 1.39994 1.40054 1.402 1.40503 1.41202 1.4227 1.43633 1.45306 1.46454 1.45824 1.43125 1.38508 1.31908 1.23623 1.13996 1.02689 0.897836 0.770553 0.670808 0.616094 0.611098 0.650874 0.729922 0.844828 0.978821 1.10457 1.20786 1.29012 1.35555 1.40575 1.44005 1.45746 1.45939 1.45069 1.43764 1.42511 1.41538 1.40875 1.40463 1.40225 1.40097 1.40033 1.40005 1.39994 1.39992 1.39993 1.39995 1.39997 1.39998 1.39999 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.39998 1.39997 1.39995 1.39992 1.39989 1.39994 1.40003 1.40063 1.40231 1.40578 1.41298 1.4242 1.43792 1.4532 1.46384 1.45827 1.43226 1.3889 1.32847 1.25098 1.15973 1.05579 0.940324 0.824502 0.728012 0.668188 0.65251 0.675885 0.731951 0.823711 0.944815 1.06961 1.17644 1.26205 1.33081 1.38523 1.42528 1.44984 1.45892 1.45541 1.44463 1.43194 1.42082 1.41256 1.40709 1.40374 1.40183 1.40081 1.4003 1.40008 1.39999 1.39997 1.39997 1.39998 1.39999 1.39999 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.39998 1.39997 1.39995 1.39991 1.3999 1.39992 1.40011 1.40077 1.40259 1.4065 1.41389 1.42532 1.43926 1.45336 1.46295 1.45877 1.43497 1.39435 1.33964 1.27022 1.18696 1.09208 0.988534 0.884998 0.796296 0.736757 0.714575 0.725702 0.762339 0.828901 0.928815 1.04492 1.15198 1.23956 1.31029 1.36748 1.41155 1.44141 1.4564 1.45803 1.45034 1.43847 1.42659 1.41694 1.41007 1.40563 1.40296 1.40146 1.40067 1.40028 1.4001 1.40003 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.39999 1.39998 1.39997 1.39994 1.39991 1.39991 1.39992 1.40017 1.40093 1.40285 1.40713 1.41469 1.42611 1.4402 1.45357 1.46217 1.45946 1.43917 1.40204 1.35247 1.29173 1.21934 1.13607 1.04487 0.953828 0.875228 0.819626 0.793973 0.796149 0.818645 0.863476 0.938097 1.03625 1.13677 1.22357 1.29467 1.35314 1.39983 1.43357 1.45317 1.45921 1.4547 1.44423 1.43221 1.42154 1.41342 1.40786 1.40436 1.4023 1.40115 1.40055 1.40025 1.40011 1.40005 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.39999 1.39997 1.39996 1.39994 1.3999 1.3999 1.39992 1.40023 1.40108 1.40311 1.40761 1.41527 1.42661 1.44066 1.45369 1.46174 1.46033 1.44414 1.41194 1.36766 1.31476 1.25371 1.18405 1.10716 1.03031 0.963716 0.914089 0.886594 0.881469 0.893446 0.92225 0.974168 1.04946 1.13528 1.2159 1.28478 1.34274 1.39054 1.42687 1.44998 1.45962 1.45797 1.44908 1.43732 1.42601 1.41685 1.41026 1.40593 1.40327 1.40173 1.40089 1.40045 1.40023 1.40012 1.40007 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.39999 1.39997 1.39996 1.39993 1.3999 1.39989 1.39994 1.40028 1.4012 1.40336 1.40794 1.41558 1.42679 1.44066 1.45352 1.4616 1.46154 1.44934 1.42302 1.38509 1.33965 1.28879 1.23222 1.17031 1.10916 1.05576 1.01315 0.985401 0.974972 0.978952 0.996046 1.03043 1.08428 1.15106 1.21951 1.28211 1.33711 1.3842 1.42166 1.44712 1.45954 1.46031 1.45294 1.44166 1.43001 1.42008 1.41262 1.40753 1.40429 1.40236 1.40126 1.40067 1.40035 1.40019 1.40011 1.40007 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.39998 1.39997 1.39996 1.39993 1.3999 1.39989 1.39996 1.40034 1.4013 1.40355 1.4081 1.4156 1.42657 1.44016 1.45299 1.46152 1.46304 1.45458 1.43424 1.40345 1.36582 1.32413 1.27888 1.23081 1.18466 1.14352 1.10796 1.08194 1.06906 1.06779 1.07652 1.09789 1.13429 1.1826 1.23589 1.28837 1.33747 1.38167 1.4185 1.44494 1.45915 1.46177 1.45574 1.44505 1.43331 1.42286 1.41473 1.409 1.40526 1.40297 1.40163 1.40089 1.40049 1.40027 1.40016 1.4001 1.40006 1.40004 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.39998 1.39997 1.39996 1.39992 1.39989 1.39988 1.39997 1.40037 1.40139 1.40365 1.40807 1.41532 1.42588 1.43908 1.45195 1.46118 1.46445 1.45957 1.44492 1.42128 1.39148 1.35827 1.32278 1.28663 1.25269 1.22118 1.19225 1.16992 1.15737 1.15336 1.15647 1.16854 1.19164 1.2244 1.26291 1.30372 1.34472 1.38392 1.41822 1.44401 1.45878 1.46247 1.45743 1.44733 1.43568 1.42497 1.4164 1.4102 1.40607 1.40348 1.40196 1.40109 1.40061 1.40035 1.4002 1.40012 1.40008 1.40005 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.39999 1.39999 1.39997 1.39995 1.39992 1.39989 1.39987 1.39998 1.4004 1.40144 1.40366 1.40786 1.41471 1.42469 1.43737 1.45025 1.46028 1.46538 1.46382 1.45436 1.43741 1.41496 1.38938 1.36228 1.33553 1.31033 1.28606 1.26355 1.24617 1.2356 1.2305 1.23004 1.23581 1.24939 1.27019 1.29628 1.32606 1.35835 1.39124 1.42141 1.44491 1.45884 1.46262 1.45807 1.44843 1.437 1.42625 1.41747 1.41101 1.40663 1.40385 1.40219 1.40123 1.4007 1.4004 1.40024 1.40015 1.40009 1.40006 1.40004 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.39998 1.39997 1.39995 1.39992 1.39988 1.39988 1.39999 1.40042 1.40145 1.40359 1.40748 1.41377 1.42299 1.43495 1.44765 1.45847 1.46539 1.46684 1.4619 1.45083 1.435 1.41614 1.39597 1.3761 1.35708 1.33875 1.32231 1.30978 1.30137 1.29591 1.2934 1.29528 1.30253 1.31487 1.33158 1.35232 1.37666 1.40293 1.42793 1.4478 1.45958 1.46243 1.45776 1.44835 1.4372 1.4266 1.41785 1.41133 1.40687 1.40402 1.40229 1.4013 1.40074 1.40043 1.40026 1.40016 1.4001 1.40006 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.39999 1.39998 1.39995 1.39992 1.39988 1.39988 1.4 1.40043 1.40144 1.40343 1.40697 1.41257 1.42085 1.43177 1.44399 1.45537 1.46397 1.46816 1.46709 1.46101 1.45083 1.43778 1.42335 1.40884 1.39475 1.38145 1.36995 1.36094 1.35399 1.34856 1.34523 1.34504 1.34843 1.35527 1.36556 1.37964 1.39743 1.41749 1.43691 1.45224 1.46083 1.46188 1.45651 1.4471 1.43625 1.42599 1.41749 1.41113 1.40676 1.40395 1.40226 1.40128 1.40074 1.40044 1.40027 1.40017 1.40011 1.40007 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.39999 1.39998 1.39995 1.39992 1.39988 1.39989 1.40002 1.40043 1.40138 1.4032 1.40634 1.41121 1.41837 1.42794 1.4392 1.45065 1.46053 1.46712 1.46949 1.46766 1.46225 1.45423 1.44478 1.43482 1.42486 1.41552 1.4074 1.40054 1.39462 1.38973 1.38647 1.38539 1.3866 1.39012 1.39635 1.40582 1.41847 1.43297 1.44683 1.45719 1.46199 1.46067 1.45424 1.44469 1.43419 1.42443 1.41641 1.41041 1.40629 1.40366 1.40208 1.40118 1.40068 1.40041 1.40026 1.40016 1.40011 1.40007 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.39998 1.39996 1.39992 1.39989 1.3999 1.40003 1.40043 1.4013 1.40293 1.40561 1.40977 1.41574 1.42375 1.43356 1.44431 1.45465 1.46299 1.46826 1.47014 1.46896 1.46543 1.46032 1.45422 1.44774 1.44147 1.43571 1.43045 1.42569 1.42173 1.41895 1.41754 1.41754 1.41918 1.42292 1.42917 1.43768 1.44721 1.45575 1.46118 1.4621 1.45832 1.45078 1.44114 1.43112 1.42205 1.4147 1.40925 1.40553 1.40318 1.40178 1.401 1.40058 1.40035 1.40023 1.40015 1.4001 1.40007 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.39999 1.40001 1.4 1.4 1.4 1.39999 1.39996 1.39993 1.3999 1.39991 1.40005 1.40042 1.40119 1.4026 1.40487 1.40829 1.41313 1.41956 1.4276 1.43691 1.44664 1.45561 1.46276 1.46755 1.46996 1.47028 1.46888 1.46626 1.46297 1.45942 1.45577 1.45214 1.44874 1.44583 1.44357 1.44205 1.44142 1.44199 1.44411 1.44787 1.45284 1.45793 1.46165 1.46265 1.46017 1.45433 1.44602 1.43655 1.42723 1.41906 1.41254 1.40779 1.40458 1.40258 1.40142 1.40079 1.40046 1.40029 1.40019 1.40014 1.40009 1.40006 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.39999 1.39999 1.40001 1.4 1.4 1.39999 1.39997 1.39993 1.39991 1.39993 1.40007 1.40039 1.40107 1.40226 1.40413 1.40687 1.41067 1.41566 1.42191 1.42935 1.43756 1.44588 1.45351 1.45985 1.46462 1.46776 1.4694 1.46988 1.4695 1.46846 1.46689 1.46503 1.4631 1.46124 1.45956 1.45819 1.45734 1.45729 1.45816 1.45983 1.46174 1.46307 1.46289 1.46047 1.45557 1.44849 1.44002 1.43115 1.42283 1.41574 1.41019 1.4062 1.40355 1.40194 1.40104 1.40056 1.40033 1.40022 1.40016 1.40012 1.40008 1.40006 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.39999 1.39999 1.4 1.40001 1.39999 1.39998 1.39993 1.39992 1.39995 1.40006 1.40037 1.40094 1.40191 1.40339 1.40555 1.40844 1.4122 1.41686 1.42242 1.42876 1.43555 1.44233 1.44869 1.45424 1.4588 1.46237 1.46499 1.46675 1.46771 1.46804 1.46789 1.46738 1.4666 1.46566 1.46472 1.46399 1.46359 1.46347 1.4634 1.46294 1.46155 1.45878 1.45435 1.44832 1.44104 1.43315 1.42534 1.41828 1.4124 1.40788 1.40467 1.40259 1.40136 1.40069 1.40037 1.40023 1.40016 1.40013 1.4001 1.40008 1.40005 1.40004 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.39999 1.4 1.40001 1.4 1.4 1.39999 1.4 1.39999 1.39999 1.39997 1.39996 1.39993 1.39994 1.40006 1.40031 1.40078 1.40157 1.40272 1.40436 1.40653 1.40925 1.41261 1.41659 1.42114 1.42615 1.43142 1.4367 1.44173 1.44634 1.45039 1.45383 1.45663 1.4588 1.46042 1.4615 1.46209 1.46226 1.4621 1.46174 1.46128 1.46073 1.45996 1.45875 1.45685 1.45404 1.45015 1.44516 1.43925 1.43271 1.42599 1.4196 1.41395 1.40931 1.40579 1.40335 1.40179 1.40089 1.40043 1.40022 1.40015 1.40012 1.40011 1.40009 1.40007 1.40005 1.40003 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.39998 1.40001 1.39999 1.39999 1.40001 1.4 1.39998 1.39999 1.39997 1.39995 1.39995 1.39993 1.39995 1.40004 1.40025 1.40062 1.40122 1.40213 1.40332 1.4049 1.40685 1.40919 1.41193 1.41505 1.41851 1.42222 1.42607 1.42992 1.43366 1.43718 1.4404 1.44325 1.44571 1.44774 1.44933 1.45049 1.45124 1.45163 1.45173 1.45153 1.45096 1.44991 1.44829 1.44596 1.44289 1.4391 1.43466 1.42971 1.42448 1.41927 1.4144 1.41015 1.40669 1.40408 1.40229 1.40118 1.40056 1.40025 1.40013 1.4001 1.40009 1.40009 1.40008 1.40006 1.40005 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.39999 1.4 1.40002 1.40001 1.39999 1.39997 1.4 1.4 1.39998 1.39999 1.39998 1.4 1.39995 1.39995 1.39992 1.39994 1.39996 1.4 1.40019 1.40048 1.40092 1.40158 1.40246 1.40357 1.40493 1.40653 1.40837 1.41042 1.4127 1.41515 1.41772 1.42037 1.42302 1.42561 1.42808 1.43037 1.43246 1.43427 1.43578 1.437 1.4379 1.4385 1.43879 1.43872 1.43821 1.4372 1.43567 1.43362 1.43105 1.42805 1.42469 1.42103 1.41724 1.41353 1.41007 1.40705 1.4046 1.40278 1.40153 1.40076 1.40034 1.40016 1.40009 1.40008 1.40008 1.40008 1.40007 1.40005 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.39998 1.40001 1.40003 1.40001 1.39997 1.40001 1.39999 1.39996 1.4 1.39999 1.39998 1.39998 1.39994 1.39992 1.3999 1.39994 1.39999 1.4001 1.40034 1.40066 1.40112 1.40175 1.40251 1.40343 1.4045 1.4057 1.40704 1.40848 1.41002 1.41166 1.41335 1.41507 1.41678 1.41844 1.42002 1.42149 1.42283 1.424 1.42498 1.42574 1.42628 1.42654 1.42648 1.42607 1.42529 1.42412 1.4226 1.4208 1.41874 1.41647 1.41404 1.41152 1.40905 1.40675 1.40472 1.40306 1.40184 1.40101 1.4005 1.40023 1.40012 1.40008 1.40008 1.40008 1.40008 1.40007 1.40005 1.40004 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40003 1.4 1.39997 1.39999 1.40002 1.40003 1.39996 1.39999 1.39999 1.39998 1.39997 1.39996 1.4 1.39993 1.39993 1.3999 1.39991 1.39996 1.40003 1.4002 1.40044 1.40075 1.40118 1.40169 1.4023 1.403 1.40377 1.4046 1.4055 1.40645 1.40745 1.40847 1.40951 1.41056 1.41158 1.41259 1.41353 1.41439 1.41516 1.41581 1.41634 1.41671 1.41687 1.41682 1.41652 1.41597 1.4152 1.41423 1.41311 1.41185 1.41043 1.40894 1.4074 1.40584 1.40436 1.40306 1.40199 1.4012 1.40067 1.40034 1.40017 1.4001 1.40008 1.40008 1.40008 1.40007 1.40006 1.40005 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.39999 1.4 1.40003 1.4 1.39998 1.39999 1.40001 1.39998 1.4 1.40001 1.39994 1.39997 1.39997 1.39995 1.39995 1.39991 1.39992 1.39988 1.39992 1.39998 1.40007 1.40024 1.40047 1.40075 1.40108 1.40147 1.40191 1.40239 1.40291 1.40346 1.40402 1.4046 1.4052 1.40581 1.40642 1.40702 1.4076 1.40816 1.40867 1.40912 1.40951 1.40982 1.41004 1.41014 1.41009 1.4099 1.40956 1.40908 1.40853 1.4079 1.40718 1.4064 1.40553 1.40461 1.40369 1.40277 1.40196 1.4013 1.40079 1.40045 1.40025 1.40014 1.4001 1.40008 1.40007 1.40007 1.40006 1.40005 1.40004 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.39998 1.40001 1.40003 1.4 1.39997 1.39998 1.40003 1.39997 1.39999 1.39998 1.39998 1.39995 1.39993 1.39996 1.3999 1.39992 1.39989 1.3999 1.39994 1.4 1.4001 1.40024 1.40041 1.40064 1.40088 1.40115 1.40144 1.40174 1.40206 1.40239 1.40273 1.40307 1.40341 1.40375 1.40409 1.4044 1.40471 1.405 1.40525 1.40548 1.40566 1.40576 1.40581 1.40579 1.40566 1.40548 1.40526 1.40496 1.40462 1.40424 1.40384 1.40339 1.40285 1.40228 1.40176 1.40127 1.40086 1.40054 1.40031 1.40018 1.40011 1.40009 1.40008 1.40007 1.40006 1.40005 1.40004 1.40003 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40002 1.4 1.39998 1.4 1.40003 1.40001 1.39997 1.40001 1.39996 1.39999 1.40003 1.39996 1.39997 1.39995 1.39994 1.39992 1.39989 1.39991 1.39987 1.3999 1.39996 1.39999 1.40008 1.4002 1.40031 1.40046 1.40062 1.40079 1.40097 1.40115 1.40133 1.40152 1.4017 1.40189 1.40207 1.40225 1.40243 1.40259 1.40274 1.40289 1.403 1.4031 1.40317 1.4032 1.40319 1.40315 1.40303 1.40294 1.40282 1.40266 1.40251 1.40231 1.40206 1.40178 1.40145 1.40112 1.40083 1.40057 1.40036 1.40023 1.40015 1.40009 1.40006 1.40006 1.40005 1.40005 1.40004 1.40003 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40002 1.4 1.39998 1.40001 1.40003 1.39999 1.39997 1.40002 1.39996 1.39999 1.39998 1.4 1.39996 1.39993 1.39992 1.3999 1.3999 1.39988 1.39989 1.39989 1.39994 1.39998 1.40003 1.40011 1.40019 1.40028 1.40037 1.40047 1.40057 1.40067 1.40076 1.40087 1.40096 1.40106 1.40114 1.40124 1.40132 1.40141 1.40149 1.40156 1.40161 1.40165 1.40169 1.40168 1.40169 1.40168 1.40161 1.40158 1.40155 1.40149 1.40142 1.40126 1.4011 1.40096 1.40075 1.40053 1.40037 1.40025 1.40017 1.40011 1.40007 1.40004 1.40004 1.40004 1.40003 1.40003 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40002 1.40001 1.39997 1.4 1.40004 1.39997 1.40002 1.39997 1.39996 1.40001 1.39997 1.39997 1.39996 1.39994 1.39991 1.39989 1.39991 1.39988 1.39988 1.3999 1.39992 1.39994 1.39998 1.40003 1.40007 1.40012 1.40017 1.40021 1.40027 1.40032 1.40036 1.40041 1.40045 1.40051 1.40055 1.4006 1.40065 1.40069 1.40072 1.40078 1.40081 1.40083 1.40086 1.40085 1.4009 1.40091 1.40087 1.40093 1.40091 1.40085 1.40083 1.40073 1.40061 1.4005 1.40036 1.40025 1.40018 1.4001 1.40005 1.40004 1.40004 1.40003 1.40003 1.40002 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40002 1.40001 1.39997 1.40002 1.4 1.39998 1.40002 1.39998 1.39999 1.39996 1.39998 1.39998 1.39995 1.39994 1.39991 1.3999 1.3999 1.3999 1.39988 1.39989 1.3999 1.39991 1.39993 1.39995 1.39997 1.39999 1.40002 1.40004 1.40006 1.40008 1.40011 1.40013 1.40015 1.40017 1.40021 1.40023 1.40026 1.4003 1.40033 1.40035 1.40037 1.40042 1.40045 1.40042 1.4005 1.40054 1.40052 1.40057 1.40054 1.40053 1.40053 1.4004 1.4003 1.40026 1.40019 1.40011 1.40006 1.40003 1.40002 1.40003 1.40003 1.40002 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.39999 1.40003 1.40001 1.39996 1.40003 1.39998 1.40002 1.4 1.39997 1.39999 1.39998 1.39997 1.39997 1.39996 1.39994 1.39992 1.39989 1.3999 1.39989 1.39988 1.39988 1.39989 1.39989 1.39989 1.3999 1.39991 1.39992 1.39993 1.39994 1.39995 1.39995 1.39997 1.39997 1.4 1.40001 1.40003 1.40005 1.40008 1.4001 1.40012 1.40015 1.40017 1.40022 1.40024 1.40024 1.40034 1.40033 1.40033 1.40039 1.40034 1.4003 1.40029 1.40021 1.40016 1.40014 1.40008 1.40004 1.40005 1.40003 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40002 1.4 1.39998 1.40004 1.39999 1.40001 1.4 1.39998 1.40002 1.4 1.4 1.39999 1.39997 1.39998 1.39996 1.39996 1.39994 1.39994 1.39991 1.39991 1.3999 1.39989 1.39988 1.39988 1.39988 1.39988 1.39988 1.39988 1.39989 1.39988 1.39989 1.3999 1.39989 1.39992 1.39992 1.39993 1.39994 1.39997 1.39997 1.39999 1.40002 1.40005 1.40006 1.40006 1.40015 1.40016 1.40015 1.40024 1.40022 1.40024 1.40026 1.40017 1.40018 1.40019 1.40009 1.40005 1.40007 1.40004 1.40002 1.40002 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40002 1.39999 1.39999 1.40003 1.39999 1.40002 1.39998 1.4 1.40003 1.39999 1.4 1.40001 1.39999 1.39997 1.39997 1.39995 1.39996 1.39993 1.39993 1.39992 1.39991 1.3999 1.3999 1.39989 1.39988 1.39988 1.39988 1.39988 1.39988 1.39989 1.39988 1.39989 1.39989 1.39989 1.39991 1.39992 1.39993 1.39994 1.39996 1.39998 1.39999 1.40002 1.40003 1.40004 1.40013 1.40009 1.40012 1.40018 1.40012 1.40015 1.40018 1.4001 1.4001 1.4001 1.40003 1.40002 1.40003 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.39999 1.40001 1.40002 1.39998 1.40001 1.4 1.40001 1.40002 1.39999 1.4 1.40001 1.4 1.40001 1.39999 1.39999 1.39998 1.39997 1.39996 1.39996 1.39994 1.39994 1.39993 1.39992 1.39991 1.39991 1.39991 1.3999 1.3999 1.3999 1.39989 1.3999 1.3999 1.3999 1.3999 1.39991 1.39991 1.39993 1.39993 1.39993 1.39997 1.39996 1.39997 1.39999 1.40004 1.40002 1.40003 1.40012 1.40006 1.4001 1.40013 1.40006 1.40011 1.40011 1.40002 1.40005 1.40007 1.40001 1.40001 1.40002 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.40002 1.40001 1.4 1.40002 1.40001 1.39999 1.40001 1.39999 1.40002 1.40001 1.39998 1.40001 1.40001 1.4 1.40001 1.40001 1.39999 1.4 1.39997 1.39998 1.39996 1.39996 1.39995 1.39995 1.39994 1.39993 1.39993 1.39992 1.39992 1.39993 1.39992 1.39992 1.39992 1.39992 1.39992 1.39993 1.39994 1.39993 1.39995 1.39996 1.39995 1.39998 1.39998 1.39999 1.4 1.40004 1.4 1.40005 1.40009 1.40002 1.4001 1.40009 1.4 1.40007 1.40007 1.4 1.40003 1.40003 1.39999 1.40001 1.40002 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40002 1.4 1.39999 1.40002 1.4 1.40001 1.4 1.39999 1.40002 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.39999 1.39998 1.39999 1.39998 1.39997 1.39996 1.39996 1.39996 1.39995 1.39995 1.39994 1.39994 1.39994 1.39994 1.39995 1.39994 1.39995 1.39995 1.39995 1.39996 1.39996 1.39997 1.39996 1.39997 1.4 1.39999 1.39998 1.40003 1.40005 1.39998 1.40006 1.40006 1.39999 1.40009 1.40005 1.39999 1.40006 1.40003 1.39998 1.40002 1.40002 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40002 1.4 1.40001 1.40001 1.40001 1.39999 1.40002 1.39999 1.40001 1.39999 1.39999 1.39999 1.39998 1.39998 1.39997 1.39997 1.39997 1.39997 1.39996 1.39997 1.39996 1.39997 1.39996 1.39997 1.39997 1.39997 1.39996 1.39997 1.39998 1.39997 1.39999 1.39998 1.39999 1.40001 1.4 1.39999 1.40005 1.40003 1.39998 1.40008 1.40001 1.39998 1.40009 1.40002 1.39998 1.40004 1.40001 1.39999 1.40002 1.40001 1.39999 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.39999 1.4 1.39999 1.39999 1.39999 1.39999 1.39998 1.39998 1.39998 1.39998 1.39998 1.39998 1.39998 1.39998 1.39998 1.39997 1.39999 1.39998 1.39998 1.39999 1.39999 1.40001 1.39998 1.4 1.40003 1.39999 1.39999 1.40006 1.4 1.4 1.40008 1.39998 1.39999 1.40007 1.4 1.39999 1.40004 1.4 1.39999 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40002 1.4 1.40001 1.4 1.40002 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.39999 1.39999 1.39999 1.39999 1.39999 1.39999 1.39999 1.4 1.39998 1.39999 1.39999 1.39999 1.4 1.39999 1.4 1.39999 1.4 1.40002 1.39998 1.40001 1.40003 1.39998 1.40001 1.40005 1.39996 1.40001 1.40007 1.39997 1.40001 1.40005 1.39999 1.4 1.40003 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.39999 1.4 1.39999 1.4 1.39999 1.4 1.4 1.39999 1.40001 1.39999 1.40001 1.40001 1.39998 1.40002 1.40003 1.39997 1.40003 1.40004 1.39996 1.40004 1.40004 1.39996 1.40001 1.40003 1.39999 1.40001 1.40002 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.39999 1.4 1.4 1.4 1.40001 1.39999 1.40003 1.4 1.39998 1.40003 1.40001 1.39998 1.40005 1.40001 1.39996 1.40003 1.40002 1.39998 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.39999 1.40001 1.4 1.4 1.40003 1.39999 1.39999 1.40004 1.39999 1.39999 1.40004 1.4 1.39998 1.40003 1.40001 1.39999 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40002 1.39999 1.4 1.40003 1.39999 1.4 1.40003 1.39999 1.4 1.40003 1.4 1.39999 1.40002 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.40002 1.39999 1.40001 1.40002 1.39999 1.40001 1.40002 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.39999 1.40001 1.40001 1.39999 1.40002 1.40002 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.39999 1.40002 1.40001 1.39999 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40002 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.40001 1.4 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.40001 1.4 1.40001 1.4 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.4 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 1.40001 ) ; boundaryField { emptyPatches_empt { type empty; } top_cyc { type cyclic; } bottom_cyc { type cyclic; } inlet_cyc { type cyclic; } outlet_cyc { type cyclic; } } // ************************************************************************* //
[ "tdg@debian" ]
tdg@debian
fb0802ca650e1530f8ec680ddb7e52d6c5f4dce4
05a2a4d28d2b64059fd23edad8a34009dc5b1888
/xml/colorbox.h
fca64b735d01accba73fce68e16dd3d2856e670f
[]
no_license
zingibertram/igs-l4
ec90d31cb05ab12e26872760ac207bb7c6f2635b
3534776c149f4c3f18bc65bf62e638807d6c586f
refs/heads/master
2021-01-21T12:58:00.421359
2016-05-13T19:34:49
2016-05-13T19:34:49
43,601,849
0
0
null
null
null
null
UTF-8
C++
false
false
543
h
#ifndef COLORBOX_H #define COLORBOX_H #include <QGroupBox> #include <QColor> #include <QString> namespace Ui { class ColorBox; } class ColorBox : public QGroupBox { Q_OBJECT public: explicit ColorBox(QWidget *parent = 0); ~ColorBox(); void setColor(int r, int g, int b); QColor color(); signals: void colorChanged(QColor color); private slots: void on_slider_valueChanged(int value); private: Ui::ColorBox *ui; QString contrastColor(); }; #endif // COLORBOX_H
[ "zingibertram@gmail.com" ]
zingibertram@gmail.com
fbe6b201716907f0850c00bc22457d957e490314
b7fe343b2f5fdb2ffc553c2a785ebbf0678ef315
/Last version with make file/patient.cpp
c110cb09855a9def19ff5f2b9581132d62f5442d
[]
no_license
Roner1-bit/Hospital-System-Program
d482dd396123192b1c3ab8fb9cf7c8ba3dbfda3c
95b8f079f2b6507f3e35680354c58f0b2df78eb2
refs/heads/master
2020-11-23T21:50:41.309448
2019-12-18T07:50:20
2019-12-18T07:50:20
227,835,600
1
1
null
2019-12-18T00:28:09
2019-12-13T12:28:49
null
UTF-8
C++
false
false
494
cpp
#include "patient.h" using namespace std; patient :: patient(){ name="unknown"; age=0; history="no history"; }; patient :: patient(string x,int y,string z){ name=x; age=y; history=z; }; void patient :: setname(string x){ name=x; } void patient :: setage(int x){ age=x; } void patient :: sethistory(string x){ history=x; } string patient :: getname(){ return name; } string patient :: gethistory(){ return history; } int patient:: getage(){ return age; }
[ "noreply@github.com" ]
noreply@github.com